Skip to content
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

Round calculator values based on order currency #2877

Merged
merged 1 commit into from
Nov 23, 2018

Conversation

ericsaupe
Copy link
Contributor

Fixes #1957 by getting the exponent of the desired currency from Money::Currency

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. Thank you!


def compute(object)
computed_amount = (object.amount * preferred_flat_percent / 100).round(2)
currency_exponent = ::Money::Currency.find(preferred_currency).exponent
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be the currency taken from the order where the calculator lives instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like that better. I'll make the changes.

@ericsaupe ericsaupe force-pushed the order-currency-rounding branch from 98c0be6 to 4105e2d Compare October 10, 2018 16:28
@ericsaupe
Copy link
Contributor Author

@kennyadsl this is ready to be looked at again. Thanks!

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Build issues should be fixed by rebasing with master.

@ericsaupe ericsaupe force-pushed the order-currency-rounding branch from 4105e2d to c027685 Compare October 15, 2018 14:48
Fixes solidusio#1957 by getting the exponent of the desired currency from
Money::Currency
@ericsaupe ericsaupe force-pushed the order-currency-rounding branch from c027685 to 0e08301 Compare October 15, 2018 15:22
Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, thanks @ericsaupe!

@kennyadsl kennyadsl merged commit 5707a64 into solidusio:master Nov 23, 2018
@kennyadsl
Copy link
Member

Thanks @ericsaupe !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants