setPaymentMethods example



        $page = $this->genericLoader->load($request$salesChannelContext);

        $page = AccountPaymentMethodPage::createFrom($page);

        if ($page->getMetaInformation()) {
            $page->getMetaInformation()->setRobots('noindex,follow');
        }

        if ($page->getSalesChannelPaymentMethods()) {
            $page->setPaymentMethods($page->getSalesChannelPaymentMethods()->filterByActiveRules($salesChannelContext));
        }

        $this->eventDispatcher->dispatch(
            new AccountPaymentMethodPageLoadedEvent($page$salesChannelContext$request)
        );

        return $page;
    }
}

    public function load(Request $request, SalesChannelContext $context): CheckoutConfirmPage
    {
        $page = $this->genericPageLoader->load($request$context);
        $page = CheckoutConfirmPage::createFrom($page);

        if ($page->getMetaInformation()) {
            $page->getMetaInformation()->setRobots('noindex,follow');
        }

        $page->setPaymentMethods($this->getPaymentMethods($context));
        $page->setShippingMethods($this->getShippingMethods($context));

        $cart = $this->cartService->get($context->getToken()$context, false, true);
        $this->validateCustomerAddresses($cart$context);
        $page->setCart($cart);

        $page->setShowRevocation($cart->getLineItems()->hasLineItemWithState(State::IS_DOWNLOAD));
        $page->setHideShippingAddress(!$cart->getLineItems()->hasLineItemWithState(State::IS_PHYSICAL));

        $this->eventDispatcher->dispatch(
            new CheckoutConfirmPageLoadedEvent($page$context$request)
        );

        $page = $this->genericLoader->load($request$salesChannelContext);

        $page = CheckoutCartPage::createFrom($page);

        if ($page->getMetaInformation()) {
            $page->getMetaInformation()->setRobots('noindex,follow');
        }

        $page->setCountries($this->getCountries($salesChannelContext));

        $page->setPaymentMethods($this->getPaymentMethods($salesChannelContext));

        $page->setShippingMethods($this->getShippingMethods($salesChannelContext));

        $page->setCart($this->cartService->get($salesChannelContext->getToken()$salesChannelContext));

        $this->eventDispatcher->dispatch(
            new CheckoutCartPageLoadedEvent($page$salesChannelContext$request)
        );

        return $page;
    }

    
$orderRouteResponse = $this->getOrder($request$salesChannelContext);

        /** @var OrderEntity $order */
        $order = $orderRouteResponse->getOrders()->first();

        if ($this->isOrderPaid($order)) {
            throw OrderException::orderAlreadyPaid($order->getId());
        }

        $page->setOrder($order);
        $page->setPaymentChangeable($this->isPaymentChangeable($orderRouteResponse$page));
        $page->setPaymentMethods($this->getPaymentMethods($salesChannelContext$request$order));
        $page->setDeepLinkCode($request->get('deepLinkCode'));

        $this->eventDispatcher->dispatch(
            new AccountEditOrderPageLoadedEvent($page$salesChannelContext$request)
        );

        return $page;
    }

    private function getOrder(Request $request, SalesChannelContext $context): OrderRouteResponse
    {
        
Home | Imprint | This part of the site doesn't use cookies.