<?php
namespace App\Service\PaymentSystem\Processor\Stripe\Listener;
use App\DTO\PaymentSystem\Config\StripePaymentSystemConfigDTO;
use App\Service\App\Merchant\Config\Event\PaymentSystemDeactivateEvent;
use App\Service\PaymentSystem\Processor\Stripe\Contract\StripeOAuthServiceInterface;
class DeactivateStripeListener
{
/**
* OAuth service
*
* @var StripeOAuthServiceInterface
*/
private StripeOAuthServiceInterface $stripeOAuthService;
/**
* Constructor
*
* @param StripeOAuthServiceInterface $stripeOAuthService
*/
public function __construct(StripeOAuthServiceInterface $stripeOAuthService)
{
$this->stripeOAuthService = $stripeOAuthService;
}
/**
* On deactivate payment system
*
* @param PaymentSystemDeactivateEvent $event
* @return void
*/
public function onDeactivate(PaymentSystemDeactivateEvent $event): void
{
if ($event->getPaymentSystem() == StripePaymentSystemConfigDTO::PAYMENT_SYSTEM_KEY) {
$this->stripeOAuthService->deactivate();
}
}
}