Jelajahi Sumber

Ticket #3550 - Payments: All subscriptions should be automatically canceled when profile/account was deleted.

AntonLV 4 tahun lalu
induk
melakukan
09527c02ce
1 mengubah file dengan 7 tambahan dan 0 penghapusan
  1. 7 0
      modules/boonex/payment/classes/BxPaymentModule.php

+ 7 - 0
modules/boonex/payment/classes/BxPaymentModule.php

@@ -950,6 +950,13 @@ class BxPaymentModule extends BxBaseModPaymentModule
 
 
     public function onProfileDelete($iProfileId)
     public function onProfileDelete($iProfileId)
     {
     {
+        //--- Cancel subscriptions
+        $aSubscriptions = $this->_oDb->getSubscription(['type' => 'mixed_ext', 'conditions' => ['client_id' => $iProfileId]]);
+        if(!empty($aSubscriptions) && is_array($aSubscriptions)) 
+            foreach($aSubscriptions as $aSubscription)
+                $this->getObjectSubscriptions()->cancel($aSubscription['pending_id']);
+
+        //--- Clean DB
         $this->_oDb->onProfileDelete($iProfileId);
         $this->_oDb->onProfileDelete($iProfileId);
     }
     }