BeforeBasketPayments
This event will be fired right before getting the list with available payments for specific basket.
BeforeBasketPaymentsEventSubscriber
<?php
declare(strict_types=1);
namespace Full\Qualified\Namespace;
use OxidEsales\GraphQL\Storefront\Basket\Event\BeforeBasketPayments;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class DeveloperBeforeBasketPaymentsEventSubscriber implements EventSubscriberInterface
{
public function handle(BeforeBasketPayments $event): BeforeBasketPayments
{
//get the user basket id from event
$userBasketId = (string) $event->getBasketId();
//do something
return $event;
}
public static function getSubscribedEvents()
{
return [
'OxidEsales\GraphQL\Storefront\Basket\Event\BeforeBasketPayments' => 'handle'
];
}
}
Important
The code above is only an example. In case you need to handle the BeforeBasketPayments
event,
please adapt to your needs.
services.yaml
services:
_defaults:
public: false
autowire: true
Full\Qualified\Namespace\DeveloperBeforeBasketPaymentsEventSubscriber:
class: Full\Qualified\Namespace\DeveloperBeforeBasketPaymentsEventSubscriber
tags: ['kernel.event_subscriber']