Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove gettext occurrences from payment.gateways
IKarbowiakc524a369e401
diff --git a/saleor/payment/gateways/braintree/__init__.py b/saleor/payment/gateways/braintree/__init__.pyindex d7b054278b..12ccb9ec0f 100644--- a/saleor/payment/gateways/braintree/__init__.py+++ b/saleor/payment/gateways/braintree/__init__.py@@ -2,7 +2,6 @@ from typing import Dict, List, Optionalimport braintree as braintree_sdkfrom django.core.exceptions import ImproperlyConfigured-from django.utils.translation import pgettext_lazyfrom ... import TransactionKindfrom ...interface import (@@ -58,9 +57,7 @@ def get_error_for_client(errors: List) -> str:"""Filter all error messages and decides which one is visible for the client."""if not errors:return ""- default_msg = pgettext_lazy(- "payment error", "Unable to process transaction. Please try again in a moment"- )+ default_msg = "Unable to process transaction. Please try again in a moment"for error in errors:if error["code"] in ERROR_CODES_WHITELIST:return ERROR_CODES_WHITELIST[error["code"]] or error["message"]diff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.pyindex fe407f0dd8..475be8c395 100644--- a/saleor/payment/gateways/braintree/plugin.py+++ b/saleor/payment/gateways/braintree/plugin.py@@ -1,7 +1,5 @@from typing import TYPE_CHECKING, List-from django.utils.translation import pgettext_lazy-from saleor.extensions import ConfigurationTypeFieldfrom saleor.extensions.base_plugin import BasePlugin@@ -40,57 +38,39 @@ class BraintreeGatewayPlugin(BasePlugin):CONFIG_STRUCTURE = {"Public API key": {"type": ConfigurationTypeField.SECRET,- "help_text": pgettext_lazy(- "Plugin help text", "Provide Braintree public API key"- ),- "label": pgettext_lazy("Plugin label", "Public API key"),+ "help_text": "Provide Braintree public API key",+ "label": "Public API key",},"Secret API key": {"type": ConfigurationTypeField.SECRET,- "help_text": pgettext_lazy(- "Plugin help text", "Provide Braintree secret API key"- ),- "label": pgettext_lazy("Plugin label", "Secret API key"),+ "help_text": "Provide Braintree secret API key",+ "label": "Secret API key",},"Merchant ID": {"type": ConfigurationTypeField.SECRET,- "help_text": pgettext_lazy(- "Plugin help text", "Provide Braintree merchant ID"- ),- "label": pgettext_lazy("Plugin label", "Merchant ID"),+ "help_text": "Provide Braintree merchant ID",+ "label": "Merchant ID",},"Use sandbox": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should use Braintree sandbox API.",- ),- "label": pgettext_lazy("Plugin label", "Use sandbox"),+ "help_text": "Determines if Saleor should use Braintree sandbox API.",+ "label": "Use sandbox",},"Store customers card": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should store cards on payments"- " in Braintree customer.",- ),- "label": pgettext_lazy("Plugin label", "Store customers card"),+ "help_text": "Determines if Saleor should store cards on payments"+ " in Braintree customer.",+ "label": "Store customers card",},"Automatic payment capture": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should automaticaly capture payments.",- ),- "label": pgettext_lazy("Plugin label", "Automatic payment capture"),+ "help_text": "Determines if Saleor should automaticaly capture payments.",+ "label": "Automatic payment capture",},"Require 3D secure": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should enforce 3D secure during payment.",- ),- "label": pgettext_lazy("Plugin label", "Require 3D secure"),+ "help_text": "Determines if Saleor should enforce 3D secure during payment.",+ "label": "Require 3D secure",},}diff --git a/saleor/payment/gateways/dummy/plugin.py b/saleor/payment/gateways/dummy/plugin.pyindex a136530b62..72471bf156 100644--- a/saleor/payment/gateways/dummy/plugin.py+++ b/saleor/payment/gateways/dummy/plugin.py@@ -1,7 +1,5 @@from typing import TYPE_CHECKING-from django.utils.translation import pgettext_lazy-from saleor.extensions import ConfigurationTypeFieldfrom saleor.extensions.base_plugin import BasePlugin@@ -38,18 +36,13 @@ class DummyGatewayPlugin(BasePlugin):CONFIG_STRUCTURE = {"Store customers card": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text", "Determines if Saleor should store cards."- ),- "label": pgettext_lazy("Plugin label", "Store customers card"),+ "help_text": "Determines if Saleor should store cards.",+ "label": "Store customers card",},"Automatic payment capture": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should automaticaly capture payments.",- ),- "label": pgettext_lazy("Plugin label", "Automatic payment capture"),+ "help_text": "Determines if Saleor should automaticaly capture payments.",+ "label": "Automatic payment capture",},}diff --git a/saleor/payment/gateways/razorpay/errors.py b/saleor/payment/gateways/razorpay/errors.pyindex d2ff8514b2..192e11f886 100644--- a/saleor/payment/gateways/razorpay/errors.py+++ b/saleor/payment/gateways/razorpay/errors.py@@ -1,13 +1,4 @@-from django.utils.translation import pgettext_lazy--# Define the existing error messages as lazy `pgettext`.-ORDER_NOT_CHARGED = pgettext_lazy("Razorpay payment error", "Order was not charged.")-INVALID_REQUEST = pgettext_lazy(- "Razorpay payment error", "The payment data was invalid."-)-SERVER_ERROR = pgettext_lazy(- "Razorpay payment error", "The order couldn't be proceeded."-)-UNSUPPORTED_CURRENCY = pgettext_lazy(- "Razorpay payment error", "The %(currency)s currency is not supported."-)+ORDER_NOT_CHARGED = "Order was not charged."+INVALID_REQUEST = "The payment data was invalid."+SERVER_ERROR = "The order couldn't be proceeded."+UNSUPPORTED_CURRENCY = "The %(currency)s currency is not supported."diff --git a/saleor/payment/gateways/razorpay/plugin.py b/saleor/payment/gateways/razorpay/plugin.pyindex 029a4a8349..b97dfc48c3 100644--- a/saleor/payment/gateways/razorpay/plugin.py+++ b/saleor/payment/gateways/razorpay/plugin.py@@ -1,7 +1,5 @@from typing import TYPE_CHECKING-from django.utils.translation import pgettext_lazy-from saleor.extensions import ConfigurationTypeFieldfrom saleor.extensions.base_plugin import BasePlugin@@ -29,32 +27,24 @@ class RazorpayGatewayPlugin(BasePlugin):CONFIG_STRUCTURE = {"Public API key": {"type": ConfigurationTypeField.SECRET,- "help_text": pgettext_lazy("Plugin help text", "Provide public API key"),- "label": pgettext_lazy("Plugin label", "Public API key"),+ "help_text": "Provide public API key",+ "label": "Public API key",},"Secret API key": {"type": ConfigurationTypeField.SECRET,- "help_text": pgettext_lazy(- "Plugin help text", "Provide Stripe secret API key"- ),- "label": pgettext_lazy("Plugin label", "Secret API key"),+ "help_text": "Provide Stripe secret API key",+ "label": "Secret API key",},"Store customers card": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should store cards on payments"- "in Stripe customer.",- ),- "label": pgettext_lazy("Plugin label", "Store customers card"),+ "help_text": "Determines if Saleor should store cards on payments"+ "in Stripe customer.",+ "label": "Store customers card",},"Automatic payment capture": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should automaticaly capture payments.",- ),- "label": pgettext_lazy("Plugin label", "Automatic payment capture"),+ "help_text": "Determines if Saleor should automaticaly capture payments.",+ "label": "Automatic payment capture",},}diff --git a/saleor/payment/gateways/stripe/plugin.py b/saleor/payment/gateways/stripe/plugin.pyindex ef201eb01e..ad8fa4153d 100644--- a/saleor/payment/gateways/stripe/plugin.py+++ b/saleor/payment/gateways/stripe/plugin.py@@ -1,7 +1,5 @@from typing import TYPE_CHECKING, List-from django.utils.translation import pgettext_lazy-from saleor.extensions import ConfigurationTypeFieldfrom saleor.extensions.base_plugin import BasePlugin@@ -39,34 +37,24 @@ class StripeGatewayPlugin(BasePlugin):CONFIG_STRUCTURE = {"Public API key": {"type": ConfigurationTypeField.SECRET,- "help_text": pgettext_lazy(- "Plugin help text", "Provide Stripe public API key"- ),- "label": pgettext_lazy("Plugin label", "Public API key"),+ "help_text": "Provide Stripe public API key",+ "label": "Public API key",},"Secret API key": {"type": ConfigurationTypeField.SECRET,- "help_text": pgettext_lazy(- "Plugin help text", "Provide Stripe secret API key"- ),- "label": pgettext_lazy("Plugin label", "Secret API key"),+ "help_text": "Provide Stripe secret API key",+ "label": "Secret API key",},"Store customers card": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should store cards on payments"- "in Stripe customer.",- ),- "label": pgettext_lazy("Plugin label", "Store customers card"),+ "help_text": "Determines if Saleor should store cards on payments"+ "in Stripe customer.",+ "label": "Store customers card",},"Automatic payment capture": {"type": ConfigurationTypeField.BOOLEAN,- "help_text": pgettext_lazy(- "Plugin help text",- "Determines if Saleor should automaticaly capture payments.",- ),- "label": pgettext_lazy("Plugin label", "Automatic payment capture"),+ "help_text": "Determines if Saleor should automaticaly capture payments.",+ "label": "Automatic payment capture",},}