source: main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/payments/interfaces.py @ 9109

Last change on this file since 9109 was 8708, checked in by Henrik Bettermann, 12 years ago

Add more attributes to webservice adapter.

  • Property svn:keywords set to Id
File size: 3.9 KB
Line 
1## $Id: interfaces.py 8708 2012-06-13 13:29:35Z 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.kofa.interfaces import (
21    IKofaObject, SimpleKofaVocabulary, academic_sessions_vocab)
22from waeup.kofa.interfaces import MessageFactory as _
23
24payment_states = SimpleKofaVocabulary(
25    (_('Not yet paid'),'unpaid'),
26    (_('Paid'),'paid'),
27    (_('Failed'),'failed'),
28    )
29
30payment_categories = SimpleKofaVocabulary(
31    (_('School Fee'),'schoolfee'),
32    (_('Clearance'),'clearance'),
33    (_('Bed Allocation'),'bed_allocation'),
34    (_('Hostel Maintenance'),'hostel_maintenance'),
35    (_('Transfer'),'transfer'),
36    (_('Gown'),'gown'),
37    (_('Application Fee'), 'application'),
38    )
39
40class IPaymentsContainer(IKofaObject):
41    """A container for all kind of payment objects.
42
43    """
44
45class IPayment(IKofaObject):
46    """A base representation of payments.
47
48    """
49    p_id = Attribute('Payment identifier.')
50
51    p_category = schema.Choice(
52        title = _(u'Payment Category'),
53        default = u'schoolfee',
54        vocabulary = payment_categories,
55        required = True,
56        )
57
58    p_item = schema.TextLine(
59        title = _(u'Payment Item'),
60        default = None,
61        required = False,
62        )
63
64    p_session = schema.Choice(
65        title = _(u'Payment Session'),
66        source = academic_sessions_vocab,
67        required = False,
68        )
69
70    p_state = schema.Choice(
71        title = _(u'Payment State'),
72        default = u'unpaid',
73        vocabulary = payment_states,
74        required = True,
75        )
76
77    creation_date = schema.Datetime(
78        title = _(u'Ticket Creation Date'),
79        readonly = False,
80        )
81
82    payment_date = schema.Datetime(
83        title = _(u'Payment Date'),
84        required = False,
85        readonly = False,
86        )
87
88    amount_auth = schema.Float(
89        title = _(u'Amount Authorized'),
90        default = 0.0,
91        required = True,
92        readonly = False,
93        )
94
95class ISCPayment(IPayment):
96    """A scratch card payment.
97
98    """
99
100    p_code = schema.TextLine(
101        title = _(u'Payment Access Code'),
102        #default = u'Certificate XYZ',
103        required = False,
104        readonly = True,
105        )
106
107class IOnlinePayment(IPayment):
108    """A payment via payment gateways.
109
110    """
111
112    ac = schema.TextLine(
113        title = _(u'Activation Code'),
114        default = None,
115        required = False,
116        readonly = False,
117        )
118
119    r_amount_approved = schema.Float(
120        title = _(u'Response Amount Approved'),
121        default = 0.0,
122        required = False,
123        readonly = False,
124        )
125
126    r_code = schema.TextLine(
127        title = _(u'Response Code'),
128        default = None,
129        required = False,
130        readonly = False,
131        )
132
133    r_desc = schema.TextLine(
134        title = _(u'Response Description'),
135        default = None,
136        required = False,
137        readonly = False,
138        )
139
140    def approve():
141        "Approve an online payment and set to paid."
142
143class IPaymentWebservice(IKofaObject):
144    """An interface for a webservice.
145
146    """
147
148    def display_fullname():
149        "Name of  payee."
150
151    def id():
152        "Id of payee"
153
154    def faculty():
155        "Faculty of payee"
156
157    def department():
158        "Department of payee"
Note: See TracBrowser for help on using the repository browser.