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 if request is not None:
49 ip = request.META['REMOTE_ADDR']
52 order = PayUOrder.objects.create(
60 class PayPal(PaymentMethod):
62 name = 'PayPal (płatność odnawialna)'
63 template_name = 'club/payment/paypal.html'
67 def initiate(self, request, schedule):
68 return reverse('club_dummy_payment', args=[schedule.key])
73 pos= getattr(settings, 'CLUB_PAYU_RECURRING_POS', None)
75 payure_method = PayURe(pos)
76 methods.append(payure_method)
80 pos = getattr(settings, 'CLUB_PAYU_POS', None)
82 payu_method = PayU(pos)
83 methods.append(payu_method)
88 #methods.append(PayPal())