-
-
Notifications
You must be signed in to change notification settings - Fork 821
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 payment function #31404
Extract payment function #31404
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
@@ -2444,8 +2444,7 @@ protected function completeTransaction($result, $contributionID) { | |||
*/ | |||
protected function bounceOnError($message): void { | |||
CRM_Core_Session::singleton() | |||
->setStatus(ts('Payment Processor Error message :') . | |||
$message); | |||
->setStatus(ts('Payment Processor Error message') . ': ' . $message); |
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.
This just simplifies translation
@@ -123,7 +123,7 @@ public static function getMessages(&$error, $separator = '<br />') { | |||
public static function displaySessionError(&$error, $separator = '<br />') { | |||
$message = self::getMessages($error, $separator); | |||
if ($message) { | |||
$status = ts("Payment Processor Error message") . "{$separator} $message"; | |||
$status = ts('Payment Processor Error message') . "{$separator} $message"; |
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.
Minor cleanup
* @throws \CRM_Core_Exception | ||
*/ | ||
private function processConfirmPayment(\CRM_Contribute_DAO_Contribution $contribution, int $contactID): array { | ||
$form = $this; |
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.
Should do a find/replace in this function but want to do a straight extraction first.
$result['is_payment_failure'] = TRUE; | ||
$result['error'] = $e; |
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.
I don't like this at all and would prefer that an exception was thrown
@mattwire this looks like a straight extraction but there is something going on in here I can't spot api_v3_ContributionPageTest::testSubmitRecurMultiProcessorInstantPayment |
Also @mattwire FYI - out of scope here but about where things might be going - I generally try to pass in an array of the parameters a function uses when I can - rather than using |
@eileenmcnaughton It was the |
Overview
Extraction of payment code in CRM_Contribute_Form_Confirm to make it easier to understand/refactor.
Before
processConfirm()
is a big long function that is difficult to follow.After
It's a bit easier to understand and a chunk of code is extracted to make it easier to see inputs/outputs.
Technical Details
Comments
I'm trying to debug a payment failure that leaves no trace on the server and got very lost in this function.