async example

$criteria->addAssociation('paymentMethod.appPaymentMethod.app');

        $this->eventDispatcher->dispatch(new FinalizePaymentOrderTransactionCriteriaEvent($orderTransactionId$criteria$context));

        /** @var OrderTransactionEntity|null $orderTransaction */
        $orderTransaction = $this->orderTransactionRepository->search($criteria$context->getContext())->first();

        if ($orderTransaction === null || $orderTransaction->getOrder() === null) {
            throw PaymentException::invalidTransaction($orderTransactionId);
        }

        return $this->paymentTransactionStructFactory->async($orderTransaction$orderTransaction->getOrder(), '');
    }
}
null,
                $transaction->getPaymentMethodId(),
                $transaction->getId(),
                $finishUrl,
                $paymentFinalizeTransactionTime,
                $errorUrl
            );

            $token = $this->tokenFactory->generateToken($tokenStruct);

            $returnUrl = $this->assembleReturnUrl($token);
            $paymentTransaction = $this->paymentTransactionStructFactory->async($transaction$order$returnUrl);

            return $paymentHandler->pay($paymentTransaction$dataBag$salesChannelContext);
        }

        return null;
    }

    private function assembleReturnUrl(string $token): string
    {
        $parameter = ['_sw_payment_token' => $token];

        
static::assertSame($order$struct->getOrder());
    }

    public function testAsync(): void
    {
        $factory = new PaymentTransactionStructFactory();

        $transaction = new OrderTransactionEntity();
        $order = new OrderEntity();
        $returnUrl = 'https://return.url';

        $struct = $factory->async($transaction$order$returnUrl);

        static::assertSame($transaction$struct->getOrderTransaction());
        static::assertSame($order$struct->getOrder());
        static::assertSame($returnUrl$struct->getReturnUrl());
    }

    public function testPrepared(): void
    {
        $factory = new PaymentTransactionStructFactory();

        $transaction = new OrderTransactionEntity();
        
Home | Imprint | This part of the site doesn't use cookies.