[REF] Param simplification
authoreileen <emcnaughton@wikimedia.org>
Sun, 17 Jan 2021 22:08:24 +0000 (11:08 +1300)
committereileen <emcnaughton@wikimedia.org>
Sun, 17 Jan 2021 22:08:24 +0000 (11:08 +1300)
On looking at this param it can only be reached if recur->id is set and the other criteria can be
squashed to an empty check

CRM/Core/Payment/PayPalIPN.php

index 789dbbf6a6d785e3c2dd5fccf2a1b244bba08037..2ec2c0f509ea19697954d1cb5580d4f4694948f3 100644 (file)
@@ -154,23 +154,16 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN {
     $recur->save();
 
     if ($this->getFirstOrLastInSeriesStatus()) {
-      $autoRenewMembership = FALSE;
-      if ($recur->id &&
-        isset($ids['membership']) && $ids['membership']
-      ) {
-        $autoRenewMembership = TRUE;
-      }
-
       //send recurring Notification email for user
       CRM_Contribute_BAO_ContributionPage::recurringNotify($this->getFirstOrLastInSeriesStatus(),
         $ids['contact'],
         $ids['contributionPage'],
         $recur,
-        $autoRenewMembership
+        !empty($ids['membership'])
       );
     }
 
-    if ($txnType != 'subscr_payment') {
+    if ($txnType !== 'subscr_payment') {
       return;
     }
 
@@ -185,7 +178,7 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN {
         return;
       }
 
-      if ($input['paymentStatus'] != 'Completed') {
+      if ($input['paymentStatus'] !== 'Completed') {
         throw new CRM_Core_Exception("Ignore all IPN payments that are not completed");
       }