From: Eileen McNaughton Date: Sun, 29 Aug 2021 21:32:36 +0000 (+1200) Subject: Use getter to get subscription id X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4848ac9ecb16d8ff01465c93c1049c4f602064ca;p=civicrm-core.git 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). --- 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; }