Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Stop passing objects to recur in paypal pro - pass specific objects #19041

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions CRM/Core/Payment/PayPalProIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,22 @@ public function retrieve($name, $type, $location = 'POST', $abort = TRUE) {
*
* @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<p>';
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
Expand Down Expand Up @@ -276,13 +277,13 @@ public function recur($input, $ids, $objects, $first) {
}

// 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);
}

/**
Expand Down Expand Up @@ -460,7 +461,7 @@ public function main() {
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;
}

Expand Down Expand Up @@ -621,7 +622,7 @@ public function handlePaymentExpress() {
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);
}

/**
Expand Down