@@ -49,6 +49,11 @@ abstract class CRM_Core_Payment_PaymentExtended extends CRM_Core_Payment {
49
49
*/
50
50
protected $ transaction_id ;
51
51
52
+ /**
53
+ * @var label for payemnt field set.
54
+ */
55
+ protected $ payment_type_label ;
56
+
52
57
/**
53
58
* Class Constructor.
54
59
*
@@ -256,6 +261,22 @@ protected function getPaymentDescription($params, $length = 24) {
256
261
return substr (implode ('- ' , $ validParts ), 0 , $ length );
257
262
}
258
263
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
+
259
280
/**
260
281
* Handle processor error.
261
282
*
@@ -275,7 +296,7 @@ protected function handleError($level, $message, $context, $errorCode = 9001, $u
275
296
// Reset gateway to NULL so don't cache it. The size of the object or closures within it could
276
297
// cause problems when serializing & saving.
277
298
$ this ->gateway = NULL ;
278
- Civi::log ()->log ($ level , $ message , $ context );
299
+ Civi::log ()->log ($ level , $ message , ( array ) $ context );
279
300
$ log = new CRM_Utils_SystemLogger ();
280
301
$ log ->log ($ level , $ message , (array ) $ context );
281
302
throw new \Civi \Payment \Exception \PaymentProcessorException ($ userMessage );
0 commit comments