1 from django.conf import settings
2 from django.urls import reverse
5 class PaymentMethod(object):
9 def initiate(self, request, schedule):
10 return reverse('club_dummy_payment', args=[schedule.key])
13 class PayU(PaymentMethod):
17 template_name = 'club/payment/payu.html'
19 def __init__(self, pos_id):
22 def initiate(self, request, schedule):
23 # Create Order at once.
24 from .models import PayUOrder
25 order = PayUOrder.objects.create(
27 customer_ip=request.META['REMOTE_ADDR'],
33 class PayURe(PaymentMethod):
35 name = 'PayU (płatność odnawialna)'
36 template_name = 'club/payment/payu-re.html'
39 def __init__(self, pos_id):
42 def initiate(self, request, schedule):
43 return reverse('club_payu_rec_payment', args=[schedule.key])
45 def pay(self, request, schedule):
46 # Create order, put it and see what happens next.
47 from .models import PayUOrder
48 order = PayUOrder.objects.create(
50 customer_ip=request.META['REMOTE_ADDR'],
56 class PayPal(PaymentMethod):
58 name = 'PayPal (płatność odnawialna)'
59 template_name = 'club/payment/paypal.html'
63 def initiate(self, request, schedule):
64 return reverse('club_dummy_payment', args=[schedule.key])
69 pos= getattr(settings, 'CLUB_PAYU_RECURRING_POS', None)
71 payure_method = PayURe(pos)
72 methods.append(payure_method)
76 pos = getattr(settings, 'CLUB_PAYU_POS', None)
78 payu_method = PayU(pos)
79 methods.append(payu_method)
84 #methods.append(PayPal())