From 982318562697e6666fd5e73fcb406df43e23c73a Mon Sep 17 00:00:00 2001
From: Matthew Wire <mjw@mjwconsult.co.uk>
Date: Tue, 20 Oct 2020 17:15:31 +0100
Subject: [PATCH] Code formatting

---
 CRM/Core/Payment/StripeIPN.php | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/CRM/Core/Payment/StripeIPN.php b/CRM/Core/Payment/StripeIPN.php
index 528fd1e5..41fecef8 100644
--- a/CRM/Core/Payment/StripeIPN.php
+++ b/CRM/Core/Payment/StripeIPN.php
@@ -221,9 +221,9 @@ class CRM_Core_Payment_StripeIPN {
           }
         }
         if (civicrm_api3('Mjwpayment', 'get_payment', [
-          'trxn_id' => $this->charge_id,
-          'status_id' => 'Completed'
-        ])['count'] > 0) {
+            'trxn_id' => $this->charge_id,
+            'status_id' => 'Completed'
+          ])['count'] > 0) {
           // Payment already recorded
           return TRUE;
         }
@@ -263,16 +263,6 @@ class CRM_Core_Payment_StripeIPN {
         }
         return TRUE;
 
-      case 'customer.subscription.deleted':
-        // Subscription is cancelled
-        if (!$this->getSubscriptionDetails()) {
-          // Subscription was not found in CiviCRM
-          return TRUE;
-        }
-        // Cancel the recurring contribution
-        $this->updateRecurCancelled(['id' => $this->contribution_recur_id, 'cancel_date' => $this->retrieve('cancel_date', 'String', FALSE)]);
-        return TRUE;
-
       // One-time donation and per invoice payment.
       case 'charge.failed':
         // If we don't have a customer_id we can't do anything with it!
@@ -383,6 +373,16 @@ class CRM_Core_Payment_StripeIPN {
           'frequency_interval' => $this->frequency_interval,
         ]);
         return TRUE;
+
+      case 'customer.subscription.deleted':
+        // Subscription is cancelled
+        if (!$this->getSubscriptionDetails()) {
+          // Subscription was not found in CiviCRM
+          return TRUE;
+        }
+        // Cancel the recurring contribution
+        $this->updateRecurCancelled(['id' => $this->contribution_recur_id, 'cancel_date' => $this->retrieve('cancel_date', 'String', FALSE)]);
+        return TRUE;
     }
     // Unhandled event type.
     return TRUE;
-- 
GitLab