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):
19 template_name = 'club/payment/payu.html'
21 def __init__(self, pos_id):
24 def initiate(self, request, schedule):
25 # Create Order at once.
26 from .models import PayUOrder
27 order = PayUOrder.objects.create(
29 customer_ip=request.META['REMOTE_ADDR'],
35 class PayURe(PaymentMethod):
37 template_name = 'club/payment/payu-re.html'
40 def __init__(self, pos_id):
43 def initiate(self, request, schedule):
44 return reverse('club_payu_rec_payment', args=[schedule.key])
46 def pay(self, request, schedule):
47 # Create order, put it and see what happens next.
48 from .models import PayUOrder
49 if request is not None:
50 ip = request.META['REMOTE_ADDR']
53 order = PayUOrder.objects.create(
61 class PayPal(PaymentMethod):
63 template_name = 'club/payment/paypal.html'
67 def initiate(self, request, schedule):
68 return reverse('club_dummy_payment', args=[schedule.key])
71 pos = getattr(settings, 'CLUB_PAYU_RECURRING_POS', None)
73 recurring_payment_method = PayURe(pos)
75 recurring_payment_method = None
77 pos = getattr(settings, 'CLUB_PAYU_POS', None)
79 single_payment_method = PayU(pos)
81 single_payment_method = None