-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
Cleanup variable assigns in ContributionPage confirm #22902
Conversation
(Standard links)
|
if (!empty($result['payment_status_id'])) { | ||
$contribution->payment_status_id = $result['payment_status_id']; | ||
} | ||
$form->assign('trxn_id', $result['trxn_id'] ?? ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simpler to use NULL coalescing operator here.
$contribution->payment_status_id = $result['payment_status_id']; | ||
} | ||
$form->assign('trxn_id', $result['trxn_id'] ?? ''); | ||
$contribution->trxn_id = $result['trxn_id'] ?? $contribution->trxn_id ?? ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than checking if return value from doPayment is empty we assign via a hierarchy which clearly shows priority
} | ||
$form->assign('trxn_id', $result['trxn_id'] ?? ''); | ||
$contribution->trxn_id = $result['trxn_id'] ?? $contribution->trxn_id ?? ''; | ||
$contribution->payment_status_id = $result['payment_status_id']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any payment processor that does not return payment_status_id
is going to be broken in multiple ways because it is the only way to check if payment was successful..
Yep agree. Thanks @mattwire |
Overview
Cleanup and simplify some variable assigns.
Before
More complicated.
After
Less complicated.
Technical Details
See inline comments on this PR
Comments