Skip to content

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

Extend dummy gateway with template path config line

Jakub Draganek5feb6cc82203
diff --git a/saleor/extensions/base_plugin.py b/saleor/extensions/base_plugin.py
index 08ee00fe51..9b1c06a13c 100644
--- a/saleor/extensions/base_plugin.py
+++ b/saleor/extensions/base_plugin.py
@@ -174,6 +174,9 @@ class BasePlugin:
def get_client_token(self, token_config, previous_value):
return NotImplemented
+ def get_payment_template(self, previous_value):
+ return NotImplemented
+
@classmethod
def _update_config_items(
cls, configuration_to_update: List[dict], current_config: List[dict]
diff --git a/saleor/payment/gateways/dummy/plugin.py b/saleor/payment/gateways/dummy/plugin.py
index 1ef9644adf..352972ff30 100644
--- a/saleor/payment/gateways/dummy/plugin.py
+++ b/saleor/payment/gateways/dummy/plugin.py
@@ -38,6 +38,13 @@ def require_active_plugin(fn):
class DummyGatewayPlugin(BasePlugin):
PLUGIN_NAME = GATEWAY_NAME
CONFIG_STRUCTURE = {
+ "Template path": {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": pgettext_lazy(
+ "Plugin help text", "Location of django payment template for gateway."
+ ),
+ "label": pgettext_lazy("Plugin label", "Template path"),
+ },
"Store customers card": {
"type": ConfigurationTypeField.BOOLEAN,
"help_text": pgettext_lazy(
@@ -77,7 +84,7 @@ class DummyGatewayPlugin(BasePlugin):
gateway_name=GATEWAY_NAME,
auto_capture=configuration["Automatic payment capture"],
connection_params={},
- template_path="",
+ template_path=configuration["Template path"],
store_customer=configuration["Store customers card"],
)
@@ -90,6 +97,7 @@ class DummyGatewayPlugin(BasePlugin):
"configuration": [
{"name": "Store customers card", "value": False},
{"name": "Automatic payment capture", "value": True},
+ {"name": "Template path", "value": "order/payment/dummy.html"},
],
}
return defaults
@@ -142,3 +150,7 @@ class DummyGatewayPlugin(BasePlugin):
@require_active_plugin
def get_client_token(self, token_config: "TokenConfig", previous_value):
return get_client_token()
+
+ @require_active_plugin
+ def get_payment_template(self, previous_value):
+ return self._get_gateway_config().template_path