Skip to content

Latest commit

 

History

History
117 lines (97 loc) · 6.2 KB

UPGRADE-API-1.12.md

File metadata and controls

117 lines (97 loc) · 6.2 KB

UPGRADE FROM v1.11.X TO v1.12.0

  1. The Sylius\Bundle\ApiBundle\DataProvider\CartShippingMethodsSubresourceDataProvider has been removed and replaced by Sylius\Bundle\ApiBundle\DataProvider\ShippingMethodsCollectionDataProvider.

  2. The Sylius\Bundle\ApiBundle\Serializer\ShippingMethodNormalizer logic 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
        ) {
            ...
        }
  3. The GET api/v2/shop/orders/{token}/shipments/{id}/methods and api/v2/shop/shipments/{id}/methods endpoints have been removed and changed into collection request with 2 parameters api/v2/shop/shipping-methods?shipmentId={id}&tokenValue={token}. Now when we do not provide parameters in response it returns all available shippingMethods in channel. Wrong parameters otherwise cause empty array [] in response and correct parameters return shippingMethods available for your shipment.
    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
             }
           ]
         }
       }
    
  4. Service src/Sylius/Bundle/ApiBundle/DataProvider/CartPaymentMethodsSubresourceDataProvider.php has been removed and logic was replaced by src/Sylius/Bundle/ApiBundle/DataProvider/PaymentMethodsCollectionDataProvider.php

  5. Endpoints /shop/orders/{tokenValue}/payments/{payments}/methods, /shop/payments/{id}/methods has been removed and replaced by /shop/payment-methods with filter paymentId and tokenValue /shop/payment-methods returns 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.

  6. Service Sylius\Bundle\ApiBundle\DataProvider/CartPaymentMethodsSubresourceDataProvider has been removed and logic was replaced by Sylius\Bundle\ApiBundle\DataProvider\PaymentMethodsCollectionDataProvider

  7. The GET api/v2/shop/orders/{tokenValue}/payments/{payments}/methods and api/v2/shop/payments/{id}/methods endpoints have been removed and changed into collection request with 2 parameters api/v2/shop/payment-methods?paymentId={id}&tokenValue={token}. Now when we do not provide parameters in response it returns all available paymentMethods in channel. Wrong parameters otherwise cause empty array [] in response and correct parameters return paymentMethods available for your payment.

  8. All arguments of src/Sylius/Bundle/ApiBundle/CommandHandler/Account/ResetPasswordHandler have been removed and substituted with Sylius\Bundle\CoreBundle\Security\UserPasswordResetter.

  9. The file src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/ResetPassword.xml has been renamed to src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/AccountResetPassword.xml and its short name has been changed from ResetPasswordRequest to AccountResetPasswordRequest.

  10. Constructor of Sylius\Bundle\ApiBundle\CommandHandler\Account\RequestResetPasswordTokenHandler has been extended with Sylius\Calendar\Provider\DateTimeProviderInterface argument:

        public function __construct(
            private UserRepositoryInterface $userRepository,
            private MessageBusInterface $commandBus,
    -       private GeneratorInterface $generator
    +       private GeneratorInterface $generator,
    +       private DateTimeProviderInterface $calendar
        ) {
        }
  11. Constructor of \Sylius\Bundle\ApiBundle\CommandHandler\Account\VerifyCustomerAccountHandler has been extended with Sylius\Calendar\Provider\DateTimeProviderInterface argument:

    -   public function __construct(private RepositoryInterface $shopUserRepository)
    -   {
    +   public function __construct(
    +       private RepositoryInterface $shopUserRepository,
    +       private DateTimeProviderInterface $calendar
    +   ) {
        }
  12. The 2nd parameter localeCode has been removed from src/Sylius/Bundle/ApiBundle/Command/Cart/PickupCart.php and now is set automatically by src/Sylius/Bundle/ApiBundle/DataTransformer/LocaleCodeAwareInputCommandDataTransformer.php.

  13. The responses of endpoints /api/v2/admin/products and /api/v2/admin/products/{code} have been changed in such a way that the field defaultVariant has been removed.

  14. The configuration of config/packages/security.yaml has to be updated:

        security:
            access_control:
    +           - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: IS_AUTHENTICATED_ANONYMOUSLY }
  15. The second argument $billingAddress of Sylius\Bundle\ApiBundle\Modifier\OrderAddressModifierInterface::modify has become nullable.

  16. The Sylius\Bundle\ApiBundle\Assigner\OrderPromoCodeAssignerInterface has been renamed to Sylius\Bundle\ApiBundle\Assigner\OrderPromotionCodeAssignerInterface.