1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.conf import settings
5 from django.urls import reverse
8 class PaymentMethod(object):
12 def initiate(self, request, schedule):
13 return reverse('club_dummy_payment', args=[schedule.key])
16 class PayU(PaymentMethod):
20 template_name = 'club/payment/payu.html'
22 def __init__(self, pos_id):
25 def initiate(self, request, schedule):
26 # Create Order at once.
27 from .models import PayUOrder
28 order = PayUOrder.objects.create(
30 customer_ip=request.META['REMOTE_ADDR'],
36 class PayURe(PaymentMethod):
38 name = 'PayU (płatność odnawialna)'
39 template_name = 'club/payment/payu-re.html'
42 def __init__(self, pos_id):
45 def initiate(self, request, schedule):
46 return reverse('club_payu_rec_payment', args=[schedule.key])
48 def pay(self, request, schedule):
49 # Create order, put it and see what happens next.
50 from .models import PayUOrder
51 if request is not None:
52 ip = request.META['REMOTE_ADDR']
55 order = PayUOrder.objects.create(
63 class PayPal(PaymentMethod):
65 name = 'PayPal (płatność odnawialna)'
66 template_name = 'club/payment/paypal.html'
70 def initiate(self, request, schedule):
71 return reverse('club_dummy_payment', args=[schedule.key])
76 pos= getattr(settings, 'CLUB_PAYU_RECURRING_POS', None)
78 payure_method = PayURe(pos)
79 methods.append(payure_method)
83 pos = getattr(settings, 'CLUB_PAYU_POS', None)
85 payu_method = PayU(pos)
86 methods.append(payu_method)
91 #methods.append(PayPal())