Skip to content

Commit

Permalink
Switch to passing payment_processor_id as input param to completeOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Sep 23, 2020
1 parent 5406ce3 commit dc65872
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
13 changes: 1 addition & 12 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -4406,18 +4406,7 @@ public static function completeOrder($input, $ids, $objects, $isPostPaymentCreat
'financial_type_id',
];

// @todo - accept payment_processor_id as an input parameter as it is part of the
// incoming payment information (at least when coming from a payment processor).
// this is the last 'object' to get rid of....
$paymentProcessorId = '';
if (isset($objects['paymentProcessor'])) {
if (is_array($objects['paymentProcessor'])) {
$paymentProcessorId = $objects['paymentProcessor']['id'];
}
else {
$paymentProcessorId = $objects['paymentProcessor']->id;
}
}
$paymentProcessorId = $input['payment_processor_id'] ?? NULL;

$completedContributionStatusID = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');

Expand Down
1 change: 1 addition & 0 deletions CRM/Core/Payment/AuthorizeNetIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function main($component = 'contribute') {
if ($objects['contribution']->contribution_status_id == 1) {
$first = FALSE;
}
$input['payment_processor_id'] = $paymentProcessorID;
return $this->recur($input, $ids, $objects, $first);
}
}
Expand Down
2 changes: 2 additions & 0 deletions CRM/Core/Payment/PayPalIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ public function main() {
return;
}

$input['payment_processor_id'] = $paymentProcessorID;

self::$_paymentProcessor = &$objects['paymentProcessor'];
if ($component == 'contribute') {
if ($ids['contributionRecur']) {
Expand Down
2 changes: 2 additions & 0 deletions CRM/Core/Payment/PayPalProIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ public function main() {
return;
}

$input['payment_processor_id'] = $paymentProcessorID;

self::$_paymentProcessor = &$objects['paymentProcessor'];
//?? how on earth would we not have component be one of these?
// they are the only valid settings & this IPN file can't even be called without one of them
Expand Down
3 changes: 2 additions & 1 deletion api/v3/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ function civicrm_api3_contribution_repeattransaction($params) {
);
}

$input['payment_processor_id'] = civicrm_api3('contributionRecur', 'getvalue', [
$input['payment_processor_id'] = $params['payment_processor_id'] = civicrm_api3('contributionRecur', 'getvalue', [
'return' => 'payment_processor_id',
'id' => $contribution->contribution_recur_id,
]);
Expand All @@ -626,6 +626,7 @@ function civicrm_api3_contribution_repeattransaction($params) {
'financial_type_id',
'contribution_status_id',
'membership_id',
'payment_processor_id',
];
$input = array_intersect_key($params, array_fill_keys($passThroughParams, NULL));

Expand Down

0 comments on commit dc65872

Please sign in to comment.