src/Service/PaymentSystem/Processor/Stripe/Listener/DeactivateStripeListener.php line 35

Open in your IDE?
  1. <?php
  2. namespace App\Service\PaymentSystem\Processor\Stripe\Listener;
  3. use App\DTO\PaymentSystem\Config\StripePaymentSystemConfigDTO;
  4. use App\Service\App\Merchant\Config\Event\PaymentSystemDeactivateEvent;
  5. use App\Service\PaymentSystem\Processor\Stripe\Contract\StripeOAuthServiceInterface;
  6. class DeactivateStripeListener
  7. {
  8.     /**
  9.      * OAuth service
  10.      *
  11.      * @var StripeOAuthServiceInterface
  12.      */
  13.     private StripeOAuthServiceInterface $stripeOAuthService;
  14.     /**
  15.      * Constructor
  16.      *
  17.      * @param StripeOAuthServiceInterface $stripeOAuthService
  18.      */
  19.     public function __construct(StripeOAuthServiceInterface $stripeOAuthService)
  20.     {
  21.         $this->stripeOAuthService $stripeOAuthService;
  22.     }
  23.     /**
  24.      * On deactivate payment system
  25.      *
  26.      * @param PaymentSystemDeactivateEvent $event
  27.      * @return void
  28.      */
  29.     public function onDeactivate(PaymentSystemDeactivateEvent $event): void
  30.     {
  31.         if ($event->getPaymentSystem() == StripePaymentSystemConfigDTO::PAYMENT_SYSTEM_KEY) {
  32.             $this->stripeOAuthService->deactivate();
  33.         }
  34.     }
  35. }