Skip to content
Snippets Groups Projects
Commit 1b08af54 authored by Valeriya(vchu)'s avatar Valeriya(vchu)
Browse files

[FIX] payment_adyen: stop logging stacktrace for invalid reference


as Adyen sends the same notification data for POS and online payments
that can not be distiguished, the webhook controller logs a stacktrace
for every POS payment. If the payment_adyen is installed it generates
noise in logs as the POS transaction can not be found in online
payments. To clear the log we make missing transaction as warning to
not log the stacktrace.

task-2960381

closes odoo/odoo#120625

Signed-off-by: default avatarAntoine Vandevenne (anv) <anv@odoo.com>
parent 5c12ec09
No related branches found
No related tags found
No related merge requests found
......@@ -245,6 +245,11 @@ class AdyenController(http.Controller):
acquirer_sudo = PaymentTransaction.sudo()._get_tx_from_feedback_data(
'adyen', notification_data
).acquirer_id # Find the acquirer based on the transaction
except ValidationError:
# Warn rather than log the traceback to avoid noise when a POS payment notification
# is received and the corresponding `payment.transaction` record is not found.
_logger.warning("unable to find the transaction; skipping to acknowledge")
else:
if not self._verify_notification_signature(
received_signature, notification_data, acquirer_sudo.adyen_hmac_key
):
......@@ -263,11 +268,13 @@ class AdyenController(http.Controller):
notification_data['resultCode'] = 'Authorised' if success else 'Error'
else:
continue # Don't handle unsupported event codes and failed events
# Handle the notification data as a regular feedback
PaymentTransaction.sudo()._handle_feedback_data('adyen', notification_data)
except ValidationError: # Acknowledge the notification to avoid getting spammed
_logger.exception("unable to handle the notification data; skipping to acknowledge")
try:
# Handle the notification data as a regular feedback
PaymentTransaction.sudo()._handle_feedback_data('adyen', notification_data)
except ValidationError: # Acknowledge the notification to avoid getting spammed
_logger.exception(
"unable to handle the notification data;skipping to acknowledge"
)
return '[accepted]' # Acknowledge the notification
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment