source: main/kofacustom.nigeria/branches/uli-paypal/src/kofacustom/nigeria/interfaces.py @ 17606

Last change on this file since 17606 was 17239, checked in by uli, 2 years ago

Sketches of paypal :)

  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1## $Id: interfaces.py 17239 2022-12-23 17:19:33Z uli $
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    (_('Awaiting Results'),'a_rslt'),
49    )
50
51high_grade = SimpleKofaVocabulary(
52    ('Upper Credit','upper_credit'),
53    ('Distinction','distinction'),
54    ('Credit','credit'),
55    ('Merit','merit'),
56    ('Lower Credit','lower_credit'),
57    ('First Class','first_class'),
58    ('Second Class Upper','second_class_upper'),
59    ('Second Class Lower','second_class_lower'),
60    ('Third Class','third_class'),
61    ('Pass','pass'),
62    ('A Levels','al'),
63    ('Unclassified Certificate', 'uc'),
64    (_('Awaiting Results'),'a_rslt'),
65    )
66
67exam_types = SimpleKofaVocabulary(
68    ('SSCE','ssce'),
69    ('WAEC','waec'),
70    ('GCE O\' LEVEL','gce_o_level'),
71    ('TC II','tc_ii'),
72    ('RSA','rsa'),
73    ('NABTEB','nabteb'),
74    ('NECO','neco'),
75    ('ACE','ace'),
76    ('GCE A\' LEVEL','gce_a_level'),
77    ('IGCSE','igcse'),
78    ('WAEC Technical Examination','wte'),
79    )
80
81# Define a validation method for JAMB reg numbers
82class NotJAMBRegNumber(schema.ValidationError):
83    __doc__ = u"Invalid JAMB registration number"
84
85#: Regular expression to check jamb_reg_number formats.
86check_jamb_reg_number = re.compile(r"^\d{12}[A-Z]{2}$").match
87
88def validate_jamb_reg_number(value):
89    if not check_jamb_reg_number(value):
90        raise NotJAMBRegNumber(value)
91    return True
92
93#lgas_vocab = SimpleKofaVocabulary(
94#    *sorted([(x[1],x[0]) for x in LGAS]))
95
96class LGASource(BasicSourceFactory):
97    """A source for school subjects used in exam documentation.
98    """
99    lga_dict = dict(LGAS)
100
101    def getValues(self):
102        return sorted(self.lga_dict.keys())
103
104    def getToken(self, value):
105        return str(value)
106
107    def getTitle(self, value):
108        return self.lga_dict.get(value,
109            _('Invalid key: ${a}', mapping = {'a':value}))
110
111class DisabilitiesSource(ContextualDictSourceFactoryBase):
112    """A source for filtering groups of students
113    """
114    #: name of dict to deliver from kofa utils.
115    DICT_NAME = 'DISABILITIES_DICT'
116
117class GradingSystemSource(ContextualDictSourceFactoryBase):
118    """A application category source delivers all special handling categories
119    provided for accommodation booking.
120    """
121    #: name of dict to deliver from kofa utils.
122    DICT_NAME = 'GRADING_SYSTEM_DICT'
123
124class ICustomSessionConfiguration(ISessionConfiguration):
125    """A session configuration object.
126    """
127
128    remita_enabled = schema.Bool(
129        title = _(u'Remita integration enabled'),
130        default = False,
131        )
132
133    interswitch_enabled = schema.Bool(
134        title = _(u'Interswitch Collegepay integration enabled'),
135        default = True,
136        )
137
138    interswitch_paydirect_enabled = schema.Bool(
139        title = _(u'Interswitch Paydirect integration enabled'),
140        default = True,
141        )
142
143    interswitch_webcheckout_enabled = schema.Bool(
144        title = _(u'Interswitch WebCheckout integration enabled'),
145        default = False,
146        )
147
148    etranzact_webconnect_enabled = schema.Bool(
149        title = _(u'Etranzact Webconnect integration enabled'),
150        default = False,
151        )
152
153    etranzact_payoutlet_enabled = schema.Bool(
154        title = _(u'Etranzact Payoutlet integration enabled'),
155        default = False,
156        )
157
158    paypal_enabled = schema.Bool(
159        title = _(u'Paypal integration enabled'),
160        default = False,
161        )
162
163
164class ICustomSessionConfigurationAdd(ICustomSessionConfiguration):
165    """A session configuration object in add mode.
166    """
167
168    academic_session = schema.Choice(
169        title = _(u'Academic Session'),
170        source = academic_sessions_vocab,
171        default = None,
172        required = True,
173        readonly = False,
174        )
175
176ICustomSessionConfigurationAdd[
177    'academic_session'].order =  ICustomSessionConfiguration[
178    'academic_session'].order
Note: See TracBrowser for help on using the repository browser.