[7195] | 1 | ## $Id: interfaces.py 7811 2012-03-08 19:00:51Z uli $ |
---|
[6861] | 2 | ## |
---|
[7195] | 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 | ## |
---|
[6969] | 18 | from zope.interface import Attribute |
---|
[6864] | 19 | from zope import schema |
---|
[7811] | 20 | from waeup.kofa.interfaces import IKOFAObject, SimpleKOFAVocabulary |
---|
| 21 | from waeup.kofa.interfaces import MessageFactory as _ |
---|
[6861] | 22 | |
---|
[7811] | 23 | payment_states = SimpleKOFAVocabulary( |
---|
[7717] | 24 | (_('Not yet paid'),'unpaid'), |
---|
| 25 | (_('Paid'),'paid'), |
---|
| 26 | (_('Failed'),'failed'), |
---|
[7627] | 27 | ) |
---|
| 28 | |
---|
[7811] | 29 | payment_categories = SimpleKOFAVocabulary( |
---|
[7717] | 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'), |
---|
[7627] | 37 | ) |
---|
| 38 | |
---|
[7811] | 39 | class IPaymentsContainer(IKOFAObject): |
---|
[6861] | 40 | """A container for all kind of payment objects. |
---|
| 41 | |
---|
| 42 | """ |
---|
[6864] | 43 | |
---|
[7811] | 44 | class IPayment(IKOFAObject): |
---|
[6864] | 45 | """A base representation of payments. |
---|
| 46 | |
---|
| 47 | """ |
---|
[6869] | 48 | p_id = Attribute('Payment identifier.') |
---|
[6864] | 49 | |
---|
| 50 | p_category = schema.Choice( |
---|
[7717] | 51 | title = _(u'Payment Category'), |
---|
[6865] | 52 | default = u'schoolfee', |
---|
[6864] | 53 | vocabulary = payment_categories, |
---|
| 54 | required = True, |
---|
| 55 | ) |
---|
| 56 | |
---|
| 57 | p_item = schema.TextLine( |
---|
[7717] | 58 | title = _(u'Payment Item'), |
---|
[6869] | 59 | default = None, |
---|
[6864] | 60 | required = False, |
---|
| 61 | ) |
---|
| 62 | |
---|
[7020] | 63 | p_state = schema.Choice( |
---|
[7717] | 64 | title = _(u'Payment State'), |
---|
[7020] | 65 | default = u'unpaid', |
---|
| 66 | vocabulary = payment_states, |
---|
| 67 | required = True, |
---|
| 68 | ) |
---|
| 69 | |
---|
[6869] | 70 | creation_date = schema.Datetime( |
---|
[7717] | 71 | title = _(u'Ticket Creation Date'), |
---|
[7623] | 72 | readonly = False, |
---|
[6864] | 73 | ) |
---|
| 74 | |
---|
[6930] | 75 | payment_date = schema.Datetime( |
---|
[7717] | 76 | title = _(u'Payment Date'), |
---|
[6869] | 77 | required = False, |
---|
[6934] | 78 | readonly = False, |
---|
[6864] | 79 | ) |
---|
| 80 | |
---|
| 81 | amount_auth = schema.Int( |
---|
[7717] | 82 | title = _(u'Amount Authorized'), |
---|
[6864] | 83 | default = 0, |
---|
| 84 | required = True, |
---|
[6869] | 85 | readonly = True, |
---|
[6864] | 86 | ) |
---|
| 87 | |
---|
| 88 | class ISCPayment(IPayment): |
---|
| 89 | """A scratch card payment. |
---|
| 90 | |
---|
| 91 | """ |
---|
| 92 | |
---|
| 93 | p_code = schema.TextLine( |
---|
[7717] | 94 | title = _(u'Payment Access Code'), |
---|
| 95 | #default = u'Certificate XYZ', |
---|
[6864] | 96 | required = False, |
---|
[6869] | 97 | readonly = True, |
---|
[6864] | 98 | ) |
---|
| 99 | |
---|
| 100 | class IOnlinePayment(IPayment): |
---|
| 101 | """A payment via payment gateways. |
---|
| 102 | |
---|
| 103 | """ |
---|
| 104 | |
---|
[6873] | 105 | surcharge_1 = schema.Int( |
---|
[7717] | 106 | title = _(u'Surcharge 1'), |
---|
[6864] | 107 | default = 0, |
---|
| 108 | required = False, |
---|
[6869] | 109 | readonly = True, |
---|
[6864] | 110 | ) |
---|
| 111 | |
---|
[6873] | 112 | surcharge_2 = schema.Int( |
---|
[7717] | 113 | title = _(u'Surcharge 2'), |
---|
[6873] | 114 | default = 0, |
---|
| 115 | required = False, |
---|
| 116 | readonly = True, |
---|
| 117 | ) |
---|
| 118 | |
---|
| 119 | surcharge_3 = schema.Int( |
---|
[7717] | 120 | title = _(u'Surcharge 3'), |
---|
[6873] | 121 | default = 0, |
---|
| 122 | required = False, |
---|
| 123 | readonly = True, |
---|
| 124 | ) |
---|
| 125 | |
---|
[6869] | 126 | #order_id = schema.TextLine( |
---|
| 127 | # title = u'Order Id', |
---|
| 128 | # default = None, |
---|
| 129 | # required = True, |
---|
| 130 | # ) |
---|
[6864] | 131 | |
---|
[6930] | 132 | ac = schema.TextLine( |
---|
[7717] | 133 | title = _(u'Activation Code'), |
---|
[6930] | 134 | default = None, |
---|
| 135 | required = False, |
---|
| 136 | readonly = False, |
---|
| 137 | ) |
---|
| 138 | |
---|
[6864] | 139 | r_amount_approved = schema.Int( |
---|
[7717] | 140 | title = _(u'Response Amount Approved'), |
---|
[6864] | 141 | default = 0, |
---|
| 142 | required = False, |
---|
[6930] | 143 | readonly = False, |
---|
[6864] | 144 | ) |
---|
| 145 | |
---|
[7623] | 146 | r_desc = schema.TextLine( |
---|
[7717] | 147 | title = _(u'Response Description'), |
---|
[7623] | 148 | default = None, |
---|
| 149 | required = False, |
---|
| 150 | readonly = False, |
---|
| 151 | ) |
---|
| 152 | |
---|
| 153 | r_pay_reference = schema.TextLine( |
---|
[7717] | 154 | title = _(u'Response Payment Reference'), |
---|
[7623] | 155 | default = None, |
---|
| 156 | required = False, |
---|
| 157 | readonly = False, |
---|
| 158 | ) |
---|
| 159 | |
---|
[6864] | 160 | r_code = schema.TextLine( |
---|
[7717] | 161 | title = _(u'Response Code'), |
---|
[6864] | 162 | default = None, |
---|
[6869] | 163 | required = False, |
---|
[6930] | 164 | readonly = False, |
---|
[6864] | 165 | ) |
---|
| 166 | |
---|
| 167 | r_card_num = schema.TextLine( |
---|
[7717] | 168 | title = _(u'Response Card Number'), |
---|
[6864] | 169 | default = None, |
---|
[6869] | 170 | required = False, |
---|
[6930] | 171 | readonly = False, |
---|
[7811] | 172 | ) |
---|