summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/models/authorize_request.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-09-05 18:52:27 +0200
committerChristophe Simonis <chs@odoo.com>2018-09-05 18:52:27 +0200
commitf19e6ce561b80d291cc97bf928c4b84b48ec0f59 (patch)
tree7c5419b940876244f95d055682bbe19429ff4747 /addons/payment_authorize/models/authorize_request.py
parent7700bd172f790858fb4cb9e64b90c9c77d9e5b0a (diff)
parent213759b03e5466f119f52a557d7feefb9d477267 (diff)
[MERGE] forward port branch 11.0 up to 213759b03e5
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 138c270e35d..ba5a14f7edd 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]]