Skip to content

Commit

Permalink
Merge pull request #11408 from cividesk/CRM-21554
Browse files Browse the repository at this point in the history
CRM-21554 Offline Credit Card Membership Renewal not showing any error message on failure
  • Loading branch information
eileenmcnaughton authored Jan 6, 2018
2 parents f995d3b + 63dd64f commit 8ba0b06
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CRM/Core/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ static public function getMessages(&$error, $separator = '<br />') {
$message = implode($separator, $message);
return $message;
}
elseif (is_a($error, 'Civi\Payment\Exception\PaymentProcessorException')) {
return $error->getMessage();
}
return NULL;
}

Expand Down
6 changes: 3 additions & 3 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ public function submit() {
// Assign amount to template if payment was successful.
$this->assign('amount', $params['total_amount']);
}
catch (PaymentProcessorException $e) {
catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
if (!empty($paymentParams['contributionID'])) {
CRM_Contribute_BAO_Contribution::failPayment($paymentParams['contributionID'], $this->_contactID,
$e->getMessage());
Expand All @@ -1426,9 +1426,9 @@ public function submit() {
CRM_Contribute_BAO_ContributionRecur::deleteRecurContribution($paymentParams['contributionRecurID']);
}

CRM_Core_Error::displaySessionError($result);
CRM_Core_Session::singleton()->setStatus($e->getMessage());
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership',
"reset=1&action=add&cid={$this->_contactID}&context=&mode={$this->_mode}"
"reset=1&action=add&cid={$this->_contactID}&context=membership&mode={$this->_mode}"
));

}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/MembershipRenewal.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public function postProcess() {
return $statusMsg;
}
catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
CRM_Core_Error::displaySessionError($e->getMessage());
CRM_Core_Session::singleton()->setStatus($e->getMessage());
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/membership',
"reset=1&action=renew&cid={$this->_contactID}&id={$this->_id}&context=membership&mode={$this->_mode}"
));
Expand Down

0 comments on commit 8ba0b06

Please sign in to comment.