diff --git a/features/cart/shopping_cart/seeing_detailed_information_about_cart.feature b/features/cart/shopping_cart/seeing_detailed_information_about_cart.feature new file mode 100644 index 00000000000..d7110d4c50a --- /dev/null +++ b/features/cart/shopping_cart/seeing_detailed_information_about_cart.feature @@ -0,0 +1,21 @@ +@shopping_cart +Feature: Seeing detailed information of cart + In order to know more about status of my cart + As a Visitor + I want to be able to see detailed information of my cart + + Background: + Given the store operates on a single channel in "United States" + And the store has a product "T-shirt banana" priced at "$12.54" + + @api + Scenario: Viewing items of my cart + When I add 5 of them to my cart + And I check items in my cart + Then my cart should have quantity of 5 items of product "T-shirt banana" + + @api + Scenario: Viewing items total of my cart + When I add 5 of them to my cart + And I check details of my cart + Then my cart should have "$62.70" items total diff --git a/features/cart/shopping_cart/seeing_order_items_in_cart.feature b/features/cart/shopping_cart/seeing_order_items_in_cart.feature deleted file mode 100644 index b1d78130e29..00000000000 --- a/features/cart/shopping_cart/seeing_order_items_in_cart.feature +++ /dev/null @@ -1,15 +0,0 @@ -@shopping_cart -Feature: Seeing order items in cart - In order to see details about my order items - As a Visitor - I want to be able to see my cart order items - - Background: - Given the store operates on a single channel in "United States" - And the store has a product "T-shirt banana" priced at "$12.54" - - @api - Scenario: Viewing content of my cart - When I add 5 of them to my cart - And I check items in my cart - Then my cart should have 5 items of product "T-shirt banana" diff --git a/src/Sylius/Behat/Context/Api/Shop/CartContext.php b/src/Sylius/Behat/Context/Api/Shop/CartContext.php index 36f50ced755..3d76cdd176f 100644 --- a/src/Sylius/Behat/Context/Api/Shop/CartContext.php +++ b/src/Sylius/Behat/Context/Api/Shop/CartContext.php @@ -526,8 +526,20 @@ public function iCheckItemsOfMyCart(string $tokenValue): void $this->cartsClient->executeCustomRequest($request); } + /** + * @Then /^my cart should have ("[^"]+") items total$/ + */ + public function myCartShouldHaveItemsTotal(int $itemsTotal): void + { + Assert::same( + $this->responseChecker->getValue($this->cartsClient->getLastResponse(), 'itemsTotal'), + $itemsTotal + ); + } + /** * @Then /^my cart should have (\d+) items of (product "([^"]+)")$/ + * @Then /^my cart should have quantity of (\d+) items of (product "([^"]+)")$/ */ public function myCartShouldHaveItems(int $quantity, ProductInterface $product): void { diff --git a/src/Sylius/Behat/Context/Api/Shop/OrderContext.php b/src/Sylius/Behat/Context/Api/Shop/OrderContext.php index 7aebbb9177a..3b4af992f12 100644 --- a/src/Sylius/Behat/Context/Api/Shop/OrderContext.php +++ b/src/Sylius/Behat/Context/Api/Shop/OrderContext.php @@ -287,7 +287,7 @@ public function iShouldHaveChosenPaymentMethodForMyOrder(PaymentMethodInterface ->getValue($this->client->show($this->sharedStorage->get('cart_token')), 'payments')[0] ; - Assert::same($this->iriConverter->getIriFromItem($paymentMethod), $payment['method']); + Assert::same($this->iriConverter->getIriFromItem($paymentMethod), $payment['method']['@id']); } /** diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml index 87f919140c7..ec1f63ebc6f 100644 --- a/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml +++ b/src/Sylius/Bundle/ApiBundle/Resources/config/api_resources/Order.xml @@ -62,6 +62,9 @@ GET /shop/orders/{tokenValue} + + shop:cart:read + @@ -70,6 +73,9 @@ Deletes cart + + shop:order:read + @@ -410,6 +416,7 @@ + diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/Order.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/Order.xml index 7a66f46e5f9..33b19d5aa78 100644 --- a/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/Order.xml +++ b/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/Order.xml @@ -67,10 +67,12 @@ admin:order:read + shop:cart:read admin:order:read + shop:cart:read @@ -102,6 +104,12 @@ admin:order:read + + shop:cart:read + shop:order:read + shop:order:account:read + + admin:order:read shop:cart:read diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/OrderItem.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/OrderItem.xml index b2f197206ed..8f365cb6364 100644 --- a/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/OrderItem.xml +++ b/src/Sylius/Bundle/ApiBundle/Resources/config/serialization/OrderItem.xml @@ -85,6 +85,7 @@ admin:order:read admin:order_item:read + shop:cart:read shop:order_item:read