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

Last change on this file since 16207 was 15792, checked in by Henrik Bettermann, 5 years ago

Add payment status scholarship.

  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1## $Id: interfaces.py 15792 2019-11-10 20:11:40Z 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    (_('Scholarship'),'scholarship'),
31    )
32
33class PaymentCategorySource(ContextualDictSourceFactoryBase):
34    """A payment category source delivers all categories of payments.
35
36    """
37    #: name of dict to deliver from kofa utils.
38    DICT_NAME = 'PAYMENT_CATEGORIES'
39
40class CombiPaymentCategorySource(ContextualDictSourceFactoryBase):
41    """A payment category source delivers all categories of payments.
42
43    """
44    #: name of dict to deliver from kofa utils.
45    DICT_NAME = 'COMBI_PAYMENT_CATEGORIES'
46
47class IPaymentsContainer(IKofaObject):
48    """A container for all kind of payment objects.
49
50    """
51
52class IPayment(IKofaObject):
53    """A base representation of payments.
54
55    """
56    p_id = Attribute('Payment identifier')
57
58    p_category = schema.Choice(
59        title = _(u'Payment Category'),
60        #default = u'schoolfee',
61        source = PaymentCategorySource(),
62        required = True,
63        )
64
65    p_item = schema.TextLine(
66        title = u'',
67        default = None,
68        required = False,
69        )
70
71    p_combi = schema.List(
72        title = _(u'Combi Payment'),
73        value_type = schema.Choice(
74            source = CombiPaymentCategorySource(),
75            ),
76        required = False,
77        defaultFactory=list,
78        )
79
80    display_item = schema.TextLine(
81        title = _(u'Payment Item'),
82        required = False,
83        readonly = True,
84        )
85
86    p_session = schema.Choice(
87        title = _(u'Payment Session'),
88        source = academic_sessions_vocab,
89        required = True,
90        )
91
92    p_state = schema.Choice(
93        title = _(u'Payment State'),
94        default = u'unpaid',
95        vocabulary = payment_states,
96        required = True,
97        )
98
99    creation_date = schema.Datetime(
100        title = _(u'Ticket Creation Date'),
101        readonly = False,
102        required = False,
103        )
104
105    payment_date = schema.Datetime(
106        title = _(u'Payment Date'),
107        required = False,
108        readonly = False,
109        )
110
111    amount_auth = schema.Float(
112        title = _(u'Amount Authorized'),
113        default = 0.0,
114        required = True,
115        readonly = False,
116        )
117
118class IOnlinePayment(IPayment):
119    """A payment via payment gateways.
120
121    """
122
123    ac = schema.TextLine(
124        title = _(u'Activation Code'),
125        default = None,
126        required = False,
127        readonly = False,
128        )
129
130    r_amount_approved = schema.Float(
131        title = _(u'Response Amount Approved'),
132        default = 0.0,
133        required = False,
134        readonly = False,
135        )
136
137    r_code = schema.TextLine(
138        title = _(u'Response Code'),
139        default = None,
140        required = False,
141        readonly = False,
142        )
143
144    r_desc = schema.TextLine(
145        title = _(u'Response Description'),
146        default = None,
147        required = False,
148        readonly = False,
149        )
150
151    def approve():
152        "Approve an online payment and set to paid."
153
154class IPayer(IKofaObject):
155    """An interface for an adapter to publish student and applicant data
156    through a simple webservice.
157
158    """
159    display_fullname = Attribute('Name of  payer')
160    id = Attribute('Id of payer')
161    reg_number = Attribute('Reg number of payer')
162    matric_number = Attribute('Matric number of payer')
163    faculty = Attribute('Faculty of payer')
164    department = Attribute('Department of payer')
165    email= Attribute('Email of payer')
166    phone= Attribute('Phone number of payer')
167    current_mode= Attribute('Current study mode of payer')
168    current_level= Attribute('Current level of payer')
Note: See TracBrowser for help on using the repository browser.