From: Eileen McNaughton Date: Sat, 28 Aug 2021 02:32:38 +0000 (+1200) Subject: [Ref] Minor extraction X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=60c374e37cd138a1cc24dfdf97482a1384121d0c;p=civicrm-core.git [Ref] Minor extraction Simply extracts getting the subscription id & since the retrieve function throws defaults to 'abort' the next line is unreachable --- 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'); + } + }