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

Last change on this file since 15124 was 15121, checked in by Henrik Bettermann, 6 years ago

Change provider amount.

  • Property svn:keywords set to Id
File size: 24.3 KB
RevLine 
[12730]1## $Id: browser.py 15121 2018-09-04 10:04:51Z henrik $
[11846]2##
3## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18import httplib
19import hashlib
20import grok
21from zope.interface import Interface
22from zope.component import queryAdapter
[12975]23from waeup.kofa.interfaces import CLEARED
[11846]24from kofacustom.nigeria.interswitch.browser import (
25    InterswitchPaymentRequestWebservicePageStudent,
26    InterswitchPaymentRequestWebservicePageApplicant,
[13586]27    InterswitchPaymentVerifyWebservicePageApplicant,
28    InterswitchPaymentVerifyWebservicePageStudent,
[11846]29    InterswitchPageStudent, InterswitchPageApplicant,
30    )
31from waeup.aaue.students.interfaces import ICustomStudentOnlinePayment
32from waeup.aaue.applicants.interfaces import ICustomApplicantOnlinePayment
33from waeup.aaue.interfaces import MessageFactory as _
34
[13379]35PRODUCT_ID_PT = '5040'
36PRODUCT_ID_REGULAR = '5845'
[11846]37SITE_NAME = 'aaue.waeup.org'
[14823]38PROVIDER_ACCT = '1014261520'
[14232]39PROVIDER_BANK_ID = '117'
[14823]40PROVIDER_ITEM_NAME = 'WAeAC'
[11846]41INSTITUTION_NAME = 'AAU Ekpoma'
42CURRENCY = '566'
[11934]43GATEWAY_AMT = 250.0
[11933]44POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'
[11846]45
[11933]46HOST = 'webpay.interswitchng.com'
[13586]47URL = '/paydirect/api/v1/gettransaction.json'
[11916]48HTTPS = True
[13606]49MAC_REGULAR = '9718FA00B0F5070B388A9896ADCED9B2FB02D30F71E12E68BDADC63F6852A3496FF97D8A0F9DA9F753B911A49BB09BB87B55FD02046BD325C74C46C0123CF023'
50MAC_PT = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3'
[11846]51
[11917]52httplib.HTTPSConnection.debuglevel = 0
[11846]53
[13379]54
[13414]55def gateway_net_amt(fee):
[13438]56    if fee > GATEWAY_AMT:
[13414]57        return fee - GATEWAY_AMT
[13438]58    return 0.0
[13406]59
[13532]60def contr_agreement_applicant(applicant):
61    if applicant.__parent__.code[:2] in ('fp', 'pt'):
62        return 'first'
63    return 'second'
64
65def contr_agreement_student(student):
[13379]66    if student.current_mode == 'found' or student.current_mode.endswith('_pt'):
[13403]67        return 'first'
68    return 'second'
[13379]69
[11846]70class CustomInterswitchPageApplicant(InterswitchPageApplicant):
71    """ View which sends a POST request to the Interswitch
72    CollegePAY payment gateway.
[13379]73
74    So far only PT application has been configured.
[11846]75    """
76    grok.context(ICustomApplicantOnlinePayment)
77    action = POST_ACTION
78    site_name = SITE_NAME
79    currency = CURRENCY
80
81    def update(self):
82
[12975]83        error = self.init_update()
84        if error:
85            self.flash(error, type='danger')
86            self.redirect(self.url(self.context, '@@index'))
87            return
[13532]88        if contr_agreement_applicant(self.context.__parent__) == 'first':
89            self.product_id = PRODUCT_ID_PT
90            self.pay_item_id = '101'
[13606]91            self.mac = MAC_PT
[15084]92            provider_amt = 4000.0
[13532]93        else:
94            self.product_id = PRODUCT_ID_REGULAR
95            self.pay_item_id = '109'
[13606]96            self.mac = MAC_REGULAR
[15084]97            provider_amt = 1000.0
[15121]98            if self.applicant.__parent__.prefix in ('trans', 'cert'):
99                provider_amt = 2000.0
[11846]100        xmldict = {}
[15080]101        xmldict['institution_acct'] = '1010835352'
[11846]102        xmldict['institution_bank_id'] = '117'
103        xmldict['detail_ref'] = self.context.p_id
104        xmldict['provider_amt'] = 100 * provider_amt
105        xmldict['provider_acct'] = PROVIDER_ACCT
106        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
107        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
[13532]108        xmldict['institution_item_name'] = self.category
[11846]109        xmldict['institution_name'] = INSTITUTION_NAME
[14121]110
111        if self.applicant.applicant_id.startswith('pg'):
112            handbook_amount = 2000.0
113            xmldict['handbook_amount'] = 100 * handbook_amount
114            xmldict['institution_amt'] = 100 * (
115                self.context.amount_auth - provider_amt - handbook_amount -GATEWAY_AMT)
116            xmltext = """<payment_item_detail>
[11846]117<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
118<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" />
119<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" />
[14945]120<item_detail item_id="3" item_name="PG Handbook" item_amt="%(handbook_amount)d" bank_id="117" acct_num="1010827641" />
[11846]121</item_details>
122</payment_item_detail>""" % xmldict
[14121]123
[14122]124        elif self.applicant.applicant_id.startswith('utme'):
125            xmldict['provider_amt'] = 100 * provider_amt
126            xmldict['institution_amt'] = 100 * (
[14833]127                self.context.amount_auth - provider_amt - GATEWAY_AMT)
[14122]128            xmltext = """<payment_item_detail>
129<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
130<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" />
131<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" />
132</item_details>
133</payment_item_detail>""" % xmldict
134
[14121]135        else:
136            xmldict['institution_amt'] = 100 * (
137                self.context.amount_auth - provider_amt - GATEWAY_AMT)
138            xmltext = """<payment_item_detail>
139<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
140<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" />
141<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" />
142</item_details>
143</payment_item_detail>""" % xmldict
144
[11846]145        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
146        self.context.provider_amt = provider_amt
147        self.context.gateway_amt = GATEWAY_AMT
148
149        hashargs = (
150            self.context.p_id +
[13532]151            self.product_id +
[11846]152            self.pay_item_id +
153            str(int(self.amount_auth)) +
154            self.site_redirect_url +
155            self.mac)
156        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
157
158        return
159
[11868]160class CustomInterswitchPageStudent(InterswitchPageStudent):
161    """ View which sends a POST request to the Interswitch
162    CollegePAY payment gateway.
163    """
164    grok.context(ICustomStudentOnlinePayment)
165    action = POST_ACTION
166    site_name = SITE_NAME
167    currency = CURRENCY
[14248]168    pay_item_id = '000'
[11846]169
[11868]170    def update(self):
[12975]171        error = self.init_update()
[13376]172
[12975]173        if error:
174            self.flash(error, type='danger')
175            self.redirect(self.url(self.context, '@@index'))
176            return
[13400]177
[11868]178        student = self.student
[13408]179        p_session = self.context.p_session
[13400]180        try:
[13408]181            academic_session = grok.getSite()['configuration'][str(p_session)]
[13400]182        except KeyError:
[13407]183            self.flash(_(u'Session configuration object is not available.'),
184                       type='danger')
[13400]185            self.redirect(self.url(self.context, '@@index'))
186            return
[13532]187        if contr_agreement_student(student) == 'first':
[13382]188            self.product_id = PRODUCT_ID_PT
[13606]189            self.mac = MAC_PT
[13382]190        else:
191            self.product_id = PRODUCT_ID_REGULAR
[13606]192            self.mac = MAC_REGULAR
[13382]193
[12975]194        # To guarantee that cleared students pay both acceptance fee
195        # and school fees, the page can only be accessed
196        # for school fee payments if acceptance/clearance fee has
197        # been successfully queried/paid beforehand. This
198        # requirement applies to students in state 'cleared' and
[14380]199        # entry_session greater than 2012 only.
[13400]200        if self.context.p_category.startswith('schoolfee') and \
[12975]201            student.state == CLEARED and \
202            student.entry_session > 2012:
203            acceptance_fee_paid = False
204            for ticket in student['payments'].values():
205                if ticket.p_state == 'paid' and \
[13400]206                    ticket.p_category.startswith('clearance'):
[12975]207                    acceptance_fee_paid = True
208                    break
209            if not acceptance_fee_paid:
210                self.flash(
211                    _('Please pay acceptance fee first.'), type="danger")
212                self.redirect(self.url(self.context, '@@index'))
213                return
214
[11868]215        xmldict = self.xmldict
[12729]216        xmltext = ""
[14945]217        xmldict['institution_acct'] = '1010827641'
218        xmldict['institution_bank_id'] = '117'
[11868]219        xmldict['detail_ref'] = self.context.p_id
220        xmldict['provider_acct'] = PROVIDER_ACCT
221        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
222        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
223        xmldict['institution_item_name'] = self.category
224        xmldict['institution_name'] = INSTITUTION_NAME
[13381]225        provider_amt = 0.0
[12729]226
[13400]227        # Schoolfee
228        if self.context.p_category.startswith('schoolfee'):
[13532]229            if contr_agreement_student(student) == 'first':
[13403]230                # First agreement
[13400]231                provider_amt = 1900.0
232                joint_venture_amt = 1100.0
233                aaue_share_amt = 1000.0
[13414]234                student_union_due_amt = gateway_net_amt(
235                    academic_session.union_fee)
236                student_welfare_assurance_amt = gateway_net_amt(
237                    academic_session.welfare_fee)
[14980]238                xmldict['student_union_bank_id'] = '31'
239                xmldict['student_union_acct'] = '0051005007'
[14920]240                xmldict['aaue_share_bank_id'] = '117'
241                xmldict['aaue_share_acct'] = '1010827641'
242                xmldict['joint_venture_bank_id'] = '117'
243                xmldict['joint_venture_acct'] = '1010827641'
[13379]244                if student.current_mode == 'found':
245                    self.pay_item_id = '103'
246                else:
247                    self.pay_item_id = '105'
[13400]248            else:
[13403]249                # Second agreement
[13400]250                provider_amt = 1500.0
251                joint_venture_amt = 1000.0
252                aaue_share_amt = 1500.0
[13414]253                student_union_due_amt = gateway_net_amt(
254                    academic_session.union_fee)
255                student_welfare_assurance_amt = gateway_net_amt(
256                    academic_session.welfare_fee)
[14980]257                xmldict['student_union_bank_id'] = '7'
258                xmldict['student_union_acct'] = '1019763348'
[14920]259                xmldict['aaue_share_bank_id'] = '117'
260                xmldict['aaue_share_acct'] = '1010827641'
[14235]261                xmldict['joint_venture_bank_id'] = '117'
[14920]262                xmldict['joint_venture_acct'] = '1010827641'
[13644]263                self.pay_item_id = '107'
[13527]264                if student.is_postgrad:
265                    self.pay_item_id = '111'
[14469]266                if student.current_mode == 'ijmbe':
[14523]267                    self.pay_item_id = '119'
[14469]268                    xmldict['joint_venture_bank_id'] = '117'
[14945]269                    xmldict['joint_venture_acct'] = '1010827641'
[13400]270
271            xmldict['provider_amt'] = 100 * provider_amt
272            xmldict['joint_venture_amt'] = 100 * joint_venture_amt
273            xmldict['aaue_share_amt'] = 100 * aaue_share_amt
[13732]274            if self.context.p_item == 'Balance':
275                xmldict['institution_amt'] = 100 * (
276                    gateway_net_amt(self.context.amount_auth))
[14987]277            elif self.context.p_category in ('schoolfee_incl', 'schoolfee_1') \
278                and student.current_mode != 'ijmbe':
[13400]279                # Schoolfee including additional fees
[13379]280                xmldict['student_union_due_amt'] = 100 * student_union_due_amt
281                xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt
282                xmldict['institution_amt'] = 100 * (
[13414]283                    gateway_net_amt(self.context.amount_auth)
[13379]284                    - provider_amt
285                    - joint_venture_amt
286                    - aaue_share_amt
[13409]287                    - student_union_due_amt
[13414]288                    - student_welfare_assurance_amt)
[13379]289                xmltext = """<payment_item_detail>
[11868]290<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
291<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" />
[12729]292<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" />
[14235]293<item_detail item_id="3" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="%(joint_venture_bank_id)s" acct_num="%(joint_venture_acct)s" />
294<item_detail item_id="4" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="%(aaue_share_bank_id)s" acct_num="%(aaue_share_acct)s" />
[14086]295<item_detail item_id="5" item_name="Student Union" item_amt="%(student_union_due_amt)d" bank_id="%(student_union_bank_id)s" acct_num="%(student_union_acct)s" />
[14979]296<item_detail item_id="6" item_name="Student Welfare Assurance" item_amt="%(student_welfare_assurance_amt)d" bank_id="123" acct_num="1006407792" />
[11868]297</item_details>
298</payment_item_detail>""" % xmldict
[13400]299            else:
300                # Schoolfee without additional fees
301                xmldict['institution_amt'] = 100 * (
[13414]302                    gateway_net_amt(self.context.amount_auth)
[13400]303                    - provider_amt
304                    - joint_venture_amt
[13414]305                    - aaue_share_amt)
[13400]306                xmltext = """<payment_item_detail>
307<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
308<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" />
309<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" />
[14235]310<item_detail item_id="3" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="%(joint_venture_bank_id)s" acct_num="%(joint_venture_acct)s" />
311<item_detail item_id="4" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="%(aaue_share_bank_id)s" acct_num="%(aaue_share_acct)s" />
[13400]312</item_details>
313</payment_item_detail>""" % xmldict
314
315
316        # Clearance
317        elif self.context.p_category.startswith('clearance'):
[13532]318            if contr_agreement_student(student) == 'first':
[13403]319                # First agreement
[13379]320                if student.current_mode == 'found':
321                    self.pay_item_id = '102'
322                else:
323                    self.pay_item_id = '104'
[13400]324            else:
[13403]325                # Second agreement
[13400]326                self.pay_item_id = '102'
[13527]327                if student.is_postgrad:
328                    self.pay_item_id = '110'
[14469]329                if student.current_mode == 'ijmbe':
[14523]330                    self.pay_item_id = '120'
[13400]331
[13410]332            if self.context.p_category.endswith('_incl'):
[13400]333                # Clearance including additional fees
[13414]334                gown_fee_amt = gateway_net_amt(academic_session.matric_gown_fee)
335                aaue_lf_fee_amt = gateway_net_amt(academic_session.lapel_fee)
[13379]336                xmldict['gown_fee_amt'] = 100 * gown_fee_amt
[13414]337                xmldict['aaue_lf_fee_amt'] = 100 * aaue_lf_fee_amt
[13379]338                xmldict['institution_amt'] = 100 * (
[13414]339                    gateway_net_amt(self.context.amount_auth)
[13409]340                    - gown_fee_amt
[13414]341                    - aaue_lf_fee_amt)
[13379]342                xmltext = """<payment_item_detail>
[11868]343<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
344<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" />
[14920]345<item_detail item_id="2" item_name="Matriculation Gown Fee" item_amt="%(gown_fee_amt)d" bank_id="117" acct_num="1010827641" />
[14945]346<item_detail item_id="3" item_name="AAU File-Lapel Fee" item_amt="%(aaue_lf_fee_amt)d" bank_id="117" acct_num="1010827641" />
[11868]347</item_details>
348</payment_item_detail>""" % xmldict
[13400]349
[13381]350            else:
[13400]351                # Clearance without additional fees
[13381]352                xmldict['institution_amt'] = 100 * (
[13414]353                    gateway_net_amt(self.context.amount_auth))
[13379]354
[13403]355        # Union Dues
[13400]356        elif self.context.p_category == 'union':
357            self.pay_item_id = '103'
358            xmldict['institution_amt'] = 100 * (
[13414]359                gateway_net_amt(self.context.amount_auth))
[14980]360            if contr_agreement_student(student) == 'first':
361                # First agreement
362                xmldict['institution_acct'] = '0051005007'
363                xmldict['institution_bank_id'] = '31'
364            else:
365                # Second agreement
366                xmldict['institution_bank_id'] = '7'
367                xmldict['institution_acct'] = '1019763348'
[13379]368
[13403]369        # Lapel/File
[13400]370        elif self.context.p_category == 'lapel':
371            self.pay_item_id = '104'
372            xmldict['institution_amt'] = 100 * (
[13414]373                gateway_net_amt(self.context.amount_auth))
[13381]374
[13403]375        # Welfare Assurance
[13400]376        elif self.context.p_category == 'welfare':
377            self.pay_item_id = '105'
[14979]378            xmldict['institution_acct'] = '1006407792'
379            xmldict['institution_bank_id'] = '123'
[13400]380            xmldict['institution_amt'] = 100 * (
[13414]381                gateway_net_amt(self.context.amount_auth))
[13381]382
[14234]383        # ID Card
384        elif self.context.p_category == 'id_card':
385            self.pay_item_id = '000'
386            xmldict['institution_amt'] = 100 * (
387                gateway_net_amt(self.context.amount_auth))
388
[13400]389        # Matric Gown
390        elif self.context.p_category == 'matric_gown':
391            self.pay_item_id = '106'
392            xmldict['institution_amt'] = 100 * (
[13414]393                gateway_net_amt(self.context.amount_auth))
[13381]394
[13400]395        # Concessional
396        elif self.context.p_category == 'concessional':
397            self.pay_item_id = '107'
398            xmldict['institution_amt'] = 100 * (
[13414]399                gateway_net_amt(self.context.amount_auth))
[13381]400
[13400]401        # Hostel Maintenance
402        elif self.context.p_category == 'hostel_maintenance':
[14223]403            provider_amt = 500.0
[13400]404            self.pay_item_id = '109'
[14223]405            xmldict['provider_amt'] = 100 * provider_amt
[13400]406            xmldict['institution_amt'] = 100 * (
[14223]407                gateway_net_amt(self.context.amount_auth) - provider_amt)
[13400]408            xmltext = """<payment_item_detail>
[13383]409<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
410<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" />
[14223]411<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" />
[13383]412</item_details>
413</payment_item_detail>""" % xmldict
414
[14258]415        # GST Fees
416        elif self.context.p_category.startswith('gst_'):
[14687]417            if contr_agreement_student(student) == 'first':
418                self.pay_item_id = '115'
419            else:
420                self.pay_item_id = '116'
[14979]421            xmldict['institution_acct'] = '1010893123'
422            xmldict['institution_bank_id'] = '117'
[14258]423            xmldict['institution_amt'] = 100 * (
424                gateway_net_amt(self.context.amount_auth))
425
426        # ENT Fees
427        elif self.context.p_category.startswith('ent_'):
[14687]428            if contr_agreement_student(student) == 'first':
429                self.pay_item_id = '114'
430            else:
431                self.pay_item_id = '118'
[14979]432            xmldict['institution_acct'] = '6220029828'
433            xmldict['institution_bank_id'] = '51'
[14258]434            xmldict['institution_amt'] = 100 * (
435                gateway_net_amt(self.context.amount_auth))
436
437        # Faculty and Departmental Dues
438        elif self.context.p_category == 'fac_dep':
439            self.pay_item_id = '117'
440            xmldict['institution_amt'] = 100 * (
441                gateway_net_amt(self.context.amount_auth))
442
[14376]443        # Restitution Fee
444        elif self.context.p_category == 'restitution':
445            self.pay_item_id = '117'
446            xmldict['institution_amt'] = 100 * (
447                gateway_net_amt(self.context.amount_auth))
448
[14676]449        # Late Registration Fee
450        elif self.context.p_category == 'late_registration':
[14686]451            if contr_agreement_student(student) == 'first':
452                self.pay_item_id = '113'
453            else:
454                self.pay_item_id = '123'
[14676]455            xmldict['institution_amt'] = 100 * (
456                gateway_net_amt(self.context.amount_auth))
[14945]457
458        if not xmltext:
[14676]459            xmltext = """<payment_item_detail>
460<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
461<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" />
462</item_details>
463</payment_item_detail>""" % xmldict
[11868]464        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
465        self.context.provider_amt = provider_amt
[13437]466        self.context.gateway_amt = self.amount_auth - gateway_net_amt(
467            self.amount_auth)
[11868]468        hashargs = (
469            self.context.p_id +
[13382]470            self.product_id +
[11868]471            self.pay_item_id +
472            str(int(self.amount_auth)) +
473            self.site_redirect_url +
474            self.mac)
475        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
476        return
477
478
[11846]479class CustomInterswitchPaymentRequestWebservicePageApplicant(
480    InterswitchPaymentRequestWebservicePageApplicant):
[13586]481    """Request webservice view for the CollegePAY gateway
482    """
483    grok.context(ICustomApplicantOnlinePayment)
484    gateway_host = HOST
485    gateway_url = URL
486    https = HTTPS
[13379]487
[13586]488    @property
[13606]489    def mac(self):
490        if contr_agreement_applicant(self.context.__parent__) == 'first':
491            return MAC_PT
492        return MAC_REGULAR
493
494    @property
[13586]495    def product_id(self):
496        if contr_agreement_applicant(self.context.__parent__) == 'first':
497            return PRODUCT_ID_PT
498        return PRODUCT_ID_REGULAR
499
500class CustomInterswitchPaymentVerifyWebservicePageApplicant(
501    InterswitchPaymentVerifyWebservicePageApplicant):
502    """Payment verify view for the CollegePAY gateway
[11846]503    """
504    grok.context(ICustomApplicantOnlinePayment)
505    gateway_host = HOST
[13586]506    gateway_url = URL
[11916]507    https = HTTPS
[11868]508
[13532]509    @property
[13606]510    def mac(self):
511        if contr_agreement_applicant(self.context.__parent__) == 'first':
512            return MAC_PT
513        return MAC_REGULAR
514
515    @property
[13532]516    def product_id(self):
517        if contr_agreement_applicant(self.context.__parent__) == 'first':
518            return PRODUCT_ID_PT
519        return PRODUCT_ID_REGULAR
520
[11868]521class CustomInterswitchPaymentRequestWebservicePageStudent(
522    InterswitchPaymentRequestWebservicePageStudent):
[13586]523    """Request webservice view for the CollegePAY gateway
[11868]524    """
525    grok.context(ICustomStudentOnlinePayment)
526    gateway_host = HOST
[13586]527    gateway_url = URL
[11916]528    https = HTTPS
[13379]529
530    @property
[13606]531    def mac(self):
532        if contr_agreement_student(self.context.student) == 'first':
533            return MAC_PT
534        return MAC_REGULAR
535
536    @property
[13379]537    def product_id(self):
[13532]538        if contr_agreement_student(self.context.student) == 'first':
[13379]539            return PRODUCT_ID_PT
540        return PRODUCT_ID_REGULAR
[13586]541
542class CustomInterswitchPaymentVerifyWebservicePageStudent(
543    InterswitchPaymentVerifyWebservicePageStudent):
544    """Payment verify view for the CollegePAY gateway
545    """
546    grok.context(ICustomStudentOnlinePayment)
547    gateway_host = HOST
548    gateway_url = URL
549    https = HTTPS
550
551    @property
[13606]552    def mac(self):
553        if contr_agreement_student(self.context.student) == 'first':
554            return MAC_PT
555        return MAC_REGULAR
556
557    @property
[13586]558    def product_id(self):
559        if contr_agreement_student(self.context.student) == 'first':
560            return PRODUCT_ID_PT
561        return PRODUCT_ID_REGULAR
Note: See TracBrowser for help on using the repository browser.