From 0a03d79d8249826a8f226c109f32531a492ba689 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 28 Jun 2021 14:03:56 +1200 Subject: [PATCH] [REF] Minor auth.net ipn simplification This removes some property setting on the contribution which is then discarded & moves a bit of validation to be with the other validation --- CRM/Core/Payment/AuthorizeNetIPN.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index a2416e61d3..cbc63cec2b 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -74,6 +74,10 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { if (!$contributionRecur->find(TRUE)) { 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']) { + throw new CRM_Core_Exception('Unrecognized subscription.'); + } // check if first contribution is completed, else complete first contribution $first = TRUE; @@ -113,19 +117,10 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN { */ public function recur($input, $recur, $contribution, $first) { - // do a subscription check - if ($recur->processor_id != $input['subscription_id']) { - throw new CRM_Core_Exception('Unrecognized subscription.'); - } - $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); $now = date('YmdHis'); - $contribution->invoice_id = md5(uniqid(rand(), TRUE)); - $contribution->total_amount = $input['amount']; - $contribution->trxn_id = $input['trxn_id']; - $isFirstOrLastRecurringPayment = FALSE; if ($input['response_code'] == 1) { // Approved -- 2.25.1