summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2020-11-10 09:30:39 +0000
committerGoffin Simon <sig@odoo.com>2020-11-15 22:40:12 +0000
commitbb022f66f2aa9ab672244d3803e8a13a95f3be36 (patch)
tree094083abc049e70441a97776e1dc0f6921d1cd6a /addons
parent43e8c3b5ab1f9bd2e96c356ca8b66a53dbc1fadf (diff)
[FIX] payment_paypal: Paypal Acquirer fees
The variable fee (Var) and fixed fee (Fix) indicated by paypal must be subtracted from the transaction amount (Am). So let's consider that Am = 100€, Var = 2.9% and Fix = 0.3€ Total fee = 100€ * (2.9/100) + 0.3€ = 3.20€ So in this case, the merchant will get 96.80€ and Paypal will get 3.20€ This computation can be verified with the simulator here: https://salecalc.com/paypal?p=100&l=us&r=0&e=0&f=0&m=2&c=0. So the idea here is to compute Am such that the merchant will get 100€ if he set his price to 100€ fees = amount_fees_included * percentage / 100 + fixed fees = (amount + fees) * percentage / 100 + fixed fees = (amount * percentage / 100 + fixed) / (1 - percentage / 100) if the merchant needs to keep 100€, Am will be equal to 103.30€. That way, paypal takes 103.30 * 2.9% + 0.30 = 3.30 and the merchant takes 103.30 - 3.30 = 100 opw:2369557 X-original-commit: 6850e638dfa652ab3fe8065ea09e23cb07648d7a Co-authored-by: AdrienHorgnies <aho@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/payment_paypal/models/payment.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/payment_paypal/models/payment.py b/addons/payment_paypal/models/payment.py
index b0834681707..cf0d0df23f8 100644
--- a/addons/payment_paypal/models/payment.py
+++ b/addons/payment_paypal/models/payment.py
@@ -81,7 +81,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
def paypal_form_generate_values(self, values):