orderTransactionNotFound example

$criteria = new Criteria([$orderTransactionId]);
        $criteria->addAssociation('paymentMethod');
        $criteria->addAssociation('order.orderCustomer');
        $criteria->addAssociation('order.transactions.stateMachineState');

        $orderTransaction = $this->transactionRepository
            ->search($criteria$event->getContext())
            ->first();

        if ($orderTransaction === null) {
            throw OrderException::orderTransactionNotFound($orderTransactionId);
        }

        if ($orderTransaction->getPaymentMethod() === null) {
            throw OrderException::orderTransactionNotFound($orderTransactionId);
        }

        if ($orderTransaction->getOrder() === null) {
            throw OrderException::orderTransactionNotFound($orderTransactionId);
        }

        $context = $this->getContext($orderTransaction->getOrderId()$event->getContext());
        
$context->scope(
            Context::SYSTEM_SCOPE,
            function D) use ($payload$context): void {
                $this->orderRepository->update([$payload]$context);
            }
        );

        $changedOrder = $this->loadOrder($order->getId()$salesChannelContext);
        $transactions = $changedOrder->getTransactions();
        if ($transactions === null || ($transaction = $transactions->get($transactionId)) === null) {
            if (Feature::isActive('v6.6.0.0')) {
                throw OrderException::orderTransactionNotFound($transactionId);
            }

            throw new UnknownPaymentMethodException($paymentMethodId);
        }

        $event = new OrderPaymentMethodChangedEvent(
            $changedOrder,
            $transaction,
            $context,
            $salesChannelContext->getSalesChannelId()
        );
        
Home | Imprint | This part of the site doesn't use cookies.