Make payment options db configurable

This commit is contained in:
Kumi 2021-05-24 14:02:50 +02:00
parent d6b7748245
commit 4b2ab3640c

View file

@ -9,6 +9,8 @@ from django.http import Http404
from smsauth.views import requestToken from smsauth.views import requestToken
from buyer.views import getCard, sendStatus from buyer.views import getCard, sendStatus
from ledger.models import Payment from ledger.models import Payment
from dbsettings.functions import getValue
from decimal import Decimal
def makeCardURL(card): def makeCardURL(card):
return CardURL.objects.create(card=card) # pylint: disable=E1101 return CardURL.objects.create(card=card) # pylint: disable=E1101
@ -32,7 +34,7 @@ class SMSAuthView(LoginRequiredMixin, FormView):
except: except:
return redirect("unavailable") return redirect("unavailable")
if not card.delivered: if not card.delivered:
Payment.objects.create(description="Paysafecard", amount=11, card=card) # pylint: disable=E1101 Payment.objects.create(description=getValue("ledger.description", "Paysafecard"), amount=Decimal(getValue("ledger.amount", 11)), card=card) # pylint: disable=E1101
return redirect(return_url) return redirect(return_url)
class CardView(LoginRequiredMixin, DetailView): class CardView(LoginRequiredMixin, DetailView):
@ -51,4 +53,4 @@ class CardView(LoginRequiredMixin, DetailView):
return obj return obj
class UnavailableView(LoginRequiredMixin, TemplateView): class UnavailableView(LoginRequiredMixin, TemplateView):
template_name = "frontend/unavailable.html" template_name = "frontend/unavailable.html"