Skip to content

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

Add template path to braintree plugin gateway settings

Jakub Draganek02bf19cd5866
diff --git a/saleor/order/views.py b/saleor/order/views.py
index 6a07aa5a62..fa07e3ae78 100644
--- a/saleor/order/views.py
+++ b/saleor/order/views.py
@@ -1,6 +1,5 @@
import logging
-from django.conf import settings
from django.contrib import auth, messages
from django.contrib.auth.decorators import login_required
from django.db import transaction
diff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.py
index f7638e201d..8d009d1f10 100644
--- a/saleor/payment/gateways/braintree/plugin.py
+++ b/saleor/payment/gateways/braintree/plugin.py
@@ -38,6 +38,13 @@ def require_active_plugin(fn):
class BraintreeGatewayPlugin(BasePlugin):
PLUGIN_NAME = "braintree"
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"),
+ },
"Public API key": {
"type": ConfigurationTypeField.STRING,
"help_text": pgettext_lazy(
@@ -114,7 +121,7 @@ class BraintreeGatewayPlugin(BasePlugin):
"public_key": configuration["Public API key"],
"private_key": configuration["Secret API key"],
},
- template_path="",
+ template_path=configuration["Template path"],
store_customer=configuration["Store customers card"],
require_3d_secure=configuration["Require 3D secure"],
)
@@ -126,6 +133,7 @@ class BraintreeGatewayPlugin(BasePlugin):
"description": "",
"active": False,
"configuration": [
+ {"name": "Template path", "value": "order/payment/braintree.html"},
{"name": "Public API key", "value": ""},
{"name": "Secret API key", "value": ""},
{"name": "Use sandbox", "value": True},
@@ -187,3 +195,7 @@ class BraintreeGatewayPlugin(BasePlugin):
@require_active_plugin
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