Skip to content
Snippets Groups Projects
Verified Commit c0636c56 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add payment processing UI (entry point).

parent 147a864f
No related branches found
No related tags found
1 merge request!3Implement payment backends and interaction
Pipeline #58878 failed
This commit is part of merge request !3. Comments created here will be created in the context of that merge request.
{% extends 'core/base.html' %}
{% load i18n %}
{% block content %}
<p class="flow-text">
{% blocktrans %}Tezor (account and payment system){% endblocktrans %}
</p>
{% endblock %}
{% extends 'core/base.html' %}
{% load i18n %}
{% load material_form %}
{% block page_title %}{% blocktrans %}Make payment for{% endblocktrans %} {{ payment.transaction_id }}{% endblock %}
{% block browser_title %}{% blocktrans %}Make payment for{% endblocktrans %} {{ payment.transaction_id }}{% endblock %}
{% block content %}
<form action="{{ form.action }}" method="{{ form.method }}">
{% csrf_token %}
{% form form=form %}{% endform %}
{% trans "Confirm payment" as caption %}
{% include "core/partials/save_button.html" with caption=caption icon="shopping_cart_checkout" %}
</form>
{% endblock %}
......@@ -4,5 +4,6 @@ from . import views
urlpatterns = [
path("payments/", include("payments.urls")),
path("invoice/<int:pk>/print", views.GetInvoicePDF.as_view(), name="get_invoice_by_pk")
path("invoice/<int:pk>/print", views.GetInvoicePDF.as_view(), name="get_invoice_by_pk"),
path("invoice/<str:token>/payment", views.payment_details, name="payment_details"),
]
from django.views.generic import View
from django.shortcuts import render
from django.shortcuts import redirect, render, get_object_or_404
from payments import get_payment_model, RedirectNeeded
from rules.contrib.views import PermissionRequiredMixin
from aleksis.core.views import RenderPDFView
......@@ -20,3 +21,19 @@ class GetInvoicePDF(PermissionRequiredMixin, RenderPDFView):
print(invoice.group.__dict__)
return context
def payment_details(request, token):
payment = get_object_or_404(get_payment_model(), token=token)
try:
form = payment.get_form(data=request.POST or None)
except RedirectNeeded as redirect_to:
return redirect(str(redirect_to))
context = {
"form": form,
"payment": payment,
}
return render(request, "tezor/invoice/payment.html", context)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment