From 6590f7745a3ac6a25bf94f404f45fbe8810a20e1 Mon Sep 17 00:00:00 2001 From: Christian Dangl Date: Mon, 2 Oct 2023 09:21:47 +0200 Subject: [PATCH] NTR: fix broken apple pay direct checkout --- .../ApplePayDirect/ApplePayDirect.php | 5 ----- .../ApplePayDirectControllerBase.php | 21 ++++++++++++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Components/ApplePayDirect/ApplePayDirect.php b/src/Components/ApplePayDirect/ApplePayDirect.php index 5a7bfc6bf..bcb490c93 100644 --- a/src/Components/ApplePayDirect/ApplePayDirect.php +++ b/src/Components/ApplePayDirect/ApplePayDirect.php @@ -460,11 +460,6 @@ public function createPayment(OrderEntity $order, string $shopwareReturnUrl, str $paymentData = $this->molliePayments->startMolliePayment(ApplePayPayment::PAYMENT_METHOD_NAME, $asyncPaymentTransition, $context, $this->paymentHandler); - if (empty($paymentData->getCheckoutURL())) { - throw new \Exception('Error when creating Apple Pay Direct order in Mollie'); - } - - # now also update the custom fields of our order # we want to have the mollie metadata in the # custom fields in Shopware too diff --git a/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php b/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php index acdd02709..1b87765f3 100644 --- a/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php +++ b/src/Controller/Storefront/ApplePayDirect/ApplePayDirectControllerBase.php @@ -234,7 +234,12 @@ public function createPaymentSession(SalesChannelContext $context, Request $requ 'session' => $session, ]); } catch (\Throwable $ex) { - $this->logger->error('Apple Pay Direct error when creating payment session: ' . $ex->getMessage()); + $this->logger->error( + 'Apple Pay Direct error when creating payment session: ' . $ex->getMessage(), + [ + 'error' => $ex, + ] + ); return new JsonResponse(['success' => false,], 500); } @@ -414,7 +419,12 @@ public function finishPayment(SalesChannelContext $context, Request $request): R $order = $this->applePay->createOrder($context); } catch (Throwable $ex) { - $this->logger->error('Apple Pay Direct error when finishing payment: ' . $ex->getMessage()); + $this->logger->error( + 'Apple Pay Direct error when finishing payment: ' . $ex->getMessage(), + [ + 'error' => $ex, + ] + ); # if we have an error here, we have to redirect to the confirm page $returnUrl = $this->getCheckoutConfirmPage($this->router); @@ -450,7 +460,12 @@ public function finishPayment(SalesChannelContext $context, Request $request): R return new RedirectResponse($returnUrl); } catch (Throwable $ex) { - $this->logger->error('Apple Pay Direct error when finishing Mollie payment: ' . $ex->getMessage()); + $this->logger->error( + 'Apple Pay Direct error when finishing Mollie payment: ' . $ex->getMessage(), + [ + 'error' => $ex, + ] + ); # we already have a valid Order ID. # so we just need to make sure to edit that order