summaryrefslogtreecommitdiff
path: root/addons/payment_authorize
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-16 18:34:56 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-16 18:34:56 +0200
commit5f2d080cf85d54bc52895f9dbc4075b10989d324 (patch)
treec925509b609fb07f6fbef8896710b756c3c6a86f /addons/payment_authorize
parent026be48ccbbb15daefda070697b135f089f49564 (diff)
parentad825b673b57344a6a1571234f62a0b3aa543bf7 (diff)
[MERGE] forward port branch 11.0 up to ad825b673b5
Diffstat (limited to 'addons/payment_authorize')
-rw-r--r--addons/payment_authorize/models/payment.py4
-rw-r--r--addons/payment_authorize/tests/test_authorize.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/addons/payment_authorize/models/payment.py b/addons/payment_authorize/models/payment.py
index b10f2824733..fe17ee4add9 100644
--- a/addons/payment_authorize/models/payment.py
+++ b/addons/payment_authorize/models/payment.py
@@ -11,7 +11,7 @@ import time
from odoo import _, api, fields, models
from odoo.addons.payment.models.payment_acquirer import ValidationError
from odoo.addons.payment_authorize.controllers.main import AuthorizeController
-from odoo.tools.float_utils import float_compare
+from odoo.tools.float_utils import float_compare, float_repr
from odoo.tools.safe_eval import safe_eval
_logger = logging.getLogger(__name__)
@@ -64,7 +64,7 @@ class PaymentAcquirerAuthorize(models.Model):
temp_authorize_tx_values = {
'x_login': self.authorize_login,
'x_trans_key': self.authorize_transaction_key,
- 'x_amount': str(values['amount']),
+ 'x_amount': float_repr(values['amount'], values['currency'].decimal_places if values['currency'] else 2),
'x_show_form': 'PAYMENT_FORM',
'x_type': 'AUTH_CAPTURE' if not self.capture_manually else 'AUTH_ONLY',
'x_method': 'CC',
diff --git a/addons/payment_authorize/tests/test_authorize.py b/addons/payment_authorize/tests/test_authorize.py
index 242fb20d265..3584cd38dc1 100644
--- a/addons/payment_authorize/tests/test_authorize.py
+++ b/addons/payment_authorize/tests/test_authorize.py
@@ -48,7 +48,7 @@ class AuthorizeForm(AuthorizeCommon):
form_values = {
'x_login': self.authorize.authorize_login,
'x_trans_key': self.authorize.authorize_transaction_key,
- 'x_amount': '320.0',
+ 'x_amount': '56.16',
'x_show_form': 'PAYMENT_FORM',
'x_type': 'AUTH_CAPTURE',
'x_method': 'CC',
@@ -84,7 +84,7 @@ class AuthorizeForm(AuthorizeCommon):
form_values['x_fp_hash'] = self._authorize_generate_hashing(form_values)
# render the button
- res = self.authorize.render('SO004', 320.0, self.currency_usd.id, values=self.buyer_values)
+ res = self.authorize.render('SO004', 56.16, self.currency_usd.id, values=self.buyer_values)
# check form result
tree = objectify.fromstring(res)