From 6689745a4efbd0fb7498a89556eabcbefab8f450 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 6 Aug 2018 18:40:32 +1200 Subject: [PATCH] Use cached version of payment processor. I am hitting a slightly obscure bug in Redis that is solved by this change. Per https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/issues/55 we have an issue whereby Omnipay adds the gateway to a variable on class when processing payments. In some cases this gateway will not serialize into a key under Redis causing a fatal. However, we don't really need it to - the payment processor that we are aiming to cache is 'as loaded' not 'as used'. The caching of the processors appears to have been removed in the past because of issues around domains -however, I think we can get past that by changing the cache key. --- CRM/Financial/BAO/PaymentProcessor.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php index 3054bb4649..6b3a722df7 100644 --- a/CRM/Financial/BAO/PaymentProcessor.php +++ b/CRM/Financial/BAO/PaymentProcessor.php @@ -273,7 +273,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces */ public static function getAllPaymentProcessors($mode = 'all', $reset = FALSE, $isCurrentDomainOnly = TRUE) { - $cacheKey = 'CRM_Financial_BAO_Payment_Processor_' . $mode . '_' . CRM_Core_Config::domainID(); + $cacheKey = 'CRM_Financial_BAO_Payment_Processor_' . $mode . '_' . $isCurrentDomainOnly . '_' . CRM_Core_Config::domainID(); if (!$reset) { $processors = CRM_Utils_Cache::singleton()->get($cacheKey); if (!empty($processors)) { @@ -370,10 +370,10 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces public static function getPaymentProcessors($capabilities = array(), $ids = FALSE) { $testProcessors = in_array('TestMode', $capabilities) ? self::getAllPaymentProcessors('test') : array(); if (is_array($ids)) { - $processors = self::getAllPaymentProcessors('all', TRUE, FALSE); + $processors = self::getAllPaymentProcessors('all', FALSE, FALSE); } else { - $processors = self::getAllPaymentProcessors('all', TRUE); + $processors = self::getAllPaymentProcessors('all'); } if (in_array('TestMode', $capabilities) && is_array($ids)) { -- 2.25.1