$client->
request('GET', '/payment/finalize-transaction?_sw_payment_token=' .
$token);
static::
assertIsString($client->
getResponse()->
getContent());
$response =
json_decode($client->
getResponse()->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertArrayHasKey('errors',
$response);
static::
assertSame('CHECKOUT__INVALID_PAYMENT_TOKEN',
$response['errors'
][0
]['code'
]);
} public function testValid(): void
{ $transaction =
$this->
createValidOrderTransaction();
$tokenStruct =
new TokenStruct(null, null,
$transaction->
getPaymentMethodId(),
$transaction->
getId(), 'testFinishUrl'
);
$token =
$this->tokenFactory->
generateToken($tokenStruct);
$client =
$this->
getBrowser();
$client->
request('GET', '/payment/finalize-transaction?_sw_payment_token=' .
$token);
$response =
$client->
getResponse();
static::
assertInstanceOf(RedirectResponse::
class,
$response);
static::
assertStringContainsString('testFinishUrl',
$response->
getTargetUrl());