Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
processUnconfirmed example
use
Symfony\Component\HttpFoundation\RedirectResponse;
use
Symfony\Component\HttpFoundation\Request;
/** * @internal only for use by the app-system */
#[Package('core')]
class
AppAsyncPaymentHandler
extends
AppPaymentHandler
implements
AsynchronousPaymentHandlerInterface
{
public
function
pay
(
AsyncPaymentTransactionStruct
$transaction
, RequestDataBag
$dataBag
, SalesChannelContext
$salesChannelContext
)
: RedirectResponse
{
$this
->transactionStateHandler->
processUnconfirmed
(
$transaction
->
getOrderTransaction
(
)
->
getId
(
)
,
$salesChannelContext
->
getContext
(
)
)
;
$payload
=
$this
->
buildPayPayload
(
$transaction
,
$dataBag
->
all
(
)
)
;
$app
=
$this
->
getAppPaymentMethod
(
$transaction
->
getOrderTransaction
(
)
)
->
getApp
(
)
;
if
(
$app
=== null
)
{
throw
PaymentException::
asyncProcessInterrupted
(
$transaction
->
getOrderTransaction
(
)
->
getId
(
)
, 'App not defined'
)
;
}
$url
=
$this
->
getAppPaymentMethod
(
$transaction
->
getOrderTransaction
(
)
)
->
getPayUrl
(
)
;
if
(
$url
=== null
)
{
throw
PaymentException::
asyncFinalizeInterrupted
(
$transaction
->
getOrderTransaction
(
)
->
getId
(
)
, 'Pay URL not defined'
)
;
}