Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove get_payment_template and taxes_are_anabled methods from payment
IKarbowiak9aaf5ae2fd9d
diff --git a/saleor/core/payments.py b/saleor/core/payments.pyindex a58458484d..af1fecad2e 100644--- a/saleor/core/payments.py+++ b/saleor/core/payments.py@@ -61,7 +61,3 @@ class PaymentInterface(ABC):self, gateway: str, customer_id: str) -> List["CustomerSource"]:pass-- @abstractmethod- def get_payment_template(self, gateway: str) -> str:- passdiff --git a/saleor/extensions/base_plugin.py b/saleor/extensions/base_plugin.pyindex 3dd380bfe8..64f0e0b37f 100644--- a/saleor/extensions/base_plugin.py+++ b/saleor/extensions/base_plugin.py@@ -150,14 +150,6 @@ class BasePlugin:"""return NotImplemented- def taxes_are_enabled(self, previous_value: bool) -> bool:- """Define if checkout should add info about included taxes.-- It is used only by the old storefront. It adds a tax section to the checkout- view.- """- return NotImplemented-def apply_taxes_to_shipping_price_range(self, prices: MoneyRange, country: Country, previous_value: TaxedMoneyRange) -> TaxedMoneyRange:@@ -313,9 +305,6 @@ class BasePlugin:def get_client_token(self, token_config, previous_value):return NotImplemented- def get_payment_template(self, previous_value):- return NotImplemented-def get_payment_config(self, previous_value):return NotImplementeddiff --git a/saleor/extensions/manager.py b/saleor/extensions/manager.pyindex ebaa7d6a7a..09f93a9bdd 100644--- a/saleor/extensions/manager.py+++ b/saleor/extensions/manager.py@@ -150,10 +150,6 @@ class ExtensionsManager(PaymentInterface):default_value = Falsereturn self.__run_method_on_plugins("show_taxes_on_storefront", default_value)- def taxes_are_enabled(self) -> bool:- default_value = False- return self.__run_method_on_plugins("taxes_are_enabled", default_value)-def apply_taxes_to_product(self, product: "Product", price: Money, country: Country):@@ -308,12 +304,6 @@ class ExtensionsManager(PaymentInterface):for plugin_name in payment_plugins]- def get_payment_template(self, gateway: str) -> str:- method_name = "get_payment_template"- default_value = None- gtw = self.get_plugin(gateway)- return self.__run_method_on_single_plugin(gtw, method_name, default_value)-def __get_payment_config(self, gateway: str) -> List[dict]:method_name = "get_payment_config"default_value = []diff --git a/saleor/extensions/plugins/avatax/plugin.py b/saleor/extensions/plugins/avatax/plugin.pyindex 8c5f8ec9fb..9fa9ce1e2d 100644--- a/saleor/extensions/plugins/avatax/plugin.py+++ b/saleor/extensions/plugins/avatax/plugin.py@@ -418,13 +418,6 @@ class AvataxPlugin(BasePlugin):return previous_valuereturn False- def taxes_are_enabled(self, previous_value: bool) -> bool:- self._initialize_plugin_configuration()-- if not self.active:- return previous_value- return True-@classmethoddef validate_plugin_configuration(cls, plugin_configuration: "PluginConfiguration"):"""Validate if provided configuration is correct."""diff --git a/saleor/extensions/plugins/vatlayer/plugin.py b/saleor/extensions/plugins/vatlayer/plugin.pyindex c9122889f5..962e180f11 100644--- a/saleor/extensions/plugins/vatlayer/plugin.py+++ b/saleor/extensions/plugins/vatlayer/plugin.py@@ -192,13 +192,6 @@ class VatlayerPlugin(BasePlugin):return previous_valuereturn True- def taxes_are_enabled(self, previous_value: bool) -> bool:- self._initialize_plugin_configuration()-- if not self.active:- return previous_value- return True-def apply_taxes_to_shipping_price_range(self, prices: MoneyRange, country: Country, previous_value: TaxedMoneyRange) -> TaxedMoneyRange:diff --git a/saleor/payment/gateway.py b/saleor/payment/gateway.pyindex 449cfd0d70..dfbd40f8a4 100644--- a/saleor/payment/gateway.py+++ b/saleor/payment/gateway.py@@ -213,10 +213,6 @@ def list_gateways() -> List[dict]:return get_extensions_manager().list_payment_gateways()-def get_template_path(gateway: str) -> str:- return get_extensions_manager().get_payment_template(gateway)--def _fetch_gateway_response(fn, *args, **kwargs):response, error = None, Nonetry:diff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.pyindex 870c5af5bc..dd396f0d7a 100644--- a/saleor/payment/gateways/braintree/plugin.py+++ b/saleor/payment/gateways/braintree/plugin.py@@ -201,10 +201,6 @@ class BraintreeGatewayPlugin(BasePlugin):def get_client_token(self, token_config: "TokenConfig", previous_value):return get_client_token(self._get_gateway_config(), token_config)- @require_active_plugin- def get_payment_template(self, previous_value) -> str:- return self._get_gateway_config().template_path-@require_active_plugindef get_payment_config(self, previous_value):config = self._get_gateway_config()diff --git a/saleor/payment/gateways/dummy/plugin.py b/saleor/payment/gateways/dummy/plugin.pyindex 47836672bc..161e30ae7f 100644--- a/saleor/payment/gateways/dummy/plugin.py+++ b/saleor/payment/gateways/dummy/plugin.py@@ -151,10 +151,6 @@ class DummyGatewayPlugin(BasePlugin):def get_client_token(self, token_config: "TokenConfig", previous_value):return get_client_token()- @require_active_plugin- def get_payment_template(self, previous_value) -> str:- return self._get_gateway_config().template_path-@require_active_plugindef get_payment_config(self, previous_value):config = self._get_gateway_config()diff --git a/saleor/payment/gateways/razorpay/plugin.py b/saleor/payment/gateways/razorpay/plugin.pyindex 4cde9e847c..27730a0db6 100644--- a/saleor/payment/gateways/razorpay/plugin.py+++ b/saleor/payment/gateways/razorpay/plugin.py@@ -128,10 +128,6 @@ class RazorpayGatewayPlugin(BasePlugin):) -> "GatewayResponse":return process_payment(payment_information, self._get_gateway_config())- @require_active_plugin- def get_payment_template(self, previous_value) -> str:- return self._get_gateway_config().template_path-@require_active_plugindef create_form(self, data, payment_information: "PaymentData", previous_valuediff --git a/tests/extensions/plugins/test_avatax.py b/tests/extensions/plugins/test_avatax.pyindex 467f340b92..656c1ecc58 100644--- a/tests/extensions/plugins/test_avatax.py+++ b/tests/extensions/plugins/test_avatax.py@@ -410,14 +410,6 @@ def test_save_plugin_configuration_cannot_be_enabled_without_config(settings):manager.save_plugin_configuration("Avalara", {"active": True})-def test_taxes_are_enabled(settings):- settings.PLUGINS = ["saleor.extensions.plugins.avatax.plugin.AvataxPlugin"]- settings.AVATAX_USERNAME_OR_ACCOUNT = "test"- settings.AVATAX_PASSWORD_OR_LICENSE = "test"- manager = get_extensions_manager()- assert manager.taxes_are_enabled() is True--def test_show_taxes_on_storefront(settings):settings.PLUGINS = ["saleor.extensions.plugins.avatax.plugin.AvataxPlugin"]settings.AVATAX_USERNAME_OR_ACCOUNT = "test"diff --git a/tests/extensions/sample_plugins.py b/tests/extensions/sample_plugins.pyindex 6a664adb93..3d6a025b55 100644--- a/tests/extensions/sample_plugins.py+++ b/tests/extensions/sample_plugins.py@@ -85,9 +85,6 @@ class PluginSample(BasePlugin):def show_taxes_on_storefront(self, previous_value: bool) -> bool:return True- def taxes_are_enabled(self, previous_value: bool) -> bool:- return True-def apply_taxes_to_product(self, product, price, country, previous_value, **kwargs):price = Money("1.0", price.currency)return TaxedMoney(price, price)diff --git a/tests/extensions/test_manager.py b/tests/extensions/test_manager.pyindex 0068493b20..ad04f94826 100644--- a/tests/extensions/test_manager.py+++ b/tests/extensions/test_manager.py@@ -140,14 +140,6 @@ def test_manager_show_taxes_on_storefront(plugins, show_taxes):assert show_taxes == ExtensionsManager(plugins=plugins).show_taxes_on_storefront()- "plugins, taxes_enabled",- [(["tests.extensions.sample_plugins.PluginSample"], True), ([], False)],-)-def test_manager_taxes_are_enabled(plugins, taxes_enabled):- assert taxes_enabled == ExtensionsManager(plugins=plugins).taxes_are_enabled()--@pytest.mark.parametrize("plugins, price",[(["tests.extensions.sample_plugins.PluginSample"], "1.0"), ([], "10.0")],