invalidPaymentButOrderStored example



    public function testOrderCartInvalidOrderException(): void
    {
        $request = new Request();
        $request->setSession($this->createMock(Session::class));

        $context = $this->createMock(SalesChannelContext::class);
        $context->method('getCustomer')->willReturn(new CustomerEntity());

        $this->orderServiceMock->expects(static::once())->method('createOrder')->willThrowException(
            CartException::invalidPaymentButOrderStored(Uuid::randomHex())
        );

        $response = $this->controller->order(new RequestDataBag()$context$request);

        static::assertEquals(new Response('forward to frontend.checkout.finish.page')$response);
    }

    public function testOrderPaymentServiceException(): void
    {
        $request = new Request();
        $request->setSession($this->createMock(Session::class));

        
Profiler::trace('checkout-order::event-listeners', function D) use ($event): void {
            $this->eventDispatcher->dispatch($event);
        });

        $this->cartPersister->delete($context->getToken()$context);

        try {
            Profiler::trace('checkout-order::post-payment', function D) use ($orderEntity$data$context$preOrderPayment): void {
                $this->preparedPaymentService->handlePostOrderPayment($orderEntity$data$context$preOrderPayment);
            });
        } catch (UnknownPaymentMethodException|PaymentException) {
            throw CartException::invalidPaymentButOrderStored($orderId);
        }

        return new CartOrderRouteResponse($orderEntity);
    }

    private function addCustomerComment(Cart $cart, DataBag $data): void
    {
        $customerComment = ltrim(rtrim((string) $data->get(OrderService::CUSTOMER_COMMENT_KEY, '')));

        if ($customerComment === '') {
            return;
        }
Home | Imprint | This part of the site doesn't use cookies.