src/EventSubscriber/PrzlelewyOrderPayed.php line 30

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use App\Env;
  4. use App\Event\OrderMakedEvent;
  5. use App\Event\OrderPayedEvent;
  6. use App\Repository\CartRepository;
  7. use App\Repository\ProdRepository;
  8. use App\Repository\UserRepository;
  9. use App\Service\Baselinker\DTO\Prod;
  10. use App\Repository\EsystemRepository;
  11. use App\Service\Baselinker\DTO\Order;
  12. use App\Repository\DeliveryRepository;
  13. use App\Service\Baselinker\Baselinker;
  14. use App\Service\Baselinker\DTO\Company;
  15. use App\Service\Baselinker\DTO\Delivery;
  16. use App\Service\Pay\Przelewy;
  17. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  18. class PrzlelewyOrderPayed implements EventSubscriberInterface
  19. {
  20.     public function __construct(
  21.         private Przelewy $Pay        
  22.     )
  23.     {
  24.         
  25.     }
  26.     public function onOrderPayed(OrderPayedEvent $event): void
  27.     {        
  28.         if (Env::site() != Env::MIX && Env::site() != Env::OPT_MIX) {
  29.             return;
  30.         }
  31.         
  32.         $this->Pay->verify($event->getOrder()->getId(), $event->getOrder()->getAmount());
  33.     }
  34.     public static function getSubscribedEvents(): array
  35.     {
  36.         return [
  37.             OrderPayedEvent::NAME => 'onOrderPayed',
  38.         ];
  39.     }
  40. }