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

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