Skip to content
Snippets Groups Projects
Unverified Commit 6ba1f018 authored by mattwire's avatar mattwire Committed by GitHub
Browse files

Merge pull request #18735 from eileenmcnaughton/aipn

financial#152 simplify interaction with membership, deprecate function
parents 5fa6284e c3407e4e
No related branches found
No related tags found
No related merge requests found
......@@ -528,6 +528,7 @@ INNER JOIN civicrm_contribution con ON ( con.id = mp.contribution_id )
* @param bool $isFirstOrLastRecurringPayment
*/
public static function sendRecurringStartOrEndNotification($ids, $recur, $isFirstOrLastRecurringPayment) {
CRM_Core_Error::deprecatedFunctionWarning('use CRM_Contribute_BAO_ContributionPage::recurringNotify');
if ($isFirstOrLastRecurringPayment) {
$autoRenewMembership = FALSE;
if ($recur->id &&
......
......@@ -139,7 +139,6 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN {
'related_contact' => $ids['related_contact'] ?? NULL,
'participant' => !empty($objects['participant']) ? $objects['participant']->id : NULL,
'contributionRecur' => !empty($objects['contributionRecur']) ? $objects['contributionRecur']->id : NULL,
'membership' => $ids['membership'] ?? NULL,
'contact' => $ids['contact'] ?? NULL,
'contributionPage' => $ids['contributionPage'] ?? NULL,
], $objects, $first);
......@@ -165,6 +164,7 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN {
*/
public function recur($input, $ids, $objects, $first) {
$recur = &$objects['contributionRecur'];
$contribution = &$objects['contribution'];
// do a subscription check
if ($recur->processor_id != $input['subscription_id']) {
......@@ -225,15 +225,15 @@ class CRM_Core_Payment_AuthorizeNetIPN extends CRM_Core_Payment_BaseIPN {
CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects['contribution']);
// Only Authorize.net does this so it is on the a.net class. If there is a need for other processors
// to do this we should make it available via the api, e.g as a parameter, changing the nuance
// from isSentReceipt to an array of which receipts to send.
// Note that there is site-by-site opinions on which notifications are good to send.
if ($isFirstOrLastRecurringPayment) {
CRM_Contribute_BAO_ContributionRecur::sendRecurringStartOrEndNotification($ids, $recur,
$isFirstOrLastRecurringPayment);
//send recurring Notification email for user
CRM_Contribute_BAO_ContributionPage::recurringNotify(TRUE,
$ids['contact'],
$ids['contributionPage'],
$recur,
(bool) $this->getMembershipID($contribution->id, $recur->id)
);
}
}
/**
......@@ -314,7 +314,6 @@ INNER JOIN civicrm_contribution co ON co.contribution_recur_id = cr.id
$log->error('payment_notification', ['message' => $message, 'ids' => $ids, 'input' => $input]);
throw new CRM_Core_Exception($message);
}
$ids['membership'] = $this->getMembershipID($ids['contribution'], $ids['contributionRecur']);
}
/**
......
......@@ -257,7 +257,7 @@ class CRM_Core_Payment_AuthorizeNetIPNTest extends CiviUnitTestCase {
/**
* Test IPN response mails don't leak.
*
* @throws \CRM_Core_Exception
* @throws \CRM_Core_Exception|\CiviCRM_API3_Exception
*/
public function testIPNPaymentMembershipRecurSuccessNoLeakage() {
$mut = new CiviMailUtils($this, TRUE);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment