RecurringPaymentOrderCriteriaEvent example


class RecurringPaymentOrderCriteriaEventTest extends TestCase
{
    public function testEvent(): void
    {
        $orderId = Uuid::randomHex();
        $context = Context::createDefaultContext();
        $criteria = new Criteria();

        $event = new RecurringPaymentOrderCriteriaEvent($orderId$criteria$context);

        static::assertSame($orderId$event->getOrderId());
        static::assertSame($criteria$event->getCriteria());
        static::assertSame($context$event->getContext());
    }
}
$criteria->addAssociation('transactions.paymentMethod');
        $criteria->addAssociation('orderCustomer.customer');
        $criteria->addAssociation('orderCustomer.salutation');
        $criteria->addAssociation('transactions.paymentMethod.appPaymentMethod.app');
        $criteria->addAssociation('language');
        $criteria->addAssociation('currency');
        $criteria->addAssociation('deliveries.shippingOrderAddress.country');
        $criteria->addAssociation('billingAddress.country');
        $criteria->addAssociation('lineItems');
        $criteria->getAssociation('transactions')->addSorting(new FieldSorting('createdAt'));

        $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);
        }
Home | Imprint | This part of the site doesn't use cookies.