getAsyncPaymentHandler example

static::assertInstanceOf($handlerClass$handler);
    }

    /** * @param array<class-string<PaymentHandlerInterface>> $handlerInstances * * @dataProvider paymentMethodDataProvider */
    public function testGetAsyncHandler(string $handlerName, string $handlerClass, array $handlerInstances): void
    {
        $paymentMethod = $this->getPaymentMethod($handlerName);
        $handler = $this->paymentHandlerRegistry->getAsyncPaymentHandler($paymentMethod->getId());

        if (\in_array(AsynchronousPaymentHandlerInterface::class$handlerInstances, true)) {
            static::assertInstanceOf(AsynchronousPaymentHandlerInterface::class$handler);
        } else {
            static::assertNull($handler);
        }
    }

    /** * @param array<class-string<PaymentHandlerInterface>> $handlerInstances * * @dataProvider paymentMethodDataProvider */
 finally {
            if ($token->getToken() !== null) {
                $this->tokenFactory->invalidateToken($token->getToken());
            }
        }

        return $token;
    }

    private function getPaymentHandlerById(string $paymentMethodId): AsynchronousPaymentHandlerInterface
    {
        $handler = $this->paymentHandlerRegistry->getAsyncPaymentHandler($paymentMethodId);

        if (!$handler) {
            throw PaymentException::unknownPaymentMethod($paymentMethodId);
        }

        return $handler;
    }

    private function getPaymentTransactionStruct(string $orderTransactionId, SalesChannelContext $context): AsyncPaymentTransactionStruct
    {
        $criteria = new Criteria([$orderTransactionId]);
        
$this->registerHandler(SynchronousPaymentHandlerInterface::class),
            $this->registerHandler(AsynchronousPaymentHandlerInterface::class),
            $this->registerHandler(PreparedPaymentHandlerInterface::class),
            $this->registerHandler(RefundPaymentHandlerInterface::class),
            $this->registerHandler(RecurringPaymentHandlerInterface::class),
            $this->connection,
        );

        $sync = $registry->getSyncPaymentHandler($this->ids->get(SynchronousPaymentHandlerInterface::class));
        static::assertInstanceOf(SynchronousPaymentHandlerInterface::class$sync);

        $async = $registry->getAsyncPaymentHandler($this->ids->get(AsynchronousPaymentHandlerInterface::class));
        static::assertInstanceOf(AsynchronousPaymentHandlerInterface::class$async);

        $prepared = $registry->getPreparedPaymentHandler($this->ids->get(PreparedPaymentHandlerInterface::class));
        static::assertInstanceOf(PreparedPaymentHandlerInterface::class$prepared);

        $refund = $registry->getRefundPaymentHandler($this->ids->get(RefundPaymentHandlerInterface::class));
        static::assertInstanceOf(RefundPaymentHandlerInterface::class$refund);

        $recurring = $registry->getRecurringPaymentHandler($this->ids->get(RecurringPaymentHandlerInterface::class));
        static::assertInstanceOf(RecurringPaymentHandlerInterface::class$recurring);

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