From 60c374e37cd138a1cc24dfdf97482a1384121d0c Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 28 Aug 2021 14:32:38 +1200 Subject: [PATCH] [Ref] Minor extraction Simply extracts getting the subscription id & since the retrieve function throws defaults to 'abort' the next line is unreachable --- CRM/Core/Payment/AuthorizeNetIPN.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index 30886d1931..f6b2a102c0 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -43,11 +43,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { try { //we only get invoice num as a key player from payment gateway response. //for ARB we get x_subscription_id and x_subscription_paynum - $x_subscription_id = $this->retrieve('x_subscription_id', 'String'); - if (!$x_subscription_id) { - // Presence of the id means it is approved. - return TRUE; - } + $x_subscription_id = $this->getRecurProcessorID(); $ids = $input = []; $input['component'] = 'contribute'; @@ -329,4 +325,18 @@ INNER JOIN civicrm_contribution co ON co.contribution_recur_id = cr.id ]); } + /** + * Get the processor_id for the recurring. + * + * This is the value stored in civicrm_contribution_recur.processor_id, + * sometimes called subscription_id. + * + * @return string + * + * @throws \CRM_Core_Exception + */ + protected function getRecurProcessorID(): string { + return $this->retrieve('x_subscription_id', 'String'); + } + } -- 2.25.1