Skip to content

Commit

Permalink
Catch Payment Processor Exception if thrown when registering via back…
Browse files Browse the repository at this point in the history
… office participant registration

Make changes as per Matt's and Eileen's comments
  • Loading branch information
seamuslee001 committed Jul 31, 2019
1 parent 7cf2668 commit 46366f1
Showing 1 changed file with 8 additions and 4 deletions.
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

0 comments on commit 46366f1

Please sign in to comment.