Remove instantiation of transaction from payment express ipn class
authoreileen <emcnaughton@wikimedia.org>
Mon, 18 May 2020 06:12:03 +0000 (18:12 +1200)
committereileen <emcnaughton@wikimedia.org>
Mon, 18 May 2020 06:12:03 +0000 (18:12 +1200)
This class is hopefully used, however, this change should be safe regardless as it just calls the same function
without needlessly instantiating the parent.

Note this processor is not enabled on install or recommended

CRM/Core/Payment/PaymentExpressIPN.php

index ab34ea13f1e536ba40766cefe6e135b0340e9a01..1bac6b1f9b5bbde1485a172163f0738742aa7ed9 100644 (file)
@@ -109,6 +109,8 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN {
    * @param $transactionReference
    *
    * @return bool
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
   public function newOrderNotify($success, $privateData, $component, $amount, $transactionReference) {
     $ids = $input = $params = [];
@@ -160,8 +162,6 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN {
       return FALSE;
     }
 
-    $transaction = new CRM_Core_Transaction();
-
     // check if contribution is already completed, if so we ignore this ipn
 
     if ($contribution->contribution_status_id == 1) {
@@ -181,7 +181,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN {
         $contribution->trxn_id = $ids['membership'];
       }
     }
-    $this->completeTransaction($input, $ids, $objects, $transaction);
+    CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects);
     return TRUE;
   }