mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[API] Use POST action to add new item to cart
This commit is contained in:
parent
219294afbe
commit
27d0121541
4 changed files with 9 additions and 4 deletions
|
|
@ -21,6 +21,8 @@
|
|||
sylius_api:
|
||||
product_image_prefix: 'media/image'
|
||||
```
|
||||
|
||||
1. The method of the `/shop/orders/{tokenValue}/items` endpoint has been changed from `PATCH` to `POST`
|
||||
|
||||
1. `Sylius\Bundle\ApiBundle\View\CartShippingMethodInterface` and `Sylius\Bundle\ApiBundle\View\CartShippingMethod` have been removed.
|
||||
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ final class CartContext implements Context
|
|||
|
||||
$tokenValue = $this->pickupCart();
|
||||
|
||||
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'items');
|
||||
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_POST, 'items');
|
||||
|
||||
$request->updateContent([
|
||||
'productCode' => $productData['code'],
|
||||
|
|
@ -678,7 +678,7 @@ final class CartContext implements Context
|
|||
{
|
||||
$tokenValue = $tokenValue ?? $this->pickupCart();
|
||||
|
||||
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'items');
|
||||
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_POST, 'items');
|
||||
|
||||
$request->updateContent([
|
||||
'productVariant' => $this->iriConverter->getIriFromItem($this->productVariantResolver->getVariant($product)),
|
||||
|
|
@ -692,7 +692,7 @@ final class CartContext implements Context
|
|||
{
|
||||
$tokenValue = $tokenValue ?? $this->pickupCart();
|
||||
|
||||
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_PATCH, 'items');
|
||||
$request = Request::customItemAction('shop', 'orders', $tokenValue, HttpRequest::METHOD_POST, 'items');
|
||||
|
||||
$request->updateContent([
|
||||
'productVariant' => $this->iriConverter->getIriFromItem($productVariant),
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
</itemOperation>
|
||||
|
||||
<itemOperation name="shop_add_item">
|
||||
<attribute name="method">PATCH</attribute>
|
||||
<attribute name="method">POST</attribute>
|
||||
<attribute name="path">/shop/orders/{tokenValue}/items</attribute>
|
||||
<attribute name="messenger">input</attribute>
|
||||
<attribute name="input">Sylius\Bundle\ApiBundle\Command\Cart\AddItemToCart</attribute>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,9 @@
|
|||
<argument>%api_platform.swagger.versions%</argument>
|
||||
</service>
|
||||
|
||||
<!-- TODO: Remove after bumping to Api Platform 3.0 -->
|
||||
<service id="api_platform.action.post_item" alias="api_platform.action.placeholder" public="true" />
|
||||
|
||||
<service id="Sylius\Bundle\ApiBundle\PropertyInfo\Extractor\EmptyPropertyListExtractor">
|
||||
<tag name="property_info.list_extractor" priority="-2000" />
|
||||
</service>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue