Skip to content

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

Update warning in get_supported_currencies for gateways

IKarbowiak80444cd3d6c4
diff --git a/saleor/graphql/checkout/tests/test_checkout.py b/saleor/graphql/checkout/tests/test_checkout.py
index 87c0e56929..b050f0ea79 100644
--- a/saleor/graphql/checkout/tests/test_checkout.py
+++ b/saleor/graphql/checkout/tests/test_checkout.py
@@ -581,7 +581,11 @@ def test_checkout_available_payment_gateways(
}
}
"""
- expected_warning = "Default currency for Dummy is used."
+ expected_warning = (
+ "Default currency used for Dummy. "
+ "DEFAULT_CURRENCY setting is deprecated, "
+ "please configure supported currencies for this gateway."
+ )
variables = {"token": str(checkout_with_item.token)}
with warnings.catch_warnings(record=True) as warns:
response = api_client.post_graphql(query, variables)
diff --git a/saleor/payment/gateways/utils.py b/saleor/payment/gateways/utils.py
index 29329b4b81..098cee018f 100644
--- a/saleor/payment/gateways/utils.py
+++ b/saleor/payment/gateways/utils.py
@@ -11,5 +11,9 @@ def get_supported_currencies(config: "GatewayConfig", gateway_name: str) -> List
currencies = config.supported_currencies
if not currencies:
currencies = [settings.DEFAULT_CURRENCY]
- warnings.warn(f"Default currency for {gateway_name} is used.")
+ warnings.warn(
+ f"Default currency used for {gateway_name}. "
+ "DEFAULT_CURRENCY setting is deprecated, "
+ "please configure supported currencies for this gateway."
+ )
return currencies
diff --git a/saleor/payment/tests/test_gateways_utils.py b/saleor/payment/tests/test_gateways_utils.py
index 79964d0fe1..764a0a6f92 100644
--- a/saleor/payment/tests/test_gateways_utils.py
+++ b/saleor/payment/tests/test_gateways_utils.py
@@ -32,7 +32,11 @@ def test_get_supported_currencies_default_currency(gateway_config):
with warnings.catch_warnings(record=True) as warns:
currencies = get_supported_currencies(gateway_config, "Test")
- expected_warning = "Default currency for Test is used."
+ expected_warning = (
+ "Default currency used for Test. "
+ "DEFAULT_CURRENCY setting is deprecated, "
+ "please configure supported currencies for this gateway."
+ )
assert any([str(warning.message) == expected_warning for warning in warns])
# then