Skip to content

Commit

Permalink
NTR: fix broken apple pay direct checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
boxblinkracer committed Oct 2, 2023
1 parent ec740ad commit 6590f77
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/Components/ApplePayDirect/ApplePayDirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6590f77

Please sign in to comment.