Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Before create refund event, confirm that order exists (#6389)

Maciej Korycinskica8d0cd57df5
diff --git a/saleor/payment/gateways/adyen/plugin.py b/saleor/payment/gateways/adyen/plugin.py
index 13784e0ef5..7ef53c797b 100644
--- a/saleor/payment/gateways/adyen/plugin.py
+++ b/saleor/payment/gateways/adyen/plugin.py
@@ -476,16 +476,17 @@ class AdyenGatewayPlugin(BasePlugin):
amount = payment_information.amount
currency = payment_information.currency
- msg = f"Adyen: Refund for amount {amount}{currency} has been requested."
- external_notification_event(
- order=transaction.payment.order, # type: ignore
- user=None,
- message=msg,
- parameters={
- "service": transaction.payment.gateway,
- "id": transaction.payment.token,
- },
- )
+ if transaction.payment.order:
+ msg = f"Adyen: Refund for amount {amount}{currency} has been requested."
+ external_notification_event(
+ order=transaction.payment.order, # type: ignore
+ user=None,
+ message=msg,
+ parameters={
+ "service": transaction.payment.gateway,
+ "id": transaction.payment.token,
+ },
+ )
return GatewayResponse(
is_success=True,
action_required=False,