mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[API] refactor order related endpoints
This commit is contained in:
parent
588e075110
commit
010460e1a4
4 changed files with 56 additions and 41 deletions
|
|
@ -25,17 +25,18 @@
|
|||
<collectionOperations />
|
||||
|
||||
<itemOperations>
|
||||
<itemOperation name="get">
|
||||
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
|
||||
<itemOperation name="get_adjustments_in_admin">
|
||||
<attribute name="method">GET</attribute>
|
||||
<attribute name="path">admin/adjustments</attribute>
|
||||
</itemOperation>
|
||||
</itemOperations>
|
||||
|
||||
<subresourceOperations>
|
||||
<subresourceOperation name="api_order_items_adjustments_get_subresource">
|
||||
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
|
||||
<attribute name="method">GET</attribute>
|
||||
</subresourceOperation>
|
||||
<subresourceOperation name="api_orders_items_adjustments_get_subresource">
|
||||
<attribute name="path">/new-api/orders/{token}/items/{itemId}/adjustments</attribute>
|
||||
<attribute name="path">/new-api/admin/orders/{token}/items/{itemId}/adjustments</attribute>
|
||||
</subresourceOperation>
|
||||
</subresourceOperations>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,14 @@
|
|||
<attribute name="validation_groups">sylius</attribute>
|
||||
|
||||
<collectionOperations>
|
||||
<collectionOperation name="get">
|
||||
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
|
||||
<collectionOperation name="get_orders_in_admin">
|
||||
<attribute name="method">GET</attribute>
|
||||
<attribute name="path">admin/orders</attribute>
|
||||
</collectionOperation>
|
||||
<collectionOperation name="post">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
|
||||
<collectionOperation name="post_order_in_shop">
|
||||
<attribute name="method">POST</attribute>
|
||||
<attribute name="path">admin/orders</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Pickup a new cart</attribute>
|
||||
</attribute>
|
||||
|
|
@ -42,21 +45,31 @@
|
|||
</collectionOperations>
|
||||
|
||||
<itemOperations>
|
||||
<itemOperation name="get" />
|
||||
<itemOperation name="delete">
|
||||
<itemOperation name="get_order_in_admin">
|
||||
<attribute name="method">GET</attribute>
|
||||
<attribute name="path">admin/orders/{id}</attribute>
|
||||
</itemOperation>
|
||||
|
||||
<itemOperation name="get_order_in_shop">
|
||||
<attribute name="method">GET</attribute>
|
||||
<attribute name="path">shop/orders/{id}</attribute>
|
||||
</itemOperation>
|
||||
|
||||
<itemOperation name="delete_order_in_shop">
|
||||
<attribute name="method">DELETE</attribute>
|
||||
<attribute name="path">shop/orders/{id}</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Delete cart</attribute>
|
||||
</attribute>
|
||||
</itemOperation>
|
||||
|
||||
<itemOperation name="cancel">
|
||||
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
|
||||
<itemOperation name="cancel_order_in_admin">
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">admin/orders/{id}/cancel</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Cancels Order</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="input">false</attribute>
|
||||
<attribute name="path">/orders/{id}/cancel</attribute>
|
||||
<attribute name="controller">sylius.api.order_state_machine_transition_applicator:cancel</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
<attribute name="groups">order:update</attribute>
|
||||
|
|
@ -64,12 +77,11 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="add_item">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">shop/orders/{id}/items</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Add Item to cart</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">/orders/{id}/items</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\AddItemToCart</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
|
|
@ -78,12 +90,11 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="address">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">shop/orders/{id}/address</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Address cart to given location, logged in Customer does not have to provide an email</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">/orders/{id}/address</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\AddressOrder</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
|
|
@ -95,7 +106,8 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="select_shipping_method">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">shop/orders/{id}/shipments/{shipmentId}</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Select shipping methods for particular shipment</attribute>
|
||||
<attribute name="parameters">
|
||||
|
|
@ -117,8 +129,6 @@
|
|||
</attribute>
|
||||
</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">/orders/{id}/shipments/{shipmentId}</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\ChooseShippingMethod</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
|
|
@ -130,7 +140,8 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="select_payment_method">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">shop/orders/{id}/payments/{paymentId}</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Select payment methods for particular payment</attribute>
|
||||
<attribute name="parameters">
|
||||
|
|
@ -152,8 +163,6 @@
|
|||
</attribute>
|
||||
</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">/orders/{id}/payments/{paymentId}</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\ChoosePaymentMethod</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
|
|
@ -165,16 +174,15 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="complete">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">shop/orders/{id}/complete</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Complete checkout</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="validation_groups">
|
||||
<attribute>sylius</attribute>
|
||||
<attribute>sylius_checkout_complete</attribute>
|
||||
</attribute>
|
||||
<attribute name="path">/orders/{id}/complete</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Checkout\CompleteOrder</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
|
|
@ -186,12 +194,11 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="remove_item">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">shop/orders/{id}/remove</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Remove Item</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">/orders/{id}/remove</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\RemoveItemFromCart</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
|
|
@ -200,12 +207,11 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="change_quantity">
|
||||
<attribute name="security">is_granted('IS_AUTHENTICATED_ANONYMOUSLY')</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">shop/orders/{id}/change-quantity</attribute>
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="summary">Change quantity of order item</attribute>
|
||||
</attribute>
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="path">/orders/{id}/change-quantity</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\ChangeItemQuantityInCart</attribute>
|
||||
<attribute name="denormalization_context">
|
||||
|
|
@ -214,6 +220,14 @@
|
|||
</itemOperation>
|
||||
</itemOperations>
|
||||
|
||||
<subresourceOperations>
|
||||
|
||||
<subresourceOperation name="api_order_items_get_subresource">
|
||||
<attribute name="method">GET</attribute>
|
||||
<attribute name="path">/new-api/admin/orders/{id}/items</attribute>
|
||||
</subresourceOperation>
|
||||
</subresourceOperations>
|
||||
|
||||
<property name="id" identifier="false" writable="false" />
|
||||
<property name="number" identifier="false" writable="false" />
|
||||
<property name="tokenValue" identifier="true" writable="false" />
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
|
||||
>
|
||||
<resource class="%sylius.model.order_item.class%" shortName="OrderItem">
|
||||
<attribute name="route_prefix">admin</attribute>
|
||||
|
||||
<attribute name="normalization_context">
|
||||
<attribute name="groups">
|
||||
<attribute>order_item:read</attribute>
|
||||
|
|
@ -25,9 +27,7 @@
|
|||
<collectionOperations />
|
||||
|
||||
<itemOperations>
|
||||
<itemOperation name="get">
|
||||
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
|
||||
</itemOperation>
|
||||
<itemOperation name="get" />
|
||||
</itemOperations>
|
||||
|
||||
<property name="id" identifier="true" writable="false" />
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
|
||||
>
|
||||
<resource class="%sylius.model.order_item_unit.class%" shortName="OrderItemUnit">
|
||||
<attribute name="route_prefix">admin</attribute>
|
||||
|
||||
<attribute name="normalization_context">
|
||||
<attribute name="groups">
|
||||
<attribute>order_item_unit:read</attribute>
|
||||
|
|
@ -25,9 +27,7 @@
|
|||
<collectionOperations />
|
||||
|
||||
<itemOperations>
|
||||
<itemOperation name="get">
|
||||
<attribute name="security">is_granted('ROLE_API_ACCESS')</attribute>
|
||||
</itemOperation>
|
||||
<itemOperation name="get" />
|
||||
</itemOperations>
|
||||
|
||||
<property name="id" identifier="true" writable="false" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue