[FIX] payment_adyen: discard refund notifications for unknown source txs
Before this commit, a ValueError would be raised upon receiving a refund notification for a source transaction whose reference was not found in the database. As only ValidationError's are caught by the webhook controller, the acknowledgment string was never returned to Adyen and the endpoint was automatically disabled. This commits adds a check on the existence of the source transaction to allow discarding refund notifications if it is not found. task-2704522 closes odoo/odoo#82291 X-original-commit: 06d79dc3d01079db27f16dc56212cf68635e8c5d Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
committed by
Antoine Vandevenne (anv)
parent
2aa5d2a666
commit
f9a460d814
@@ -173,7 +173,13 @@ class PaymentTransaction(models.Model):
|
||||
source_tx = self.search(
|
||||
[('acquirer_reference', '=', source_acquirer_reference), ('provider', '=', 'adyen')]
|
||||
)
|
||||
tx = self._adyen_create_refund_tx_from_feedback_data(source_tx, data)
|
||||
if source_tx:
|
||||
# Manually create a refund transaction with a new reference. The reference of
|
||||
# the refund transaction was personalized from Adyen and could be identical to
|
||||
# that of an existing transaction.
|
||||
tx = self._adyen_create_refund_tx_from_feedback_data(source_tx, data)
|
||||
else: # The refund was initiated for an unknown source transaction
|
||||
pass # Don't do anything with the refund notification
|
||||
|
||||
if not tx:
|
||||
raise ValidationError(
|
||||
|
||||
Reference in New Issue
Block a user