From: eileen Date: Tue, 24 Nov 2020 21:26:41 +0000 (+1300) Subject: Stop passing objects to recur - pass specific objects X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=62dda083ad50e7281cece9dd66c46785fdb22075;p=civicrm-core.git Stop passing objects to recur - pass specific objects --- diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index 4005a219b2..0f449aa21d 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -148,21 +148,22 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { * * @param array $input * @param array $ids - * @param array $objects + * @param \CRM_Contribute_BAO_ContributionRecur $recur + * @param \CRM_Contribute_BAO_Contribution $contribution * @param bool $first * + * @throws \API_Exception * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception + * @throws \Civi\API\Exception\UnauthorizedException */ - public function recur($input, $ids, $objects, $first) { + public function recur($input, $ids, $recur, $contribution, $first) { if (!isset($input['txnType'])) { Civi::log()->debug('PayPalProIPN: Could not find txn_type in input request.'); echo 'Failure: Invalid parameters

'; return; } - $recur = &$objects['contributionRecur']; - // make sure the invoice ids match // make sure the invoice is valid and matches what we have in // the contribution record @@ -276,13 +277,13 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { } // CRM-13737 - am not aware of any reason why payment_date would not be set - this if is a belt & braces - $objects['contribution']->receive_date = !empty($input['payment_date']) ? date('YmdHis', strtotime($input['payment_date'])) : $now; + $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, - ], $objects['contribution'], TRUE, $first); + ], $contribution, TRUE, $first); } /** @@ -460,7 +461,7 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr if ($objects['contribution']->contribution_status_id == $completedStatusId) { $first = FALSE; } - $this->recur($input, $ids, $objects, $first); + $this->recur($input, $ids, $objects['contributionRecur'], $objects['contribution'], $first); return; } @@ -621,7 +622,7 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr if (!$this->loadObjects($input, $ids, $objects, TRUE, $paymentProcessorID)) { throw new CRM_Core_Exception('Data did not validate'); } - $this->recur($input, $ids, $objects, $isFirst); + $this->recur($input, $ids, $objects['contributionRecur'], $objects['contribution'], $isFirst); } /**