source: main/waeup.sirp/trunk/src/waeup/sirp/payments/payment.py @ 6946

Last change on this file since 6946 was 6875, checked in by Henrik Bettermann, 13 years ago

Add StudentOnlinePayment? class (including factory) which also implements IStudentNavigation.

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
2## This program is free software; you can redistribute it and/or modify
3## it under the terms of the GNU General Public License as published by
4## the Free Software Foundation; either version 2 of the License, or
5## (at your option) any later version.
6##
7## This program is distributed in the hope that it will be useful,
8## but WITHOUT ANY WARRANTY; without even the implied warranty of
9## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10## GNU General Public License for more details.
11##
12## You should have received a copy of the GNU General Public License
13## along with this program; if not, write to the Free Software
14## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15##
16"""
17These are the payment tickets.
18"""
19import grok
20from datetime import datetime
21from grok import index
22from waeup.sirp.payments.interfaces import (
23    IPayment, ISCPayment, IOnlinePayment)
24from waeup.sirp.utils.helpers import attrs_to_fields
25from waeup.sirp.payments.vocabularies import payment_states, payment_categories
26
27class Payment(grok.Container):
28    """This is a payment.
29    """
30    grok.implements(IPayment)
31    grok.provides(IPayment)
32    grok.baseclass()
33
34    def __init__(self):
35        super(Payment, self).__init__()
36        self.creation_date = datetime.now()
37        self.p_id = None
38        return
39
40    @property
41    def state(self):
42        return payment_states.getTermByToken(self.p_state).title
43
44    @property
45    def category(self):
46        return payment_categories.getTermByToken(self.p_category).title
47
48class SCPayment(Payment):
49    """This is a scratch card payment.
50    """
51    grok.implements(ISCPayment)
52    grok.provides(ISCPayment)
53
54    def __init__(self):
55        super(SCPayment, self).__init__()
56        p_id = None
57        return
58
59SCPayment = attrs_to_fields(SCPayment)
60
61class OnlinePayment(Payment):
62    """This is an online payment.
63    """
64    grok.implements(IOnlinePayment)
65    grok.provides(IOnlinePayment)
66
67    def __init__(self):
68        super(OnlinePayment, self).__init__()
69        p_id = None
70        return
71
72OnlinePayment = attrs_to_fields(OnlinePayment)
Note: See TracBrowser for help on using the repository browser.