-
-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract code to set isEmailReceipt in Contribution.completeOrder #18039
Conversation
(Standard links)
|
@mattwire this removes another chunk & I suspect the addActivity above it can go too |
1e3f201
to
7cfe17f
Compare
@KarinG @artfulrobot @jitendrapurohit If any of you are able to confirm the logic here - on first glance it seems correct and a good cleanup |
Warning this may hurt your brains |
Jenkins re test this please |
test this please |
Might be a cleanup issue or a CI server issue ok 571 - api_v3_ContactTypeTest::testContactUpdateSubtypeInvalid with data set "APIv3" (3)
|
test this please |
ee022fa
to
cd875e8
Compare
@eileenmcnaughton Check your style |
This consolidates all the code in the completeOrder that determines whether or not to send an email receipt. Note that - testCompleteTransactionWithEmailReceiptInput tests that input is respected - for events the event::sendMail function will not send unless it's configured for the event - which explains our final default of TRUE (testCompleteTransactionWithParticipantRecord) - testCompleteTransaction covers the back-office case which also defaults to true - I figure the cost of reloading the value for contribution_recur is pretty cheap compared to the confusion of passing values around - testpayLater covers contribution_page with is_email_receipt
Jenkins is a grumpy bum |
Overview
This consolidates all the code in the completeOrder that determines whether or not to send an email receipt.
Looking at it here it seems deceptively simple but this calculation has always done my head in and I think it needs some pretty careful eyes on this to verify it.
I'm still evaluating the adequacy of test cover but I've described the tests I've found so far
Before
isEmailReceipt calculation 'distributed' in the main function
After
isEmailReceipt calculation extracted. Note that this does an extra lookup for recurring contributions but the (very small) performance cost seems acceptable given the readability issues and the fact we reduced the columns retrieved in the other look up
Technical Details
Note that
explains our final default of TRUE (testCompleteTransactionWithParticipantRecord)
Comments
I'm thinking about making this not-a-static-function - so it becomes $contribution->isSendEmailReceipt - the only issue would be if $this->contribution_page-id were empty due to no ->find(). Then only input would need to be passed in.