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

Last change on this file since 14498 was 13012, checked in by Henrik Bettermann, 9 years ago

Revert changes from r13007.

  • Property svn:keywords set to Id
File size: 4.2 KB
RevLine 
[7195]1## $Id: interfaces.py 13012 2015-05-28 13:55:06Z 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
[8245]20from waeup.kofa.interfaces import (
[11450]21    IKofaObject, SimpleKofaVocabulary, academic_sessions_vocab,
22    ContextualDictSourceFactoryBase)
[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'),
[12568]29    (_('Fees waived'),'waived'),
[7627]30    )
31
[9405]32class PaymentCategorySource(ContextualDictSourceFactoryBase):
[9864]33    """A payment category source delivers all categories of payments.
34
[9405]35    """
36    #: name of dict to deliver from kofa utils.
37    DICT_NAME = 'PAYMENT_CATEGORIES'
[7627]38
[7819]39class IPaymentsContainer(IKofaObject):
[6861]40    """A container for all kind of payment objects.
41
42    """
[6864]43
[7819]44class IPayment(IKofaObject):
[6864]45    """A base representation of payments.
46
47    """
[9533]48    p_id = Attribute('Payment identifier')
[6864]49
50    p_category = schema.Choice(
[7717]51        title = _(u'Payment Category'),
[10842]52        #default = u'schoolfee',
[9405]53        source = PaymentCategorySource(),
[6864]54        required = True,
55        )
56
57    p_item = schema.TextLine(
[9984]58        title = u'',
[6869]59        default = None,
[6864]60        required = False,
61        )
62
[9984]63    display_item = schema.TextLine(
64        title = _(u'Payment Item'),
65        required = False,
66        readonly = True,
67        )
68
[8245]69    p_session = schema.Choice(
70        title = _(u'Payment Session'),
71        source = academic_sessions_vocab,
[9512]72        required = True,
[8245]73        )
74
[7020]75    p_state = schema.Choice(
[7717]76        title = _(u'Payment State'),
[7020]77        default = u'unpaid',
78        vocabulary = payment_states,
79        required = True,
80        )
81
[8170]82    creation_date = schema.Datetime(
[7717]83        title = _(u'Ticket Creation Date'),
[7623]84        readonly = False,
[8944]85        required = False,
[6864]86        )
87
[8170]88    payment_date = schema.Datetime(
[7717]89        title = _(u'Payment Date'),
[6869]90        required = False,
[6934]91        readonly = False,
[6864]92        )
93
[7927]94    amount_auth = schema.Float(
[7717]95        title = _(u'Amount Authorized'),
[7927]96        default = 0.0,
[6864]97        required = True,
[7931]98        readonly = False,
[6864]99        )
100
101class IOnlinePayment(IPayment):
102    """A payment via payment gateways.
103
104    """
105
[6930]106    ac = schema.TextLine(
[7717]107        title = _(u'Activation Code'),
[6930]108        default = None,
109        required = False,
110        readonly = False,
111        )
112
[7927]113    r_amount_approved = schema.Float(
[7717]114        title = _(u'Response Amount Approved'),
[7927]115        default = 0.0,
[6864]116        required = False,
[6930]117        readonly = False,
[6864]118        )
119
120    r_code = schema.TextLine(
[7717]121        title = _(u'Response Code'),
[6864]122        default = None,
[6869]123        required = False,
[6930]124        readonly = False,
[6864]125        )
[8420]126
[8429]127    r_desc = schema.TextLine(
128        title = _(u'Response Description'),
129        default = None,
130        required = False,
131        readonly = False,
132        )
133
[8420]134    def approve():
135        "Approve an online payment and set to paid."
[8703]136
[10030]137class IPayer(IKofaObject):
138    """An interface for an adapter to publish student and applicant data
139    through a simple webservice.
[8703]140
[9533]141    """
[10030]142    display_fullname = Attribute('Name of  payer')
143    id = Attribute('Id of payer')
144    reg_number = Attribute('Reg number of payer')
145    matric_number = Attribute('Matric number of payer')
146    faculty = Attribute('Faculty of payer')
147    department = Attribute('Department of payer')
[10914]148    email= Attribute('Email of payer')
149    phone= Attribute('Phone number of payer')
150    current_mode= Attribute('Current study mode of payer')
151    current_level= Attribute('Current level of payer')
Note: See TracBrowser for help on using the repository browser.