source: main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py @ 10013

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

FCEOkene wants to hide the bed coordinates if maintenance fee is not yet paid. Thus we need additional property attributes which return the p_item (payment tickets) and the bed_coordinates attributes (bed tickets) by default and can be easily customized to hide this information in certain cases. bed_coordinates and p_item must be omitted on forms. The new display_ attributes are displayed instead.

All packages must now be adjusted.

The 'cost-benefit ratio' of these kinds of customizations is quite bad and we should think about declining such customization requests. However, I started customization and these are the changed made in the base package.

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