$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'
);
} try { $response =
$this->payloadService->
request($url,
$payload,
$app, AsyncPayResponse::
class,
$salesChannelContext->
getContext());
} catch (ClientExceptionInterface
$exception) { throw PaymentException::
asyncProcessInterrupted($transaction->
getOrderTransaction()->
getId(),
sprintf('App error: %s',
$exception->
getMessage()));
} if (!
$response instanceof AsyncPayResponse
) { throw PaymentException::
asyncProcessInterrupted($transaction->
getOrderTransaction()->
getId(), 'Invalid app response'
);
}