summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/models/authorize_request.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-09-07 14:43:48 +0200
committerChristophe Simonis <chs@odoo.com>2018-09-07 14:43:48 +0200
commit49c3264ce0f73a746f9a229dba423f6c0ea3d485 (patch)
tree9cd4603a7b9708d061802f9e0f638e5c684d15a9 /addons/payment_authorize/models/authorize_request.py
parentb4c72220c72e22328b3a96024c59d79889b71ae5 (diff)
parent4850fb08385de3f0851a732c97c90402e89838b7 (diff)
[MERGE] forward port branch saas-11.3 up to 4850fb08385
Diffstat (limited to 'addons/payment_authorize/models/authorize_request.py')
-rw-r--r--addons/payment_authorize/models/authorize_request.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/addons/payment_authorize/models/authorize_request.py b/addons/payment_authorize/models/authorize_request.py
index f38b6535b9c..e4bd3382caa 100644
--- a/addons/payment_authorize/models/authorize_request.py
+++ b/addons/payment_authorize/models/authorize_request.py
@@ -7,7 +7,7 @@ from uuid import uuid4
import pprint
import logging
-from odoo import _
+from odoo.addons.payment.models.payment_acquirer import _partner_split_name
from odoo.exceptions import ValidationError, UserError
from odoo import _
@@ -153,6 +153,12 @@ class AuthorizeAPI():
payment_profile = etree.SubElement(profile, "paymentProfiles")
etree.SubElement(payment_profile, "customerType").text = 'business' if partner.is_company else 'individual'
billTo = etree.SubElement(payment_profile, "billTo")
+ if partner.is_company:
+ etree.SubElement(billTo, "firstName").text = ' '
+ etree.SubElement(billTo, "lastName").text = partner.name
+ else:
+ etree.SubElement(billTo, "firstName").text = _partner_split_name(partner.name)[0]
+ etree.SubElement(billTo, "lastName").text = _partner_split_name(partner.name)[1]
etree.SubElement(billTo, "address").text = (partner.street or '' + (partner.street2 if partner.street2 else '')) or None
missing_fields = [partner._fields[field].string for field in ['city', 'country_id'] if not partner[field]]