Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add table with all payment gateways
Mira Szewczykace53dad41f0
diff --git a/saleor/dashboard/payments/views.py b/saleor/dashboard/payments/views.pyindex eb36441dc1..ed2245396f 100644--- a/saleor/dashboard/payments/views.py+++ b/saleor/dashboard/payments/views.py@@ -3,14 +3,27 @@ from typing import TYPE_CHECKINGfrom django.contrib.auth.decorators import permission_requiredfrom django.template.response import TemplateResponse+from ...payment.gateways.braintree.plugin import BraintreeGatewayPlugin+from ...payment.gateways.dummy.plugin import DummyGatewayPlugin+from ...payment.gateways.razorpay.plugin import RazorpayGatewayPlugin+from ...payment.gateways.stripe.plugin import StripeGatewayPluginfrom ..views import staff_member_requiredif TYPE_CHECKING:from django.http import HttpRequest+GATEWAYS_PLUGINS = [+ BraintreeGatewayPlugin,+ DummyGatewayPlugin,+ RazorpayGatewayPlugin,+ StripeGatewayPlugin,+]+@staff_member_required@permission_required("extensions.manage_plugins")def index(request: "HttpRequest") -> TemplateResponse:- ctx = {}+ payment_gateways = [gateway.PLUGIN_NAME for gateway in GATEWAYS_PLUGINS]++ ctx = {"payment_gateways": payment_gateways}return TemplateResponse(request, "dashboard/payments/index.html", ctx)diff --git a/templates/dashboard/payments/index.html b/templates/dashboard/payments/index.htmlindex 789b439ab2..c6e45e3acf 100644--- a/templates/dashboard/payments/index.html+++ b/templates/dashboard/payments/index.html@@ -7,3 +7,46 @@{% block title %}{% trans "Payments" context "Dashboard payments form" %} - {{ block.super }}{% endblock %}++{% block body_class %}body-customers{% endblock %}+{% block menu_payments_class %}active{% endblock %}++{% block breadcrumbs %}+<ul class="breadcrumbs" >+ <li class="visible-s">+ {% trans "Payments configuration" context "Dashboard payment configuration page" %}+ </li>+</ul>+{% endblock %}++{% block content %}+<div class="row">+ <div class="col s12 l9">+ {% if payment_gateways %}+ <div class="card">+ <div class="data-table-container">+ <table class="bordered highlight responsive data-table">+ <thead>+ <tr>+ {% trans "Name" context "Payment gateways table header" as label %}+ {% sorting_header 'name' label %}+ </tr>+ </thead>+ <tbody>+ {% for gateway in payment_gateways%}+ <tr data-action-go="">+ <td>+ {{ gateway }}+ </td>+ </tr>+ {% endfor %}+ </tbody>+ </table>+ </div>+ </div>+ {% paginate payment_gateways %}+ {% else %}+ {% endif %}+ </div>+</div>+{% endblock %}