diff --git a/src/Api/CommandHandler/AddItemToCartHandler.php b/src/Api/CommandHandler/AddItemToCartHandler.php index 2cdf6c9e..b807fff9 100644 --- a/src/Api/CommandHandler/AddItemToCartHandler.php +++ b/src/Api/CommandHandler/AddItemToCartHandler.php @@ -82,6 +82,6 @@ private function isGiftCard(SyliusAddItemToCart $addItemToCart, ProductVariantIn return $addItemToCart instanceof SetonoSyliusGiftCardAddItemToCart && $product instanceof ProductInterface && - $product->isGiftCard(); + ($product->isGiftCard() || $product->isGiftCardAmountConfigurable()); } } diff --git a/src/Resources/config/api_resources/Order.yaml b/src/Resources/config/api_resources/Order.yaml index 23fa6fdc..3e4feca5 100644 --- a/src/Resources/config/api_resources/Order.yaml +++ b/src/Resources/config/api_resources/Order.yaml @@ -1,13 +1,13 @@ '%sylius.model.order.class%': - itemOperations: - shop_add_item: - method: POST - path: /shop/orders/{tokenValue}/items - messenger: input - input: Setono\SyliusGiftCardPlugin\Api\Command\AddItemToCart - normalization_context: - groups: ['shop:cart:read'] - denormalization_context: - groups: ['shop:cart:add_item'] - openapi_context: - summary: 'Adds Item to cart' + itemOperations: + shop_add_item: + method: POST + path: /shop/orders/{tokenValue}/items + messenger: input + input: Setono\SyliusGiftCardPlugin\Api\Command\AddItemToCart + normalization_context: + groups: ['shop:cart:read'] + denormalization_context: + groups: ['shop:cart:add_item'] + openapi_context: + summary: 'Adds Item to cart' diff --git a/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php b/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php index d833b44b..258687bd 100644 --- a/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php +++ b/tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php @@ -146,7 +146,6 @@ public function it_adds_simple_item_to_cart(): void ->createNew() ->willReturn($cartItem); - $orderItemQuantityModifier->modify($cartItem, 1)->shouldBeCalled(); $orderModifier->addToOrder($cart, $cartItem)->shouldBeCalled();