source: main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py @ 17719

Last change on this file since 17719 was 17719, checked in by Henrik Bettermann, 8 months ago

Add new application form and change existing ones.

  • Property svn:executable set to *
File size: 25.7 KB
Line 
1    # -*- coding: utf-8 -*-
2## $Id: browser.py 17429 2023-06-05 04:34:30Z henrik $
3##
4## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann
5## This program is free software; you can redistribute it and/or modify
6## it under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 2 of the License, or
8## (at your option) any later version.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty ofself.context.amount_auth
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13## GNU General Public License for more details.
14##
15## You should have received a copy of the GNU General Public License
16## along with this program; if not, write to the Free Software
17## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18##
19import httplib
20import hashlib
21import grok
22import os
23import csv
24from xml.dom import minidom
25from zope.interface import Interface
26from zope.component import queryAdapter
27from waeup.kofa.interfaces import CLEARED
28from kofacustom.nigeria.interswitch.browser import (
29    InterswitchPaymentRequestWebservicePageStudent,
30    InterswitchPaymentRequestWebservicePageApplicant,
31    InterswitchPaymentVerifyWebservicePageApplicant,
32    InterswitchPaymentVerifyWebservicePageStudent,
33    InterswitchPageStudent, InterswitchPageApplicant,
34    module_activated,
35    )
36from waeup.aaue.students.interfaces import ICustomStudentOnlinePayment
37from waeup.aaue.applicants.interfaces import ICustomApplicantOnlinePayment
38from waeup.aaue.students.utils import SFEECHANGES
39from waeup.aaue.interfaces import MessageFactory as _
40
41PRODUCT_ID = '5845'
42SITE_NAME = 'aaue.waeup.org'
43PROVIDER_ACCT = '0200244434'
44PROVIDER_BANK_ID = '11'
45PROVIDER_ITEM_NAME = 'WAeAC Portal Fee'
46INSTITUTION_NAME = 'AAU Ekpoma'
47CURRENCY = '566'
48GATEWAY_AMT = 200.0
49POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'
50
51HOST = 'webpay.interswitchng.com'
52URL = '/paydirect/api/v1/gettransaction.json'
53HTTPS = True
54MAC = '9718FA00B0F5070B388A9896ADCED9B2FB02D30F71E12E68BDADC63F6852A3496FF97D8A0F9DA9F753B911A49BB09BB87B55FD02046BD325C74C46C0123CF023'
55
56httplib.HTTPSConnection.debuglevel = 0
57
58BANK_ACCOUNTS = {
59    'edohis':    ('2043582455', '8'),
60    'union':     ('1019763348', '7'),
61    'union_pt':  ('0051005007', '31'),
62    'sport':     ('1021941220', '7'),
63    'access':    ('1012688013', '123'),
64    'notebook':  ('4011210501', '51'),
65    'accredit':  ('5060023412', '51'),
66    'library':   ('2000122995', '8'),
67    'fac1':      ('1022438743', '7'),
68    'fac2':      ('2000249757', '8'),
69    'fac3':      ('1012678566', '123'),
70    'matricgown':('2000249757', '8'),
71    'lapel':     ('2000249757', '8'),
72    'lmsplus':   ('5060023429', '51'),
73
74    'acceptance': ('2043582644', '8'),
75    'parttime': ('1012678566', '123'),
76
77    'ijmb':   ('1012278272', '123'),
78    'exam':   ('1012278272', '123'),
79
80
81    'hostel_maintenance': ('1006406795', '123'),
82    'bed_allocation':     ('1006406795', '123'),
83    'late_registration':  ('5210006575', '51'),
84    'ent_combined':       ('6220029828', '51'),
85    'ent_registration_0': ('6220029828', '51'),
86    'ent_registration_1': ('6220029828', '51'),
87    'ent_registration_2': ('6220029828', '51'),
88    'ent_text_book_0':    ('6220029828', '51'),
89    'ent_text_book_1':    ('6220029828', '51'),
90    'ent_text_book_2':    ('6220029828', '51'),
91    'gst_registration_1': ('1010893123', '117'),
92    'gst_registration_2': ('1010893123', '117'),
93    'gst_text_book_0':    ('1010893123', '117'),
94    'gst_text_book_1':    ('1010893123', '117'),
95    'gst_text_book_2':    ('1010893123', '117'),
96    'gst_text_book_3':    ('1010893123', '117'),
97
98    'postgrad': ('1010827641', '117'),
99    }
100
101FEE_NAMES = {
102    'edohis':     'Edo State Health Insurance Scheme',
103    'union':      'Student Union Dues',
104    'union_pt':   'Student Union Dues Part-Time',
105    'sport':      'Sport Development Fee',
106    'access':     'Access Card Fee',
107    'notebook':   'Branded Notebook',
108    'accredit':   'Accreditation Fee',
109    'library':    'Library Development Fee',
110    'tuition':    'Tuition',
111    'acceptance': 'Acceptance Fee',
112    'matricgown': 'Matriculation Gown Fee',
113    'lapel':      'File/Lapel Fee',
114    'lmsplus':    'LMS Plus Fee',
115    'nuga':       'NUGA Fee',
116    }
117
118
119SCHOOLFEES = dict()
120
121for year in SFEECHANGES:
122    schoolfees_path = os.path.join(
123        os.path.dirname(__file__), '../students/schoolfees_%s.csv' %year)
124    reader = csv.DictReader(open(schoolfees_path, 'rb'))
125    SCHOOLFEES[year] = {item['code']:item for item in reader}
126
127acceptancefees_path = os.path.join(
128    os.path.dirname(__file__), '../students/acceptancefees.csv')
129reader = csv.DictReader(open(acceptancefees_path, 'rb'))
130ACCEPTANCEFEES = {item['code']:item for item in reader}
131
132class CustomInterswitchPageApplicant(InterswitchPageApplicant):
133    """ View which sends a POST request to the Interswitch
134    CollegePAY payment gateway.
135
136    So far only PT application has been configured.
137    """
138    grok.context(ICustomApplicantOnlinePayment)
139    action = POST_ACTION
140    site_name = SITE_NAME
141    currency = CURRENCY
142    provider_bank_id = PROVIDER_BANK_ID
143    provider_acct = PROVIDER_ACCT
144    pay_item_id = '101'
145    product_id = PRODUCT_ID
146
147    def update(self):
148        if not module_activated(
149            self.context.__parent__.__parent__.year, self.context):
150            self.flash(_('Forbidden'), type='danger')
151            self.redirect(self.url(self.context, '@@index'))
152            return
153        error = self.init_update()
154        if error:
155            self.flash(error, type='danger')
156            self.redirect(self.url(self.context, '@@index'))
157            return
158        # Already now it becomes an Interswitch payment. We set the net amount
159        # and add the gateway amount.
160        if not self.context.r_company:
161            self.context.net_amt = self.context.amount_auth
162            self.context.amount_auth += GATEWAY_AMT
163            self.context.gateway_amt = GATEWAY_AMT
164            self.context.r_company = u'interswitch'
165        xmldict = {}
166        provider_amt = 2000.0
167        xmldict['institution_acct'] = '2043582644'
168        xmldict['institution_bank_id'] = '8'
169        if self.applicant.__parent__.code in ('ver2019', 'send2019', 'res2024'):
170            provider_amt = 3000.0
171            xmldict['institution_acct'] = '2043583005'
172            xmldict['institution_bank_id'] = '8'
173        elif self.applicant.__parent__.code.startswith('cert'):
174            provider_amt = 3000.0
175        elif self.applicant.__parent__.code.startswith('trans'):
176            provider_amt = 3000.0
177
178        if self.applicant.applicant_id.startswith('dsh'):
179            xmldict['institution_acct'] = '1014847058'
180            xmldict['institution_bank_id'] = '7'
181        elif self.applicant.applicant_id.startswith('ijmbe'):
182            xmldict['institution_acct'] = '1012278272'
183            xmldict['institution_bank_id'] = '123'
184        elif 'alumni' in self.application_url():
185            xmldict['institution_acct'] = '2043583005'
186        xmldict['detail_ref'] = self.context.p_id
187        xmldict['provider_amt'] = 100 * provider_amt
188        xmldict['provider_acct'] = PROVIDER_ACCT
189        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
190        if 'alumni' in self.application_url():
191            xmldict['provider_acct'] = '0427773399'
192            xmldict['provider_bank_id'] = '10'
193        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
194        xmldict['institution_item_name'] = self.context.category
195        xmldict['institution_name'] = INSTITUTION_NAME
196        xmldict['institution_amt'] = 100 * self.context.net_amt
197        if not self.context.provider_amt:
198            self.context.provider_amt = provider_amt
199            self.context.amount_auth += provider_amt
200        if provider_amt:
201            xmltext = """<payment_item_detail>
202<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
203<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
204<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
205</item_details>
206</payment_item_detail>""" % xmldict
207        else:
208            xmltext = """<payment_item_detail>
209<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
210<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
211</item_details>
212</payment_item_detail>""" % xmldict
213
214        # Overwrite above configuration
215        if self.applicant.__parent__.code in ('cert1', 'cert2', 'cert6', 'cert9'):
216            xmldict['institution_amt'] = 100 * self.context.net_amt - 100000
217            xmltext = """<payment_item_detail>
218<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
219<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
220<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
221<item_detail item_id="3" item_name="Ambrose Alli Foundation" item_amt="100000" bank_id="117" acct_num="1015567975" />
222</item_details>
223</payment_item_detail>""" % xmldict
224
225        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
226        xmlitems = ''
227        xmldoc = minidom.parseString(xmltext)
228        itemlist = xmldoc.getElementsByTagName('item_detail')
229        for s in itemlist:
230            xmlitems += "%s (%s %s, %s (%s)),  " % (
231                s.attributes['item_name'].value,
232                u'\u20a6',
233                int(s.attributes['item_amt'].value)/100,
234                s.attributes['acct_num'].value,
235                s.attributes['bank_id'].value,
236                )
237        self.context.p_split_data = xmlitems
238        self.amount_auth = int(100 * self.context.amount_auth)
239        hashargs = (
240            self.context.p_id +
241            PRODUCT_ID +
242            self.pay_item_id +
243            str(int(self.amount_auth)) +
244            self.site_redirect_url +
245            MAC)
246        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
247        return
248
249class CustomInterswitchPageStudent(InterswitchPageStudent):
250    """ View which sends a POST request to the Interswitch
251    CollegePAY payment gateway.
252    """
253    grok.context(ICustomStudentOnlinePayment)
254    action = POST_ACTION
255    site_name = SITE_NAME
256    currency = CURRENCY
257    pay_item_id = '101'
258    product_id = PRODUCT_ID
259
260    def update(self):
261        if not module_activated(
262            self.context.student.current_session, self.context):
263            self.flash(_('Forbidden'), type='danger')
264            self.redirect(self.url(self.context, '@@index'))
265            return
266        error = self.init_update()
267        if error:
268            self.flash(error, type='danger')
269            self.redirect(self.url(self.context, '@@index'))
270            return
271        student = self.student
272        category = self.context.p_category
273        # To guarantee that cleared students pay both acceptance fee
274        # and school fees, the page can only be accessed
275        # for school fee payments if acceptance/clearance fee has
276        # been successfully queried/paid beforehand. This
277        # requirement applies to students in state 'cleared' and
278        # entry_session greater than 2012 only.
279        if self.context.p_category.startswith('schoolfee') and \
280            student.state == CLEARED and \
281            student.entry_session > 2012:
282            acceptance_fee_paid = False
283            for ticket in student['payments'].values():
284                if ticket.p_state == 'paid' and \
285                    ticket.p_category.startswith('clearance'):
286                    acceptance_fee_paid = True
287                    break
288            if not acceptance_fee_paid:
289                self.flash(
290                    _('Please pay acceptance fee first.'), type="danger")
291                self.redirect(self.url(self.context, '@@index'))
292                return
293        # Already now it becomes an Interswitch payment. We set the net amount
294        # and add the gateway amount.
295        if not self.context.r_company:
296            self.context.net_amt = self.context.amount_auth
297            self.context.amount_auth += GATEWAY_AMT
298            self.context.gateway_amt = GATEWAY_AMT
299            self.context.r_company = u'interswitch'
300        xmldict = self.xmldict
301        # Provider data
302        xmldict['detail_ref'] = self.context.p_id
303        xmldict['provider_acct'] = PROVIDER_ACCT
304        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
305        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
306        # Institution data
307        xmldict['institution_acct'] = '00000000'
308        xmldict['institution_bank_id'] = '00'
309        provider_amt = 0.0
310        if category.startswith('clearance'):
311            provider_amt = 1500.0
312        elif category.startswith('hostel_maintenance'):
313            provider_amt = 1000.0
314        elif category in ('schoolfee', 'schoolfee_1', 'schoolfee_incl'):
315            provider_amt = 2500.0
316        xmldict['provider_amt'] = 100 * provider_amt
317        xmldict['institution_item_name'] = self.context.category
318        xmldict['institution_name'] = INSTITUTION_NAME
319        xmldict['institution_amt'] = 100 * self.context.net_amt
320        if not self.context.provider_amt:
321            self.context.provider_amt = provider_amt
322            self.context.amount_auth += provider_amt
323        xmltext = ''
324
325        # School fee
326        if category.startswith('schoolfee'):
327            # collect additional fees
328            if self.context.p_category in ('schoolfee_1', 'schoolfee_incl'):
329                xmltext = """<payment_item_detail>
330<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">""" % xmldict
331                item_id = 1
332
333                if student.entry_session < 2013:
334                    sorted_items = SCHOOLFEES[12][student.certcode].items()
335                elif student.entry_session < 2014:
336                    sorted_items = SCHOOLFEES[13][student.certcode].items()
337                elif student.entry_session < 2015:
338                    sorted_items = SCHOOLFEES[14][student.certcode].items()
339                elif student.entry_session < 2020:
340                    sorted_items = SCHOOLFEES[15][student.certcode].items()
341                elif student.entry_session < 2021:
342                    sorted_items = SCHOOLFEES[20][student.certcode].items()
343                elif student.entry_session < 2022:
344                    sorted_items = SCHOOLFEES[21][student.certcode].items()
345                elif student.entry_session < 2023:
346                    sorted_items = SCHOOLFEES[22][student.certcode].items()
347                else:
348                    sorted_items = SCHOOLFEES[23][student.certcode].items()
349                # Move tuition. We expect that tuition is the fourth element
350                sorted_items.insert(0, sorted_items.pop(3))
351                for item in sorted_items:
352                    try:
353                        if  item[1].startswith('100_') and student.state == CLEARED:
354                            # first year payment only
355                            item_amt = int(item[1].split('_')[1])
356                        else:
357                            item_amt = int(item[1])
358                        if self.context.p_category == 'schoolfee_1' and item[0] == 'tuition':
359                            item_amt /= 2
360                        # Add non-indigenous fee and session specific penalty fees
361                        try:
362                            academic_session = grok.getSite()['configuration'][str(self.context.p_session)]
363                        except KeyError:
364                            self.flash(
365                                _('Session configuration object is missing.'), type="danger")
366                            self.redirect(self.url(self.context, '@@index'))
367                            return
368                        if student.is_postgrad and item[0] == 'tuition':
369                            item_amt += academic_session.penalty_pg
370                            if student.lga and not student.lga.startswith('edo') \
371                                and student.entry_session < 2022:
372                                item_amt += 20000.0
373                        else:
374                            item_amt += academic_session.penalty_ug
375                        item_amt *= 100
376                        acct_num = ''
377                        bank_id = ''
378                        item_name = ''
379                        # Find appropriate bank
380                        bank = None
381                        try:
382                            bank = BANK_ACCOUNTS[item[0]]
383                        except: # transfer to faculty account
384                            if student.is_postgrad:
385                                bank = BANK_ACCOUNTS['postgrad']
386                            elif student.current_mode in (
387                                'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh', 'dp_ft'):
388                                bank = BANK_ACCOUNTS['parttime']
389                            elif student.faccode in ('FAG', 'FAT', 'FBM', 'FMLS', 'fac1'):
390                                bank = BANK_ACCOUNTS['fac1']
391                            elif student.faccode in ('FCS', 'FED', 'FES', 'FET'):
392                                bank = BANK_ACCOUNTS['fac2']
393                            elif student.faccode in ('FLS', 'FLW', 'FMS', 'FPS', 'FSS'):
394                                bank = BANK_ACCOUNTS['fac3']
395                            elif student.faccode in ('FP',):
396                                bank = BANK_ACCOUNTS['ijmb']
397                        if not bank:
398                            self.flash(
399                                'Bank account not set (%s).' % item[0], type="danger")
400                            self.redirect(self.url(self.context, '@@index'))
401                            return
402                        acct_num = bank[0]
403                        bank_id = bank[1]
404                        item_name = FEE_NAMES[item[0]]
405                        xmltext += """
406<item_detail item_id="%s" item_name="%s" item_amt="%d" bank_id="%s" acct_num="%s" />""" % (item_id, item_name, item_amt, bank_id, acct_num)
407                        item_id += 1
408                    except:
409                        pass
410                xmldict['item_id'] = item_id
411                xmltext += """
412<item_detail item_id="%(item_id)d" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
413</item_details>
414</payment_item_detail>""" % xmldict
415            # no additional charges, determine faculty bank only
416            else:
417                bank = None
418                if student.is_postgrad:
419                    bank = BANK_ACCOUNTS['postgrad']
420                elif student.current_mode in (
421                    'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh', 'dp_ft'):
422                    bank = BANK_ACCOUNTS['parttime']
423                elif student.faccode in ('FAG', 'FAT', 'FBM', 'FMLS', 'fac1'):
424                    bank = BANK_ACCOUNTS['fac1']
425                elif student.faccode in ('FCS', 'FED', 'FES', 'FET'):
426                    bank = BANK_ACCOUNTS['fac2']
427                elif student.faccode in ('FLS', 'FLW', 'FMS', 'FPS', 'FSS'):
428                    bank = BANK_ACCOUNTS['fac3']
429                elif student.faccode in ('FP',):
430                    bank = BANK_ACCOUNTS['ijmb']
431                if not bank:
432                    self.flash('Bank account not set.', type="danger")
433                    self.redirect(self.url(self.context, '@@index'))
434                    return
435                xmldict['institution_acct'] = bank[0]
436                xmldict['institution_bank_id'] = bank[1]
437
438        # Clearance (acceptance) fee
439
440        elif category.startswith('clearance'):
441            # collect additional fees
442            if self.context.p_category == 'clearance_incl':
443                xmltext = """<payment_item_detail>
444<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">""" % xmldict
445                item_id = 1
446                for item in ACCEPTANCEFEES[student.certcode].items():
447                    try:
448                        item_amt = 100 * int(item[1])
449                        bank = BANK_ACCOUNTS[item[0]]
450                        acct_num = bank[0]
451                        bank_id = bank[1]
452                        item_name = FEE_NAMES[item[0]]
453                        xmltext += """
454<item_detail item_id="%s" item_name="%s" item_amt="%d" bank_id="%s" acct_num="%s" />""" % (item_id, item_name, item_amt, bank_id, acct_num)
455                        item_id += 1
456                    except:
457                        pass
458                xmldict['item_id'] = item_id
459                xmltext += """
460<item_detail item_id="%(item_id)d" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
461</item_details>
462</payment_item_detail>""" % xmldict
463            # no additional charges, determine faculty bank only
464            else:
465                if student.is_postgrad:
466                    bank = BANK_ACCOUNTS['postgrad']
467                else:
468                    bank = BANK_ACCOUNTS['acceptance']
469                xmldict['institution_acct'] = bank[0]
470                xmldict['institution_bank_id'] = bank[1]
471
472        # Hostel Maintenance
473
474        elif category == 'hostel_maintenance':
475            xmldict['institution_amt'] = 100 * self.context.net_amt - 1000000
476            bank = BANK_ACCOUNTS[category]
477            xmldict['institution_acct'] = bank[0]
478            xmldict['institution_bank_id'] = bank[1]
479            xmltext = """<payment_item_detail>
480<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
481<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
482<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
483<item_detail item_id="3" item_name="Hostel Consumable Fee" item_amt="1000000" bank_id="123" acct_num="1012332141" />
484</item_details>
485</payment_item_detail>""" % xmldict
486
487        # Other fees
488
489        elif category in BANK_ACCOUNTS.keys():
490            bank = BANK_ACCOUNTS[category]
491            xmldict['institution_acct'] = bank[0]
492            xmldict['institution_bank_id'] = bank[1]
493
494        if not xmltext and provider_amt == 0:
495            xmltext = """<payment_item_detail>
496<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
497<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
498</item_details>
499</payment_item_detail>""" % xmldict
500        elif not xmltext:
501            xmltext = """<payment_item_detail>
502<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
503<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
504<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
505</item_details>
506</payment_item_detail>""" % xmldict
507        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
508        xmlitems = ''
509        xmldoc = minidom.parseString(xmltext)
510        itemlist = xmldoc.getElementsByTagName('item_detail')
511        for s in itemlist:
512            xmlitems += "%s (%s %s, %s (%s)),  " % (
513                s.attributes['item_name'].value,
514                u'\u20a6',
515                int(s.attributes['item_amt'].value)/100,
516                s.attributes['acct_num'].value,
517                s.attributes['bank_id'].value,
518                )
519        self.context.p_split_data = xmlitems
520        self.context.provider_amt = provider_amt
521        self.amount_auth = int(100 * self.context.amount_auth)
522        hashargs = (
523            self.context.p_id +
524            PRODUCT_ID +
525            self.pay_item_id +
526            str(int(self.amount_auth)) +
527            self.site_redirect_url +
528            MAC)
529        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
530        return
531
532
533class CustomInterswitchPaymentRequestWebservicePageApplicant(
534    InterswitchPaymentRequestWebservicePageApplicant):
535    """Request webservice view for the CollegePAY gateway
536    """
537    grok.context(ICustomApplicantOnlinePayment)
538    gateway_host = HOST
539    gateway_url = URL
540    https = HTTPS
541    mac = MAC
542    product_id = PRODUCT_ID
543
544class CustomInterswitchPaymentVerifyWebservicePageApplicant(
545    InterswitchPaymentVerifyWebservicePageApplicant):
546    """Payment verify view for the CollegePAY gateway
547    """
548    grok.context(ICustomApplicantOnlinePayment)
549    gateway_host = HOST
550    gateway_url = URL
551    https = HTTPS
552    mac = MAC
553    product_id = PRODUCT_ID
554
555class CustomInterswitchPaymentRequestWebservicePageStudent(
556    InterswitchPaymentRequestWebservicePageStudent):
557    """Request webservice view for the CollegePAY gateway
558    """
559    grok.context(ICustomStudentOnlinePayment)
560    gateway_host = HOST
561    gateway_url = URL
562    https = HTTPS
563    mac = MAC
564    product_id = PRODUCT_ID
565
566class CustomInterswitchPaymentVerifyWebservicePageStudent(
567    InterswitchPaymentVerifyWebservicePageStudent):
568    """Payment verify view for the CollegePAY gateway
569    """
570    grok.context(ICustomStudentOnlinePayment)
571    gateway_host = HOST
572    gateway_url = URL
573    https = HTTPS
574    mac = MAC
575    product_id = PRODUCT_ID
Note: See TracBrowser for help on using the repository browser.