Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
AsyncFinalizeResponse example
if
(
!Feature::
isActive
(
'v6.6.0.0'
)
)
{
$this
->
expectException
(
AsyncPaymentProcessException::
class
)
;
}
$this
->paymentService->
handlePaymentByOrder
(
$orderId
,
new
RequestDataBag
(
)
,
$salesChannelContext
)
;
}
public
function
testPayFinalizeWithUnsignedResponse
(
)
: void
{
$data
=
$this
->
prepareTransaction
(
)
;
$response
=
(
new
AsyncFinalizeResponse
(
)
)
->
assign
(
[
'message' => self::ERROR_MESSAGE,
]
)
;
$json
= \
json_encode
(
$response
, \JSON_THROW_ON_ERROR
)
;
static
::
assertNotFalse
(
$json
)
;
$this
->
appendNewResponse
(
new
Response
(
200,
[
'shopware-app-signature' => 'invalid'
]
,
$json
)
)
;
$return
=
$this
->paymentService->
finalizeTransaction
(
$data
[
'token'
]
,
new
\Symfony\Component\HttpFoundation\
Request
(
)
,
$this
->
getSalesChannelContext
(
$data
[
'paymentMethodId'
]
)
)
;
static
::
assertInstanceOf
(
PaymentException::
class
,
$return
->
getException
(
)
)
;