363d4451c029af95dc3dfee8d28d4261a348c7b4
[wolnelektury.git] / src / club / payment_methods.py
1 from django.urls import reverse
2
3
4 class PaymentMethod(object):
5     is_recurring = False
6
7     @classmethod
8     def get_payment_url(cls, schedule):
9         return reverse('club_dummy_payment', args=[schedule.key])
10
11
12 class PayU(PaymentMethod):
13     slug = 'payu'
14     name = 'PayU'
15     template_name = 'club/payment/payu.html'
16
17     @classmethod
18     def get_payment_url(cls, schedule):
19         return reverse('club_dummy_payment', args=[schedule.key])
20
21
22 class PayURe(PaymentMethod):
23     slug='payu-re'
24     name = 'PayU Recurring'
25     template_name = 'club/payment/payu-re.html'
26     is_recurring = True
27
28     @classmethod
29     def get_payment_url(cls, schedule):
30         return reverse('club_dummy_payment', args=[schedule.key])
31
32
33 class PayPalRe(PaymentMethod):
34     slug='paypal-re'
35     name = 'PayPal Recurring'
36     template_name = 'club/payment/paypal-re.html'
37     is_recurring = True
38
39     @classmethod
40     def get_payment_url(cls, schedule):
41         return reverse('club_dummy_payment', args=[schedule.key])
42
43
44 methods = [
45     PayU,
46     PayURe,
47     PayPalRe,
48 ]
49
50 method_by_slug = {
51     m.slug: m
52     for m in methods
53 }