[FIX] payment: do not add fee for validation transaction
When making transaction with 'validation' type and where fees were active, fees were added to the amount. This behaviour is problematic because validation operations are used for tokenization for example where no credit should charged to the customer. Now validation operations have no fees even if fees are active on the acquirer. Task - 2784765 closes odoo/odoo#96712 X-original-commit: 69b04e753ab4e90e68b9d3e678ebea277586e7ac Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
@@ -206,11 +206,14 @@ class PaymentTransaction(models.Model):
|
||||
'partner_phone': partner.phone,
|
||||
})
|
||||
|
||||
# Compute fees
|
||||
currency = self.env['res.currency'].browse(values.get('currency_id')).exists()
|
||||
values['fees'] = acquirer._compute_fees(
|
||||
values.get('amount', 0), currency, partner.country_id
|
||||
)
|
||||
# Compute fees, for validation transactions fees are zero
|
||||
if values.get('operation') == 'validation':
|
||||
values['fees'] = 0
|
||||
else:
|
||||
currency = self.env['res.currency'].browse(values.get('currency_id')).exists()
|
||||
values['fees'] = acquirer._compute_fees(
|
||||
values.get('amount', 0), currency, partner.country_id,
|
||||
)
|
||||
|
||||
# Include acquirer-specific create values
|
||||
values.update(self._get_specific_create_values(acquirer.provider, values))
|
||||
|
||||
Reference in New Issue
Block a user