Files
odoo_source/addons/payment_flutterwave/tests/test_payment_acquirer.py
T
Horacio Tellez c1aa010af7 [IMP] payment: filter out acquirers based on the amount
This commit adds the possibility to define a maximum payment amount that
a given acquirer can process. If the payment amount exceeds the value,
the acquirer is filtered out of the available acquirers listed on the
payment forms.

While we're at it, the field `country_ids` is renamed to
`available_country_ids` to better depict that it is not a property of
the acquirer, but a configuration option. It will also be coherent with
the field `available_currency_ids` that is expected to be added soon.

Task - 2162165

closes odoo/odoo#82411

Related: odoo/enterprise#24412
Related: odoo/upgrade#3703
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-07-26 13:24:57 +02:00

28 lines
1.2 KiB
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import tagged
from odoo.addons.payment_flutterwave.tests.common import FlutterwaveCommon
@tagged('post_install', '-at_install')
class TestPaymentAcquirer(FlutterwaveCommon):
def test_incompatible_with_unsupported_currencies(self):
compatible_acquirers = self.env['payment.acquirer']._get_compatible_acquirers(
self.company_id, self.partner.id, self.amount, currency_id=self.env.ref('base.AFN').id
)
self.assertNotIn(self.flutterwave, compatible_acquirers)
def test_incompatible_with_validation_transactions(self):
compatible_acquirers = self.env['payment.acquirer']._get_compatible_acquirers(
self.company_id, self.partner.id, 0., is_validation=True
)
self.assertNotIn(self.flutterwave, compatible_acquirers)
def test_neutralize(self):
self.env['payment.acquirer']._neutralize()
self.assertEqual(self.acquirer.flutterwave_public_key, False)
self.assertEqual(self.acquirer.flutterwave_secret_key, False)
self.assertEqual(self.acquirer.flutterwave_webhook_secret, False)