|
|
|
|
@ -14,7 +14,7 @@ from django.http import HttpResponse, Http404 |
|
|
|
|
from django.shortcuts import redirect, get_object_or_404 |
|
|
|
|
from django.views.generic import View, TemplateView |
|
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
|
from django.urls import reverse |
|
|
|
|
from django.urls import reverse_lazy |
|
|
|
|
from django.utils.decorators import method_decorator |
|
|
|
|
from django.utils.timezone import now |
|
|
|
|
|
|
|
|
|
@ -59,7 +59,7 @@ class SchoolBuySuccessView(TemplateView): |
|
|
|
|
|
|
|
|
|
@method_decorator(login_required, name='dispatch') |
|
|
|
|
class CourseBuyView(TemplateView): |
|
|
|
|
template_name = 'payment/paymentwall_widget.html' |
|
|
|
|
template_name = 'payment/pay.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, pk=None, *args, **kwargs): |
|
|
|
|
use_bonuses = request.GET.get('use_bonuses') |
|
|
|
|
@ -119,7 +119,6 @@ class CourseBuyView(TemplateView): |
|
|
|
|
|
|
|
|
|
@method_decorator(login_required, name='dispatch') |
|
|
|
|
class SchoolBuyView(TemplateView): |
|
|
|
|
# template_name = 'payment/paymentwall_widget.html' |
|
|
|
|
template_name = 'payment/pay.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
@ -156,7 +155,7 @@ class SchoolBuyView(TemplateView): |
|
|
|
|
school_payment.bonus = bonus |
|
|
|
|
school_payment.save() |
|
|
|
|
if school_payment.is_paid(): |
|
|
|
|
return redirect('%s?duration=%s' % (reverse('payment-success'), duration)) |
|
|
|
|
return redirect('%s?duration=%s' % (str(reverse_lazy('payment-success')), duration)) |
|
|
|
|
if payment_id and school_payment.bonus and not use_bonuses: |
|
|
|
|
bonus = school_payment.bonus |
|
|
|
|
school_payment.amount += school_payment.bonus |
|
|
|
|
@ -178,8 +177,8 @@ class SchoolBuyView(TemplateView): |
|
|
|
|
'evaluation': 1, |
|
|
|
|
'demo': 1, |
|
|
|
|
'test_mode': 1, |
|
|
|
|
'success_url': host + reverse('payment-success') + '?duration=%s' % duration, |
|
|
|
|
'failure_url': host + reverse('payment-error'), |
|
|
|
|
'success_url': host + str(reverse_lazy('payment-success')) + '?duration=%s' % duration, |
|
|
|
|
'failure_url': host + str(reverse_lazy('payment-error')), |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
if self.request.is_ajax(): |
|
|
|
|
@ -193,7 +192,7 @@ class SchoolBuyView(TemplateView): |
|
|
|
|
|
|
|
|
|
@method_decorator(login_required, name='dispatch') |
|
|
|
|
class DrawingCampBuyView(TemplateView): |
|
|
|
|
template_name = 'payment/paymentwall_widget.html' |
|
|
|
|
template_name = 'payment/pay.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
host = urlsplit(self.request.META.get('HTTP_REFERER')) |
|
|
|
|
@ -411,7 +410,7 @@ class GiftCertificatesView(TemplateView): |
|
|
|
|
@method_decorator(login_required, name='dispatch') |
|
|
|
|
class GiftCertificateBuyView(TemplateView): |
|
|
|
|
model = GiftCertificate |
|
|
|
|
template_name = 'payment/paymentwall_widget.html' |
|
|
|
|
template_name = 'payment/pay.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, pk, *args, **kwargs): |
|
|
|
|
gift_certificate = get_object_or_404(GiftCertificate, pk=pk) |
|
|
|
|
|