Skip to content
Snippets Groups Projects
Commit df0ae7e4 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] payment_paypal: wrong handling fees computation formula

parent 00dc3a59
No related branches found
No related tags found
No related merge requests found
...@@ -90,9 +90,12 @@ class AcquirerPaypal(osv.Model): ...@@ -90,9 +90,12 @@ class AcquirerPaypal(osv.Model):
return 0.0 return 0.0
country = self.pool['res.country'].browse(cr, uid, country_id, context=context) country = self.pool['res.country'].browse(cr, uid, country_id, context=context)
if country and acquirer.company_id.country_id.id == country.id: if country and acquirer.company_id.country_id.id == country.id:
fees = amount * (1 + acquirer.fees_dom_var / 100.0) + acquirer.fees_dom_fixed - amount percentage = acquirer.fees_dom_var
fixed = acquirer.fees_dom_fixed
else: else:
fees = amount * (1 + acquirer.fees_int_var / 100.0) + acquirer.fees_int_fixed - amount percentage = acquirer.fees_int_var
fixed = acquirer.fees_int_fixed
fees = (percentage / 100.0 * amount + fixed ) / (1 - percentage / 100.0)
return fees return fees
def paypal_form_generate_values(self, cr, uid, id, partner_values, tx_values, context=None): def paypal_form_generate_values(self, cr, uid, id, partner_values, tx_values, context=None):
......
...@@ -148,7 +148,7 @@ class PaypalForm(PaypalCommon): ...@@ -148,7 +148,7 @@ class PaypalForm(PaypalCommon):
for form_input in tree.input: for form_input in tree.input:
if form_input.get('name') in ['handling']: if form_input.get('name') in ['handling']:
handling_found = True handling_found = True
self.assertEqual(form_input.get('value'), '1.56', 'paypal: wrong computed fees') self.assertEqual(form_input.get('value'), '1.57', 'paypal: wrong computed fees')
self.assertTrue(handling_found, 'paypal: fees_active did not add handling input in rendered form') self.assertTrue(handling_found, 'paypal: fees_active did not add handling input in rendered form')
@mute_logger('openerp.addons.payment_paypal.models.paypal', 'ValidationError') @mute_logger('openerp.addons.payment_paypal.models.paypal', 'ValidationError')
......
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