From 3a317d6d94f518d5f41dc4d217b7b38650ada74d Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 26 Jan 2021 08:27:00 +1300 Subject: [PATCH] [REF] Move sendNotification out of recur, remove unused related_contact We no longer use ids['related_contact'] & are attempting to simplify (& eventually remove the ids variable) --- CRM/Core/Payment/PayPalIPN.php | 24 ++++++++++-------------- CRM/Core/Payment/PayPalProIPN.php | 2 -- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index 2ec2c0f509..26e1367b17 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -89,8 +89,7 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { // make sure the invoice is valid and matches what we have in the contribution record if ($recur->invoice_id != $input['invoice']) { Civi::log()->debug('PayPalIPN: Invoice values dont match between database and IPN request (RecurID: ' . $recur->id . ').'); - echo "Failure: Invoice values dont match between database and IPN request

"; - return; + throw new CRM_Core_Exception("Failure: Invoice values dont match between database and IPN request"); } $now = date('YmdHis'); @@ -153,16 +152,6 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { $recur->save(); - if ($this->getFirstOrLastInSeriesStatus()) { - //send recurring Notification email for user - CRM_Contribute_BAO_ContributionPage::recurringNotify($this->getFirstOrLastInSeriesStatus(), - $ids['contact'], - $ids['contributionPage'], - $recur, - !empty($ids['membership']) - ); - } - if ($txnType !== 'subscr_payment') { return; } @@ -193,7 +182,6 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { } $this->single($input, [ - 'related_contact' => $ids['related_contact'] ?? NULL, 'participant' => $ids['participant'] ?? NULL, 'contributionRecur' => $recur->id, ], $contribution, TRUE); @@ -358,6 +346,15 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { $first = FALSE; } $this->recur($input, $ids, $contributionRecur, $contribution, $first); + if ($this->getFirstOrLastInSeriesStatus()) { + //send recurring Notification email for user + CRM_Contribute_BAO_ContributionPage::recurringNotify($this->getFirstOrLastInSeriesStatus(), + $ids['contact'], + $ids['contributionPage'], + $contributionRecur, + !empty($ids['membership']) + ); + } return; } @@ -387,7 +384,6 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { return; } $this->single($input, [ - 'related_contact' => $ids['related_contact'] ?? NULL, 'participant' => $ids['participant'] ?? NULL, 'contributionRecur' => $contributionRecurID, ], $contribution); diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index 45dc5c2c06..87b5686546 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -274,7 +274,6 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { $contribution->receive_date = !empty($input['payment_date']) ? date('YmdHis', strtotime($input['payment_date'])) : $now; $this->single($input, [ - 'related_contact' => $ids['related_contact'] ?? NULL, 'participant' => $ids['participant'] ?? NULL, 'contributionRecur' => $recur->id ?? NULL, ], $contribution, TRUE, $first); @@ -493,7 +492,6 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr } $this->single($input, [ - 'related_contact' => $ids['related_contact'] ?? NULL, 'participant' => $ids['participant'] ?? NULL, 'contributionRecur' => $ids['contributionRecur'] ?? NULL, ], $contribution, FALSE, FALSE); -- 2.25.1