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

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

Move vocabularies to interfaces module.

batchprocessing.txt: fix test

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