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