-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2752,13 +2752,9 @@ public function processConfirm( | |
} | ||
$result = $payment->doPayment($paymentParams); | ||
$form->_params = array_merge($form->_params, $result); | ||
$form->assign('trxn_id', CRM_Utils_Array::value('trxn_id', $result)); | ||
if (!empty($result['trxn_id'])) { | ||
$contribution->trxn_id = $result['trxn_id']; | ||
} | ||
if (!empty($result['payment_status_id'])) { | ||
$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 commentThe 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 |
||
$contribution->payment_status_id = $result['payment_status_id']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any payment processor that does not return |
||
$result['contribution'] = $contribution; | ||
if ($result['payment_status_id'] == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending') | ||
&& $payment->isSendReceiptForPending()) { | ||
|
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.