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

Last change on this file since 14980 was 14980, checked in by Henrik Bettermann, 7 years ago

Revert to original SUG accounts.

  • Property svn:keywords set to Id
File size: 24.1 KB
Line 
1## $Id: browser.py 14980 2018-04-03 06:10:38Z 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 = '1014261520'
39PROVIDER_BANK_ID = '117'
40PROVIDER_ITEM_NAME = 'WAeAC'
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 = 4000.0
98        xmldict['institution_acct'] = '1010827641'
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="1010827641" />
118</item_details>
119</payment_item_detail>""" % xmldict
120
121        elif self.applicant.applicant_id.startswith('utme'):
122            xmldict['provider_amt'] = 100 * provider_amt
123            xmldict['institution_amt'] = 100 * (
124                self.context.amount_auth - provider_amt - GATEWAY_AMT)
125            xmltext = """<payment_item_detail>
126<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
127<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" />
128<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" />
129</item_details>
130</payment_item_detail>""" % xmldict
131
132        else:
133            xmldict['institution_amt'] = 100 * (
134                self.context.amount_auth - provider_amt - GATEWAY_AMT)
135            xmltext = """<payment_item_detail>
136<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
137<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" />
138<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" />
139</item_details>
140</payment_item_detail>""" % xmldict
141
142        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
143        self.context.provider_amt = provider_amt
144        self.context.gateway_amt = GATEWAY_AMT
145
146        hashargs = (
147            self.context.p_id +
148            self.product_id +
149            self.pay_item_id +
150            str(int(self.amount_auth)) +
151            self.site_redirect_url +
152            self.mac)
153        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
154
155        return
156
157class CustomInterswitchPageStudent(InterswitchPageStudent):
158    """ View which sends a POST request to the Interswitch
159    CollegePAY payment gateway.
160    """
161    grok.context(ICustomStudentOnlinePayment)
162    action = POST_ACTION
163    site_name = SITE_NAME
164    currency = CURRENCY
165    pay_item_id = '000'
166
167    def update(self):
168        error = self.init_update()
169
170        if error:
171            self.flash(error, type='danger')
172            self.redirect(self.url(self.context, '@@index'))
173            return
174
175        student = self.student
176        p_session = self.context.p_session
177        try:
178            academic_session = grok.getSite()['configuration'][str(p_session)]
179        except KeyError:
180            self.flash(_(u'Session configuration object is not available.'),
181                       type='danger')
182            self.redirect(self.url(self.context, '@@index'))
183            return
184        if contr_agreement_student(student) == 'first':
185            self.product_id = PRODUCT_ID_PT
186            self.mac = MAC_PT
187        else:
188            self.product_id = PRODUCT_ID_REGULAR
189            self.mac = MAC_REGULAR
190
191        # To guarantee that cleared students pay both acceptance fee
192        # and school fees, the page can only be accessed
193        # for school fee payments if acceptance/clearance fee has
194        # been successfully queried/paid beforehand. This
195        # requirement applies to students in state 'cleared' and
196        # entry_session greater than 2012 only.
197        if self.context.p_category.startswith('schoolfee') and \
198            student.state == CLEARED and \
199            student.entry_session > 2012:
200            acceptance_fee_paid = False
201            for ticket in student['payments'].values():
202                if ticket.p_state == 'paid' and \
203                    ticket.p_category.startswith('clearance'):
204                    acceptance_fee_paid = True
205                    break
206            if not acceptance_fee_paid:
207                self.flash(
208                    _('Please pay acceptance fee first.'), type="danger")
209                self.redirect(self.url(self.context, '@@index'))
210                return
211
212        xmldict = self.xmldict
213        xmltext = ""
214        xmldict['institution_acct'] = '1010827641'
215        xmldict['institution_bank_id'] = '117'
216        xmldict['detail_ref'] = self.context.p_id
217        xmldict['provider_acct'] = PROVIDER_ACCT
218        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
219        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
220        xmldict['institution_item_name'] = self.category
221        xmldict['institution_name'] = INSTITUTION_NAME
222        provider_amt = 0.0
223
224        # Schoolfee
225        if self.context.p_category.startswith('schoolfee'):
226            if contr_agreement_student(student) == 'first':
227                # First agreement
228                provider_amt = 1900.0
229                joint_venture_amt = 1100.0
230                aaue_share_amt = 1000.0
231                student_union_due_amt = gateway_net_amt(
232                    academic_session.union_fee)
233                student_welfare_assurance_amt = gateway_net_amt(
234                    academic_session.welfare_fee)
235                xmldict['student_union_bank_id'] = '31'
236                xmldict['student_union_acct'] = '0051005007'
237                xmldict['aaue_share_bank_id'] = '117'
238                xmldict['aaue_share_acct'] = '1010827641'
239                xmldict['joint_venture_bank_id'] = '117'
240                xmldict['joint_venture_acct'] = '1010827641'
241                if student.current_mode == 'found':
242                    self.pay_item_id = '103'
243                else:
244                    self.pay_item_id = '105'
245            else:
246                # Second agreement
247                provider_amt = 1500.0
248                joint_venture_amt = 1000.0
249                aaue_share_amt = 1500.0
250                student_union_due_amt = gateway_net_amt(
251                    academic_session.union_fee)
252                student_welfare_assurance_amt = gateway_net_amt(
253                    academic_session.welfare_fee)
254                xmldict['student_union_bank_id'] = '7'
255                xmldict['student_union_acct'] = '1019763348'
256                xmldict['aaue_share_bank_id'] = '117'
257                xmldict['aaue_share_acct'] = '1010827641'
258                xmldict['joint_venture_bank_id'] = '117'
259                xmldict['joint_venture_acct'] = '1010827641'
260                self.pay_item_id = '107'
261                if student.is_postgrad:
262                    self.pay_item_id = '111'
263                if student.current_mode == 'ijmbe':
264                    self.pay_item_id = '119'
265                    xmldict['joint_venture_bank_id'] = '117'
266                    xmldict['joint_venture_acct'] = '1010827641'
267
268            xmldict['provider_amt'] = 100 * provider_amt
269            xmldict['joint_venture_amt'] = 100 * joint_venture_amt
270            xmldict['aaue_share_amt'] = 100 * aaue_share_amt
271            if self.context.p_item == 'Balance':
272                xmldict['institution_amt'] = 100 * (
273                    gateway_net_amt(self.context.amount_auth))
274            elif self.context.p_category in ('schoolfee_incl', 'schoolfee_1'):
275                # Schoolfee including additional fees
276                xmldict['student_union_due_amt'] = 100 * student_union_due_amt
277                xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt
278                xmldict['institution_amt'] = 100 * (
279                    gateway_net_amt(self.context.amount_auth)
280                    - provider_amt
281                    - joint_venture_amt
282                    - aaue_share_amt
283                    - student_union_due_amt
284                    - student_welfare_assurance_amt)
285                xmltext = """<payment_item_detail>
286<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
287<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" />
288<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" />
289<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" />
290<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" />
291<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" />
292<item_detail item_id="6" item_name="Student Welfare Assurance" item_amt="%(student_welfare_assurance_amt)d" bank_id="123" acct_num="1006407792" />
293</item_details>
294</payment_item_detail>""" % xmldict
295            else:
296                # Schoolfee without additional fees
297                xmldict['institution_amt'] = 100 * (
298                    gateway_net_amt(self.context.amount_auth)
299                    - provider_amt
300                    - joint_venture_amt
301                    - aaue_share_amt)
302                xmltext = """<payment_item_detail>
303<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
304<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" />
305<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" />
306<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" />
307<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" />
308</item_details>
309</payment_item_detail>""" % xmldict
310
311
312        # Clearance
313        elif self.context.p_category.startswith('clearance'):
314            if contr_agreement_student(student) == 'first':
315                # First agreement
316                if student.current_mode == 'found':
317                    self.pay_item_id = '102'
318                else:
319                    self.pay_item_id = '104'
320            else:
321                # Second agreement
322                self.pay_item_id = '102'
323                if student.is_postgrad:
324                    self.pay_item_id = '110'
325                if student.current_mode == 'ijmbe':
326                    self.pay_item_id = '120'
327
328            if self.context.p_category.endswith('_incl'):
329                # Clearance including additional fees
330                gown_fee_amt = gateway_net_amt(academic_session.matric_gown_fee)
331                aaue_lf_fee_amt = gateway_net_amt(academic_session.lapel_fee)
332                xmldict['gown_fee_amt'] = 100 * gown_fee_amt
333                xmldict['aaue_lf_fee_amt'] = 100 * aaue_lf_fee_amt
334                xmldict['institution_amt'] = 100 * (
335                    gateway_net_amt(self.context.amount_auth)
336                    - gown_fee_amt
337                    - aaue_lf_fee_amt)
338                xmltext = """<payment_item_detail>
339<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
340<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" />
341<item_detail item_id="2" item_name="Matriculation Gown Fee" item_amt="%(gown_fee_amt)d" bank_id="117" acct_num="1010827641" />
342<item_detail item_id="3" item_name="AAU File-Lapel Fee" item_amt="%(aaue_lf_fee_amt)d" bank_id="117" acct_num="1010827641" />
343</item_details>
344</payment_item_detail>""" % xmldict
345
346            else:
347                # Clearance without additional fees
348                xmldict['institution_amt'] = 100 * (
349                    gateway_net_amt(self.context.amount_auth))
350
351        # Union Dues
352        elif self.context.p_category == 'union':
353            self.pay_item_id = '103'
354            xmldict['institution_amt'] = 100 * (
355                gateway_net_amt(self.context.amount_auth))
356            if contr_agreement_student(student) == 'first':
357                # First agreement
358                xmldict['institution_acct'] = '0051005007'
359                xmldict['institution_bank_id'] = '31'
360            else:
361                # Second agreement
362                xmldict['institution_bank_id'] = '7'
363                xmldict['institution_acct'] = '1019763348'
364
365        # Lapel/File
366        elif self.context.p_category == 'lapel':
367            self.pay_item_id = '104'
368            xmldict['institution_amt'] = 100 * (
369                gateway_net_amt(self.context.amount_auth))
370
371        # Welfare Assurance
372        elif self.context.p_category == 'welfare':
373            self.pay_item_id = '105'
374            xmldict['institution_acct'] = '1006407792'
375            xmldict['institution_bank_id'] = '123'
376            xmldict['institution_amt'] = 100 * (
377                gateway_net_amt(self.context.amount_auth))
378
379        # ID Card
380        elif self.context.p_category == 'id_card':
381            self.pay_item_id = '000'
382            xmldict['institution_amt'] = 100 * (
383                gateway_net_amt(self.context.amount_auth))
384
385        # Matric Gown
386        elif self.context.p_category == 'matric_gown':
387            self.pay_item_id = '106'
388            xmldict['institution_amt'] = 100 * (
389                gateway_net_amt(self.context.amount_auth))
390
391        # Concessional
392        elif self.context.p_category == 'concessional':
393            self.pay_item_id = '107'
394            xmldict['institution_amt'] = 100 * (
395                gateway_net_amt(self.context.amount_auth))
396
397        # Hostel Maintenance
398        elif self.context.p_category == 'hostel_maintenance':
399            provider_amt = 500.0
400            self.pay_item_id = '109'
401            xmldict['provider_amt'] = 100 * provider_amt
402            xmldict['institution_amt'] = 100 * (
403                gateway_net_amt(self.context.amount_auth) - provider_amt)
404            xmltext = """<payment_item_detail>
405<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
406<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" />
407<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" />
408</item_details>
409</payment_item_detail>""" % xmldict
410
411        # GST Fees
412        elif self.context.p_category.startswith('gst_'):
413            if contr_agreement_student(student) == 'first':
414                self.pay_item_id = '115'
415            else:
416                self.pay_item_id = '116'
417            xmldict['institution_acct'] = '1010893123'
418            xmldict['institution_bank_id'] = '117'
419            xmldict['institution_amt'] = 100 * (
420                gateway_net_amt(self.context.amount_auth))
421
422        # ENT Fees
423        elif self.context.p_category.startswith('ent_'):
424            if contr_agreement_student(student) == 'first':
425                self.pay_item_id = '114'
426            else:
427                self.pay_item_id = '118'
428            xmldict['institution_acct'] = '6220029828'
429            xmldict['institution_bank_id'] = '51'
430            xmldict['institution_amt'] = 100 * (
431                gateway_net_amt(self.context.amount_auth))
432
433        # Faculty and Departmental Dues
434        elif self.context.p_category == 'fac_dep':
435            self.pay_item_id = '117'
436            xmldict['institution_amt'] = 100 * (
437                gateway_net_amt(self.context.amount_auth))
438
439        # Restitution Fee
440        elif self.context.p_category == 'restitution':
441            self.pay_item_id = '117'
442            xmldict['institution_amt'] = 100 * (
443                gateway_net_amt(self.context.amount_auth))
444
445        # Late Registration Fee
446        elif self.context.p_category == 'late_registration':
447            if contr_agreement_student(student) == 'first':
448                self.pay_item_id = '113'
449            else:
450                self.pay_item_id = '123'
451            xmldict['institution_amt'] = 100 * (
452                gateway_net_amt(self.context.amount_auth))
453
454        if not xmltext:
455            xmltext = """<payment_item_detail>
456<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
457<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" />
458</item_details>
459</payment_item_detail>""" % xmldict
460        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
461        self.context.provider_amt = provider_amt
462        self.context.gateway_amt = self.amount_auth - gateway_net_amt(
463            self.amount_auth)
464        hashargs = (
465            self.context.p_id +
466            self.product_id +
467            self.pay_item_id +
468            str(int(self.amount_auth)) +
469            self.site_redirect_url +
470            self.mac)
471        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
472        return
473
474
475class CustomInterswitchPaymentRequestWebservicePageApplicant(
476    InterswitchPaymentRequestWebservicePageApplicant):
477    """Request webservice view for the CollegePAY gateway
478    """
479    grok.context(ICustomApplicantOnlinePayment)
480    gateway_host = HOST
481    gateway_url = URL
482    https = HTTPS
483
484    @property
485    def mac(self):
486        if contr_agreement_applicant(self.context.__parent__) == 'first':
487            return MAC_PT
488        return MAC_REGULAR
489
490    @property
491    def product_id(self):
492        if contr_agreement_applicant(self.context.__parent__) == 'first':
493            return PRODUCT_ID_PT
494        return PRODUCT_ID_REGULAR
495
496class CustomInterswitchPaymentVerifyWebservicePageApplicant(
497    InterswitchPaymentVerifyWebservicePageApplicant):
498    """Payment verify view for the CollegePAY gateway
499    """
500    grok.context(ICustomApplicantOnlinePayment)
501    gateway_host = HOST
502    gateway_url = URL
503    https = HTTPS
504
505    @property
506    def mac(self):
507        if contr_agreement_applicant(self.context.__parent__) == 'first':
508            return MAC_PT
509        return MAC_REGULAR
510
511    @property
512    def product_id(self):
513        if contr_agreement_applicant(self.context.__parent__) == 'first':
514            return PRODUCT_ID_PT
515        return PRODUCT_ID_REGULAR
516
517class CustomInterswitchPaymentRequestWebservicePageStudent(
518    InterswitchPaymentRequestWebservicePageStudent):
519    """Request webservice view for the CollegePAY gateway
520    """
521    grok.context(ICustomStudentOnlinePayment)
522    gateway_host = HOST
523    gateway_url = URL
524    https = HTTPS
525
526    @property
527    def mac(self):
528        if contr_agreement_student(self.context.student) == 'first':
529            return MAC_PT
530        return MAC_REGULAR
531
532    @property
533    def product_id(self):
534        if contr_agreement_student(self.context.student) == 'first':
535            return PRODUCT_ID_PT
536        return PRODUCT_ID_REGULAR
537
538class CustomInterswitchPaymentVerifyWebservicePageStudent(
539    InterswitchPaymentVerifyWebservicePageStudent):
540    """Payment verify view for the CollegePAY gateway
541    """
542    grok.context(ICustomStudentOnlinePayment)
543    gateway_host = HOST
544    gateway_url = URL
545    https = HTTPS
546
547    @property
548    def mac(self):
549        if contr_agreement_student(self.context.student) == 'first':
550            return MAC_PT
551        return MAC_REGULAR
552
553    @property
554    def product_id(self):
555        if contr_agreement_student(self.context.student) == 'first':
556            return PRODUCT_ID_PT
557        return PRODUCT_ID_REGULAR
Note: See TracBrowser for help on using the repository browser.