Skip to content

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

Fix condition for void and refund

Maciej Korycinski2ccb95f3f55a
diff --git a/saleor/payment/gateways/adyen/plugin.py b/saleor/payment/gateways/adyen/plugin.py
index 79f25bb2a0..319426cabc 100644
--- a/saleor/payment/gateways/adyen/plugin.py
+++ b/saleor/payment/gateways/adyen/plugin.py
@@ -369,7 +369,7 @@ class AdyenGatewayPlugin(BasePlugin):
is_success=True,
action_required=False,
)
- .exclude(token__isnull=True, token__exact="")
+ .exclude(token__isnull=False, token__exact="")
.last()
)
@@ -426,9 +426,10 @@ class AdyenGatewayPlugin(BasePlugin):
kind=TransactionKind.AUTH,
is_success=True,
)
- .exclude(token__isnull=True, token__exact="")
+ .exclude(token__isnull=False, token__exact="")
.last()
)
+
if not transaction:
# If we don't find the Auth kind we will try to get Capture kind
transaction = (
@@ -437,7 +438,7 @@ class AdyenGatewayPlugin(BasePlugin):
kind=TransactionKind.CAPTURE,
is_success=True,
)
- .exclude(token__isnull=True, token__exact="")
+ .exclude(token__isnull=False, token__exact="")
.last()
)
diff --git a/saleor/payment/gateways/adyen/utils.py b/saleor/payment/gateways/adyen/utils.py
index 22599935de..648c421364 100644
--- a/saleor/payment/gateways/adyen/utils.py
+++ b/saleor/payment/gateways/adyen/utils.py
@@ -49,7 +49,7 @@ def api_call(request_data: Optional[Dict[str, Any]], method: Callable) -> Adyen.
try:
return method(request_data)
except (Adyen.AdyenError, ValueError, TypeError) as e:
- logger.error(f"Unable to process the payment: {e}")
+ logger.warning(f"Unable to process the payment: {e}")
raise PaymentError("Unable to process the payment request.")