diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 973fbd988894..9ace047b52c9 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -214,7 +214,8 @@ public function loadObjects($input, &$ids, &$objects, $required, $paymentProcess * @return bool * @throws \CiviCRM_API3_Exception */ - public function failed(&$objects, &$transaction, $input = []) { + public function failed(&$objects, $input = []) { + $transaction = new CRM_Core_Transaction(); $contribution = &$objects['contribution']; $memberships = []; if (!empty($objects['membership'])) { diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index 0e87056c8755..32bc939851c2 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -260,7 +260,7 @@ public function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE $status = $input['paymentStatus']; if ($status == 'Denied' || $status == 'Failed' || $status == 'Voided') { - return $this->failed($objects, $transaction); + return $this->failed($objects); } if ($status === 'Pending') { Civi::log()->debug('Returning since contribution status is Pending'); diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index d249aa0bef30..6052c54f2ec0 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -348,7 +348,7 @@ public function single(&$input, &$ids, &$objects, $recur = FALSE, $first = FALSE $status = $input['paymentStatus']; if ($status == 'Denied' || $status == 'Failed' || $status == 'Voided') { - $this->failed($objects, $transaction); + $this->failed($objects); return; } if ($status === 'Pending') { diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index 9a52015e42d3..2388d5ada413 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -394,8 +394,7 @@ public static function updateContributionStatus($params) { return $statusId; } elseif ($statusId == $contributionStatuses['Failed']) { - $transaction = new CRM_Core_Transaction(); - $baseIPN->failed($objects, $transaction, $input); + $baseIPN->failed($objects, $input); $transaction->commit(); return $statusId; } diff --git a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php index 758503c6c5ac..592139c58ef0 100644 --- a/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/BaseIPNTest.php @@ -428,8 +428,7 @@ public function testThatFailedEventPaymentWillCancelAllAdditionalPendingParticip 'status_id' => 'Pending from incomplete transaction', ]); - $transaction = new CRM_Core_Transaction(); - $this->IPN->failed($this->objects, $transaction); + $this->IPN->failed($this->objects); $cancelledParticipantsCount = civicrm_api3('Participant', 'get', [ 'sequential' => 1,