[7195] | 1 | ## $Id: interfaces.py 8260 2012-04-24 10:30:14Z henrik $ |
---|
[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 |
---|
[8245] | 20 | from waeup.kofa.interfaces import ( |
---|
| 21 | IKofaObject, SimpleKofaVocabulary, academic_sessions_vocab) |
---|
[7811] | 22 | from waeup.kofa.interfaces import MessageFactory as _ |
---|
[6861] | 23 | |
---|
[7819] | 24 | payment_states = SimpleKofaVocabulary( |
---|
[7717] | 25 | (_('Not yet paid'),'unpaid'), |
---|
| 26 | (_('Paid'),'paid'), |
---|
| 27 | (_('Failed'),'failed'), |
---|
[7627] | 28 | ) |
---|
| 29 | |
---|
[7819] | 30 | payment_categories = SimpleKofaVocabulary( |
---|
[7717] | 31 | (_('School Fee'),'schoolfee'), |
---|
| 32 | (_('Clearance'),'clearance'), |
---|
| 33 | (_('Bed Allocation'),'bed_allocation'), |
---|
| 34 | (_('Hostel Maintenance'),'hostel_maintenance'), |
---|
| 35 | (_('Transfer'),'transfer'), |
---|
| 36 | (_('Gown'),'gown'), |
---|
[8260] | 37 | (_('Application Fee'), 'application'), |
---|
[7627] | 38 | ) |
---|
| 39 | |
---|
[7819] | 40 | class IPaymentsContainer(IKofaObject): |
---|
[6861] | 41 | """A container for all kind of payment objects. |
---|
| 42 | |
---|
| 43 | """ |
---|
[6864] | 44 | |
---|
[7819] | 45 | class IPayment(IKofaObject): |
---|
[6864] | 46 | """A base representation of payments. |
---|
| 47 | |
---|
| 48 | """ |
---|
[6869] | 49 | p_id = Attribute('Payment identifier.') |
---|
[6864] | 50 | |
---|
| 51 | p_category = schema.Choice( |
---|
[7717] | 52 | title = _(u'Payment Category'), |
---|
[6865] | 53 | default = u'schoolfee', |
---|
[6864] | 54 | vocabulary = payment_categories, |
---|
| 55 | required = True, |
---|
| 56 | ) |
---|
| 57 | |
---|
| 58 | p_item = schema.TextLine( |
---|
[7717] | 59 | title = _(u'Payment Item'), |
---|
[6869] | 60 | default = None, |
---|
[6864] | 61 | required = False, |
---|
| 62 | ) |
---|
| 63 | |
---|
[8245] | 64 | p_session = schema.Choice( |
---|
| 65 | title = _(u'Payment Session'), |
---|
| 66 | source = academic_sessions_vocab, |
---|
| 67 | required = False, |
---|
| 68 | ) |
---|
| 69 | |
---|
[7020] | 70 | p_state = schema.Choice( |
---|
[7717] | 71 | title = _(u'Payment State'), |
---|
[7020] | 72 | default = u'unpaid', |
---|
| 73 | vocabulary = payment_states, |
---|
| 74 | required = True, |
---|
| 75 | ) |
---|
| 76 | |
---|
[8170] | 77 | creation_date = schema.Datetime( |
---|
[7717] | 78 | title = _(u'Ticket Creation Date'), |
---|
[7623] | 79 | readonly = False, |
---|
[6864] | 80 | ) |
---|
| 81 | |
---|
[8170] | 82 | payment_date = schema.Datetime( |
---|
[7717] | 83 | title = _(u'Payment Date'), |
---|
[6869] | 84 | required = False, |
---|
[6934] | 85 | readonly = False, |
---|
[6864] | 86 | ) |
---|
| 87 | |
---|
[7927] | 88 | amount_auth = schema.Float( |
---|
[7717] | 89 | title = _(u'Amount Authorized'), |
---|
[7927] | 90 | default = 0.0, |
---|
[6864] | 91 | required = True, |
---|
[7931] | 92 | readonly = False, |
---|
[6864] | 93 | ) |
---|
| 94 | |
---|
| 95 | class ISCPayment(IPayment): |
---|
| 96 | """A scratch card payment. |
---|
| 97 | |
---|
| 98 | """ |
---|
| 99 | |
---|
| 100 | p_code = schema.TextLine( |
---|
[7717] | 101 | title = _(u'Payment Access Code'), |
---|
| 102 | #default = u'Certificate XYZ', |
---|
[6864] | 103 | required = False, |
---|
[6869] | 104 | readonly = True, |
---|
[6864] | 105 | ) |
---|
| 106 | |
---|
| 107 | class IOnlinePayment(IPayment): |
---|
| 108 | """A payment via payment gateways. |
---|
| 109 | |
---|
| 110 | """ |
---|
| 111 | |
---|
[6930] | 112 | ac = schema.TextLine( |
---|
[7717] | 113 | title = _(u'Activation Code'), |
---|
[6930] | 114 | default = None, |
---|
| 115 | required = False, |
---|
| 116 | readonly = False, |
---|
| 117 | ) |
---|
| 118 | |
---|
[7927] | 119 | r_amount_approved = schema.Float( |
---|
[7717] | 120 | title = _(u'Response Amount Approved'), |
---|
[7927] | 121 | default = 0.0, |
---|
[6864] | 122 | required = False, |
---|
[6930] | 123 | readonly = False, |
---|
[6864] | 124 | ) |
---|
| 125 | |
---|
| 126 | r_code = schema.TextLine( |
---|
[7717] | 127 | title = _(u'Response Code'), |
---|
[6864] | 128 | default = None, |
---|
[6869] | 129 | required = False, |
---|
[6930] | 130 | readonly = False, |
---|
[6864] | 131 | ) |
---|