From: eileen Date: Thu, 4 Jun 2020 23:47:28 +0000 (+1200) Subject: [Ref] Remove calls to, and deprecate, unhandled function X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=85ce114de01f68987a1d86f28a9fba6db6a78f6f;p=civicrm-core.git [Ref] Remove calls to, and deprecate, unhandled function --- diff --git a/CRM/Core/Payment/BaseIPN.php b/CRM/Core/Payment/BaseIPN.php index 8f5dd3786f..7153221524 100644 --- a/CRM/Core/Payment/BaseIPN.php +++ b/CRM/Core/Payment/BaseIPN.php @@ -361,15 +361,18 @@ class CRM_Core_Payment_BaseIPN { /** * Rollback unhandled outcomes. * + * @deprecated + * * @param array $objects * @param CRM_Core_Transaction $transaction * * @return bool */ public function unhandled(&$objects, &$transaction) { + CRM_Core_Error::deprecatedFunctionWarning('This function will be removed at some point'); $transaction->rollback(); - Civi::log()->debug("Returning since contribution status is not handled"); - echo "Failure: contribution status is not handled

"; + Civi::log()->debug('Returning since contribution status is not handled'); + echo 'Failure: contribution status is not handled

'; return FALSE; } diff --git a/CRM/Core/Payment/PayPalIPN.php b/CRM/Core/Payment/PayPalIPN.php index 0d3eae5386..c241bf2b8e 100644 --- a/CRM/Core/Payment/PayPalIPN.php +++ b/CRM/Core/Payment/PayPalIPN.php @@ -270,8 +270,9 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { elseif ($status == 'Refunded' || $status == 'Reversed') { return $this->cancelled($objects, $transaction); } - elseif ($status != 'Completed') { - return $this->unhandled($objects, $transaction); + elseif ($status !== 'Completed') { + Civi::log()->debug('Returning since contribution status is not handled'); + return; } // check if contribution is already completed, if so we ignore this ipn @@ -279,7 +280,7 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { if ($contribution->contribution_status_id == $completedStatusId) { $transaction->commit(); Civi::log()->debug('PayPalIPN: Returning since contribution has already been handled. (ID: ' . $contribution->id . ').'); - echo "Success: Contribution has already been handled

"; + echo 'Success: Contribution has already been handled

'; return; } diff --git a/CRM/Core/Payment/PayPalProIPN.php b/CRM/Core/Payment/PayPalProIPN.php index a215552724..42951def30 100644 --- a/CRM/Core/Payment/PayPalProIPN.php +++ b/CRM/Core/Payment/PayPalProIPN.php @@ -359,8 +359,8 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { $this->cancelled($objects, $transaction); return; } - elseif ($status != 'Completed') { - $this->unhandled($objects, $transaction); + elseif ($status !== 'Completed') { + Civi::log()->debug('Returning since contribution status is not handled'); return; } @@ -369,7 +369,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN { if ($contribution->contribution_status_id == $completedStatusId) { $transaction->commit(); Civi::log()->debug('PayPalProIPN: Returning since contribution has already been handled.'); - echo "Success: Contribution has already been handled

"; + echo 'Success: Contribution has already been handled

'; return; }