source: main/waeup.kofa/trunk/src/waeup/kofa/payments/payment.py @ 8197

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

Store utc without tzinfo in persistent datetime objects. Localisation will be done in views only.

  • Property svn:keywords set to Id
File size: 2.2 KB
RevLine 
[7195]1## $Id: payment.py 8194 2012-04-17 11:40:06Z henrik $
2##
[6864]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
[6869]22from datetime import datetime
[6864]23from grok import index
[8182]24from zope.component import getUtility
25from waeup.kofa.interfaces import IKofaUtils
[7811]26from waeup.kofa.payments.interfaces import (
[7627]27    IPayment, ISCPayment, IOnlinePayment,
28    payment_states, payment_categories)
[7811]29from waeup.kofa.utils.helpers import attrs_to_fields
[6864]30
31class Payment(grok.Container):
32    """This is a payment.
33    """
34    grok.implements(IPayment)
35    grok.provides(IPayment)
36    grok.baseclass()
37
38    def __init__(self):
39        super(Payment, self).__init__()
[8194]40        self.creation_date = datetime.utcnow()
[6869]41        self.p_id = None
[6864]42        return
43
[6869]44    @property
45    def state(self):
46        return payment_states.getTermByToken(self.p_state).title
47
48    @property
49    def category(self):
50        return payment_categories.getTermByToken(self.p_category).title
51
[6864]52class SCPayment(Payment):
53    """This is a scratch card payment.
54    """
55    grok.implements(ISCPayment)
56    grok.provides(ISCPayment)
57
58    def __init__(self):
59        super(SCPayment, self).__init__()
[6869]60        p_id = None
[6864]61        return
62
63SCPayment = attrs_to_fields(SCPayment)
64
65class OnlinePayment(Payment):
66    """This is an online payment.
67    """
68    grok.implements(IOnlinePayment)
69    grok.provides(IOnlinePayment)
70
71    def __init__(self):
72        super(OnlinePayment, self).__init__()
[6869]73        p_id = None
[6864]74        return
75
[7811]76OnlinePayment = attrs_to_fields(OnlinePayment)
Note: See TracBrowser for help on using the repository browser.