Skip to content
Permalink
Browse files

[FIX] payment_sips: rounding error

- Activate SIPS
- Make a payment of 263.90 on the eCommerce

The SO is not confirmed because there is 0.01 of difference.

This is due to the fact that 263.90 * 100 = 26389.9999...

Using `round` instead of `int` prevents truncating the value.

opw-2179123

closes #48134

X-original-commit: 189a790
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
  • Loading branch information
nim-odoo committed Mar 20, 2020
1 parent 6fb03e4 commit 29969c553a3a1769071bc67829cbea16ea456820
Showing with 1 addition and 1 deletion.
  1. +1 −1 addons/payment_sips/models/payment.py
@@ -73,7 +73,7 @@ def sips_form_generate_values(self, values):
currency_code = CURRENCY_CODES.get(currency.name, False)
if not currency_code:
raise ValidationError(_('Currency not supported by Wordline'))
amount = int(values['amount'] * 100)
amount = round(values['amount'] * 100)
if self.environment == 'prod':
# For production environment, key version 2 is required
merchant_id = getattr(self, 'sips_merchant_id')

0 comments on commit 29969c5

Please sign in to comment.
You can’t perform that action at this time.