prepareTransaction example

$this->expectException(PaymentException::class);
        $this->expectExceptionMessage('The asynchronous payment process was interrupted due to the following error:' . \PHP_EOL . 'Invalid app response');
        if (!Feature::isActive('v6.6.0.0')) {
            $this->expectException(AsyncPaymentProcessException::class);
        }

        $this->paymentService->handlePaymentByOrder($orderIdnew 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']));

        
Home | Imprint | This part of the site doesn't use cookies.