summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/models/authorize_request.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-04-12 13:37:44 +0200
committerChristophe Simonis <chs@odoo.com>2019-04-12 13:37:44 +0200
commit0a09a4d8a819ef06db47e798f0465e500004e4c1 (patch)
treeb9d66d60a1e9b5ff6030be62fff89df410b744ee /addons/payment_authorize/models/authorize_request.py
parentdb97bb7f1136dc3ebde9924b79364a698a63765d (diff)
parent120359bf0c98191051ac19ae2e5fde53ca7d2ae5 (diff)
[MERGE] forward port branch saas-12.3 up to 120359bf0c9
Diffstat (limited to 'addons/payment_authorize/models/authorize_request.py')
-rw-r--r--addons/payment_authorize/models/authorize_request.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/payment_authorize/models/authorize_request.py b/addons/payment_authorize/models/authorize_request.py
index bca2164dac1..79d0a7589c5 100644
--- a/addons/payment_authorize/models/authorize_request.py
+++ b/addons/payment_authorize/models/authorize_request.py
@@ -148,7 +148,8 @@ class AuthorizeAPI():
"""
root = self._base_tree('createCustomerProfileRequest')
profile = etree.SubElement(root, "profile")
- etree.SubElement(profile, "merchantCustomerId").text = 'ODOO-%s-%s' % (partner.id, uuid4().hex[:8])
+ # merchantCustomerId is ODOO-{partner.id}-{random hex string} truncated to maximum 20 characters
+ etree.SubElement(profile, "merchantCustomerId").text = ('ODOO-%s-%s' % (partner.id, uuid4().hex[:8]))[:20]
etree.SubElement(profile, "email").text = partner.email or ''
payment_profile = etree.SubElement(profile, "paymentProfiles")
etree.SubElement(payment_profile, "customerType").text = 'business' if partner.is_company else 'individual'
@@ -220,7 +221,8 @@ class AuthorizeAPI():
root = self._base_tree('createCustomerProfileFromTransactionRequest')
etree.SubElement(root, "transId").text = transaction_id
customer = etree.SubElement(root, "customer")
- etree.SubElement(customer, "merchantCustomerId").text = 'ODOO-%s-%s' % (partner.id, uuid4().hex[:8])
+ # merchantCustomerId is ODOO-{partner.id}-{random hex string} truncated to maximum 20 characters
+ etree.SubElement(customer, "merchantCustomerId").text = ('ODOO-%s-%s' % (partner.id, uuid4().hex[:8]))[:20]
etree.SubElement(customer, "email").text = partner.email or ''
response = self._authorize_request(root)
res = dict()