Skip to content

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

Update supported currencies help_texts in gateways and update get_supported_currencies utils func

IKarbowiak339e41af7084
diff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.py
index 1dd43b12c9..ac3118876d 100644
--- a/saleor/payment/gateways/braintree/plugin.py
+++ b/saleor/payment/gateways/braintree/plugin.py
@@ -86,7 +86,7 @@ class BraintreeGatewayPlugin(BasePlugin):
"Supported currencies": {
"type": ConfigurationTypeField.STRING,
"help_text": "Determines currencies supported by gateway."
- " Please enter currencies separated by a comma.",
+ " Please enter currency codes separated by a comma.",
"label": "Supported currencies",
},
}
diff --git a/saleor/payment/gateways/dummy/plugin.py b/saleor/payment/gateways/dummy/plugin.py
index b66285dbe0..37ac3faa05 100644
--- a/saleor/payment/gateways/dummy/plugin.py
+++ b/saleor/payment/gateways/dummy/plugin.py
@@ -55,7 +55,7 @@ class DummyGatewayPlugin(BasePlugin):
"Supported currencies": {
"type": ConfigurationTypeField.STRING,
"help_text": "Determines currencies supported by gateway."
- " Please enter currencies separated by a comma.",
+ " Please enter currency codes separated by a comma.",
"label": "Supported currencies",
},
}
diff --git a/saleor/payment/gateways/razorpay/plugin.py b/saleor/payment/gateways/razorpay/plugin.py
index 6f2a3a1b9b..87c002998c 100644
--- a/saleor/payment/gateways/razorpay/plugin.py
+++ b/saleor/payment/gateways/razorpay/plugin.py
@@ -57,7 +57,7 @@ class RazorpayGatewayPlugin(BasePlugin):
"Supported currencies": {
"type": ConfigurationTypeField.STRING,
"help_text": "Determines currencies supported by gateway."
- " Please enter currencies separated by a comma.",
+ " Please enter currency codes separated by a comma.",
"label": "Supported currencies",
},
}
diff --git a/saleor/payment/gateways/stripe/plugin.py b/saleor/payment/gateways/stripe/plugin.py
index d085c543a9..5177c5d507 100644
--- a/saleor/payment/gateways/stripe/plugin.py
+++ b/saleor/payment/gateways/stripe/plugin.py
@@ -67,7 +67,7 @@ class StripeGatewayPlugin(BasePlugin):
"Supported currencies": {
"type": ConfigurationTypeField.STRING,
"help_text": "Determines currencies supported by gateway."
- " Please enter currencies separated by a comma.",
+ " Please enter currency codes separated by a comma.",
"label": "Supported currencies",
},
}
diff --git a/saleor/payment/gateways/utils.py b/saleor/payment/gateways/utils.py
index 3dbfcd1f51..d0312b87ad 100644
--- a/saleor/payment/gateways/utils.py
+++ b/saleor/payment/gateways/utils.py
@@ -1,4 +1,3 @@
-import re
import warnings
from typing import TYPE_CHECKING, List
@@ -18,6 +17,6 @@ def get_supported_currencies(config: "GatewayConfig", gateway_name: str) -> List
"please configure supported currencies for this gateway."
)
else:
- currencies = re.split(r",\s*", supp_currencies)
+ currencies = [c.strip() for c in supp_currencies.split(",")]
return currencies
diff --git a/saleor/payment/tests/test_gateways_utils.py b/saleor/payment/tests/test_gateways_utils.py
index 3c2f3c5ffd..920583569c 100644
--- a/saleor/payment/tests/test_gateways_utils.py
+++ b/saleor/payment/tests/test_gateways_utils.py
@@ -21,6 +21,7 @@ def gateway_config():
[
("PLN, USD, EUR", ["PLN", "USD", "EUR"]),
("PLN,EUR", ["PLN", "EUR"]),
+ (" PLN,EUR ", ["PLN", "EUR"]),
("USD", ["USD"]),
],
)