Files
odoo_source/addons/payment_authorize
Joren Van Onder 5e13e13a20 [FIX] payment_authorize: create a customer profile for ACH transactions
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

closes odoo/odoo#36298

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-09-05 17:25:27 +00:00
..
…
2018-11-23 15:28:32 +00:00