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

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

IJMBE students do not have to pay Student Union Dues + Welfare Assurance Fee.

  • Property svn:keywords set to Id
File size: 24.1 KB
Line 
1## $Id: browser.py 14987 2018-04-23 07:36:08Z 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                and student.current_mode != 'ijmbe':
276                # Schoolfee including additional fees
277                xmldict['student_union_due_amt'] = 100 * student_union_due_amt
278                xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt
279                xmldict['institution_amt'] = 100 * (
280                    gateway_net_amt(self.context.amount_auth)
281                    - provider_amt
282                    - joint_venture_amt
283                    - aaue_share_amt
284                    - student_union_due_amt
285                    - student_welfare_assurance_amt)
286                xmltext = """<payment_item_detail>
287<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
288<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" />
289<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" />
290<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" />
291<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" />
292<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" />
293<item_detail item_id="6" item_name="Student Welfare Assurance" item_amt="%(student_welfare_assurance_amt)d" bank_id="123" acct_num="1006407792" />
294</item_details>
295</payment_item_detail>""" % xmldict
296            else:
297                # Schoolfee without additional fees
298                xmldict['institution_amt'] = 100 * (
299                    gateway_net_amt(self.context.amount_auth)
300                    - provider_amt
301                    - joint_venture_amt
302                    - aaue_share_amt)
303                xmltext = """<payment_item_detail>
304<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
305<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" />
306<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" />
307<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" />
308<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" />
309</item_details>
310</payment_item_detail>""" % xmldict
311
312
313        # Clearance
314        elif self.context.p_category.startswith('clearance'):
315            if contr_agreement_student(student) == 'first':
316                # First agreement
317                if student.current_mode == 'found':
318                    self.pay_item_id = '102'
319                else:
320                    self.pay_item_id = '104'
321            else:
322                # Second agreement
323                self.pay_item_id = '102'
324                if student.is_postgrad:
325                    self.pay_item_id = '110'
326                if student.current_mode == 'ijmbe':
327                    self.pay_item_id = '120'
328
329            if self.context.p_category.endswith('_incl'):
330                # Clearance including additional fees
331                gown_fee_amt = gateway_net_amt(academic_session.matric_gown_fee)
332                aaue_lf_fee_amt = gateway_net_amt(academic_session.lapel_fee)
333                xmldict['gown_fee_amt'] = 100 * gown_fee_amt
334                xmldict['aaue_lf_fee_amt'] = 100 * aaue_lf_fee_amt
335                xmldict['institution_amt'] = 100 * (
336                    gateway_net_amt(self.context.amount_auth)
337                    - gown_fee_amt
338                    - aaue_lf_fee_amt)
339                xmltext = """<payment_item_detail>
340<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
341<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" />
342<item_detail item_id="2" item_name="Matriculation Gown Fee" item_amt="%(gown_fee_amt)d" bank_id="117" acct_num="1010827641" />
343<item_detail item_id="3" item_name="AAU File-Lapel Fee" item_amt="%(aaue_lf_fee_amt)d" bank_id="117" acct_num="1010827641" />
344</item_details>
345</payment_item_detail>""" % xmldict
346
347            else:
348                # Clearance without additional fees
349                xmldict['institution_amt'] = 100 * (
350                    gateway_net_amt(self.context.amount_auth))
351
352        # Union Dues
353        elif self.context.p_category == 'union':
354            self.pay_item_id = '103'
355            xmldict['institution_amt'] = 100 * (
356                gateway_net_amt(self.context.amount_auth))
357            if contr_agreement_student(student) == 'first':
358                # First agreement
359                xmldict['institution_acct'] = '0051005007'
360                xmldict['institution_bank_id'] = '31'
361            else:
362                # Second agreement
363                xmldict['institution_bank_id'] = '7'
364                xmldict['institution_acct'] = '1019763348'
365
366        # Lapel/File
367        elif self.context.p_category == 'lapel':
368            self.pay_item_id = '104'
369            xmldict['institution_amt'] = 100 * (
370                gateway_net_amt(self.context.amount_auth))
371
372        # Welfare Assurance
373        elif self.context.p_category == 'welfare':
374            self.pay_item_id = '105'
375            xmldict['institution_acct'] = '1006407792'
376            xmldict['institution_bank_id'] = '123'
377            xmldict['institution_amt'] = 100 * (
378                gateway_net_amt(self.context.amount_auth))
379
380        # ID Card
381        elif self.context.p_category == 'id_card':
382            self.pay_item_id = '000'
383            xmldict['institution_amt'] = 100 * (
384                gateway_net_amt(self.context.amount_auth))
385
386        # Matric Gown
387        elif self.context.p_category == 'matric_gown':
388            self.pay_item_id = '106'
389            xmldict['institution_amt'] = 100 * (
390                gateway_net_amt(self.context.amount_auth))
391
392        # Concessional
393        elif self.context.p_category == 'concessional':
394            self.pay_item_id = '107'
395            xmldict['institution_amt'] = 100 * (
396                gateway_net_amt(self.context.amount_auth))
397
398        # Hostel Maintenance
399        elif self.context.p_category == 'hostel_maintenance':
400            provider_amt = 500.0
401            self.pay_item_id = '109'
402            xmldict['provider_amt'] = 100 * provider_amt
403            xmldict['institution_amt'] = 100 * (
404                gateway_net_amt(self.context.amount_auth) - provider_amt)
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_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" />
409</item_details>
410</payment_item_detail>""" % xmldict
411
412        # GST Fees
413        elif self.context.p_category.startswith('gst_'):
414            if contr_agreement_student(student) == 'first':
415                self.pay_item_id = '115'
416            else:
417                self.pay_item_id = '116'
418            xmldict['institution_acct'] = '1010893123'
419            xmldict['institution_bank_id'] = '117'
420            xmldict['institution_amt'] = 100 * (
421                gateway_net_amt(self.context.amount_auth))
422
423        # ENT Fees
424        elif self.context.p_category.startswith('ent_'):
425            if contr_agreement_student(student) == 'first':
426                self.pay_item_id = '114'
427            else:
428                self.pay_item_id = '118'
429            xmldict['institution_acct'] = '6220029828'
430            xmldict['institution_bank_id'] = '51'
431            xmldict['institution_amt'] = 100 * (
432                gateway_net_amt(self.context.amount_auth))
433
434        # Faculty and Departmental Dues
435        elif self.context.p_category == 'fac_dep':
436            self.pay_item_id = '117'
437            xmldict['institution_amt'] = 100 * (
438                gateway_net_amt(self.context.amount_auth))
439
440        # Restitution Fee
441        elif self.context.p_category == 'restitution':
442            self.pay_item_id = '117'
443            xmldict['institution_amt'] = 100 * (
444                gateway_net_amt(self.context.amount_auth))
445
446        # Late Registration Fee
447        elif self.context.p_category == 'late_registration':
448            if contr_agreement_student(student) == 'first':
449                self.pay_item_id = '113'
450            else:
451                self.pay_item_id = '123'
452            xmldict['institution_amt'] = 100 * (
453                gateway_net_amt(self.context.amount_auth))
454
455        if not xmltext:
456            xmltext = """<payment_item_detail>
457<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
458<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" />
459</item_details>
460</payment_item_detail>""" % xmldict
461        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
462        self.context.provider_amt = provider_amt
463        self.context.gateway_amt = self.amount_auth - gateway_net_amt(
464            self.amount_auth)
465        hashargs = (
466            self.context.p_id +
467            self.product_id +
468            self.pay_item_id +
469            str(int(self.amount_auth)) +
470            self.site_redirect_url +
471            self.mac)
472        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
473        return
474
475
476class CustomInterswitchPaymentRequestWebservicePageApplicant(
477    InterswitchPaymentRequestWebservicePageApplicant):
478    """Request webservice view for the CollegePAY gateway
479    """
480    grok.context(ICustomApplicantOnlinePayment)
481    gateway_host = HOST
482    gateway_url = URL
483    https = HTTPS
484
485    @property
486    def mac(self):
487        if contr_agreement_applicant(self.context.__parent__) == 'first':
488            return MAC_PT
489        return MAC_REGULAR
490
491    @property
492    def product_id(self):
493        if contr_agreement_applicant(self.context.__parent__) == 'first':
494            return PRODUCT_ID_PT
495        return PRODUCT_ID_REGULAR
496
497class CustomInterswitchPaymentVerifyWebservicePageApplicant(
498    InterswitchPaymentVerifyWebservicePageApplicant):
499    """Payment verify view for the CollegePAY gateway
500    """
501    grok.context(ICustomApplicantOnlinePayment)
502    gateway_host = HOST
503    gateway_url = URL
504    https = HTTPS
505
506    @property
507    def mac(self):
508        if contr_agreement_applicant(self.context.__parent__) == 'first':
509            return MAC_PT
510        return MAC_REGULAR
511
512    @property
513    def product_id(self):
514        if contr_agreement_applicant(self.context.__parent__) == 'first':
515            return PRODUCT_ID_PT
516        return PRODUCT_ID_REGULAR
517
518class CustomInterswitchPaymentRequestWebservicePageStudent(
519    InterswitchPaymentRequestWebservicePageStudent):
520    """Request webservice view for the CollegePAY gateway
521    """
522    grok.context(ICustomStudentOnlinePayment)
523    gateway_host = HOST
524    gateway_url = URL
525    https = HTTPS
526
527    @property
528    def mac(self):
529        if contr_agreement_student(self.context.student) == 'first':
530            return MAC_PT
531        return MAC_REGULAR
532
533    @property
534    def product_id(self):
535        if contr_agreement_student(self.context.student) == 'first':
536            return PRODUCT_ID_PT
537        return PRODUCT_ID_REGULAR
538
539class CustomInterswitchPaymentVerifyWebservicePageStudent(
540    InterswitchPaymentVerifyWebservicePageStudent):
541    """Payment verify view for the CollegePAY gateway
542    """
543    grok.context(ICustomStudentOnlinePayment)
544    gateway_host = HOST
545    gateway_url = URL
546    https = HTTPS
547
548    @property
549    def mac(self):
550        if contr_agreement_student(self.context.student) == 'first':
551            return MAC_PT
552        return MAC_REGULAR
553
554    @property
555    def product_id(self):
556        if contr_agreement_student(self.context.student) == 'first':
557            return PRODUCT_ID_PT
558        return PRODUCT_ID_REGULAR
Note: See TracBrowser for help on using the repository browser.