source: main/waeup.sirp/trunk/src/waeup/sirp/payments/interfaces.py @ 11110

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

Internationalization of payments package finished.

  • Property svn:keywords set to Id
File size: 4.3 KB
Line 
1## $Id: interfaces.py 7717 2012-02-28 11:50:10Z 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.sirp.interfaces import ISIRPObject, SimpleSIRPVocabulary
21from waeup.sirp.interfaces import MessageFactory as _
22
23payment_states = SimpleSIRPVocabulary(
24    (_('Not yet paid'),'unpaid'),
25    (_('Paid'),'paid'),
26    (_('Failed'),'failed'),
27    )
28
29payment_categories = SimpleSIRPVocabulary(
30    (_('School Fee'),'schoolfee'),
31    (_('Clearance'),'clearance'),
32    (_('Bed Allocation'),'bed_allocation'),
33    (_('Hostel Maintenance'),'hostel_maintenance'),
34    (_('Transfer'),'transfer'),
35    (_('Gown'),'gown'),
36    (_('Acceptance Fee'), 'acceptance'),
37    )
38
39class IPaymentsContainer(ISIRPObject):
40    """A container for all kind of payment objects.
41
42    """
43
44class IPayment(ISIRPObject):
45    """A base representation of payments.
46
47    """
48    p_id = Attribute('Payment identifier.')
49
50    p_category = schema.Choice(
51        title = _(u'Payment Category'),
52        default = u'schoolfee',
53        vocabulary = payment_categories,
54        required = True,
55        )
56
57    p_item = schema.TextLine(
58        title = _(u'Payment Item'),
59        default = None,
60        required = False,
61        )
62
63    p_state = schema.Choice(
64        title = _(u'Payment State'),
65        default = u'unpaid',
66        vocabulary = payment_states,
67        required = True,
68        )
69
70    creation_date = schema.Datetime(
71        title = _(u'Ticket Creation Date'),
72        readonly = False,
73        )
74
75    payment_date = schema.Datetime(
76        title = _(u'Payment Date'),
77        required = False,
78        readonly = False,
79        )
80
81    amount_auth = schema.Int(
82        title = _(u'Amount Authorized'),
83        default = 0,
84        required = True,
85        readonly = True,
86        )
87
88class ISCPayment(IPayment):
89    """A scratch card payment.
90
91    """
92
93    p_code = schema.TextLine(
94        title = _(u'Payment Access Code'),
95        #default = u'Certificate XYZ',
96        required = False,
97        readonly = True,
98        )
99
100class IOnlinePayment(IPayment):
101    """A payment via payment gateways.
102
103    """
104
105    surcharge_1 = schema.Int(
106        title = _(u'Surcharge 1'),
107        default = 0,
108        required = False,
109        readonly = True,
110        )
111
112    surcharge_2 = schema.Int(
113        title = _(u'Surcharge 2'),
114        default = 0,
115        required = False,
116        readonly = True,
117        )
118
119    surcharge_3 = schema.Int(
120        title = _(u'Surcharge 3'),
121        default = 0,
122        required = False,
123        readonly = True,
124        )
125
126    #order_id = schema.TextLine(
127    #    title = u'Order Id',
128    #    default = None,
129    #    required = True,
130    #    )
131
132    ac = schema.TextLine(
133        title = _(u'Activation Code'),
134        default = None,
135        required = False,
136        readonly = False,
137        )
138
139    r_amount_approved = schema.Int(
140        title = _(u'Response Amount Approved'),
141        default = 0,
142        required = False,
143        readonly = False,
144        )
145
146    r_desc = schema.TextLine(
147        title = _(u'Response Description'),
148        default = None,
149        required = False,
150        readonly = False,
151        )
152
153    r_pay_reference = schema.TextLine(
154        title = _(u'Response Payment Reference'),
155        default = None,
156        required = False,
157        readonly = False,
158        )
159
160    r_code = schema.TextLine(
161        title = _(u'Response Code'),
162        default = None,
163        required = False,
164        readonly = False,
165        )
166
167    r_card_num = schema.TextLine(
168        title = _(u'Response Card Number'),
169        default = None,
170        required = False,
171        readonly = False,
172        )
Note: See TracBrowser for help on using the repository browser.