diff --git a/CRM/Core/Payment/AuthorizeNetIPN.php b/CRM/Core/Payment/AuthorizeNetIPN.php index a2416e61d319..cbc63cec2bc3 100644 --- a/CRM/Core/Payment/AuthorizeNetIPN.php +++ b/CRM/Core/Payment/AuthorizeNetIPN.php @@ -74,6 +74,10 @@ public function main() { 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 @@ public function main() { */ 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