Skip to content

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

Remove payment gateways templates

IKarbowiak6a747b0ebc31
diff --git a/saleor/payment/gateways/braintree/plugin.py b/saleor/payment/gateways/braintree/plugin.py
index f7e5eae487..3393b73aec 100644
--- a/saleor/payment/gateways/braintree/plugin.py
+++ b/saleor/payment/gateways/braintree/plugin.py
@@ -36,13 +36,6 @@ def require_active_plugin(fn):
class BraintreeGatewayPlugin(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"),
- },
"Public API key": {
"type": ConfigurationTypeField.SECRET,
"help_text": pgettext_lazy(
@@ -102,10 +95,7 @@ class BraintreeGatewayPlugin(BasePlugin):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.config = GatewayConfig(
- gateway_name=GATEWAY_NAME,
- auto_capture=True,
- template_path="",
- connection_params={},
+ gateway_name=GATEWAY_NAME, auto_capture=True, connection_params={}
)
def _initialize_plugin_configuration(self):
@@ -124,7 +114,6 @@ class BraintreeGatewayPlugin(BasePlugin):
"public_key": configuration["Public API key"],
"private_key": configuration["Secret API key"],
},
- template_path=configuration["Template path"],
store_customer=configuration["Store customers card"],
require_3d_secure=configuration["Require 3D secure"],
)
@@ -136,7 +125,6 @@ class BraintreeGatewayPlugin(BasePlugin):
"description": "",
"active": False,
"configuration": [
- {"name": "Template path", "value": "order/payment/braintree.html"},
{"name": "Public API key", "value": None},
{"name": "Secret API key", "value": None},
{"name": "Use sandbox", "value": True},
diff --git a/saleor/payment/gateways/dummy/plugin.py b/saleor/payment/gateways/dummy/plugin.py
index 9f9228da94..a136530b62 100644
--- a/saleor/payment/gateways/dummy/plugin.py
+++ b/saleor/payment/gateways/dummy/plugin.py
@@ -36,13 +36,6 @@ 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(
@@ -67,7 +60,6 @@ class DummyGatewayPlugin(BasePlugin):
gateway_name=GATEWAY_NAME,
auto_capture=True,
connection_params={},
- template_path="",
store_customer=False,
)
@@ -82,7 +74,6 @@ class DummyGatewayPlugin(BasePlugin):
gateway_name=GATEWAY_NAME,
auto_capture=configuration["Automatic payment capture"],
connection_params={},
- template_path=configuration["Template path"],
store_customer=configuration["Store customers card"],
)
@@ -95,7 +86,6 @@ 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
diff --git a/saleor/payment/gateways/razorpay/plugin.py b/saleor/payment/gateways/razorpay/plugin.py
index 4177832c8c..029a4a8349 100644
--- a/saleor/payment/gateways/razorpay/plugin.py
+++ b/saleor/payment/gateways/razorpay/plugin.py
@@ -27,13 +27,6 @@ def require_active_plugin(fn):
class RazorpayGatewayPlugin(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"),
- },
"Public API key": {
"type": ConfigurationTypeField.SECRET,
"help_text": pgettext_lazy("Plugin help text", "Provide public API key"),
@@ -86,7 +79,6 @@ class RazorpayGatewayPlugin(BasePlugin):
"store_name": None,
"store_image": None,
},
- template_path=configuration["Template path"],
store_customer=configuration["Store customers card"],
)
@@ -97,7 +89,6 @@ class RazorpayGatewayPlugin(BasePlugin):
"description": "",
"active": False,
"configuration": [
- {"name": "Template path", "value": "order/payment/razorpay.html"},
{"name": "Public API key", "value": None},
{"name": "Secret API key", "value": None},
{"name": "Store customers card", "value": False},
diff --git a/saleor/payment/gateways/stripe/plugin.py b/saleor/payment/gateways/stripe/plugin.py
index 13fc73a705..c70b6e51c4 100644
--- a/saleor/payment/gateways/stripe/plugin.py
+++ b/saleor/payment/gateways/stripe/plugin.py
@@ -86,7 +86,6 @@ class StripeGatewayPlugin(BasePlugin):
"public_key": configuration["Public API key"],
"private_key": configuration["Secret API key"],
},
- template_path="",
store_customer=configuration["Store customers card"],
)
diff --git a/saleor/payment/interface.py b/saleor/payment/interface.py
index c9ebbcb464..a0b110afba 100644
--- a/saleor/payment/interface.py
+++ b/saleor/payment/interface.py
@@ -89,7 +89,6 @@ class GatewayConfig:
gateway_name: str
auto_capture: bool
- template_path: str
# Each gateway has different connection data so we are not able to create
# a unified structure
connection_params: Dict[str, Any]
diff --git a/templates/order/_ordered_items_table.html b/templates/order/_ordered_items_table.html
deleted file mode 100644
index ee322b8507..0000000000
--- a/templates/order/_ordered_items_table.html
+++ /dev/null
@@ -1,222 +0,0 @@
-{% load discount_as_negative from voucher %}
-{% load i18n %}
-{% load i18n_address_tags %}
-{% load placeholder %}
-{% load price from taxed_prices %}
-{% load get_product_image_thumbnail from product_images %}
-{% load display_translated_order_line_name from order_lines %}
-
-{% if order.user == user %}
- <div class="order-details__addresses">
- <div class="row">
- {% if order.is_shipping_required %}
- <div class="col-6">
- <h3>
- <b>
- {% trans "Shipping address" context "Order details address title" %}
- </b>
- </h3>
- <hr class="margin-default" />
- {% format_address order.shipping_address %}
- </div>
- {% endif %}
- <div class="col-6">
- <h3>
- <b>
- {% trans "Billing address" context "Order details address title" %}
- </b>
- </h3>
- <hr class="margin-default" />
- {% format_address order.billing_address %}
- </div>
- </div>
- </div>
-{% endif %}
-<div class="table__header order-details__table-header d-none d-sm-block">
- <div class="row">
- <div class="col-md-8">
- <small>
- {% trans "Product" context "Order details column title" %}
- </small>
- </div>
- <div class="col-md-2 text-right">
- <small>
- {% trans "Quantity" context "Order details column title" %}
- </small>
- </div>
- <div class="col-md-2 text-right">
- <small>
- {% trans "Price" context "Order details column title" %}
- </small>
- </div>
- </div>
-</div>
-
-{% for line in order %}
- <div class="table__row order-details__product{% if forloop.last %} order-details__last-row{% endif %}">
- <div class="row">
- <div class="col-md-8 order-details__product__description">
- {% if line.variant %}
- <img data-src="{% get_product_image_thumbnail line.variant.get_first_image size=60 method="thumbnail" %}"
- data-srcset="{% get_product_image_thumbnail line.variant.get_first_image size=60 method="thumbnail" %} 1x, {% get_product_image_thumbnail line.variant.get_first_image size=120 method="thumbnail" %} 2x"
- class="float-left lazyload lazypreload"
- src="{% placeholder size=60 %}">
- <span>{% display_translated_order_line_name line %}</span>
- {% else %}
- <img src="{% placeholder size=60 %}" class="float-left">
- <span>{% display_translated_order_line_name line %}</span>
- {% endif %}
- </div>
- <div class="col-md-4 order-details__product__description">
- <div class="row">
- <div class="col-md-6 col-12">
- <p class="text-right">
- <span>
- x {{ line.quantity }}
- </span>
- </p>
- </div>
- <div class="col-md-6 col-12">
- <p class="text-right">
- {% price line.get_total display_gross=order.display_gross_prices %}
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
-{% endfor %}
-
-<div class="table__row">
- <div class="row">
- <div class="col-8 order-details__table-footer">
- <p>
- {% trans "Subtotal" context "Order details subtotal row text" %}
- </p>
- </div>
- <div class="col-4">
- <p class="float-right">
- {% price order.get_subtotal display_gross=order.display_gross_prices %}
- </p>
- <br>
- </div>
- </div>
-</div>
-
-{% if order.is_shipping_required %}
- <div class="table__row">
- <div class="row">
- <div class="col-8 order-details__table-footer">
- <p>
- {% trans "Shipping" context "Order details shipment row text" %} ({{ order.shipping_method_name|default:"-" }})
- </p>
- </div>
- <div class="col-4">
- <p class="float-right">
- {% price order.shipping_price display_gross=order.display_gross_prices %}
- </p>
- </div>
- </div>
- </div>
-{% endif %}
-
-{% if order.discount_amount %}
-<div class="table__row">
- <div class="row">
- <div class="col-8 order-details__table-footer">
- <p>{{ order.translated_discount_name|default:order.discount_name }}</p>
- </div>
- <div class="col-4">
- <p class="float-right">
- {% discount_as_negative order.discount html=True %}
- </p>
- </div>
- </div>
-</div>
-{% endif %}
-
-<div class="table__row">
- <div class="row">
- <div class="col-8 order-details__table-footer">
- <p>
- {% if order.display_gross_prices %}
- {% trans "Taxes (included)" context "Order details taxes text" %}
- {% else %}
- {% trans "Taxes" context "Order details taxes text" %}
- {% endif %}
- </p>
- </div>
- <div class="col-4">
- <p class="float-right">{% price order.total.tax %}</p>
- </div>
- </div>
-</div>
-
-<div class="order-details__total">
- <div class="row">
- <div class="col-8 order-details__table-footer">
- <div class="total">
- <h3>{% trans "Total" context "Order details total text" %}</h3>
- </div>
- </div>
- <div class="col-4">
- <p class="float-right">
- {% price order.total.gross %}
- </p>
- </div>
- </div>
-</div>
-
-
-{% for fulfillment in fulfillments %}
- <h2 class="order-details__header">
- {% blocktrans trimmed with fulfillment=fulfillment.composed_id context "Order details fulfillment title" %}
- Fulfillment #{{ fulfillment }}
- {% endblocktrans %}
- </h2>
-
- <div class="table__header order-details__table-header d-none d-sm-block">
- <div class="row">
- <div class="col-md-9">
- <small>
- {% trans "Product" context "Order details column title" %}
- </small>
- </div>
- <div class="col-md-3 text-right">
- <small>
- {% trans "Quantity" context "Order details column title" %}
- </small>
- </div>
- </div>
- </div>
- {% for fulfillment_line in fulfillment %}
- <div class="table__row fulfillment__row order-details__product{% if forloop.last %} order-details__last-row{% endif %}">
- <div class="row">
- <div class="col-md-6 col-9 order-details__product__description">
- {% with variant=fulfillment_line.order_line.variant %}
- {% if variant %}
- <span>{% display_translated_order_line_name fulfillment_line.order_line %}</span>
- {% else %}
- <span>{% display_translated_order_line_name fulfillment_line.order_line%}</span>
- {% endif %}
- {% endwith %}
- </div>
- <div class="col-md-6 col-3">
- <p class="float-right">x {{ fulfillment_line.quantity }}</p>
- </div>
- </div>
- </div>
- {% endfor %}
- {% if fulfillment.tracking_number %}
- <div class="order-details__total">
- <div class="row">
- <div class="col-4 order-details__table-footer">
- <p>{% trans "Tracking number" context "Fulfillment tracking number details" %}</p>
- </div>
- <div class="col-8">
- <p class="float-right">{{ fulfillment.tracking_number }}</p>
- </div>
- </div>
- </div>
- {% endif %}
-{% endfor %}
diff --git a/templates/order/payment/braintree.html b/templates/order/payment/braintree.html
deleted file mode 100644
index fb2416925c..0000000000
--- a/templates/order/payment/braintree.html
+++ /dev/null
@@ -1,60 +0,0 @@
-{% extends "order/payment/details.html" %}
-{% load bootstrap_form from bootstrap4 %}
-{% load i18n %}
-{% load l10n %}
-
-{% block forms %}
-<form method="POST" id="payment-form" class="form-horizontal"{% if form.action %} action="{{ form.action }}"{% endif %} novalidate>
- {% csrf_token %}
- {% if form.errors or form.non_field_errors %}
- <blockquote>
- {% for non_field_error in form.non_field_errors %}
- {{ non_field_error }}
- {% endfor %}
- {% for error in form.errors %}
- {{ error }}
- {% endfor %}
- </blockquote>
- {% endif %}
- <div class="form-group">
- <div class="col-sm-2"></div>
- <div class="col-sm-10">
- <div class="bt-drop-in-wrapper">
- <div id="bt-dropin"></div>
- </div>
-
- <input type="hidden" id="nonce" name="payment_method_nonce"/>
- <input type="hidden" id="amount" name="amount" value="{% localize off %}{{ payment.total }}{% endlocalize %}"/>
- <button type="submit" class="btn btn-primary">
- {% trans "Make payment" context "Payment form primary action" %}
- </button>
- </div>
- </div>
-</form>
-
-<script src="https://js.braintreegateway.com/web/dropin/1.13.0/js/dropin.min.js"></script>
-<script>
- var form = document.querySelector('#payment-form');
- var client_token = '{{ client_token }}';
- braintree.dropin.create({
- authorization: client_token,
- container: '#bt-dropin',
- paypal: {
- flow: 'vault'
- }
- }, function (createErr, instance) {
- form.addEventListener('submit', function (event) {
- event.preventDefault();
- instance.requestPaymentMethod(function (err, payload) {
- if (err) {
- console.log('Error', err);
- return;
- }
- // Add the nonce to the form and submit
- document.querySelector('#nonce').value = payload.nonce;
- form.submit();
- });
- });
- });
-</script>
-{% endblock forms %}
diff --git a/templates/order/payment/details.html b/templates/order/payment/details.html
deleted file mode 100644
index 4efffaa45c..0000000000
--- a/templates/order/payment/details.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-{% load i18n %}
-<body>
-
-{% block content %}
- <div class="row checkout">
- <div class="col-lg-1"></div>
- <div class="col-md-6">
- <h1>{% trans "Payment" context "Payment form title" %}</h1>
- {% block forms %}{% endblock %}
- </div>
- </div>
- <h2 class="order-details__header">
- {% trans "Order details" context "Header of the order summary table" %}
- </h2>
- {% include "order/_ordered_items_table.html" %}
-{% endblock content %}
-</body>
-</html>
diff --git a/templates/order/payment/dummy.html b/templates/order/payment/dummy.html
deleted file mode 100644
index b73c0e8024..0000000000
--- a/templates/order/payment/dummy.html
+++ /dev/null
@@ -1,37 +0,0 @@
-{% extends "order/payment/details.html" %}
-{% load bootstrap_form from bootstrap4 %}
-{% load i18n %}
-
-{% block forms %}
-<div class="checkout__payment-form">
- <form method="POST" id="payment-form" class="form-horizontal"{% if form.action %} action="{{ form.action }}"{% endif %} novalidate>
- {% csrf_token %}
- {% if form.errors or form.non_field_errors %}
- <blockquote>
- {% for non_field_error in form.non_field_errors %}
- {{ non_field_error }}
- {% endfor %}
- </blockquote>
- {% endif %}
- {{ form.media }}
- {% for choice in form.charge_status %}
- <div class="radio">
- <label>
- <div class="card card-default">
- <div class="card-body">
- <strong>
- {{choice}}
- </strong>
- </div>
- </div>
- </label>
- </div>
- {% endfor %}
- {% if not form.autosubmit %}
- <button type="submit" class="btn btn-primary">
- {% trans "Make payment" context "Payment form primary action" %}
- </button>
- {% endif %}
- </form>
-</div>
-{% endblock forms %}
diff --git a/templates/order/payment/razorpay.html b/templates/order/payment/razorpay.html
deleted file mode 100644
index c262d9dda2..0000000000
--- a/templates/order/payment/razorpay.html
+++ /dev/null
@@ -1,10 +0,0 @@
-{% extends "order/payment/details.html" %}
-{% load i18n %}
-
-{% block forms %}
- <form method="POST" id="payment-form" {% if form.action %} action="{{ form.action }}"{% endif %} novalidate>
- {% csrf_token %}
- {{ form.media }}
- {{ form }}
- </form>
-{% endblock forms %}
diff --git a/tests/gateway/stripe/test_stripe.py b/tests/gateway/stripe/test_stripe.py
index add0e7689f..1d44d577c3 100644
--- a/tests/gateway/stripe/test_stripe.py
+++ b/tests/gateway/stripe/test_stripe.py
@@ -37,7 +37,6 @@ def gateway_config():
return GatewayConfig(
gateway_name="stripe",
auto_capture=True,
- template_path="template.html",
connection_params={
"public_key": "public",
"private_key": "secret",
diff --git a/tests/gateway/test_braintree.py b/tests/gateway/test_braintree.py
index ddeec03730..bd3181a7b7 100644
--- a/tests/gateway/test_braintree.py
+++ b/tests/gateway/test_braintree.py
@@ -84,7 +84,6 @@ def braintree_error_response(braintree_error):
def gateway_config():
return GatewayConfig(
gateway_name="braintree",
- template_path="template.html",
auto_capture=False,
store_customer=False,
connection_params={
diff --git a/tests/gateway/test_razorpay.py b/tests/gateway/test_razorpay.py
index a3351300d7..1a15dc4f0b 100644
--- a/tests/gateway/test_razorpay.py
+++ b/tests/gateway/test_razorpay.py
@@ -27,7 +27,6 @@ def gateway_config():
return GatewayConfig(
gateway_name="razorpay",
auto_capture=False,
- template_path="template.html",
connection_params={
"public_key": "public",
"private_key": "secret",
diff --git a/tests/test_payment.py b/tests/test_payment.py
index 4c8ed15e7c..968353724f 100644
--- a/tests/test_payment.py
+++ b/tests/test_payment.py
@@ -68,7 +68,6 @@ def gateway_config():
return GatewayConfig(
gateway_name="Dummy",
auto_capture=True,
- template_path="template.html",
connection_params={"secret-key": "nobodylikesspanishinqusition"},
)