Skip to content

Commit

Permalink
[REF] Minor auth.net ipn simplification
Browse files Browse the repository at this point in the history
This removes some property setting on the contribution
which is then discarded & moves a bit of validation to be
with the other validation
  • Loading branch information
eileenmcnaughton committed Jun 28, 2021
1 parent 055a3b1 commit c087739
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions CRM/Core/Payment/AuthorizeNetIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c087739

Please sign in to comment.