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

Last change on this file since 14234 was 14234, checked in by Henrik Bettermann, 8 years ago

Ad Stuent ID card payments.

  • Property svn:keywords set to Id
File size: 25.7 KB
Line 
1## $Id: browser.py 14234 2016-10-27 14:20:09Z henrik $
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
23from waeup.kofa.interfaces import CLEARED
24from kofacustom.nigeria.interswitch.browser import (
25    InterswitchPaymentRequestWebservicePageStudent,
26    InterswitchPaymentRequestWebservicePageApplicant,
27    InterswitchPaymentVerifyWebservicePageApplicant,
28    InterswitchPaymentVerifyWebservicePageStudent,
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
35PRODUCT_ID_PT = '5040'
36PRODUCT_ID_REGULAR = '5845'
37SITE_NAME = 'aaue.waeup.org'
38PROVIDER_ACCT = '1010764827'
39PROVIDER_BANK_ID = '117'
40PROVIDER_ITEM_NAME = 'BT Education'
41INSTITUTION_NAME = 'AAU Ekpoma'
42CURRENCY = '566'
43GATEWAY_AMT = 250.0
44POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay'
45
46HOST = 'webpay.interswitchng.com'
47URL = '/paydirect/api/v1/gettransaction.json'
48HTTPS = True
49MAC_REGULAR = '9718FA00B0F5070B388A9896ADCED9B2FB02D30F71E12E68BDADC63F6852A3496FF97D8A0F9DA9F753B911A49BB09BB87B55FD02046BD325C74C46C0123CF023'
50MAC_PT = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3'
51
52httplib.HTTPSConnection.debuglevel = 0
53
54
55def gateway_net_amt(fee):
56    if fee > GATEWAY_AMT:
57        return fee - GATEWAY_AMT
58    return 0.0
59
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):
66    if student.current_mode == 'found' or student.current_mode.endswith('_pt'):
67        return 'first'
68    return 'second'
69
70class CustomInterswitchPageApplicant(InterswitchPageApplicant):
71    """ View which sends a POST request to the Interswitch
72    CollegePAY payment gateway.
73
74    So far only PT application has been configured.
75    """
76    grok.context(ICustomApplicantOnlinePayment)
77    action = POST_ACTION
78    site_name = SITE_NAME
79    currency = CURRENCY
80
81    def update(self):
82
83        error = self.init_update()
84        if error:
85            self.flash(error, type='danger')
86            self.redirect(self.url(self.context, '@@index'))
87            return
88        if contr_agreement_applicant(self.context.__parent__) == 'first':
89            self.product_id = PRODUCT_ID_PT
90            self.pay_item_id = '101'
91            self.mac = MAC_PT
92        else:
93            self.product_id = PRODUCT_ID_REGULAR
94            self.pay_item_id = '109'
95            self.mac = MAC_REGULAR
96        xmldict = {}
97        provider_amt = 2000.0
98        xmldict['institution_acct'] = '1010835352'
99        xmldict['institution_bank_id'] = '117'
100        xmldict['detail_ref'] = self.context.p_id
101        xmldict['provider_amt'] = 100 * provider_amt
102        xmldict['provider_acct'] = PROVIDER_ACCT
103        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
104        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
105        xmldict['institution_item_name'] = self.category
106        xmldict['institution_name'] = INSTITUTION_NAME
107
108        if self.applicant.applicant_id.startswith('pg'):
109            handbook_amount = 2000.0
110            xmldict['handbook_amount'] = 100 * handbook_amount
111            xmldict['institution_amt'] = 100 * (
112                self.context.amount_auth - provider_amt - handbook_amount -GATEWAY_AMT)
113            xmltext = """<payment_item_detail>
114<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
115<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" />
116<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" />
117<item_detail item_id="3" item_name="PG Handbook" item_amt="%(handbook_amount)d" bank_id="117" acct_num="1014270207" />
118</item_details>
119</payment_item_detail>""" % xmldict
120
121        elif self.applicant.applicant_id.startswith('utme'):
122            provider_amt = 1000.0
123            screening_guide_amount = 2000.0
124            xmldict['provider_amt'] = 100 * provider_amt
125            xmldict['screening_guide_amount'] = 100 * screening_guide_amount
126            xmldict['institution_amt'] = 100 * (
127                self.context.amount_auth - provider_amt - screening_guide_amount -GATEWAY_AMT)
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_detail item_id="3" item_name="Screening Guide" item_amt="%(screening_guide_amount)d" bank_id="117" acct_num="1013879579" />
133</item_details>
134</payment_item_detail>""" % xmldict
135
136        else:
137            xmldict['institution_amt'] = 100 * (
138                self.context.amount_auth - provider_amt - GATEWAY_AMT)
139            xmltext = """<payment_item_detail>
140<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
141<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" />
142<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" />
143</item_details>
144</payment_item_detail>""" % xmldict
145
146        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
147        self.context.provider_amt = provider_amt
148        self.context.gateway_amt = GATEWAY_AMT
149
150        hashargs = (
151            self.context.p_id +
152            self.product_id +
153            self.pay_item_id +
154            str(int(self.amount_auth)) +
155            self.site_redirect_url +
156            self.mac)
157        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
158
159        return
160
161class CustomInterswitchPageStudent(InterswitchPageStudent):
162    """ View which sends a POST request to the Interswitch
163    CollegePAY payment gateway.
164    """
165    grok.context(ICustomStudentOnlinePayment)
166    action = POST_ACTION
167    site_name = SITE_NAME
168    currency = CURRENCY
169    #pay_item_id = '101'
170
171    def update(self):
172        error = self.init_update()
173
174        ######################################
175        #error = 'Sorry, Interswitch payments are temporarily disabled.'
176        ######################################
177
178        if error:
179            self.flash(error, type='danger')
180            self.redirect(self.url(self.context, '@@index'))
181            return
182
183        student = self.student
184        p_session = self.context.p_session
185        try:
186            academic_session = grok.getSite()['configuration'][str(p_session)]
187        except KeyError:
188            self.flash(_(u'Session configuration object is not available.'),
189                       type='danger')
190            self.redirect(self.url(self.context, '@@index'))
191            return
192        if contr_agreement_student(student) == 'first':
193            self.product_id = PRODUCT_ID_PT
194            self.mac = MAC_PT
195        else:
196            self.product_id = PRODUCT_ID_REGULAR
197            self.mac = MAC_REGULAR
198
199        # To guarantee that cleared students pay both acceptance fee
200        # and school fees, the page can only be accessed
201        # for school fee payments if acceptance/clearance fee has
202        # been successfully queried/paid beforehand. This
203        # requirement applies to students in state 'cleared' and
204        # entry_session greater than 2013 only.
205        if self.context.p_category.startswith('schoolfee') and \
206            student.state == CLEARED and \
207            student.entry_session > 2012:
208            acceptance_fee_paid = False
209            for ticket in student['payments'].values():
210                if ticket.p_state == 'paid' and \
211                    ticket.p_category.startswith('clearance'):
212                    acceptance_fee_paid = True
213                    break
214            if not acceptance_fee_paid:
215                self.flash(
216                    _('Please pay acceptance fee first.'), type="danger")
217                self.redirect(self.url(self.context, '@@index'))
218                return
219
220        xmldict = self.xmldict
221        xmltext = ""
222        # Provider data
223        xmldict['detail_ref'] = self.context.p_id
224        xmldict['provider_acct'] = PROVIDER_ACCT
225        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
226        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
227        xmldict['institution_item_name'] = self.category
228        xmldict['institution_name'] = INSTITUTION_NAME
229        provider_amt = 0.0
230
231        # Schoolfee
232        if self.context.p_category.startswith('schoolfee'):
233            if contr_agreement_student(student) == 'first':
234                # First agreement
235                provider_amt = 1900.0
236                joint_venture_amt = 1100.0
237                aaue_share_amt = 1000.0
238                student_union_due_amt = gateway_net_amt(
239                    academic_session.union_fee)
240                student_welfare_assurance_amt = gateway_net_amt(
241                    academic_session.welfare_fee)
242                xmldict['institution_bank_id'] = '7'
243                xmldict['institution_acct'] = '1014847058'
244                xmldict['student_union_bank_id'] = '31'
245                xmldict['student_union_acct'] = '0051005007'
246                if student.current_mode == 'found':
247                    self.pay_item_id = '103'
248                else:
249                    self.pay_item_id = '105'
250            else:
251                # Second agreement
252                provider_amt = 1500.0
253                joint_venture_amt = 1000.0
254                aaue_share_amt = 1500.0
255                student_union_due_amt = gateway_net_amt(
256                    academic_session.union_fee)
257                student_welfare_assurance_amt = gateway_net_amt(
258                    academic_session.welfare_fee)
259                xmldict['institution_bank_id'] = '117'
260                xmldict['institution_acct'] = '1010827641'
261                xmldict['student_union_bank_id'] = '123'
262                xmldict['student_union_acct'] = '1006360118'
263                self.pay_item_id = '107'
264                if student.is_postgrad:
265                    xmldict['institution_bank_id'] = '51'
266                    xmldict['institution_acct'] = '5210006575'
267                    self.pay_item_id = '111'
268
269            xmldict['provider_amt'] = 100 * provider_amt
270            xmldict['joint_venture_amt'] = 100 * joint_venture_amt
271            xmldict['aaue_share_amt'] = 100 * aaue_share_amt
272            if self.context.p_item == 'Balance':
273                xmldict['institution_amt'] = 100 * (
274                    gateway_net_amt(self.context.amount_auth))
275                xmltext = """<payment_item_detail>
276<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
277<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" />
278</item_details>
279</payment_item_detail>""" % xmldict
280            elif self.context.p_category in ('schoolfee_incl', 'schoolfee_1'):
281                # Schoolfee including additional fees
282                xmldict['student_union_due_amt'] = 100 * student_union_due_amt
283                xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt
284                xmldict['institution_amt'] = 100 * (
285                    gateway_net_amt(self.context.amount_auth)
286                    - provider_amt
287                    - joint_venture_amt
288                    - aaue_share_amt
289                    - student_union_due_amt
290                    - student_welfare_assurance_amt)
291                xmltext = """<payment_item_detail>
292<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
293<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" />
294<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" />
295<item_detail item_id="3" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="117" acct_num="1014573025" />
296<item_detail item_id="4" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="11" acct_num="0030656377" />
297<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" />
298<item_detail item_id="6" item_name="Student Welfare Assurance" item_amt="%(student_welfare_assurance_amt)d" bank_id="123" acct_num="1006407792" />
299</item_details>
300</payment_item_detail>""" % xmldict
301            else:
302                # Schoolfee without additional fees
303                xmldict['institution_amt'] = 100 * (
304                    gateway_net_amt(self.context.amount_auth)
305                    - provider_amt
306                    - joint_venture_amt
307                    - aaue_share_amt)
308                xmltext = """<payment_item_detail>
309<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
310<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" />
311<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" />
312<item_detail item_id="3" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="117" acct_num="1014573025" />
313<item_detail item_id="4" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="11" acct_num="0030656377" />
314</item_details>
315</payment_item_detail>""" % xmldict
316
317
318        # Clearance
319        elif self.context.p_category.startswith('clearance'):
320            if contr_agreement_student(student) == 'first':
321                # First agreement
322                if student.current_mode == 'found':
323                    self.pay_item_id = '102'
324                else:
325                    self.pay_item_id = '104'
326                xmldict['institution_acct'] = '1014066976'
327                xmldict['institution_bank_id'] = '117'
328            else:
329                # Second agreement
330                self.pay_item_id = '102'
331                xmldict['institution_acct'] = '1010827641'
332                xmldict['institution_bank_id'] = '117'
333                if student.is_postgrad:
334                    xmldict['institution_bank_id'] = '51'
335                    xmldict['institution_acct'] = '5210006575'
336                    self.pay_item_id = '110'
337
338            if self.context.p_category.endswith('_incl'):
339                # Clearance including additional fees
340                gown_fee_amt = gateway_net_amt(academic_session.matric_gown_fee)
341                aaue_lf_fee_amt = gateway_net_amt(academic_session.lapel_fee)
342                xmldict['gown_fee_amt'] = 100 * gown_fee_amt
343                xmldict['aaue_lf_fee_amt'] = 100 * aaue_lf_fee_amt
344                xmldict['institution_amt'] = 100 * (
345                    gateway_net_amt(self.context.amount_auth)
346                    - gown_fee_amt
347                    - aaue_lf_fee_amt)
348                xmltext = """<payment_item_detail>
349<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
350<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" />
351<item_detail item_id="2" item_name="Matriculation Gown Fee" item_amt="%(gown_fee_amt)d" bank_id="51" acct_num="5060020947" />
352<item_detail item_id="3" item_name="AAU File-Lapel Fee" item_amt="%(aaue_lf_fee_amt)d" bank_id="51" acct_num="4010660109" />
353</item_details>
354</payment_item_detail>""" % xmldict
355
356            else:
357                # Clearance without additional fees
358                xmldict['institution_amt'] = 100 * (
359                    gateway_net_amt(self.context.amount_auth))
360                xmltext = """<payment_item_detail>
361<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
362<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" />
363</item_details>
364</payment_item_detail>""" % xmldict
365
366        # Union Dues
367        elif self.context.p_category == 'union':
368            self.pay_item_id = '103'
369            if contr_agreement_student(student) == 'first':
370                # First agreement
371                xmldict['institution_acct'] = '0051005007'
372                xmldict['institution_bank_id'] = '31'
373            else:
374                # Second agreement
375                xmldict['institution_bank_id'] = '123'
376                xmldict['institution_acct'] = '1006360118'
377            xmldict['institution_amt'] = 100 * (
378                gateway_net_amt(self.context.amount_auth))
379            xmltext = """<payment_item_detail>
380<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
381<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" />
382</item_details>
383</payment_item_detail>""" % xmldict
384
385        # Lapel/File
386        elif self.context.p_category == 'lapel':
387            self.pay_item_id = '104'
388            xmldict['institution_acct'] = '4010660109'
389            xmldict['institution_bank_id'] = '51'
390            xmldict['institution_amt'] = 100 * (
391                gateway_net_amt(self.context.amount_auth))
392            xmltext = """<payment_item_detail>
393<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
394<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" />
395</item_details>
396</payment_item_detail>""" % xmldict
397
398        # Welfare Assurance
399        elif self.context.p_category == 'welfare':
400            self.pay_item_id = '105'
401            xmldict['institution_acct'] = '1006407792'
402            xmldict['institution_bank_id'] = '123'
403            xmldict['institution_amt'] = 100 * (
404                gateway_net_amt(self.context.amount_auth))
405            xmltext = """<payment_item_detail>
406<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
407<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" />
408</item_details>
409</payment_item_detail>""" % xmldict
410
411        # ID Card
412        elif self.context.p_category == 'id_card':
413            self.pay_item_id = '000'
414            xmldict['institution_acct'] = '1010827641'
415            xmldict['institution_bank_id'] = '117'
416            xmldict['institution_amt'] = 100 * (
417                gateway_net_amt(self.context.amount_auth))
418            xmltext = """<payment_item_detail>
419<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
420<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" />
421</item_details>
422</payment_item_detail>""" % xmldict
423
424        # Matric Gown
425        elif self.context.p_category == 'matric_gown':
426            self.pay_item_id = '106'
427            xmldict['institution_acct'] = '5060023429'
428            xmldict['institution_bank_id'] = '51'
429            xmldict['institution_amt'] = 100 * (
430                gateway_net_amt(self.context.amount_auth))
431            xmltext = """<payment_item_detail>
432<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
433<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" />
434</item_details>
435</payment_item_detail>""" % xmldict
436
437        # Concessional
438        elif self.context.p_category == 'concessional':
439            self.pay_item_id = '107'
440            xmldict['institution_acct'] = '1010835352'
441            xmldict['institution_bank_id'] = '117'
442            xmldict['institution_amt'] = 100 * (
443                gateway_net_amt(self.context.amount_auth))
444            xmltext = """<payment_item_detail>
445<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
446<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" />
447</item_details>
448</payment_item_detail>""" % xmldict
449
450        # Hostel Maintenance
451        elif self.context.p_category == 'hostel_maintenance':
452            provider_amt = 500.0
453            self.pay_item_id = '109'
454            xmldict['provider_amt'] = 100 * provider_amt
455            xmldict['institution_acct'] = '1006406795'
456            xmldict['institution_bank_id'] = '123'
457            xmldict['institution_amt'] = 100 * (
458                gateway_net_amt(self.context.amount_auth) - provider_amt)
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_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" />
463</item_details>
464</payment_item_detail>""" % xmldict
465
466        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
467        self.context.provider_amt = provider_amt
468        self.context.gateway_amt = self.amount_auth - gateway_net_amt(
469            self.amount_auth)
470        hashargs = (
471            self.context.p_id +
472            self.product_id +
473            self.pay_item_id +
474            str(int(self.amount_auth)) +
475            self.site_redirect_url +
476            self.mac)
477        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
478        return
479
480
481class CustomInterswitchPaymentRequestWebservicePageApplicant(
482    InterswitchPaymentRequestWebservicePageApplicant):
483    """Request webservice view for the CollegePAY gateway
484    """
485    grok.context(ICustomApplicantOnlinePayment)
486    gateway_host = HOST
487    gateway_url = URL
488    https = HTTPS
489
490    @property
491    def mac(self):
492        if contr_agreement_applicant(self.context.__parent__) == 'first':
493            return MAC_PT
494        return MAC_REGULAR
495
496    @property
497    def product_id(self):
498        if contr_agreement_applicant(self.context.__parent__) == 'first':
499            return PRODUCT_ID_PT
500        return PRODUCT_ID_REGULAR
501
502class CustomInterswitchPaymentVerifyWebservicePageApplicant(
503    InterswitchPaymentVerifyWebservicePageApplicant):
504    """Payment verify view for the CollegePAY gateway
505    """
506    grok.context(ICustomApplicantOnlinePayment)
507    gateway_host = HOST
508    gateway_url = URL
509    https = HTTPS
510
511    @property
512    def mac(self):
513        if contr_agreement_applicant(self.context.__parent__) == 'first':
514            return MAC_PT
515        return MAC_REGULAR
516
517    @property
518    def product_id(self):
519        if contr_agreement_applicant(self.context.__parent__) == 'first':
520            return PRODUCT_ID_PT
521        return PRODUCT_ID_REGULAR
522
523class CustomInterswitchPaymentRequestWebservicePageStudent(
524    InterswitchPaymentRequestWebservicePageStudent):
525    """Request webservice view for the CollegePAY gateway
526    """
527    grok.context(ICustomStudentOnlinePayment)
528    gateway_host = HOST
529    gateway_url = URL
530    https = HTTPS
531
532    @property
533    def mac(self):
534        if contr_agreement_student(self.context.student) == 'first':
535            return MAC_PT
536        return MAC_REGULAR
537
538    @property
539    def product_id(self):
540        if contr_agreement_student(self.context.student) == 'first':
541            return PRODUCT_ID_PT
542        return PRODUCT_ID_REGULAR
543
544class CustomInterswitchPaymentVerifyWebservicePageStudent(
545    InterswitchPaymentVerifyWebservicePageStudent):
546    """Payment verify view for the CollegePAY gateway
547    """
548    grok.context(ICustomStudentOnlinePayment)
549    gateway_host = HOST
550    gateway_url = URL
551    https = HTTPS
552
553    @property
554    def mac(self):
555        if contr_agreement_student(self.context.student) == 'first':
556            return MAC_PT
557        return MAC_REGULAR
558
559    @property
560    def product_id(self):
561        if contr_agreement_student(self.context.student) == 'first':
562            return PRODUCT_ID_PT
563        return PRODUCT_ID_REGULAR
Note: See TracBrowser for help on using the repository browser.