Remove unused parameters from BaseIPN->cancelled signature
authoreileen <emcnaughton@wikimedia.org>
Sat, 10 Oct 2020 21:20:33 +0000 (10:20 +1300)
committereileen <emcnaughton@wikimedia.org>
Sat, 10 Oct 2020 21:20:33 +0000 (10:20 +1300)
CRM/Core/Payment/BaseIPN.php
tests/phpunit/CRM/Core/Payment/BaseIPNTest.php

index e1fa68af31b61bc8293d58dbe01a0b7f1461d892..e8b9fdc96f9f3ae710cc1cabbb3c103c5e79e0e4 100644 (file)
@@ -235,13 +235,11 @@ class CRM_Core_Payment_BaseIPN {
    * Process cancelled payment outcome.
    *
    * @param array $objects
-   * @param CRM_Core_Transaction $transaction
-   * @param array $input
    *
    * @return bool
-   * @throws \CiviCRM_API3_Exception
+   * @throws \CiviCRM_API3_Exception|\CRM_Core_Exception
    */
-  public function cancelled(&$objects, $transaction = NULL, $input = []) {
+  public function cancelled($objects) {
     $contribution = &$objects['contribution'];
     $memberships = [];
     if (!empty($objects['membership'])) {
@@ -264,7 +262,6 @@ class CRM_Core_Payment_BaseIPN {
     ]);
     $contribution->contribution_status_id = $contributionStatuses['Cancelled'];
     $contribution->cancel_date = self::$_now;
-    $contribution->cancel_reason = $input['reasonCode'] ?? NULL;
     $contribution->save();
 
     // Add line items for recurring payments.
@@ -291,9 +288,6 @@ class CRM_Core_Payment_BaseIPN {
       $this->cancelParticipant($participant->id);
     }
 
-    if ($transaction) {
-      $transaction->commit();
-    }
     Civi::log()->debug("Setting contribution status to Cancelled");
     return TRUE;
   }
index 4b4da2c8de1a5cf4c9bc578385155c0181114c5b..9a80a19ffc49b2916c41bab7941919eb833b7cb8 100644 (file)
@@ -413,7 +413,7 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
     ]);
 
     $transaction = new CRM_Core_Transaction();
-    $this->IPN->cancelled($this->objects, $transaction);
+    $this->IPN->cancelled($this->objects);
 
     $cancelledParticipantsCount = civicrm_api3('Participant', 'get', [
       'sequential' => 1,