AsyncPaymentTransactionStruct example

$transactionRepository = $this->createMock(EntityRepository::class);
        $transactionRepository->expects(static::once())->method('search')->with(static::callback(function DCriteria $criteria) use ($transactionId) {
            static::assertEquals($transactionId$criteria->getIds()[0]);
            static::assertSame('payment-service::load-transaction', $criteria->getTitle());
            static::assertTrue($criteria->hasAssociation('order'));
            static::assertTrue($criteria->hasAssociation('paymentMethod'));

            return true;
        }))->willReturn(new EntitySearchResult('order_transaction', 1, new OrderTransactionCollection([$transaction]), null, new Criteria()$context->getContext()));

        $struct = new AsyncPaymentTransactionStruct($transaction$order, '');
        $paymentStructFactory = $this->createMock(AbstractPaymentTransactionStructFactory::class);
        $paymentStructFactory->expects(static::once())->method('async')->willReturn($struct);

        $paymentHandler = $this->createMock(AsynchronousPaymentHandlerInterface::class);
        $paymentHandler->expects(static::once())->method('finalize')->with($struct$request$context);

        $paymentHandlerRegistry = $this->createMock(PaymentHandlerRegistry::class);
        $paymentHandlerRegistry->expects(static::once())->method('getAsyncPaymentHandler')->willReturn($paymentHandler);

        $paymentService = new PaymentService(
            $this->createMock(PaymentTransactionChainProcessor::class),
            

        throw new DecorationPatternException(self::class);
    }

    public function sync(OrderTransactionEntity $orderTransaction, OrderEntity $order): SyncPaymentTransactionStruct
    {
        return new SyncPaymentTransactionStruct($orderTransaction$order);
    }

    public function async(OrderTransactionEntity $orderTransaction, OrderEntity $order, string $returnUrl): AsyncPaymentTransactionStruct
    {
        return new AsyncPaymentTransactionStruct($orderTransaction$order$returnUrl);
    }

    public function prepared(OrderTransactionEntity $orderTransaction, OrderEntity $order): PreparedPaymentTransactionStruct
    {
        return new PreparedPaymentTransactionStruct($orderTransaction$order);
    }

    public function recurring(OrderTransactionEntity $orderTransaction, OrderEntity $order): RecurringPaymentTransactionStruct
    {
        return new RecurringPaymentTransactionStruct($orderTransaction$order);
    }
}
Home | Imprint | This part of the site doesn't use cookies.