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

Last change on this file since 17650 was 17643, checked in by Henrik Bettermann, 12 months ago

Set bank account for schoolfee_2 part time payments.

  • Property svn:executable set to *
File size: 24.9 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 = {
[17514]59    'edohis':    ('1222577132', '117'),
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
[17468]74    'acceptance': ('2000249757', '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
[17630]171        xmldict['institution_acct'] = '2000249757'
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'
176        if self.applicant.applicant_id.startswith('ijmbe'):
177            xmldict['institution_acct'] = '1012278272'
178            xmldict['institution_bank_id'] = '123'
[17431]179        xmldict['detail_ref'] = self.context.p_id
180        xmldict['provider_amt'] = 100 * provider_amt
181        xmldict['provider_acct'] = PROVIDER_ACCT
182        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
[17490]183        if 'alumni' in self.application_url():
184            xmldict['provider_acct'] = '0427773399'
185            xmldict['provider_bank_id'] = '10'
[17431]186        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
187        xmldict['institution_item_name'] = self.context.category
188        xmldict['institution_name'] = INSTITUTION_NAME
189        xmldict['institution_amt'] = 100 * self.context.net_amt
190        if not self.context.provider_amt:
191            self.context.provider_amt = provider_amt
192            self.context.amount_auth += provider_amt
[17469]193        if provider_amt:
194            xmltext = """<payment_item_detail>
[17431]195<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
196<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" />
197<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" />
198</item_details>
199</payment_item_detail>""" % xmldict
[17469]200        else:
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_details>
205</payment_item_detail>""" % xmldict
[17485]206
207        # Overwrite above configuration
208        if self.applicant.__parent__.code in ('cert1', 'cert2', 'cert6', 'cert9'):
209            xmldict['institution_amt'] = 100 * self.context.net_amt - 100000
210            xmltext = """<payment_item_detail>
211<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
212<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" />
213<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" />
214<item_detail item_id="3" item_name="Ambrose Alli Foundation" item_amt="100000" bank_id="117" acct_num="1015567975" />
215</item_details>
216</payment_item_detail>""" % xmldict
217
[17431]218        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
219        xmlitems = ''
220        xmldoc = minidom.parseString(xmltext)
221        itemlist = xmldoc.getElementsByTagName('item_detail')
222        for s in itemlist:
[17442]223            xmlitems += "%s (%s %s, %s (%s)),  " % (
[17431]224                s.attributes['item_name'].value,
[17442]225                u'\u20a6',
[17431]226                int(s.attributes['item_amt'].value)/100,
227                s.attributes['acct_num'].value,
228                s.attributes['bank_id'].value,
229                )
230        self.context.p_split_data = xmlitems
231        self.amount_auth = int(100 * self.context.amount_auth)
232        hashargs = (
233            self.context.p_id +
234            PRODUCT_ID +
235            self.pay_item_id +
236            str(int(self.amount_auth)) +
237            self.site_redirect_url +
238            MAC)
239        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
240        return
241
242class CustomInterswitchPageStudent(InterswitchPageStudent):
243    """ View which sends a POST request to the Interswitch
244    CollegePAY payment gateway.
245    """
246    grok.context(ICustomStudentOnlinePayment)
247    action = POST_ACTION
248    site_name = SITE_NAME
249    currency = CURRENCY
250    pay_item_id = '101'
[17433]251    product_id = PRODUCT_ID
[17431]252
253    def update(self):
254        if not module_activated(
255            self.context.student.current_session, self.context):
256            self.flash(_('Forbidden'), type='danger')
257            self.redirect(self.url(self.context, '@@index'))
258            return
259        error = self.init_update()
260        if error:
261            self.flash(error, type='danger')
262            self.redirect(self.url(self.context, '@@index'))
263            return
[17434]264        student = self.student
[17431]265        category = self.context.p_category
[17434]266        # To guarantee that cleared students pay both acceptance fee
267        # and school fees, the page can only be accessed
268        # for school fee payments if acceptance/clearance fee has
269        # been successfully queried/paid beforehand. This
270        # requirement applies to students in state 'cleared' and
271        # entry_session greater than 2012 only.
272        if self.context.p_category.startswith('schoolfee') and \
273            student.state == CLEARED and \
274            student.entry_session > 2012:
275            acceptance_fee_paid = False
276            for ticket in student['payments'].values():
277                if ticket.p_state == 'paid' and \
278                    ticket.p_category.startswith('clearance'):
279                    acceptance_fee_paid = True
280                    break
281            if not acceptance_fee_paid:
282                self.flash(
283                    _('Please pay acceptance fee first.'), type="danger")
284                self.redirect(self.url(self.context, '@@index'))
285                return
[17431]286        # Already now it becomes an Interswitch payment. We set the net amount
287        # and add the gateway amount.
288        if not self.context.r_company:
289            self.context.net_amt = self.context.amount_auth
290            self.context.amount_auth += GATEWAY_AMT
291            self.context.gateway_amt = GATEWAY_AMT
292            self.context.r_company = u'interswitch'
293        xmldict = self.xmldict
294        # Provider data
295        xmldict['detail_ref'] = self.context.p_id
296        xmldict['provider_acct'] = PROVIDER_ACCT
297        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
298        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
299        # Institution data
300        xmldict['institution_acct'] = '00000000'
301        xmldict['institution_bank_id'] = '00'
302        provider_amt = 0.0
303        if category.startswith('clearance'):
304            provider_amt = 1500.0
305        elif category.startswith('hostel_maintenance'):
306            provider_amt = 1000.0
307        elif category in ('schoolfee', 'schoolfee_1', 'schoolfee_incl'):
308            provider_amt = 2500.0
309        xmldict['provider_amt'] = 100 * provider_amt
310        xmldict['institution_item_name'] = self.context.category
311        xmldict['institution_name'] = INSTITUTION_NAME
312        xmldict['institution_amt'] = 100 * self.context.net_amt
313        if not self.context.provider_amt:
314            self.context.provider_amt = provider_amt
315            self.context.amount_auth += provider_amt
316        xmltext = ''
317
318        # School fee
319        if category.startswith('schoolfee'):
320            # collect additional fees
321            if self.context.p_category in ('schoolfee_1', 'schoolfee_incl'):
322                xmltext = """<payment_item_detail>
323<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">""" % xmldict
324                item_id = 1
[17446]325
326                if student.entry_session < 2013:
[17447]327                    sorted_items = SCHOOLFEES[12][student.certcode].items()
[17446]328                elif student.entry_session < 2014:
[17447]329                    sorted_items = SCHOOLFEES[13][student.certcode].items()
[17455]330                elif student.entry_session < 2015:
[17447]331                    sorted_items = SCHOOLFEES[14][student.certcode].items()
[17446]332                elif student.entry_session < 2020:
[17455]333                    sorted_items = SCHOOLFEES[15][student.certcode].items()
[17445]334                elif student.entry_session < 2021:
[17447]335                    sorted_items = SCHOOLFEES[20][student.certcode].items()
[17445]336                elif student.entry_session < 2022:
[17447]337                    sorted_items = SCHOOLFEES[21][student.certcode].items()
[17580]338                elif student.entry_session < 2023:
339                    sorted_items = SCHOOLFEES[22][student.certcode].items()
[17444]340                else:
[17580]341                    sorted_items = SCHOOLFEES[23][student.certcode].items()
[17529]342                # Move tuition. We expect that tuition is the fourth element
[17523]343                sorted_items.insert(0, sorted_items.pop(3))
[17439]344                for item in sorted_items:
[17431]345                    try:
[17508]346                        if  item[1].startswith('100_') and student.state == CLEARED:
[17494]347                            # first year payment only
[17529]348                            item_amt = int(item[1].split('_')[1])
[17494]349                        else:
[17529]350                            item_amt = int(item[1])
[17431]351                        if self.context.p_category == 'schoolfee_1' and item[0] == 'tuition':
352                            item_amt /= 2
[17529]353                        # Add non-indigenous fee and session specific penalty fees
354                        try:
355                            academic_session = grok.getSite()['configuration'][str(self.context.p_session)]
356                        except KeyError:
357                            self.flash(
358                                _('Session configuration object is missing.'), type="danger")
359                            self.redirect(self.url(self.context, '@@index'))
360                            return
361                        if student.is_postgrad and item[0] == 'tuition':
362                            item_amt += academic_session.penalty_pg
363                            if student.lga and not student.lga.startswith('edo') \
364                                and student.entry_session < 2022:
365                                item_amt += 20000.0
366                        else:
367                            item_amt += academic_session.penalty_ug
368                        item_amt *= 100
[17431]369                        acct_num = ''
370                        bank_id = ''
371                        item_name = ''
372                        # Find appropriate bank
373                        try:
374                            bank = BANK_ACCOUNTS[item[0]]
375                        except: # transfer to faculty account
[17516]376                            if student.is_postgrad:
377                                bank = BANK_ACCOUNTS['postgrad']
[17518]378                            elif student.current_mode in (
379                                'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
[17523]380                                bank = BANK_ACCOUNTS['parttime']
[17516]381                            elif student.faccode in ('FAG', 'FAT', 'FBM', 'FMLS', 'fac1'):
[17431]382                                bank = BANK_ACCOUNTS['fac1']
383                            elif student.faccode in ('FCS', 'FED', 'FES', 'FET'):
384                                bank = BANK_ACCOUNTS['fac2']
385                            elif student.faccode in ('FLS', 'FLW', 'FMS', 'FPS', 'FSS'):
386                                bank = BANK_ACCOUNTS['fac3']
[17582]387                            elif student.faccode in ('FP',):
388                                bank = BANK_ACCOUNTS['ijmb']
[17431]389                        acct_num = bank[0]
390                        bank_id = bank[1]
[17437]391                        item_name = FEE_NAMES[item[0]]
[17431]392                        xmltext += """
393<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)
394                        item_id += 1
395                    except:
396                        pass
397                xmldict['item_id'] = item_id
398                xmltext += """
399<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" />
400</item_details>
401</payment_item_detail>""" % xmldict
402            # no additional charges, determine faculty bank only
403            else:
[17468]404                if student.is_postgrad:
405                    bank = BANK_ACCOUNTS['postgrad']
[17643]406                elif student.current_mode in (
407                    'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
408                    bank = BANK_ACCOUNTS['parttime']
[17468]409                elif student.faccode in ('FAG', 'FAT', 'FBM', 'FMLS', 'fac1'):
[17431]410                    bank = BANK_ACCOUNTS['fac1']
411                elif student.faccode in ('FCS', 'FED', 'FES', 'FET'):
412                    bank = BANK_ACCOUNTS['fac2']
413                elif student.faccode in ('FLS', 'FLW', 'FMS', 'FPS', 'FSS'):
414                    bank = BANK_ACCOUNTS['fac3']
[17583]415                elif student.faccode in ('FP',):
416                    bank = BANK_ACCOUNTS['ijmb']
[17431]417                xmldict['institution_acct'] = bank[0]
418                xmldict['institution_bank_id'] = bank[1]
419
420
421        # Clearance (acceptance) fee
422
[17456]423        elif category.startswith('clearance'):
[17431]424            # collect additional fees
425            if self.context.p_category == 'clearance_incl':
426                xmltext = """<payment_item_detail>
427<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">""" % xmldict
428                item_id = 1
429                for item in ACCEPTANCEFEES[student.certcode].items():
430                    try:
431                        item_amt = 100 * int(item[1])
432                        bank = BANK_ACCOUNTS[item[0]]
433                        acct_num = bank[0]
434                        bank_id = bank[1]
[17437]435                        item_name = FEE_NAMES[item[0]]
[17431]436                        xmltext += """
437<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)
438                        item_id += 1
439                    except:
440                        pass
441                xmldict['item_id'] = item_id
442                xmltext += """
443<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" />
444</item_details>
445</payment_item_detail>""" % xmldict
446            # no additional charges, determine faculty bank only
447            else:
[17468]448                if student.is_postgrad:
449                    bank = BANK_ACCOUNTS['postgrad']
450                else:
451                    bank = BANK_ACCOUNTS['acceptance']
[17431]452                xmldict['institution_acct'] = bank[0]
453                xmldict['institution_bank_id'] = bank[1]
454
[17491]455        # Hostel Maintenance
456
457        elif category == 'hostel_maintenance':
458            xmldict['institution_amt'] = 100 * self.context.net_amt - 1000000
459            bank = BANK_ACCOUNTS[category]
460            xmldict['institution_acct'] = bank[0]
461            xmldict['institution_bank_id'] = bank[1]
462            xmltext = """<payment_item_detail>
463<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
464<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" />
465<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" />
466<item_detail item_id="3" item_name="Hostel Consumable Fee" item_amt="1000000" bank_id="123" acct_num="1012332141" />
467</item_details>
468</payment_item_detail>""" % xmldict
469
[17431]470        # Other fees
[17491]471
[17456]472        elif category in BANK_ACCOUNTS.keys():
473            bank = BANK_ACCOUNTS[category]
474            xmldict['institution_acct'] = bank[0]
475            xmldict['institution_bank_id'] = bank[1]
[17431]476
477        if not xmltext and provider_amt == 0:
478            xmltext = """<payment_item_detail>
479<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
480<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" />
481</item_details>
482</payment_item_detail>""" % xmldict
483        elif not xmltext:
484            xmltext = """<payment_item_detail>
485<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
486<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" />
487<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" />
488</item_details>
489</payment_item_detail>""" % xmldict
490        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
491        xmlitems = ''
492        xmldoc = minidom.parseString(xmltext)
493        itemlist = xmldoc.getElementsByTagName('item_detail')
494        for s in itemlist:
[17442]495            xmlitems += "%s (%s %s, %s (%s)),  " % (
[17431]496                s.attributes['item_name'].value,
497                u'\u20a6',
498                int(s.attributes['item_amt'].value)/100,
499                s.attributes['acct_num'].value,
500                s.attributes['bank_id'].value,
501                )
502        self.context.p_split_data = xmlitems
503        self.context.provider_amt = provider_amt
504        self.amount_auth = int(100 * self.context.amount_auth)
505        hashargs = (
506            self.context.p_id +
507            PRODUCT_ID +
508            self.pay_item_id +
509            str(int(self.amount_auth)) +
510            self.site_redirect_url +
511            MAC)
512        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
513        return
514
515
516class CustomInterswitchPaymentRequestWebservicePageApplicant(
517    InterswitchPaymentRequestWebservicePageApplicant):
518    """Request webservice view for the CollegePAY gateway
519    """
520    grok.context(ICustomApplicantOnlinePayment)
521    gateway_host = HOST
522    gateway_url = URL
523    https = HTTPS
[17480]524    mac = MAC
525    product_id = PRODUCT_ID
[17431]526
527class CustomInterswitchPaymentVerifyWebservicePageApplicant(
528    InterswitchPaymentVerifyWebservicePageApplicant):
529    """Payment verify view for the CollegePAY gateway
530    """
531    grok.context(ICustomApplicantOnlinePayment)
532    gateway_host = HOST
533    gateway_url = URL
534    https = HTTPS
535    mac = MAC
536    product_id = PRODUCT_ID
537
538class CustomInterswitchPaymentRequestWebservicePageStudent(
539    InterswitchPaymentRequestWebservicePageStudent):
540    """Request webservice view for the CollegePAY gateway
541    """
542    grok.context(ICustomStudentOnlinePayment)
543    gateway_host = HOST
544    gateway_url = URL
545    https = HTTPS
546    mac = MAC
547    product_id = PRODUCT_ID
548
549class CustomInterswitchPaymentVerifyWebservicePageStudent(
550    InterswitchPaymentVerifyWebservicePageStudent):
551    """Payment verify view for the CollegePAY gateway
552    """
553    grok.context(ICustomStudentOnlinePayment)
554    gateway_host = HOST
555    gateway_url = URL
556    https = HTTPS
557    mac = MAC
558    product_id = PRODUCT_ID
Note: See TracBrowser for help on using the repository browser.