Skip to content

Commit 38d5650

Browse files
Improve error handling, show more if permission to admin payment processors is held
1 parent a915787 commit 38d5650

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CRM/Core/Payment/OmnipayMultiProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function doPayment(&$params, $component = 'contribute') {
175175
}
176176
else {
177177
//@todo - is $response->getCode supported by some / many processors?
178-
return $this->handleError('alert', 'failed processor transaction ' . $this->_paymentProcessor['payment_processor_type'], (array) $response, 9001, $response->getMessage());
178+
return $this->handleError('alert', 'failed processor transaction ' . $this->_paymentProcessor['payment_processor_type'], array($response->getCode() => $response->getMessage()));
179179
}
180180
}
181181
catch (\Exception $e) {

CRM/Core/Payment/PaymentExtended.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ abstract class CRM_Core_Payment_PaymentExtended extends CRM_Core_Payment {
5454
*/
5555
protected $payment_type_label;
5656

57+
/**
58+
* @var \Omnipay\Common\AbstractGateway
59+
*/
60+
protected $gateway;
61+
5762
/**
5863
* Class Constructor.
5964
*
@@ -299,6 +304,10 @@ protected function handleError($level, $message, $context, $errorCode = 9001, $u
299304
Civi::log()->log($level, $message, (array) $context);
300305
$log = new CRM_Utils_SystemLogger();
301306
$log->log($level, $message, (array) $context);
307+
308+
if (CRM_Core_Permission::check('administer payment processors')) {
309+
$userMessage = implode(',', $context);
310+
}
302311
throw new \Civi\Payment\Exception\PaymentProcessorException($userMessage);
303312
}
304313

0 commit comments

Comments
 (0)