Skip to content
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

Catch Payment Processor Exception if thrown when registering via bac… #14930

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions CRM/Event/Form/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -1256,10 +1256,14 @@ public function submit($params) {

// CRM-15622: fix for incorrect contribution.fee_amount
$paymentParams['fee_amount'] = NULL;
$result = $payment->doPayment($paymentParams);

if (is_a($result, 'CRM_Core_Error')) {
CRM_Core_Error::displaySessionError($result);
try {
$result = $payment->doPayment($paymentParams);
}
catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
// @todo un comment the following line out when we are creating a contribution before we get to this point
// see dev/financial#53 about ensuring we create a pending contribution before we try processing payment
// CRM_Contribute_BAO_Contribution::failPayment($contributionID);
CRM_Core_Session::singleton()->setStatus($e->getMessage());
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/participant',
"reset=1&action=add&cid={$this->_contactId}&context=participant&mode={$this->_mode}"
));
Expand Down