[FIX]payment_paypal: wrong fees computation

Steps to reproduce the bug:
- Create a product P with price=100€
- Configure payment aquier Paypal with fees_int_fixed = 1€ and fees_int_var = 1%
- Set Paypal to be available in the website
- Go to the web shop and add P in the cart
- Choose to pay with Paypal

Bug:

The amout to pay was 102.02€ instead of 102.01€

Before the fix, the fees was computed as followed:

fees = (percentage / 100.0 * amount + fixed) / (1 - percentage / 100.0)
Where fees_dom_fixed = fixed and fees_int_var = percentage

With this computation, the percentage was applied twice.
If for example, we had fixed = 0 then

fees = (percentage / 100.0 * amount) / (1 - percentage / 100.0)

In this case, it's easy to see that the percentage is applied twice.

opw:1981784

closes odoo/odoo#33830

Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2019-06-04 07:24:34 +00:00
parent 4cdcab43ee
commit 74706e9e03
+1 -1
View File
@@ -86,7 +86,7 @@ class AcquirerPaypal(models.Model):
else:
percentage = self.fees_int_var
fixed = self.fees_int_fixed
fees = (percentage / 100.0 * amount + fixed) / (1 - percentage / 100.0)
fees = (percentage / 100.0 * amount) + fixed / (1 - percentage / 100.0)
return fees
@api.multi