Skip to content

Commit 2cb965f

Browse files
Fix for payment display fields.
Requires civicrm/civicrm-core#10935
1 parent e2cc5cc commit 2cb965f

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

CRM/Core/Payment/PaymentExtended.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ abstract class CRM_Core_Payment_PaymentExtended extends CRM_Core_Payment {
4949
*/
5050
protected $transaction_id;
5151

52+
/**
53+
* @var label for payemnt field set.
54+
*/
55+
protected $payment_type_label;
56+
5257
/**
5358
* Class Constructor.
5459
*
@@ -256,6 +261,22 @@ protected function getPaymentDescription($params, $length = 24) {
256261
return substr(implode('-', $validParts), 0, $length);
257262
}
258263

264+
/**
265+
* Get label for the payment information type.
266+
*
267+
* @return string
268+
*/
269+
public function getPaymentTypeLabel() {
270+
if (!isset($this->payment_type_label)) {
271+
$this->payment_type_label = civicrm_api3('OptionValue', 'getvalue', array(
272+
'option_group_id' => 'payment_type',
273+
'return' => 'label',
274+
'value' => $this->_paymentProcessor['payment_type'],
275+
));
276+
}
277+
return $this->payment_type_label;
278+
}
279+
259280
/**
260281
* Handle processor error.
261282
*
@@ -275,7 +296,7 @@ protected function handleError($level, $message, $context, $errorCode = 9001, $u
275296
// Reset gateway to NULL so don't cache it. The size of the object or closures within it could
276297
// cause problems when serializing & saving.
277298
$this->gateway = NULL;
278-
Civi::log()->log($level, $message, $context);
299+
Civi::log()->log($level, $message, (array) $context);
279300
$log = new CRM_Utils_SystemLogger();
280301
$log->log($level, $message, (array) $context);
281302
throw new \Civi\Payment\Exception\PaymentProcessorException($userMessage);

0 commit comments

Comments
 (0)