The response profile of an ACH transaction won't contain a credit card
number since ACH transactions use bank accounts instead. It looks like
this:
<getCustomerPaymentProfileResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<messages>
...
</messages>
<paymentProfile>
<billTo>
<firstName>XXX</firstName>
<lastName>XXXX</lastName>
<address>XXX XXX XXX</address>
<city>XXX</city>
<state>XX</state>
<zip>XXXXX</zip>
<country>XXX</country>
<phoneNumber>XXXXXXXXX</phoneNumber>
</billTo>
<customerProfileId>XXXXXXXXX</customerProfileId>
<customerPaymentProfileId>XXXXXXXXX</customerPaymentProfileId>
<payment>
<bankAccount>
<accountType>checking</accountType>
<routingNumber>XXXXXXXX</routingNumber>
<accountNumber>XXXXXXXX</accountNumber>
<nameOnAccount>XXX</nameOnAccount>
<echeckType>WEB</echeckType>
</bankAccount>
</payment>
</paymentProfile>
</getCustomerPaymentProfileResponse>
This causes the transaction not to get confirmed in Odoo:
...
File ".../authorize_request.py", line 241, in create_customer_profile_from_tx
res['name'] = response_profile.find('paymentProfile/payment/creditCard/cardNumber').text
AttributeError: 'NoneType' object has no attribute 'text' - - -
To solve it fall back on the accountNumber if there's no cardNumber.
opw-2062784
closesodoo/odoo#36298
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>