Skip to content
Permalink
Browse files

[FIX] payment: Wrong extra fees with payment acquier

Steps to reproduce the bug:

- Install Sales
- Configure Paypal payment acquier
- Add extra fees such as 10€ of domestic fee
- Create a customer C with an email E and with no country
- Create a quotation Q of 100€ for C and send it by email to C
- Go in the email box of E and click on the link
- Click on 'Sign and Pay' button
- Sign Q and click on 'Pay'
- Choose Paypal as payment acquier
- Process the payment with Paypal

Bug:

An error log was displayed saying:

Paypal incorrect data:
mc_gross received 100 instead of 110

PS: the domestic fee was not counted because the partner_country_id
was not set in function render defined in model payment.acquirer

Inspired from function create defined in model payment.transaction
(addons/payment/models/payment_acquirer.py +961) where the domestic fee
is counted.

opw:2167104

closes #43262

X-original-commit: 581020c
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
  • Loading branch information
simongoffin committed Jan 13, 2020
1 parent ce31b42 commit 65c8fac401643a760ec476175664ee41eb451a9e
Showing with 2 additions and 2 deletions.
  1. +1 −1 addons/payment/models/payment_acquirer.py
  2. +1 −1 addons/payment_paypal/models/payment.py
@@ -414,7 +414,7 @@ def render(self, reference, amount, currency_id, partner_id=False, values=None):
'partner_zip': partner.zip,
'partner_city': partner.city,
'partner_address': _partner_format_address(partner.street, partner.street2),
'partner_country_id': partner.country_id.id,
'partner_country_id': partner.country_id.id or self.env['res.company']._company_default_get().country_id.id,
'partner_country': partner.country_id,
'partner_phone': partner.phone,
'partner_state': partner.state_id,
@@ -157,7 +157,7 @@ def _paypal_form_get_invalid_parameters(self, data):
invalid_parameters.append(('txn_id', data.get('txn_id'), self.acquirer_reference))
# check what is buyed
if float_compare(float(data.get('mc_gross', '0.0')), (self.amount + self.fees), 2) != 0:
invalid_parameters.append(('mc_gross', data.get('mc_gross'), '%.2f' % self.amount)) # mc_gross is amount + fees
invalid_parameters.append(('mc_gross', data.get('mc_gross'), '%.2f' % self.amount + self.fees)) # mc_gross is amount + fees
if data.get('mc_currency') != self.currency_id.name:
invalid_parameters.append(('mc_currency', data.get('mc_currency'), self.currency_id.name))
if 'handling_amount' in data and float_compare(float(data.get('handling_amount')), self.fees, 2) != 0:

0 comments on commit 65c8fac

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