Skip to content

Commit

Permalink
[IMP] payment_authorize: display the reason for declining the payment
Browse files Browse the repository at this point in the history
In some occasions, Authorize would decline a payment and provide the
reason for it, but not mark the payment as in error. The customer would
see that their payment is cancelled but not know what to do. That is
because error messages were not processed in the case of declined
payments.

This commit makes eventual error messages (decline reasons) logged on
the linked document's chatter and displayed on the /payment/status page.

opw-4125895

closes odoo#179805

X-original-commit: 2d29d74
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
  • Loading branch information
AntoineVDV committed Sep 11, 2024
1 parent 868d5b9 commit 3613fec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/payment/static/src/xml/payment_post_processing.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<t t-elif="state == 'cancel'">
<t t-set="alert_style" t-value="'danger'"/>
<t t-set="alert_header" t-value="'This payment has been canceled'"/>
<t t-set="alert_message" t-value="'No payment has been processed.'"/>
<t t-set="alert_message" t-value="state_message ? 'Reason: ' + state_message : 'No payment has been processed.'"/>
</t>
<t t-elif="state == 'error'">
<t t-set="alert_style" t-value="'danger'"/>
Expand Down
2 changes: 1 addition & 1 deletion addons/payment_authorize/models/payment_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _process_notification_data(self, notification_data):
# triggered by a customer browsing the transaction from the portal.
self.env.ref('payment.cron_post_process_payment_tx')._trigger()
elif status_code == '2': # Declined
self._set_canceled()
self._set_canceled(state_message=response_content.get('x_response_reason_text'))
elif status_code == '4': # Held for Review
self._set_pending()
else: # Error / Unknown code
Expand Down

0 comments on commit 3613fec

Please sign in to comment.