diff options
| author | Goffin Simon <sig@odoo.com> | 2020-11-10 12:20:54 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2020-11-15 22:40:13 +0000 |
| commit | 283fd263601843d2fae73124f9d8c32eb40fd845 (patch) | |
| tree | 26d408e0a2e727551d44047612f52a6c143ed065 /addons/payment_paypal | |
| parent | bb022f66f2aa9ab672244d3803e8a13a95f3be36 (diff) | |
[FIX] payment_paypal: Test paypal_compute_fees
Add a test for the computation of the Paypal fees
opw:2369557
closes odoo/odoo#61749
X-original-commit: 8bedef042bd7be5830de92ae9a6976c9e17fb792
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons/payment_paypal')
| -rw-r--r-- | addons/payment_paypal/tests/test_paypal.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/addons/payment_paypal/tests/test_paypal.py b/addons/payment_paypal/tests/test_paypal.py index a8d173c3ed1..38a50a91c50 100644 --- a/addons/payment_paypal/tests/test_paypal.py +++ b/addons/payment_paypal/tests/test_paypal.py @@ -205,3 +205,15 @@ class PaypalForm(PaypalCommon): self.assertEqual(tx.state, 'done', 'paypal: wrong state after receiving a valid pending notification') self.assertEqual(tx.acquirer_reference, '08D73520KX778924N', 'paypal: wrong txn_id after receiving a valid pending notification') self.assertEqual(fields.Datetime.to_string(tx.date), '2013-11-18 11:21:19', 'paypal: wrong validation date') + + def test_21_paypal_compute_fees(self): + #If the merchant needs to keep 100€, the transaction will be equal to 103.30€. + #In this way, Paypal will take 103.30 * 2.9% + 0.30 = 3.30€ + #And the merchant will take 103.30 - 3.30 = 100€ + self.paypal.write({ + 'fees_active': True, + 'fees_int_fixed': 0.30, + 'fees_int_var': 2.90, + }) + total_fee = self.paypal.paypal_compute_fees(100, False, False) + self.assertEqual(round(total_fee, 2), 3.3, 'Wrong computation of the Paypal fees') |
