summaryrefslogtreecommitdiff
path: root/addons/payment_authorize
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-07-10 09:42:48 +0000
committerMartin Trigaux <mat@odoo.com>2019-07-10 10:14:06 +0000
commit00ef2653da41d7c7633d5fdf26bda11a4e8208ee (patch)
tree874b4e9bff77330d645f073faf3c04daaccba44c /addons/payment_authorize
parentf9ead39f5f8d0d2bdeeab5c10b12d26ae323b117 (diff)
parent3b1d00acda935810826e476ad49a48bf5947c0ab (diff)
[MERGE] Forward port of 12.0 to saas-12.2 up to 3b1d00acda9358108
closes odoo/odoo#34732 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/payment_authorize')
-rw-r--r--addons/payment_authorize/models/payment.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/payment_authorize/models/payment.py b/addons/payment_authorize/models/payment.py
index 946f031484d..6361a211f16 100644
--- a/addons/payment_authorize/models/payment.py
+++ b/addons/payment_authorize/models/payment.py
@@ -62,7 +62,8 @@ class PaymentAcquirerAuthorize(models.Model):
# The signature key is now '128-character hexadecimal format', while the
# transaction key was only 16-character.
if len(values['x_trans_key']) == 128:
- return hmac.new(values['x_trans_key'].decode("hex").encode('utf-8'), data, hashlib.sha512).hexdigest().upper()
+ key = bytes.fromhex(values['x_trans_key'])
+ return hmac.new(key, data, hashlib.sha512).hexdigest().upper()
else:
return hmac.new(values['x_trans_key'].encode('utf-8'), data, hashlib.md5).hexdigest()
@@ -315,13 +316,14 @@ class TxAuthorize(models.Model):
'acquirer_reference': tree.get('x_trans_id'),
'date': fields.Datetime.now(),
})
- if init_state != 'authorized':
- self.execute_callback()
if self.payment_token_id:
self.payment_token_id.verified = True
self._set_transaction_done()
+
+ if init_state != 'authorized':
+ self.execute_callback()
if tree.get('x_type').lower() == 'auth_only':
self.write({'acquirer_reference': tree.get('x_trans_id')})
self._set_transaction_authorized()