diff options
| author | Damien Bouvy <dbo@odoo.com> | 2020-04-16 08:33:21 +0000 |
|---|---|---|
| committer | Damien Bouvy <dbo@odoo.com> | 2020-04-22 16:54:27 +0000 |
| commit | b1c81a65729a3f6c6b1b11df6d3edd5ff6503be3 (patch) | |
| tree | 0be9798ee5248b7574d1d9cfbeeded0eb20d9342 /addons/payment_authorize/models/authorize_request.py | |
| parent | e3021499a4fc1c9d40f2c2f39d601e667e8c3213 (diff) | |
[FIX] payment_authorize: display errors to customers
Set the transaction to the state 'error' when Authorize.net responds
with that status, as it will display a message to the customer to detail
the problem.
opw-2231276
X-original-commit: 005607fce4a22394a9f67cc4eaa52f8bf89780f0
Diffstat (limited to 'addons/payment_authorize/models/authorize_request.py')
| -rw-r--r-- | addons/payment_authorize/models/authorize_request.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/payment_authorize/models/authorize_request.py b/addons/payment_authorize/models/authorize_request.py index 4d28aed0396..2b810f1a21d 100644 --- a/addons/payment_authorize/models/authorize_request.py +++ b/addons/payment_authorize/models/authorize_request.py @@ -226,11 +226,15 @@ class AuthorizeAPI(): 'x_response_reason_text': response.get('err_msg') } - return { + result = { 'x_response_code': response.get('transactionResponse', {}).get('responseCode'), 'x_trans_id': response.get('transactionResponse', {}).get('transId'), 'x_type': 'auth_capture' } + errors = response.get('transactionResponse', {}).get('errors') + if errors: + result['x_response_reason_text'] = '\n'.join([e.get('errorText') for e in errors]) + return result def authorize(self, token, amount, reference): """Authorize a payment for the given amount. |
