[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>
This commit is contained in:
co-authored by
AdrienHorgnies
parent
f8df10dd01
commit
eb8beffbe9
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user