missingTransactions example

$this->eventDispatcher->dispatch(new RecurringPaymentOrderCriteriaEvent($orderId$criteria$context));

        /** @var OrderEntity $order */
        $order = $this->orderRepository->search($criteria$context)->first();

        if (!$order) {
            throw OrderException::orderNotFound($orderId);
        }

        $transactions = $order->getTransactions();
        if ($transactions === null) {
            throw OrderException::missingTransactions($orderId);
        }

        $transactions = $transactions->filterByStateId(
            $this->initialStateIdLoader->get(OrderTransactionStates::STATE_MACHINE)
        );

        $transaction = $transactions->last();
        if ($transaction === null) {
            return;
        }

        
$processor = new PaymentRecurringProcessor(
            $repo,
            $this->createMock(InitialStateIdLoader::class),
            $this->createMock(OrderTransactionStateHandler::class),
            $this->createMock(PaymentHandlerRegistry::class),
            new PaymentTransactionStructFactory(),
            $dispatcher,
        );

        static::expectException(OrderException::class);
        static::expectExceptionMessage(OrderException::missingTransactions('foo')->getMessage());

        $processor->processRecurring('foo', Context::createDefaultContext());
    }

    public function testNoInitialStateTransactionsDoesNothing(): void
    {
        $transaction1 = new OrderTransactionEntity();
        $transaction1->setId('foo');
        $transaction1->setStateId('foo');

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