From 4848ac9ecb16d8ff01465c93c1049c4f602064ca Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 30 Aug 2021 09:32:36 +1200 Subject: [PATCH] Use getter to get subscription id These places all effectively do the same as I was tempted to update that function to set the type to 'Integer' since it is retrieved that way once it must be the case that it could only be an integer (or that line will fail). --- CRM/Core/Payment/AuthorizeNetIPN.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index edcb8dc11a..939bd86836 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -71,7 +71,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { throw new CRM_Core_Exception("Could not find contribution recur record: {$ids['ContributionRecur']} in IPN request: " . print_r($input, TRUE)); } // do a subscription check - if ($contributionRecur->processor_id != $input['subscription_id']) { + if ($contributionRecur->processor_id != $this->getRecurProcessorID()) { throw new CRM_Core_Exception('Unrecognized subscription.'); } @@ -167,7 +167,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { */ public function getInput(&$input) { $input['amount'] = $this->retrieve('x_amount', 'String'); - $input['subscription_id'] = $this->retrieve('x_subscription_id', 'Integer'); + $input['subscription_id'] = $this->getRecurProcessorID(); $input['response_code'] = $this->retrieve('x_response_code', 'Integer'); $input['response_reason_code'] = $this->retrieve('x_response_reason_code', 'String', FALSE); $input['response_reason_text'] = $this->retrieve('x_response_reason_text', 'String', FALSE); @@ -211,7 +211,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { */ public function getIDs(&$ids, $input) { $ids['contribution'] = $this->getContributionID(); - $contributionRecur = $this->getContributionRecurObject($input['subscription_id'], (int) $this->retrieve('x_cust_id', 'Integer', FALSE, 0), $this->getContributionID()); + $contributionRecur = $this->getContributionRecurObject($this->getRecurProcessorID(), (int) $this->retrieve('x_cust_id', 'Integer', FALSE, 0), $this->getContributionID()); $ids['contributionRecur'] = (int) $contributionRecur->id; } -- 2.25.1