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

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

Split pg application payments.

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