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\EshopCommunity\Internal\Framework\Event\AbstractShopAwareEventSubscriber;
use OxidEsales\GraphQL\Storefront\Basket\Event\BeforeBasketPayments;
class DeveloperBeforeBasketPaymentsEventSubscriber extends AbstractShopAwareEventSubscriber
{
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']