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

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