1 | ## $Id: interfaces.py 7195 2011-11-25 07:34:07Z 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 | from zope.interface import Attribute |
---|
19 | from zope import schema |
---|
20 | from waeup.sirp.interfaces import IWAeUPObject |
---|
21 | from waeup.sirp.payments.vocabularies import ( |
---|
22 | payment_states, payment_categories) |
---|
23 | |
---|
24 | class IPaymentsContainer(IWAeUPObject): |
---|
25 | """A container for all kind of payment objects. |
---|
26 | |
---|
27 | """ |
---|
28 | |
---|
29 | class IPayment(IWAeUPObject): |
---|
30 | """A base representation of payments. |
---|
31 | |
---|
32 | """ |
---|
33 | p_id = Attribute('Payment identifier.') |
---|
34 | |
---|
35 | p_category = schema.Choice( |
---|
36 | title = u'Payment Category', |
---|
37 | default = u'schoolfee', |
---|
38 | vocabulary = payment_categories, |
---|
39 | required = True, |
---|
40 | ) |
---|
41 | |
---|
42 | p_item = schema.TextLine( |
---|
43 | title = u'Payment Item', |
---|
44 | default = None, |
---|
45 | required = False, |
---|
46 | ) |
---|
47 | |
---|
48 | p_state = schema.Choice( |
---|
49 | title = u'Payment State', |
---|
50 | default = u'unpaid', |
---|
51 | vocabulary = payment_states, |
---|
52 | required = True, |
---|
53 | ) |
---|
54 | |
---|
55 | creation_date = schema.Datetime( |
---|
56 | title = u'Ticket Creation Date', |
---|
57 | readonly = True, |
---|
58 | ) |
---|
59 | |
---|
60 | payment_date = schema.Datetime( |
---|
61 | title = u'Payment Date', |
---|
62 | required = False, |
---|
63 | readonly = False, |
---|
64 | ) |
---|
65 | |
---|
66 | amount_auth = schema.Int( |
---|
67 | title = u'Amount Authorized', |
---|
68 | default = 0, |
---|
69 | required = True, |
---|
70 | readonly = True, |
---|
71 | ) |
---|
72 | |
---|
73 | class ISCPayment(IPayment): |
---|
74 | """A scratch card payment. |
---|
75 | |
---|
76 | """ |
---|
77 | |
---|
78 | p_code = schema.TextLine( |
---|
79 | title = u'Payment Access Code', |
---|
80 | default = u'Certificate XYZ', |
---|
81 | required = False, |
---|
82 | readonly = True, |
---|
83 | ) |
---|
84 | |
---|
85 | class IOnlinePayment(IPayment): |
---|
86 | """A payment via payment gateways. |
---|
87 | |
---|
88 | """ |
---|
89 | |
---|
90 | surcharge_1 = schema.Int( |
---|
91 | title = u'Surcharge 1', |
---|
92 | default = 0, |
---|
93 | required = False, |
---|
94 | readonly = True, |
---|
95 | ) |
---|
96 | |
---|
97 | surcharge_2 = schema.Int( |
---|
98 | title = u'Surcharge 2', |
---|
99 | default = 0, |
---|
100 | required = False, |
---|
101 | readonly = True, |
---|
102 | ) |
---|
103 | |
---|
104 | surcharge_3 = schema.Int( |
---|
105 | title = u'Surcharge 3', |
---|
106 | default = 0, |
---|
107 | required = False, |
---|
108 | readonly = True, |
---|
109 | ) |
---|
110 | |
---|
111 | #order_id = schema.TextLine( |
---|
112 | # title = u'Order Id', |
---|
113 | # default = None, |
---|
114 | # required = True, |
---|
115 | # ) |
---|
116 | |
---|
117 | ac = schema.TextLine( |
---|
118 | title = u'Activation Code', |
---|
119 | default = None, |
---|
120 | required = False, |
---|
121 | readonly = False, |
---|
122 | ) |
---|
123 | |
---|
124 | r_amount_approved = schema.Int( |
---|
125 | title = u'Response Amount Approved', |
---|
126 | default = 0, |
---|
127 | required = False, |
---|
128 | readonly = False, |
---|
129 | ) |
---|
130 | |
---|
131 | r_code = schema.TextLine( |
---|
132 | title = u'Response Code', |
---|
133 | default = None, |
---|
134 | required = False, |
---|
135 | readonly = False, |
---|
136 | ) |
---|
137 | |
---|
138 | r_card_num = schema.TextLine( |
---|
139 | title = u'Response Card Number', |
---|
140 | default = None, |
---|
141 | required = False, |
---|
142 | readonly = False, |
---|
143 | ) |
---|