Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
isPaymentFailed example
try
{
$page
=
$this
->finishPageLoader->
load
(
$request
,
$context
)
;
}
catch
(
OrderException
$exception
)
{
$this
->
addFlash
(
self::DANGER,
$this
->
trans
(
'error.' .
$exception
->
getErrorCode
(
)
)
)
;
return
$this
->
redirectToRoute
(
'frontend.checkout.cart.page'
)
;
}
$this
->
hook
(
new
CheckoutFinishPageLoadedHook
(
$page
,
$context
)
)
;
if
(
$page
->
isPaymentFailed
(
)
=== true
)
{
return
$this
->
redirectToRoute
(
'frontend.account.edit-order.page',
[
'orderId' =>
$request
->
get
(
'orderId'
)
,
'error-code' => 'CHECKOUT__UNKNOWN_ERROR',
]
)
;
}
if
(
$context
->
getCustomer
(
)
->
getGuest
(
)
&&
$this
->config->
get
(
'core.cart.logoutGuestAfterCheckout',
$context
->
getSalesChannelId
(
)
)
)
{
$this
->logoutRoute->
logout
(
$context
,
$dataBag
)
;
}