Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Checkout\Payment\Exception\AsyncPaymentFinalizeException,
Checkout\Payment\Exception\AsyncPaymentProcessException,
Checkout\Payment\Exception\CustomerCanceledAsyncPaymentException,
Checkout\Payment\PaymentException,
Framework\Validation\DataBag\RequestDataBag,
System\SalesChannel\SalesChannelContext
};
Expand Down Expand Up @@ -140,7 +141,7 @@ public function finalize(
]);
unset($_SESSION['transactionId']);
$this->logger->info($errorMessage);
throw new \Exception($transaction->getOrder()->getId());
throw PaymentException::customerCanceled($transaction->getOrderTransaction()->getId(), $errorMessage);
}
} else {
$this->orderTransactionStateHandler->paid($transaction->getOrderTransaction()->getId(), $salesChannelContext->getContext());
Expand Down
13 changes: 13 additions & 0 deletions src/Core/Storefront/Checkout/Controller/CheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,19 @@ public function recreateCart(Request $request, SalesChannelContext $salesChannel
throw new MissingRequestParameterException('orderId');
}

// Adoption for Headless Storefronts
$orderRepo = $this->container->get('order.repository');
$criteria = new Criteria([$orderId]);

$orderEntity = $orderRepo->search($criteria, $salesChannelContext->getContext())->first();

if($orderEntity->getSalesChannelId() !== $salesChannelContext->getSalesChannelId()) {
$this->settings = $this->settingsService->getSettings($orderEntity->getSalesChannelId());
$trans = $this->getTransaction($orderId, $salesChannelContext->getContext());
return $this->redirect($trans->getSuccessUrl());
}
// End Adoption for Headless Storefronts

try {
$this->cartService->deleteCart($salesChannelContext);
$cart = $this->cartService->createNew($salesChannelContext->getToken());
Expand Down