Skip to content

Commit

Permalink
issue Setono#261 fix when card is configurable too
Browse files Browse the repository at this point in the history
  • Loading branch information
ehibes committed Oct 14, 2024
1 parent 36e4fb4 commit a1faf9e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Api/CommandHandler/AddItemToCartHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ private function isGiftCard(SyliusAddItemToCart $addItemToCart, ProductVariantIn

return $addItemToCart instanceof SetonoSyliusGiftCardAddItemToCart &&
$product instanceof ProductInterface &&
$product->isGiftCard();
($product->isGiftCard() || $product->isGiftCardAmountConfigurable());
}
}
24 changes: 12 additions & 12 deletions src/Resources/config/api_resources/Order.yaml
Original file line number Diff line number Diff line change
@@ -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'
1 change: 0 additions & 1 deletion tests/Unit/Api/CommandHandler/AddItemToCartHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit a1faf9e

Please sign in to comment.