-
-
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] Exchange rate refactor #6846
Merged
michalmarcinkowski
merged 4 commits into
Sylius:currency-party
from
lchrusciel:exchange-rate-refactor
Nov 25, 2016
Merged
[Currency] Exchange rate refactor #6846
michalmarcinkowski
merged 4 commits into
Sylius:currency-party
from
lchrusciel:exchange-rate-refactor
Nov 25, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
michalmarcinkowski
added
BC Break
PRs introducing BC breaks (do not even try to merge).
Bug Fix
labels
Nov 24, 2016
lchrusciel
changed the title
[Currency] Exchange rate refactor
[WIP] [Currency] Exchange rate refactor
Nov 24, 2016
} | ||
|
||
return (int) round($amount * $currency->getExchangeRate()); | ||
return (int) round($amount * $exchangeRate->getRatio()); |
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 two cases here:
- Ratio for
source
->target
(multiply) - Ratio for
target
->source
(divide)
if ($exchangeRate->getSourceCurrency()->getCode() === $sourceCurrencyCode) {
return (int) round(amount * $exchangeRate->getRatio());
}
return (int) round(amount / $exchangeRate->getRatio());
This should be covered by Behat.
{ | ||
if (isset($this->cache[$code])) { | ||
return $this->cache[$code]; | ||
$cacheIndex = $sourceCode . $targetCode; |
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.
$cacheIndex = sprintf('%s-%s', $sourceCode, $targetCode);
lchrusciel
force-pushed
the
exchange-rate-refactor
branch
from
November 24, 2016 14:08
173a7b1
to
306793c
Compare
lchrusciel
changed the title
[WIP] [Currency] Exchange rate refactor
[Currency] Exchange rate refactor
Nov 24, 2016
lchrusciel
changed the title
[Currency] Exchange rate refactor
[WIP] [Currency] Exchange rate refactor
Nov 24, 2016
lchrusciel
force-pushed
the
exchange-rate-refactor
branch
6 times, most recently
from
November 25, 2016 08:44
6c893c8
to
215f832
Compare
lchrusciel
changed the title
[WIP] [Currency] Exchange rate refactor
[Currency] Exchange rate refactor
Nov 25, 2016
lchrusciel
force-pushed
the
exchange-rate-refactor
branch
from
November 25, 2016 08:56
215f832
to
ec56d60
Compare
lchrusciel
force-pushed
the
exchange-rate-refactor
branch
from
November 25, 2016 09:20
ec56d60
to
bc3f754
Compare
Well done! Getting closer to party 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #6820