source: main/waeup.kofa/backup-trunk/src/waeup/kofa/payments/interfaces.py @ 10009

Last change on this file since 10009 was 8944, checked in by Henrik Bettermann, 12 years ago

creation_date is not required.

Strip hash symbol also of datetime strings.

  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1## $Id: interfaces.py 8944 2012-07-08 14:40:59Z 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##
18from zope.interface import Attribute
19from zope import schema
20from waeup.kofa.interfaces import (
21    IKofaObject, SimpleKofaVocabulary, academic_sessions_vocab)
22from waeup.kofa.interfaces import MessageFactory as _
23
24payment_states = SimpleKofaVocabulary(
25    (_('Not yet paid'),'unpaid'),
26    (_('Paid'),'paid'),
27    (_('Failed'),'failed'),
28    )
29
30payment_categories = SimpleKofaVocabulary(
31    (_('School Fee'),'schoolfee'),
32    (_('Clearance'),'clearance'),
33    (_('Bed Allocation'),'bed_allocation'),
34    (_('Hostel Maintenance'),'hostel_maintenance'),
35    (_('Transfer'),'transfer'),
36    (_('Gown'),'gown'),
37    (_('Application Fee'), 'application'),
38    )
39
40class IPaymentsContainer(IKofaObject):
41    """A container for all kind of payment objects.
42
43    """
44
45class IPayment(IKofaObject):
46    """A base representation of payments.
47
48    """
49    p_id = Attribute('Payment identifier.')
50
51    p_category = schema.Choice(
52        title = _(u'Payment Category'),
53        default = u'schoolfee',
54        vocabulary = payment_categories,
55        required = True,
56        )
57
58    p_item = schema.TextLine(
59        title = _(u'Payment Item'),
60        default = None,
61        required = False,
62        )
63
64    p_session = schema.Choice(
65        title = _(u'Payment Session'),
66        source = academic_sessions_vocab,
67        required = False,
68        )
69
70    p_state = schema.Choice(
71        title = _(u'Payment State'),
72        default = u'unpaid',
73        vocabulary = payment_states,
74        required = True,
75        )
76
77    creation_date = schema.Datetime(
78        title = _(u'Ticket Creation Date'),
79        readonly = False,
80        required = False,
81        )
82
83    payment_date = schema.Datetime(
84        title = _(u'Payment Date'),
85        required = False,
86        readonly = False,
87        )
88
89    amount_auth = schema.Float(
90        title = _(u'Amount Authorized'),
91        default = 0.0,
92        required = True,
93        readonly = False,
94        )
95
96class ISCPayment(IPayment):
97    """A scratch card payment.
98
99    """
100
101    p_code = schema.TextLine(
102        title = _(u'Payment Access Code'),
103        #default = u'Certificate XYZ',
104        required = False,
105        readonly = True,
106        )
107
108class IOnlinePayment(IPayment):
109    """A payment via payment gateways.
110
111    """
112
113    ac = schema.TextLine(
114        title = _(u'Activation Code'),
115        default = None,
116        required = False,
117        readonly = False,
118        )
119
120    r_amount_approved = schema.Float(
121        title = _(u'Response Amount Approved'),
122        default = 0.0,
123        required = False,
124        readonly = False,
125        )
126
127    r_code = schema.TextLine(
128        title = _(u'Response Code'),
129        default = None,
130        required = False,
131        readonly = False,
132        )
133
134    r_desc = schema.TextLine(
135        title = _(u'Response Description'),
136        default = None,
137        required = False,
138        readonly = False,
139        )
140
141    def approve():
142        "Approve an online payment and set to paid."
143
144class IPaymentWebservice(IKofaObject):
145    """An interface for a webservice.
146
147    """
148
149    def display_fullname():
150        "Name of  payee."
151
152    def id():
153        "Id of payee"
154
155    def faculty():
156        "Faculty of payee"
157
158    def department():
159        "Department of payee"
Note: See TracBrowser for help on using the repository browser.