<?php
declare(strict_types=1);
namespace Wbfk\Offer\Subscriber;
use JetBrains\PhpStorm\NoReturn;
use Shopware\Storefront\Event\RouteRequest\SetPaymentOrderRouteRequestEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class SetPaymentOrderRouteRequestEventSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
SetPaymentOrderRouteRequestEvent::class => 'onSetPaymentOrderRouteRequestEvent',
];
}
public function onSetPaymentOrderRouteRequestEvent(SetPaymentOrderRouteRequestEvent $event): void
{
if ($event->getStorefrontRequest()->get('deepLinkCode', false)) {
$event->getStoreApiRequest()->attributes->set('deepLinkCode', $event->getStorefrontRequest()->get('deepLinkCode'));
}
}
}