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

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

Add Payment class attribute created_online to mark payment tickets
which are added online and not by import. This attribute is needed in
custom packages when sending data to payment gateways.

  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1## $Id: interfaces.py 13005 2015-05-27 15:26:26Z 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    created_online = Attribute('True if not imported')
50
51    p_category = schema.Choice(
52        title = _(u'Payment Category'),
53        #default = u'schoolfee',
54        source = PaymentCategorySource(),
55        required = True,
56        )
57
58    p_item = schema.TextLine(
59        title = u'',
60        default = None,
61        required = False,
62        )
63
64    display_item = schema.TextLine(
65        title = _(u'Payment Item'),
66        required = False,
67        readonly = True,
68        )
69
70    p_session = schema.Choice(
71        title = _(u'Payment Session'),
72        source = academic_sessions_vocab,
73        required = True,
74        )
75
76    p_state = schema.Choice(
77        title = _(u'Payment State'),
78        default = u'unpaid',
79        vocabulary = payment_states,
80        required = True,
81        )
82
83    creation_date = schema.Datetime(
84        title = _(u'Ticket Creation Date'),
85        readonly = False,
86        required = False,
87        )
88
89    payment_date = schema.Datetime(
90        title = _(u'Payment Date'),
91        required = False,
92        readonly = False,
93        )
94
95    amount_auth = schema.Float(
96        title = _(u'Amount Authorized'),
97        default = 0.0,
98        required = True,
99        readonly = False,
100        )
101
102class IOnlinePayment(IPayment):
103    """A payment via payment gateways.
104
105    """
106
107    ac = schema.TextLine(
108        title = _(u'Activation Code'),
109        default = None,
110        required = False,
111        readonly = False,
112        )
113
114    r_amount_approved = schema.Float(
115        title = _(u'Response Amount Approved'),
116        default = 0.0,
117        required = False,
118        readonly = False,
119        )
120
121    r_code = schema.TextLine(
122        title = _(u'Response Code'),
123        default = None,
124        required = False,
125        readonly = False,
126        )
127
128    r_desc = schema.TextLine(
129        title = _(u'Response Description'),
130        default = None,
131        required = False,
132        readonly = False,
133        )
134
135    def approve():
136        "Approve an online payment and set to paid."
137
138class IPayer(IKofaObject):
139    """An interface for an adapter to publish student and applicant data
140    through a simple webservice.
141
142    """
143    display_fullname = Attribute('Name of  payer')
144    id = Attribute('Id of payer')
145    reg_number = Attribute('Reg number of payer')
146    matric_number = Attribute('Matric number of payer')
147    faculty = Attribute('Faculty of payer')
148    department = Attribute('Department of payer')
149    email= Attribute('Email of payer')
150    phone= Attribute('Phone number of payer')
151    current_mode= Attribute('Current study mode of payer')
152    current_level= Attribute('Current level of payer')
Note: See TracBrowser for help on using the repository browser.