1 from django.conf import settings
2 from django.urls import reverse
5 class PaymentMethod(object):
8 def initiate(self, request, schedule):
9 return reverse('club_dummy_payment', args=[schedule.key])
12 class PayU(PaymentMethod):
15 template_name = 'club/payment/payu.html'
17 def __init__(self, pos_id):
20 def initiate(self, request, schedule):
21 # Create Order at once.
22 from .models import PayUOrder
23 order = PayUOrder.objects.create(
25 customer_ip=request.META['REMOTE_ADDR'],
31 class PayURe(PaymentMethod):
33 name = 'PayU Recurring'
34 template_name = 'club/payment/payu-re.html'
37 def __init__(self, pos_id):
40 def initiate(self, request, schedule):
41 return reverse('club_payu_rec_payment', args=[schedule.key])
43 def pay(self, request, schedule):
44 # Create order, put it and see what happens next.
45 from .models import PayUOrder
46 order = PayUOrder.objects.create(
48 customer_ip=request.META['REMOTE_ADDR'],
54 class PayPalRe(PaymentMethod):
56 name = 'PayPal Recurring'
57 template_name = 'club/payment/paypal-re.html'
60 def initiate(self, request, schedule):
61 return reverse('club_dummy_payment', args=[schedule.key])
66 pos = getattr(settings, 'CLUB_PAYU_POS', None)
68 payu_method = PayU(pos)
69 methods.append(payu_method)
73 pos= getattr(settings, 'CLUB_PAYU_RECURRING_POS', None)
75 payure_method = PayURe(pos)
76 methods.append(payure_method)
81 methods.append(PayPalRe())