[FIX] payment_authorize: P3 version of 88de931141

closes odoo/odoo#34667

Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This commit is contained in:
Damien Bouvy
2019-07-08 14:41:41 +00:00
parent 63a5b44380
commit b5f61bfaad
+2 -1
View File
@@ -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()