-
-
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
[Currency] Refactoring of display currency feature #6820
[Currency] Refactoring of display currency feature #6820
Conversation
lchrusciel
commented
Nov 22, 2016
Q | A |
---|---|
Bug fix? | yes |
New feature? | yes |
BC breaks? | yes |
Related tickets | partially #6641 |
License | MIT |
ddccf91
to
5250160
Compare
2b9c5e9
to
15e1c83
Compare
5250160
to
b0189e3
Compare
@@ -5,17 +5,16 @@ Feature: Viewing details of an order | |||
I want to be able to view details of my placed order |
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.
This feature isn't good, we should have a feature "Order is always placed in a base currency of a channel" and then in the scenario:
- Browse shop in a different than base currency
- Place order through UI
- Verify than order amounts are in a base currency
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 have such a scenario in checkout
Given I have added 2 products "The Pug Mug" to the cart | ||
When I switch to the "EUR" currency | ||
Then grand total value should be "€13.63" | ||
And grand total value in base currency should be "$14.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.
We should also assert the value of a single item, to show the rounding issue.
@@ -14,13 +14,12 @@ Feature: Modifying a customer's shipping address of an order with a different cu | |||
And the store has "DHL" shipping method with "$20.00" fee within the "EN" 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.
This feature can be removed. We don't have exchange rate on the order anymore, and we always display the amounts from database in admin, so there is no possibility to break something when changing exchange rate.
Then I should see the order "#00000666" with total "£40.00" | ||
|
||
@ui | ||
Scenario: Seeing multiple orders in different currencies |
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 have such scenario, but use 2 channels with different base currencies.
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.
@@ -9,7 +10,7 @@ | |||
{{ payment.method }} | |||
</div> | |||
<p> | |||
{{ payment.amount|sylius_price(payment.order.currencyCode) }} | |||
{{ money.convertAndFormat(payment.amount) }} |
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.
Not sure if we should convert the value here, the customer will be charged in a base currency anyway /cc @pjedrzejewski
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.
Of course not.
Looks good! 👍 Rebase needed. |
26f1ea5
to
92f8b3b
Compare
As a Visitor | ||
I want to see every cash amount in my chosen currency | ||
I want to see rounded every cash amount in my chosen currency |
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.
Changing display currency of the cart
and
I want to see every cash amount rounded to my chosen currency
or something alike
Scenario: Changing the currency of my cart | ||
Given I have product "The Pug Mug" in the cart | ||
When I switch to the "EUR" currency | ||
Then grand total value should be "€6.82" |
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.
the grand total...
same below
*/ | ||
public function myBaseCartTotalShouldBe($total) | ||
{ | ||
$this->summaryPage->open(); |
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.
add an empty line below
e26edcd
to
6f39136
Compare
Rebase needed :) |
6f39136
to
bcb366b
Compare
bcb366b
to
00c8fce
Compare
315b038
to
95acaa6
Compare
@michalmarcinkowski done |
And that channel allows to shop using the "CAD" currency with exchange rate 3.0 | ||
And the store ships to "United States" | ||
And the store has a zone "United States" with code "US" | ||
And this zone has the "United States" country member |
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 use DefaultUnitedStatesChannelFactory
and then the 3 steps above won't be necessary.
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.
This test is turned of, it can be adjusted later on.
And the store has a product "Angel T-Shirt" priced at "$20.00" | ||
And I am a logged in customer | ||
|
||
# This test should pass, but refactoring of context would be needed to fulfill requirements. Because refactoring is postponed this test will be turned on later |
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.
What is the issue?
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 need to process whole checkout and then access a show page of an order. Both of them have specifyEmail
method. There is no point in creating order programmatically.
{% macro convertAndFormat(amount) %} | ||
{% import _self as macro %} | ||
|
||
{{ macro.format(amount|sylius_convert_money(shopperContext.currencyCode), shopperContext.currencyCode) }} |
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 use shopperContext.channel.baseCurrency
as a base currency.
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.
Already done
Great work! Please apply my comments in a separate PR. |