[API][Behat] Implement other scenarios for applying taxes included in price on order

This commit is contained in:
Grzegorz Sadowski 2022-05-06 13:31:40 +02:00
parent da55b3aaca
commit 95a9788d0d
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
4 changed files with 12 additions and 11 deletions

View file

@ -13,7 +13,7 @@ Feature: Apply correct taxes for an order with a discount for a shipping when ta
And the promotion gives "10%" discount on shipping to every order
And I am a logged in customer
@ui
@ui @api
Scenario: Properly rounded up tax
Given the store has "DHL" shipping method with "$56.95" fee
And shipping method "DHL" belongs to "Shipping" tax category
@ -22,7 +22,7 @@ Feature: Apply correct taxes for an order with a discount for a shipping when ta
Then my cart total should be "$61.25"
And my included in price taxes should be "$4.66"
@ui
@ui @api
Scenario: Properly rounded down tax
Given the store has "DHL" shipping method with "$56.85" fee
And shipping method "DHL" belongs to "Shipping" tax category
@ -31,7 +31,7 @@ Feature: Apply correct taxes for an order with a discount for a shipping when ta
Then my cart total should be "$61.16"
And my included in price taxes should be "$4.65"
@ui
@ui @api
Scenario: Properly calculated taxes when item belongs to different tax category and has tax included in price
Given the store has included in price "Standard VAT" tax rate of 23% for "Mugs" within the "US" zone
And the store has a product "Sonata Mug" priced at "$10.00"
@ -43,7 +43,7 @@ Feature: Apply correct taxes for an order with a discount for a shipping when ta
Then my cart total should be "$55.00"
And my included in price taxes should be "$5.96"
@ui
@ui @api
Scenario: Properly calculated taxes when item belongs to different tax category and not has tax included in price
Given the store has "Standard VAT" tax rate of 23% for "Mugs" within the "US" zone
And the store has a product "Sonata Mug" priced at "$10.00"

View file

@ -20,33 +20,33 @@ Feature: Apply correct taxes for an order with a discount applied for all items
And there is a promotion "PHP promotion"
And the promotion gives "$10.00" off if order contains a "PHP Mug" product
@ui
@ui @api
Scenario: Properly rounded up tax for single product
When I add product "Symfony Mug" to the cart
Then my cart total should be "$46.95"
And my included in price taxes should be "$4.27"
@ui
@ui @api
Scenario: Properly rounded down tax for single product
When I add product "PHP Mug" to the cart
Then my cart total should be "$46.90"
And my included in price taxes should be "$4.26"
@ui
@ui @api
Scenario: Properly rounded taxes for multiple products with different tax rate
When I add 2 products "PHP T-Shirt" to the cart
And I add product "PHP Mug" to the cart
Then my cart total should be "$66.90"
And my included in price taxes should be "$7.75"
@ui
@ui @api
Scenario: Properly rounded taxes for multiple products with the same tax rate
When I add 2 products "PHP Mug" to the cart
And I add product "Symfony Mug" to the cart
Then my cart total should be "$150.75"
And my included in price taxes should be "$13.70"
@ui
@ui @api
Scenario: Properly rounded taxes for order with multiple promotions and multiple products with different tax rate
And there is a promotion "Clothing promotion"
And the promotion gives "$5.00" off if order contains a "PHP T-Shirt" product

View file

@ -11,7 +11,7 @@ Feature: Apply correct taxes for items with tax rate included in price
And the store has a product "PHP T-Shirt" priced at "$100.00"
And it belongs to "Clothes" tax category
@ui
@ui @api
Scenario: Proper taxes for taxed product
When I add product "PHP T-Shirt" to the cart
Then my cart total should be "$100.00"

View file

@ -420,6 +420,7 @@ final class CartContext implements Context
/**
* @Then /^the product "([^"]+)" should have total price ("[^"]+") in the cart$/
* @Then /^total price of "([^"]+)" item should be ("[^"]+")$/
*/
public function theProductShouldHaveTotalPriceInTheCart(string $productName, int $totalPrice): void
{
@ -592,7 +593,7 @@ final class CartContext implements Context
public function myCartTaxesShouldBe(int $taxTotal): void
{
Assert::same(
$this->responseChecker->getValue($this->shopClient->getLastResponse(), 'taxTotal'),
$this->responseChecker->getValue($this->shopClient->getLastResponse(), 'taxExcludedTotal'),
$taxTotal
);
}