source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interfaces.py @ 17929

Last change on this file since 17929 was 17730, checked in by Henrik Bettermann, 6 months ago

Implement Etranzact Credo platform payments.

  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1## $Id: interfaces.py 17730 2024-04-02 20:25:29Z 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##
18
19import re
20import zope.i18nmessageid
21from zope import schema
22from zc.sourcefactory.basic import BasicSourceFactory
23from waeup.kofa.interfaces import (SimpleKofaVocabulary,
24    ISessionConfiguration, academic_sessions_vocab,
25    ContextualDictSourceFactoryBase)
26from kofacustom.nigeria.utils.lgas import LGAS
27
28_ = MessageFactory = zope.i18nmessageid.MessageFactory('kofacustom.nigeria')
29
30high_qual = SimpleKofaVocabulary(
31    ('National Certificate of Education','nce'),
32    ('Pre Degree Programme','pre'),
33    ('Diploma Programme','dip'),
34    ('National Diploma','ond'),
35    ('Bachelors Degree','bd'),
36    ('Masters Degree','md'),
37    ('Professional Qualification','pq'),
38    ('Other Certification','oc'),
39    ('Higher National Diploma','hnd'),
40    ('Post Graduate Diploma','pgd'),
41    ('NCE AL OTH','nce_al_oth'),
42    ('National Defence Academy','nda'),
43    ('RMC','rmc'),
44    ('Ph.D.(Doctor of Philosophy)','phd'),
45    ('M.Phil (Master of Philosophy)','mphil'),
46    ('JUPEB','jupeb'),
47    ('IJMBE','ijmbe'),
48    ('Registered Nursing','rn'),
49    ('Registered Midwifery','rm'),
50    ('Bachelor of Nursing Science','bnsc'),
51    (_('Awaiting Results'),'a_rslt'),
52    )
53
54high_grade = SimpleKofaVocabulary(
55    ('Upper Credit','upper_credit'),
56    ('Distinction','distinction'),
57    ('Credit','credit'),
58    ('Merit','merit'),
59    ('Lower Credit','lower_credit'),
60    ('First Class','first_class'),
61    ('Second Class Upper','second_class_upper'),
62    ('Second Class Lower','second_class_lower'),
63    ('Third Class','third_class'),
64    ('Pass','pass'),
65    ('A Levels','al'),
66    ('Unclassified Certificate', 'uc'),
67    (_('Awaiting Results'),'a_rslt'),
68    )
69
70exam_types = SimpleKofaVocabulary(
71    ('SSCE','ssce'),
72    ('WAEC','waec'),
73    ('GCE O\' LEVEL','gce_o_level'),
74    ('TC II','tc_ii'),
75    ('RSA','rsa'),
76    ('NABTEB','nabteb'),
77    ('NECO','neco'),
78    ('ACE','ace'),
79    ('GCE A\' LEVEL','gce_a_level'),
80    ('IGCSE','igcse'),
81    ('WAEC Technical Examination','wte'),
82    )
83
84# Define a validation method for JAMB reg numbers
85class NotJAMBRegNumber(schema.ValidationError):
86    __doc__ = u"Invalid JAMB registration number"
87
88#: Regular expression to check jamb_reg_number formats.
89check_jamb_reg_number = re.compile(r"^\d{12}[A-Z]{2,3}$").match
90
91def validate_jamb_reg_number(value):
92    if not check_jamb_reg_number(value):
93        raise NotJAMBRegNumber(value)
94    return True
95
96#lgas_vocab = SimpleKofaVocabulary(
97#    *sorted([(x[1],x[0]) for x in LGAS]))
98
99class LGASource(BasicSourceFactory):
100    """A source for school subjects used in exam documentation.
101    """
102    lga_dict = dict(LGAS)
103
104    def getValues(self):
105        return sorted(self.lga_dict.keys())
106
107    def getToken(self, value):
108        return str(value)
109
110    def getTitle(self, value):
111        return self.lga_dict.get(value,
112            _('Invalid key: ${a}', mapping = {'a':value}))
113
114class DisabilitiesSource(ContextualDictSourceFactoryBase):
115    """A source for filtering groups of students
116    """
117    #: name of dict to deliver from kofa utils.
118    DICT_NAME = 'DISABILITIES_DICT'
119
120class GradingSystemSource(ContextualDictSourceFactoryBase):
121    """A application category source delivers all special handling categories
122    provided for accommodation booking.
123    """
124    #: name of dict to deliver from kofa utils.
125    DICT_NAME = 'GRADING_SYSTEM_DICT'
126
127class ICustomSessionConfiguration(ISessionConfiguration):
128    """A session configuration object.
129    """
130
131    remita_enabled = schema.Bool(
132        title = _(u'Remita integration enabled'),
133        default = False,
134        )
135
136    interswitch_enabled = schema.Bool(
137        title = _(u'Interswitch Collegepay integration enabled'),
138        default = True,
139        )
140
141    interswitch_paydirect_enabled = schema.Bool(
142        title = _(u'Interswitch Paydirect integration enabled'),
143        default = True,
144        )
145
146    interswitch_webcheckout_enabled = schema.Bool(
147        title = _(u'Interswitch WebCheckout integration enabled'),
148        default = False,
149        )
150
151    etranzact_webconnect_enabled = schema.Bool(
152        title = _(u'Etranzact Webconnect integration enabled'),
153        default = False,
154        )
155
156    etranzact_credo_enabled = schema.Bool(
157        title = _(u'Etranzact Credo integration enabled'),
158        default = False,
159        )
160
161    etranzact_payoutlet_enabled = schema.Bool(
162        title = _(u'Etranzact Payoutlet integration enabled'),
163        default = False,
164        )
165
166    paypal_enabled = schema.Bool(
167        title = _(u'Paypal integration enabled'),
168        default = False,
169        )
170
171
172class ICustomSessionConfigurationAdd(ICustomSessionConfiguration):
173    """A session configuration object in add mode.
174    """
175
176    academic_session = schema.Choice(
177        title = _(u'Academic Session'),
178        source = academic_sessions_vocab,
179        default = None,
180        required = True,
181        readonly = False,
182        )
183
184ICustomSessionConfigurationAdd[
185    'academic_session'].order =  ICustomSessionConfiguration[
186    'academic_session'].order
Note: See TracBrowser for help on using the repository browser.