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

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

Show item name not amount.

  • Property svn:executable set to *
File size: 25.5 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
79    'hostel_maintenance': ('1006406795', '123'),
80    'bed_allocation':     ('1006406795', '123'),
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'),
95
96    'postgrad': ('1010827641', '117'),
97    }
98
99FEE_NAMES = {
100    'edohis':     'Edo State Health Insurance Scheme',
101    'union':      'Student Union Dues',
102    'union_pt':   'Student Union Dues Part-Time',
103    'sport':      'Sport Development Fee',
104    'access':     'Access Card Fee',
105    'notebook':   'Branded Notebook',
106    'accredit':   'Accreditation Fee',
107    'library':    'Library Development Fee',
108    'tuition':    'Tuition',
109    'acceptance': 'Acceptance Fee',
110    'matricgown': 'Matriculation Gown Fee',
111    'lapel':      'File/Lapel Fee',
112    'lmsplus':    'LMS Plus Fee',
113    'nuga':       'NUGA Fee',
114    }
115
116
117SCHOOLFEES = dict()
118
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}
124
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'
143    product_id = PRODUCT_ID
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 = {}
164        provider_amt = 2000.0
165        if self.applicant.__parent__.code in ('ver2019', 'send2019'):
166            provider_amt = 0.0
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
171        xmldict['institution_acct'] = '2043582644'
172        xmldict['institution_bank_id'] = '8'
173        if self.applicant.applicant_id.startswith('dsh'):
174            xmldict['institution_acct'] = '1014847058'
175            xmldict['institution_bank_id'] = '7'
176        elif self.applicant.applicant_id.startswith('ijmbe'):
177            xmldict['institution_acct'] = '1012278272'
178            xmldict['institution_bank_id'] = '123'
179        elif 'alumni' in self.application_url():
180            xmldict['institution_acct'] = '2043583005'
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
185        if 'alumni' in self.application_url():
186            xmldict['provider_acct'] = '0427773399'
187            xmldict['provider_bank_id'] = '10'
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
195        if provider_amt:
196            xmltext = """<payment_item_detail>
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
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
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
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:
225            xmlitems += "%s (%s %s, %s (%s)),  " % (
226                s.attributes['item_name'].value,
227                u'\u20a6',
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'
253    product_id = PRODUCT_ID
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
266        student = self.student
267        category = self.context.p_category
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
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
327
328                if student.entry_session < 2013:
329                    sorted_items = SCHOOLFEES[12][student.certcode].items()
330                elif student.entry_session < 2014:
331                    sorted_items = SCHOOLFEES[13][student.certcode].items()
332                elif student.entry_session < 2015:
333                    sorted_items = SCHOOLFEES[14][student.certcode].items()
334                elif student.entry_session < 2020:
335                    sorted_items = SCHOOLFEES[15][student.certcode].items()
336                elif student.entry_session < 2021:
337                    sorted_items = SCHOOLFEES[20][student.certcode].items()
338                elif student.entry_session < 2022:
339                    sorted_items = SCHOOLFEES[21][student.certcode].items()
340                elif student.entry_session < 2023:
341                    sorted_items = SCHOOLFEES[22][student.certcode].items()
342                else:
343                    sorted_items = SCHOOLFEES[23][student.certcode].items()
344                # Move tuition. We expect that tuition is the fourth element
345                sorted_items.insert(0, sorted_items.pop(3))
346                for item in sorted_items:
347                    try:
348                        if  item[1].startswith('100_') and student.state == CLEARED:
349                            # first year payment only
350                            item_amt = int(item[1].split('_')[1])
351                        else:
352                            item_amt = int(item[1])
353                        if self.context.p_category == 'schoolfee_1' and item[0] == 'tuition':
354                            item_amt /= 2
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
371                        acct_num = ''
372                        bank_id = ''
373                        item_name = ''
374                        # Find appropriate bank
375                        bank = None
376                        try:
377                            bank = BANK_ACCOUNTS[item[0]]
378                        except: # transfer to faculty account
379                            if student.is_postgrad:
380                                bank = BANK_ACCOUNTS['postgrad']
381                            elif student.current_mode in (
382                                'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
383                                bank = BANK_ACCOUNTS['parttime']
384                            elif student.faccode in ('FAG', 'FAT', 'FBM', 'FMLS', 'fac1'):
385                                bank = BANK_ACCOUNTS['fac1']
386                            elif student.faccode in ('FCS', 'FED', 'FES', 'FET'):
387                                bank = BANK_ACCOUNTS['fac2']
388                            elif student.faccode in ('FLS', 'FLW', 'FMS', 'FPS', 'FSS'):
389                                bank = BANK_ACCOUNTS['fac3']
390                            elif student.faccode in ('FP',):
391                                bank = BANK_ACCOUNTS['ijmb']
392                        if not bank:
393                            self.flash(
394                                'Bank account not set (%s).' % item[0], type="danger")
395                            self.redirect(self.url(self.context, '@@index'))
396                            return
397                        acct_num = bank[0]
398                        bank_id = bank[1]
399                        item_name = FEE_NAMES[item[0]]
400                        xmltext += """
401<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)
402                        item_id += 1
403                    except:
404                        pass
405                xmldict['item_id'] = item_id
406                xmltext += """
407<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" />
408</item_details>
409</payment_item_detail>""" % xmldict
410            # no additional charges, determine faculty bank only
411            else:
412                bank = None
413                if student.is_postgrad:
414                    bank = BANK_ACCOUNTS['postgrad']
415                elif student.current_mode in (
416                    'ug_pt', 'de_pt','dp_pt', 'de_dsh', 'ug_dsh'):
417                    bank = BANK_ACCOUNTS['parttime']
418                elif student.faccode in ('FAG', 'FAT', 'FBM', 'FMLS', 'fac1'):
419                    bank = BANK_ACCOUNTS['fac1']
420                elif student.faccode in ('FCS', 'FED', 'FES', 'FET'):
421                    bank = BANK_ACCOUNTS['fac2']
422                elif student.faccode in ('FLS', 'FLW', 'FMS', 'FPS', 'FSS'):
423                    bank = BANK_ACCOUNTS['fac3']
424                elif student.faccode in ('FP',):
425                    bank = BANK_ACCOUNTS['ijmb']
426                if not bank:
427                    self.flash('Bank account not set.', type="danger")
428                    self.redirect(self.url(self.context, '@@index'))
429                    return
430                xmldict['institution_acct'] = bank[0]
431                xmldict['institution_bank_id'] = bank[1]
432
433        # Clearance (acceptance) fee
434
435        elif category.startswith('clearance'):
436            # collect additional fees
437            if self.context.p_category == 'clearance_incl':
438                xmltext = """<payment_item_detail>
439<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">""" % xmldict
440                item_id = 1
441                for item in ACCEPTANCEFEES[student.certcode].items():
442                    try:
443                        item_amt = 100 * int(item[1])
444                        bank = BANK_ACCOUNTS[item[0]]
445                        acct_num = bank[0]
446                        bank_id = bank[1]
447                        item_name = FEE_NAMES[item[0]]
448                        xmltext += """
449<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)
450                        item_id += 1
451                    except:
452                        pass
453                xmldict['item_id'] = item_id
454                xmltext += """
455<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" />
456</item_details>
457</payment_item_detail>""" % xmldict
458            # no additional charges, determine faculty bank only
459            else:
460                if student.is_postgrad:
461                    bank = BANK_ACCOUNTS['postgrad']
462                else:
463                    bank = BANK_ACCOUNTS['acceptance']
464                xmldict['institution_acct'] = bank[0]
465                xmldict['institution_bank_id'] = bank[1]
466
467        # Hostel Maintenance
468
469        elif category == 'hostel_maintenance':
470            xmldict['institution_amt'] = 100 * self.context.net_amt - 1000000
471            bank = BANK_ACCOUNTS[category]
472            xmldict['institution_acct'] = bank[0]
473            xmldict['institution_bank_id'] = bank[1]
474            xmltext = """<payment_item_detail>
475<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
476<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" />
477<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" />
478<item_detail item_id="3" item_name="Hostel Consumable Fee" item_amt="1000000" bank_id="123" acct_num="1012332141" />
479</item_details>
480</payment_item_detail>""" % xmldict
481
482        # Other fees
483
484        elif category in BANK_ACCOUNTS.keys():
485            bank = BANK_ACCOUNTS[category]
486            xmldict['institution_acct'] = bank[0]
487            xmldict['institution_bank_id'] = bank[1]
488
489        if not xmltext and provider_amt == 0:
490            xmltext = """<payment_item_detail>
491<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
492<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" />
493</item_details>
494</payment_item_detail>""" % xmldict
495        elif not xmltext:
496            xmltext = """<payment_item_detail>
497<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
498<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" />
499<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" />
500</item_details>
501</payment_item_detail>""" % xmldict
502        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
503        xmlitems = ''
504        xmldoc = minidom.parseString(xmltext)
505        itemlist = xmldoc.getElementsByTagName('item_detail')
506        for s in itemlist:
507            xmlitems += "%s (%s %s, %s (%s)),  " % (
508                s.attributes['item_name'].value,
509                u'\u20a6',
510                int(s.attributes['item_amt'].value)/100,
511                s.attributes['acct_num'].value,
512                s.attributes['bank_id'].value,
513                )
514        self.context.p_split_data = xmlitems
515        self.context.provider_amt = provider_amt
516        self.amount_auth = int(100 * self.context.amount_auth)
517        hashargs = (
518            self.context.p_id +
519            PRODUCT_ID +
520            self.pay_item_id +
521            str(int(self.amount_auth)) +
522            self.site_redirect_url +
523            MAC)
524        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
525        return
526
527
528class CustomInterswitchPaymentRequestWebservicePageApplicant(
529    InterswitchPaymentRequestWebservicePageApplicant):
530    """Request webservice view for the CollegePAY gateway
531    """
532    grok.context(ICustomApplicantOnlinePayment)
533    gateway_host = HOST
534    gateway_url = URL
535    https = HTTPS
536    mac = MAC
537    product_id = PRODUCT_ID
538
539class CustomInterswitchPaymentVerifyWebservicePageApplicant(
540    InterswitchPaymentVerifyWebservicePageApplicant):
541    """Payment verify view for the CollegePAY gateway
542    """
543    grok.context(ICustomApplicantOnlinePayment)
544    gateway_host = HOST
545    gateway_url = URL
546    https = HTTPS
547    mac = MAC
548    product_id = PRODUCT_ID
549
550class CustomInterswitchPaymentRequestWebservicePageStudent(
551    InterswitchPaymentRequestWebservicePageStudent):
552    """Request webservice view for the CollegePAY gateway
553    """
554    grok.context(ICustomStudentOnlinePayment)
555    gateway_host = HOST
556    gateway_url = URL
557    https = HTTPS
558    mac = MAC
559    product_id = PRODUCT_ID
560
561class CustomInterswitchPaymentVerifyWebservicePageStudent(
562    InterswitchPaymentVerifyWebservicePageStudent):
563    """Payment verify view for the CollegePAY gateway
564    """
565    grok.context(ICustomStudentOnlinePayment)
566    gateway_host = HOST
567    gateway_url = URL
568    https = HTTPS
569    mac = MAC
570    product_id = PRODUCT_ID
Note: See TracBrowser for help on using the repository browser.