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

Zero-decimal currencies support for Stripe #3

Open
pszpetkowski opened this issue Mar 3, 2017 · 2 comments
Open

Zero-decimal currencies support for Stripe #3

pszpetkowski opened this issue Mar 3, 2017 · 2 comments

Comments

@pszpetkowski
Copy link
Contributor

Some currencies (e.g. Japanese Yen) have smallest currency unit same as its primary currency unit and therefore do not have any decimal places. Most tools integrating Stripe assume that all currencies have SCU equal to 1/100 of PCU which in case of e.g. Japanese Yen is not true. I suppose that some currencies might even have SCU equal to 1/1000 or 1/10 of PCU.

How should we handle such cases? One solution that comes to my mind is to build a map of currencies compliant with ISO 4217 and one of keys providing SCU lambda.

For example:

CURRENCIES = {
    'USD': {
        'sign': '$',
        'scu': lambda: 1/100
    }
}

Also, should we fork / extend with PR existing lib like https://github.com/limist/py-moneyed or should we write something internal to DRP?

@pawelswiecki
Copy link

Looks good. Make sure lambdas return decimals.

@pawelswiecki
Copy link

About py-moneyed: I don't like forking idea. I'd prefer using it to get currency list and currency symbols.

BTW, it's not currency "sign", but "symbol": https://en.wikipedia.org/wiki/Currency_symbol.

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

No branches or pull requests

2 participants