custom/plugins/StripeShopwarePayment/src/Payment/Subscriber/LogoutSubscriber.php line 38

Open in your IDE?
  1. <?php
  2. /*
  3.  * Copyright (c) Pickware GmbH. All rights reserved.
  4.  * This file is part of software that is released under a proprietary license.
  5.  * You must not copy, modify, distribute, make publicly available, or execute
  6.  * its contents or parts thereof without express permission by the copyright
  7.  * holder, unless otherwise permitted by law.
  8.  */
  9. declare(strict_types=1);
  10. namespace Stripe\ShopwarePayment\Payment\Subscriber;
  11. use Shopware\Core\Checkout\Customer\Event\CustomerLogoutEvent;
  12. use Stripe\ShopwarePayment\Session\StripePaymentMethodSettings;
  13. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  14. class LogoutSubscriber implements EventSubscriberInterface
  15. {
  16.     /**
  17.      * @var StripePaymentMethodSettings
  18.      */
  19.     private $stripePaymentMethodSettings;
  20.     public function __construct(
  21.         StripePaymentMethodSettings $stripePaymentMethodSettings
  22.     ) {
  23.         $this->stripePaymentMethodSettings $stripePaymentMethodSettings;
  24.     }
  25.     public static function getSubscribedEvents(): array
  26.     {
  27.         return [
  28.             CustomerLogoutEvent::class => 'onCustomerLogout',
  29.         ];
  30.     }
  31.     public function onCustomerLogout(): void
  32.     {
  33.         $this->stripePaymentMethodSettings->reset();
  34.     }
  35. }