src/Utils/OrderCreator/Event/Handler/ManaulVerificationNotifyHandler.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Utils\OrderCreator\Event\Handler;
  3. use App\Utils\MailerUtils;
  4. use App\Utils\OrderCreator\Event\OrderPlacingFinished;
  5. use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
  6. #[AsEventListener(eventOrderPlacingFinished::class)]
  7. final class ManaulVerificationNotifyHandler
  8. {
  9.     public function __construct(private readonly MailerUtils $mailerUtils)
  10.     {}
  11.     public function __invoke(OrderPlacingFinished $event): void
  12.     {
  13.         $orderContext $event->getOrderCreationContext();
  14.         $order $orderContext->getOrder();
  15.         $portalSettings $orderContext->getResolvedPortalSettings();
  16.         $manualVerificationEnabled $orderContext->isManualVerificationNotify() ?? false;
  17.         if ($manualVerificationEnabled) {
  18.             $this->mailerUtils->sendManualVerificationNotify($order$portalSettings->getTitle());
  19.         }
  20.     }
  21. }