[FIX] payment_authorize: use name to send values when partner is a company
Currently, the name's fields to send to Authorize when the partner is a company are: * firstName * lastName if we consider following name `Company Duck Inc`: the code is sending: * firstName: '' * lastName: 'Duck' Only it sends the `lastName` with the second word found in the name, due to the new validations in Authorize.Net, this kind of transactions are marked as suspicious and it's not confirming the transactions, leave them as pending, this commit is sending the full name in `lastName` instead of only second word to meet with the validation in Authorize.Net Also, we are sending the fields `firstName` and `lastName`, with the maximum length allowed by Authorize. closes odoo/odoo#112977 X-original-commit: 77d83b327fd99ed090194ec0d3a771c9afc47115 Signed-off-by: Morgane Demesmaeker <edm@odoo.com>
This commit is contained in:
committed by
Demesmaeker
parent
829329ab84
commit
d75339f1d3
@@ -161,11 +161,14 @@ class AuthorizeAPI:
|
||||
# but is not allowed for transactions with a payment.token.
|
||||
bill_to = {}
|
||||
if 'profile' not in tx_data:
|
||||
split_name = payment_utils.split_partner_name(tx.partner_name)
|
||||
if tx.partner_id.is_company:
|
||||
split_name = '', tx.partner_name
|
||||
else:
|
||||
split_name = payment_utils.split_partner_name(tx.partner_name)
|
||||
# max lengths are defined by the Authorize API
|
||||
bill_to = {
|
||||
'billTo': {
|
||||
'firstName': '' if tx.partner_id.is_company else split_name[0][:50],
|
||||
'firstName': split_name[0][:50],
|
||||
'lastName': split_name[1][:50], # lastName is always required
|
||||
'company': tx.partner_name[:50] if tx.partner_id.is_company else '',
|
||||
'address': tx.partner_address,
|
||||
|
||||
Reference in New Issue
Block a user