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

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

Change provider amount.

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