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

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

Revert changes from r13007.

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