-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP][RFC][Cart] Cart taxes scenarios #3941
Conversation
Background: | ||
Given that store is operating on the France channel | ||
And default currency is "EUR" | ||
And tax rate "EU VAT" with 23% rate belongs to "Taxable Goods" category for "EU" zone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about: And store has "EU VAT" tax rate of 23% for "Taxable Goods" in "EU" zone
I'd use a different example here, Taxable Goods is too general, let's say it is food category or something like WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I was wondering about sth conciser, but didn't know how short can it be 😄 And 👍 for more specific category
We should be more explicit about the zone, I'd be fine with steps like:
I know that first step is assuming we are operating a single country store, but in these scenarios we should be more explicit so something like:
I think our scenario will evolve and I am just throwing random ideas here, we will improve them step by step, but we need to get rid of this old, anti-BDD style. ;) |
And catalog has a product "PHP T-Shirt" priced at €100.00 | ||
And "PHP T-Shirt" tax category is "Clothes" | ||
And catalog has a product "Symfony Mug" priced at €50.00 | ||
And "Symfony T-Shirt" tax category is "Mugs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be "Symfony Mug"
Great to see these 👍 I suggest you add some scenarios that look at rounding and the calculation of tax at item / unit level as discussed by myself and @michalmarcinkowski in #3868. Even if the default stance of Sylius doesn't agree with me, I think having scenarios that cover this are really important, and can be extended when multiple calculation strategies are implemented |
@@ -0,0 +1,30 @@ | |||
@ui-cart | |||
Feature: Cart with multiple tax rates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature: Apply correct tax for items with different tax rates
From the implementation point of view, implementing step like this may be tough: And "DHL" tax category is "Clothes" # DHL = Shipping method
And "Banana" tax category is "Fruits" # Banana = Product |
And default currency is "EUR" | ||
And there is user "[email protected]" identified by "password123" | ||
And catalog has a product "PHP T-Shirt" priced at €100.00 | ||
And store has "DHL" shipping method with "€10.00" fee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should decide whether we write prices as €0.50
or "€3.00"
.
Scenario: Proper taxes before addressing | ||
Given I added product "PHP T-Shirt" to the cart | ||
Then my cart taxes should be "€23.00" | ||
And my cart total should be "€123.00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it's more natural to swap these two:
Then my cart total should be ...
And my cart taxes should be
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to follow:
GIVEN -> WHEN -> THEN
This should be:
When I add product "PHP T-Shirt" to the cart
Then my cart taxes should be "€23.00"
And my cart total should be "€123.00"
Anyway, we are clearly missing some context here, because we don't know anything about the user or the zone he falls into. We probably need to say: And default tax zone is "EU"
in the background.
I left bunch of comments but I stopped to avoid creating a mess in the diff comments section, so please apply these and other suggestion and we will iterate again. Not an easy task but I think we are very close! 👍 |
@pjedrzejewski @michalmarcinkowski @peteward @pamil Ok 😄
|
@peteward we definitely are going to have some scenarios for rounding the tax at item / unit level. @Zales0123 as for 3. IMO |
d8180c2
to
ac7f485
Compare
And I am logged in customer | ||
|
||
Scenario: Displaying correct tax before specifying shipping address | ||
When I added product "PHP T-Shirt" to the cart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added suggests it is a pre condition, I think it should be action (When) -> add product
And product "PHP T-Shirt" belongs to "Clothes" tax category | ||
And store has a product "Symfony Mug" priced at "€50.00" | ||
And product "Symfony Mug" belongs to "Mugs" tax category | ||
And store ships everything for free |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right, that shipment cost is calculated based on zone, not on item? Shouldn't we change this step to And store ships everywhere for free?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we ship only to the countries/zones we specified not everywhere in the world, so everything is probably more accurate than everywhere, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still found everywhere much more accurate. Firstly, as I wrote before, because shipping cost is related to zone, not to item. Secondly, because in this scenario we are delivering items everywhere in the world, actually. But to me more precise, WDYT about And all store shipments are free of charge
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Actually the shipping cost can be per item, there are e.g. per item and volume based calculators :)
- The step is implemented in a way that right now it takes the 'current' zone, so the shipping method is available in one zone, not everywhere.
The most appropriate step will be:
And the store ships everything for free everywhere
- this step could get all zones and create free shipping method for every available zone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the store ships everything for free to every possible location
Still not perfect, because it is not really everywhere, it is only to zones defined, which can be 2 countries. :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjedrzejewski looks like the most self describing 👍
@Zales0123 I suppose this can be closed? |
@michalmarcinkowski I think yes, as we're heading to the end of this scenarios implementation ;) |
According to awesome work of @Arminek with behat scenarios here and upcoming changes with taxes here, there are some new scenarios for dealing with taxes in cart.
Of course, they could be green after merging whole taxes-related stuff. They are not implemented yet, I'm just wondering about community feedback about theirs style, have I properly caught concept of new scenarios ;)