Skip to content
Snippets Groups Projects
Commit e849a791 authored by momegahed's avatar momegahed
Browse files

[FIX] payment: use iso 4217 currency minor units in payments

Steps to reproduce:

1- install ecommerce - payment_stripe
2- configure stripe testing credentials
3- edit main currency to have more decimal places (assume 4 instead
of 2 for USD)
4- add product p to cart (assume p.price = 100 USD)
5- checkout with stripe
6- the price is 10,000 USD instead of 100 USD

Bug:

Stripe expects the amount in the smallest unit possible for the
currency. https://stripe.com/docs/currencies#zero-decimal

This differs from a currency to another according to
https://en.wikipedia.org/wiki/ISO_4217#Minor_unit_fractions

`to_minor_currency_units` uses the decimal places of the currency by
default which will produce wrong values

Fix:

use currency exponent table built from
https://en.wikipedia.org/wiki/ISO_4217#Minor_unit_fractions



default behavior (for a currency that is not available) is not changed

OPW-3058173

closes odoo/odoo#106928

X-original-commit: 703ed2b4
Signed-off-by: default avatarAntoine Vandevenne (anv) <anv@odoo.com>
parent ff1055dd
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment