Skip to content

Commit

Permalink
Remove doTransferCheckout (#420)
Browse files Browse the repository at this point in the history
* doPayment throws exceptions when payment fails. Catch and display to the user instead of an internal server error

* Don't call doTransferCheckout which has been deprecated for some time. If a processor does not have doPayment CiviCRM core will call doTransferCheckout internally
  • Loading branch information
mattwire committed Dec 23, 2020
1 parent 0238e3f commit ab915c0
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions includes/wf_crm_webform_postprocess.inc
Expand Up @@ -2010,20 +2010,12 @@ class wf_crm_webform_postprocess extends wf_crm_webform_base {
$paymentProcessor->setCancelUrl($this->getIpnRedirectUrl('cancel'));
}

if (method_exists($paymentProcessor, 'doTransferCheckout')) {
// doTransferCheckout is deprecated but some processors might still implement it.
// Somewhere around 4.6 it was replaced by doPayment as the method of choice,
// but to be safe still call it if it exists for now.
$paymentProcessor->doTransferCheckout($params, 'contribute');
try {
$paymentProcessor->doPayment($params);
}
else {
try {
$paymentProcessor->doPayment($params);
}
catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
drupal_set_message(ts('Payment approval failed with message: ') . $e->getMessage(),'error');
CRM_Utils_System::redirect($this->getIpnRedirectUrl('cancel'));
}
catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
drupal_set_message(ts('Payment approval failed with message: ') . $e->getMessage(),'error');
CRM_Utils_System::redirect($this->getIpnRedirectUrl('cancel'));
}

}
Expand Down

0 comments on commit ab915c0

Please sign in to comment.