diff --git a/CRM/Event/Form/Task/Batch.php b/CRM/Event/Form/Task/Batch.php index 3979b29edd7e..c5f532a0846c 100644 --- a/CRM/Event/Form/Task/Batch.php +++ b/CRM/Event/Form/Task/Batch.php @@ -367,7 +367,6 @@ public static function updateContributionStatus($params) { $input['component'] = $name; $baseIPN = new CRM_Core_Payment_BaseIPN(); - $transaction = new CRM_Core_Transaction(); // reset template values. $template = CRM_Core_Smarty::singleton(); @@ -385,11 +384,13 @@ public static function updateContributionStatus($params) { ]); $input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] = $params['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] ?? NULL; if ($statusId == $contributionStatuses['Cancelled']) { + $transaction = new CRM_Core_Transaction(); $baseIPN->cancelled($objects, $transaction, $input); $transaction->commit(); return $statusId; } elseif ($statusId == $contributionStatuses['Failed']) { + $transaction = new CRM_Core_Transaction(); $baseIPN->failed($objects, $transaction, $input); $transaction->commit(); return $statusId; @@ -397,7 +398,6 @@ public static function updateContributionStatus($params) { // status is not pending if ($contribution->contribution_status_id != $contributionStatuses['Pending']) { - $transaction->commit(); return; } @@ -426,7 +426,7 @@ public static function updateContributionStatus($params) { //complete the contribution. // @todo use the api - ie civicrm_api3('Contribution', 'completetransaction', $input); // as this method is not preferred / supported. - $baseIPN->completeTransaction($input, $ids, $objects, $transaction, FALSE); + CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects); // reset template values before processing next transactions $template->clearTemplateVars();