From cc309a73bcf22c1d47407ad775e479c77f2253ee Mon Sep 17 00:00:00 2001 From: Vitalij Mik Date: Mon, 2 Sep 2024 11:03:49 +0200 Subject: [PATCH] NTR: stan fix --- src/Checkout/Cart/ExpressCartItemAddRoute.php | 7 ++++++ .../ApplePayDirectControllerBase.php | 22 ++----------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/Checkout/Cart/ExpressCartItemAddRoute.php b/src/Checkout/Cart/ExpressCartItemAddRoute.php index bd6e3927d..f5358e4e4 100644 --- a/src/Checkout/Cart/ExpressCartItemAddRoute.php +++ b/src/Checkout/Cart/ExpressCartItemAddRoute.php @@ -41,6 +41,13 @@ public function getDecorated(): AbstractCartItemAddRoute return $this->cartItemAddRoute; } + /** + * @param Request $request + * @param Cart $cart + * @param SalesChannelContext $context + * @param ?array $items + * @return CartResponse + */ public function add(Request $request, Cart $cart, SalesChannelContext $context, ?array $items): CartResponse { //we have to create a new request from global variables, because the request is not set here in the route diff --git a/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php b/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php index c8585a7c0..23a730737 100644 --- a/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php +++ b/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php @@ -8,7 +8,6 @@ use Kiener\MolliePayments\Components\ApplePayDirect\ApplePayDirect; use Kiener\MolliePayments\Controller\Storefront\AbstractStoreFrontController; use Kiener\MolliePayments\Repository\Customer\CustomerRepositoryInterface; -use Kiener\MolliePayments\Service\Cart\CartBackupService; use Kiener\MolliePayments\Service\OrderService; use Kiener\MolliePayments\Traits\Storefront\RedirectTrait; use Psr\Log\LoggerInterface; @@ -21,7 +20,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\Routing\RouterInterface; use Throwable; @@ -42,20 +40,12 @@ class ApplePayDirectControllerBase extends AbstractStoreFrontController */ private $applePay; - /** - * @var CartBackupService - */ - private $cartBackupService; /** * @var RouterInterface */ private $router; - /** - * @var ?FlashBag - */ - private $flashBag; /** * @var FlowBuilderDispatcherAdapterInterface @@ -87,20 +77,18 @@ class ApplePayDirectControllerBase extends AbstractStoreFrontController * @param ApplePayDirect $applePay * @param RouterInterface $router * @param LoggerInterface $logger - * @param CartBackupService $cartBackup - * @param null|FlashBag $sessionFlashBag * @param FlowBuilderFactory $flowBuilderFactory * @param FlowBuilderEventFactory $flowBuilderEventFactory * @param CustomerRepositoryInterface $repoCustomers * @param OrderService $orderService * @throws \Exception */ - public function __construct(ApplePayDirect $applePay, RouterInterface $router, LoggerInterface $logger, CartBackupService $cartBackup, FlowBuilderFactory $flowBuilderFactory, FlowBuilderEventFactory $flowBuilderEventFactory, CustomerRepositoryInterface $repoCustomers, OrderService $orderService) + public function __construct(ApplePayDirect $applePay, RouterInterface $router, LoggerInterface $logger, FlowBuilderFactory $flowBuilderFactory, FlowBuilderEventFactory $flowBuilderEventFactory, CustomerRepositoryInterface $repoCustomers, OrderService $orderService) { $this->applePay = $applePay; $this->router = $router; $this->logger = $logger; - $this->cartBackupService = $cartBackup; + $this->repoCustomers = $repoCustomers; $this->orderService = $orderService; @@ -328,12 +316,6 @@ public function setShippingMethod(SalesChannelContext $context, Request $request public function startPayment(SalesChannelContext $context, Request $request): Response { try { - # we clear our cart backup now - # we are in the user redirection process where a restoring wouldnt make sense - # because from now on we would end on the cart page where we could even switch payment method. - // $this->cartBackupService->clearBackup($context); - - $email = (string)$request->get('email', ''); $firstname = (string)$request->get('firstname', ''); $lastname = (string)$request->get('lastname', '');