1
0
Эх сурвалжийг харах

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

AntonLV 4 жил өмнө
parent
commit
09527c02ce

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

@@ -950,6 +950,13 @@ class BxPaymentModule extends BxBaseModPaymentModule
 
     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);
     }