3.1 KiB
UPGRADE FROM v1.11.X TO v1.12.0
-
The
Sylius\Bundle\ApiBundle\DataProvider\CartShippingMethodsSubresourceDataProviderhas been removed and replaced bySylius\Bundle\ApiBundle\DataProvider\ShippingMethodsCollectionDataProvider. -
The
Sylius\Bundle\ApiBundle\Serializer\ShippingMethodNormalizerlogic and constructor has been changed due to refactor above.public function __construct( private OrderRepositoryInterface $orderRepository, private ShipmentRepositoryInterface $shipmentRepository, private ServiceRegistryInterface $shippingCalculators, + private RequestStack $requestStack, + private ChannelContextInterface $channelContext ) { ... } -
The
GETapi/v2/shop/orders/{token}/shipments/{id}/methodsandapi/v2/shop/shipments/{id}/methodsendpoints have been removed and changed into collection request with 2 parametersapi/v2/shop/shipping-methods?shipmentId={id}&orderToken={token}. Now when we do not provide parameters in response it returns all availableshippingMethodsin channel. Wrong parameters otherwise cause empty array[]in response and correct parameters returnshippingMethodsavailable for yourshipment.
Here is how the response looks like:{ "@context": "/api/v2/contexts/ShippingMethod", "@id": "/api/v2/shop/shipping-methods", "@type": "hydra:Collection", "hydra:member": [ { "@id": "/api/v2/shop/shipping-methods/ups", "@type": "ShippingMethod", "id": 1, "code": "ups", "position": 0, "name": "UPS", "description": "Quasi perferendis debitis officiis ut inventore exercitationem." } ], "hydra:totalItems": 1, "hydra:search": { "@type": "hydra:IriTemplate", "hydra:template": "/api/v2/shop/shipping-methods{?shipmentId,tokenValue}", "hydra:variableRepresentation": "BasicRepresentation", "hydra:mapping": [ { "@type": "IriTemplateMapping", "variable": "shipmentId", "property": null, "required": false }, { "@type": "IriTemplateMapping", "variable": "tokenValue", "property": null, "required": false } ] } } -
Service
src/Sylius/Bundle/ApiBundle/DataProvider/CartPaymentMethodsSubresourceDataProvider.phphas been removed and logic was replaced bysrc/Sylius/Bundle/ApiBundle/DataProvider/PaymentMethodsCollectionDataProvider.php -
Endpoints
/shop/orders/{tokenValue}/payments/{payments}/methods,/shop/payments/{id}/methodshas been removed and replaced by/shop/payment-methodswith filterpaymentIdandtokenValue/shop/payment-methodsreturns all enable payment methods if filters are not set, payment methods related to payment if filters are filled or empty response if filters ale filled with invalid data.