Files
odoo_source/addons/payment_authorize
Joren Van Onder c1ad809974 [FIX] payment_authorize: show detailed transaction error messages
createTransactionRequests can return responses like this:

{'messages': {'message': [{'code': 'E00027',
                          'text': 'The transaction was unsuccessful.'}],
             'resultCode': 'Error'},
'transactionResponse': {'SupplementalDataQualificationIndicator': 0,
                        'accountNumber': 'XXXXXXXX',
                        'accountType': 'eCheck',
                        'authCode': '',
                        'avsResultCode': 'P',
                        'cavvResultCode': '',
                        'cvvResultCode': '',
                        'errors': [{'errorCode': '33',
                                    'errorText': 'Bill To Address is '
                                                 'required.'},
                                   {'errorCode': '33',
                                    'errorText': 'Bill To State/Province is '
                                                 'required.'}],
                        'refTransID': '',
                        'responseCode': '3',
                        'testRequest': '0',
                        'transHash': '',
                        'transHashSha2': 'xxx',
                        'transId': '0'}}

_make_request() threw out the detailed errors ("Bill To Address is
required" and "Bill to State/Province is required") and only returned:

{
  'err_code': 'E00027',
  'err_msg': 'The transaction was unsuccessful.'
}

which results in the following vague error on an SO:

  The transaction with reference SO1111/1111111 for US$ 100.00
  encountered an error (Authorize.net). Error: Authorize.Net: Received
  data with status code "3" and error code "The transaction was
  unsuccessful."

This commit extracts the transaction errors and appends them to
'err_msg'. After this commit the above response results in this chatter:

  The transaction with reference SO1111/1111111 for $ 100.00
  encountered an error (Authorize.net). Error: Authorize.Net: Received
  data with status code "3" and error code "The transaction was
  unsuccessful. Bill To Address is required. Bill To State/Province is
  required."

Ideally the error handling logic would be rewritten so that
_make_request() doesn't handle specific errors like this. But changing
it is too high risk in a stable release.

opw-2718318

closes odoo/odoo#82443

X-original-commit: c7b292f7b86679b11527a68093ed70b36dc2fd1a
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2022-01-10 13:52:57 +00:00
..
…
2021-09-16 07:17:40 +00:00