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

Last change on this file since 17660 was 17657, checked in by Henrik Bettermann, 11 months ago

Change accounts.

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