vendor/shopware/core/Checkout/Payment/SalesChannel/SortedPaymentMethodRoute.php line 38

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Checkout\Payment\SalesChannel;
  3. use Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria;
  4. use Shopware\Core\Framework\Routing\Annotation\Entity;
  5. use Shopware\Core\Framework\Routing\Annotation\RouteScope;
  6. use Shopware\Core\Framework\Routing\Annotation\Since;
  7. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  8. use Symfony\Component\HttpFoundation\Request;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. /**
  11.  * @Route(defaults={"_routeScope"={"store-api"}})
  12.  */
  13. class SortedPaymentMethodRoute extends AbstractPaymentMethodRoute
  14. {
  15.     private AbstractPaymentMethodRoute $decorated;
  16.     /**
  17.      * @internal
  18.      */
  19.     public function __construct(AbstractPaymentMethodRoute $decorated)
  20.     {
  21.         $this->decorated $decorated;
  22.     }
  23.     public function getDecorated(): AbstractPaymentMethodRoute
  24.     {
  25.         return $this->decorated;
  26.     }
  27.     /**
  28.      * @Since("6.2.0.0")
  29.      * @Entity("payment_method")
  30.      * @Route("/store-api/payment-method", name="store-api.payment.method", methods={"GET", "POST"})
  31.      */
  32.     public function load(Request $requestSalesChannelContext $contextCriteria $criteria): PaymentMethodRouteResponse
  33.     {
  34.         $response $this->getDecorated()->load($request$context$criteria);
  35.         $response->getPaymentMethods()->sortPaymentMethodsByPreference($context);
  36.         return $response;
  37.     }
  38. }