[12730] | 1 | ## $Id: browser.py 16898 2022-03-21 06:20:24Z henrik $ |
---|
[11846] | 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 | ## |
---|
| 18 | import httplib |
---|
| 19 | import hashlib |
---|
| 20 | import grok |
---|
[15473] | 21 | from xml.dom import minidom |
---|
[11846] | 22 | from zope.interface import Interface |
---|
| 23 | from zope.component import queryAdapter |
---|
[12975] | 24 | from waeup.kofa.interfaces import CLEARED |
---|
[11846] | 25 | from kofacustom.nigeria.interswitch.browser import ( |
---|
| 26 | InterswitchPaymentRequestWebservicePageStudent, |
---|
| 27 | InterswitchPaymentRequestWebservicePageApplicant, |
---|
[13586] | 28 | InterswitchPaymentVerifyWebservicePageApplicant, |
---|
| 29 | InterswitchPaymentVerifyWebservicePageStudent, |
---|
[11846] | 30 | InterswitchPageStudent, InterswitchPageApplicant, |
---|
| 31 | ) |
---|
| 32 | from waeup.aaue.students.interfaces import ICustomStudentOnlinePayment |
---|
| 33 | from waeup.aaue.applicants.interfaces import ICustomApplicantOnlinePayment |
---|
| 34 | from waeup.aaue.interfaces import MessageFactory as _ |
---|
| 35 | |
---|
[13379] | 36 | PRODUCT_ID_PT = '5040' |
---|
| 37 | PRODUCT_ID_REGULAR = '5845' |
---|
[11846] | 38 | SITE_NAME = 'aaue.waeup.org' |
---|
[15927] | 39 | PROVIDER_ACCT = '5100189030' |
---|
| 40 | PROVIDER_BANK_ID = '307' |
---|
[14823] | 41 | PROVIDER_ITEM_NAME = 'WAeAC' |
---|
[11846] | 42 | INSTITUTION_NAME = 'AAU Ekpoma' |
---|
| 43 | CURRENCY = '566' |
---|
[15867] | 44 | GATEWAY_AMT = 200.0 |
---|
[11933] | 45 | POST_ACTION = 'https://webpay.interswitchng.com/paydirect/pay' |
---|
[11846] | 46 | |
---|
[11933] | 47 | HOST = 'webpay.interswitchng.com' |
---|
[13586] | 48 | URL = '/paydirect/api/v1/gettransaction.json' |
---|
[11916] | 49 | HTTPS = True |
---|
[13606] | 50 | MAC_REGULAR = '9718FA00B0F5070B388A9896ADCED9B2FB02D30F71E12E68BDADC63F6852A3496FF97D8A0F9DA9F753B911A49BB09BB87B55FD02046BD325C74C46C0123CF023' |
---|
| 51 | MAC_PT = '74424F1DFECD6058F153148255CDD55E16724B4F380ADB2C63C5D1D7A5675759010C8153DCB930AAF2D38903CBF7CE32B8A6BA2C16BBC46721DF2E3F3E4548E3' |
---|
[11846] | 52 | |
---|
[11917] | 53 | httplib.HTTPSConnection.debuglevel = 0 |
---|
[11846] | 54 | |
---|
[13379] | 55 | |
---|
[13414] | 56 | def gateway_net_amt(fee): |
---|
[13438] | 57 | if fee > GATEWAY_AMT: |
---|
[13414] | 58 | return fee - GATEWAY_AMT |
---|
[13438] | 59 | return 0.0 |
---|
[13406] | 60 | |
---|
[13532] | 61 | def contr_agreement_applicant(applicant): |
---|
[16779] | 62 | if applicant.__parent__.prefix in ( |
---|
[15396] | 63 | 'fp', |
---|
| 64 | 'ptee', |
---|
| 65 | 'dsh', |
---|
| 66 | 'bridge', |
---|
| 67 | 'ijmbe', |
---|
| 68 | ): |
---|
[13532] | 69 | return 'first' |
---|
| 70 | return 'second' |
---|
| 71 | |
---|
| 72 | def contr_agreement_student(student): |
---|
[15382] | 73 | if student.current_mode in ( |
---|
[15387] | 74 | 'found', |
---|
| 75 | 'bridge', |
---|
| 76 | 'ug_dsh', |
---|
| 77 | 'de_dsh', |
---|
| 78 | 'ug_pt', |
---|
| 79 | 'de_pt', |
---|
[15396] | 80 | 'dp_pt', |
---|
| 81 | 'ijmbe', |
---|
| 82 | ): |
---|
[13403] | 83 | return 'first' |
---|
| 84 | return 'second' |
---|
[13379] | 85 | |
---|
[11846] | 86 | class CustomInterswitchPageApplicant(InterswitchPageApplicant): |
---|
| 87 | """ View which sends a POST request to the Interswitch |
---|
| 88 | CollegePAY payment gateway. |
---|
[13379] | 89 | |
---|
| 90 | So far only PT application has been configured. |
---|
[11846] | 91 | """ |
---|
| 92 | grok.context(ICustomApplicantOnlinePayment) |
---|
| 93 | action = POST_ACTION |
---|
| 94 | site_name = SITE_NAME |
---|
| 95 | currency = CURRENCY |
---|
[15135] | 96 | provider_bank_id = PROVIDER_BANK_ID |
---|
| 97 | provider_acct = PROVIDER_ACCT |
---|
[15224] | 98 | institution_acct = '1010835352' |
---|
| 99 | institution_bank_id = '117' |
---|
[11846] | 100 | |
---|
| 101 | def update(self): |
---|
| 102 | |
---|
[12975] | 103 | error = self.init_update() |
---|
| 104 | if error: |
---|
| 105 | self.flash(error, type='danger') |
---|
| 106 | self.redirect(self.url(self.context, '@@index')) |
---|
| 107 | return |
---|
[15761] | 108 | self.context.r_company = u'interswitch' |
---|
[15260] | 109 | provider_amt = 2000.0 |
---|
[15746] | 110 | fedex_amt = 0.0 |
---|
[16779] | 111 | if contr_agreement_applicant(self.applicant) == 'first': |
---|
[13532] | 112 | self.product_id = PRODUCT_ID_PT |
---|
| 113 | self.pay_item_id = '101' |
---|
[13606] | 114 | self.mac = MAC_PT |
---|
[16681] | 115 | if self.applicant.__parent__.prefix == 'ijmbe': |
---|
[16778] | 116 | self.institution_bank_id = '123' |
---|
| 117 | self.institution_acct = '1012278272' |
---|
[13532] | 118 | else: |
---|
| 119 | self.product_id = PRODUCT_ID_REGULAR |
---|
| 120 | self.pay_item_id = '109' |
---|
[13606] | 121 | self.mac = MAC_REGULAR |
---|
[15464] | 122 | if self.applicant.__parent__.prefix in ('utme', 'ude'): |
---|
| 123 | provider_amt = 1000.0 |
---|
[15524] | 124 | elif self.applicant.__parent__.prefix in ('trans', 'cert'): |
---|
[15512] | 125 | self.institution_acct = '1010827641' |
---|
| 126 | self.institution_bank_id = '117' |
---|
[15135] | 127 | self.provider_bank_id = '10' |
---|
| 128 | self.provider_acct = '0427773399' |
---|
[15512] | 129 | if self.applicant.applicant_id[:5] in ('cert7', 'cert8'): |
---|
| 130 | provider_amt = 0.0 |
---|
| 131 | if self.applicant.applicant_id[:6] in ('trans5', 'trans6'): |
---|
| 132 | self.institution_acct = '5210006575' |
---|
[15520] | 133 | self.institution_bank_id = '51' |
---|
[15837] | 134 | #if self.applicant.applicant_id[:6] in ('trans1', 'trans6'): |
---|
| 135 | # fedex_amt = 10500.0 |
---|
[15591] | 136 | if self.context.p_category == 'app_balance': |
---|
| 137 | provider_amt = 0.0 |
---|
[15524] | 138 | elif self.applicant.applicant_id.startswith('bridge'): # easier to test |
---|
[15224] | 139 | self.institution_acct = '1014847058' |
---|
| 140 | self.institution_bank_id = '7' |
---|
[15524] | 141 | elif self.applicant.applicant_id.startswith('dsh'): # easier to test |
---|
| 142 | self.institution_acct = '1014847058' |
---|
| 143 | self.institution_bank_id = '7' |
---|
[15735] | 144 | elif self.applicant.__parent__.prefix in ('ver', 'send'): |
---|
| 145 | provider_amt = 0.0 |
---|
[15952] | 146 | elif self.applicant.__parent__.prefix == 'fedex': |
---|
| 147 | provider_amt = 0.0 |
---|
[16003] | 148 | self.institution_acct = '0001115694' |
---|
| 149 | self.institution_bank_id = '10' |
---|
[16898] | 150 | elif self.applicant.applicant_id.startswith('pg'): |
---|
| 151 | self.institution_acct = '5210006575' |
---|
| 152 | self.institution_bank_id = '51' |
---|
[16678] | 153 | |
---|
[11846] | 154 | xmldict = {} |
---|
| 155 | xmldict['detail_ref'] = self.context.p_id |
---|
| 156 | xmldict['provider_amt'] = 100 * provider_amt |
---|
[15135] | 157 | xmldict['provider_acct'] = self.provider_acct |
---|
| 158 | xmldict['provider_bank_id'] = self.provider_bank_id |
---|
[11846] | 159 | xmldict['provider_item_name'] = PROVIDER_ITEM_NAME |
---|
[15224] | 160 | xmldict['institution_acct'] = self.institution_acct |
---|
| 161 | xmldict['institution_bank_id'] = self.institution_bank_id |
---|
[13532] | 162 | xmldict['institution_item_name'] = self.category |
---|
[11846] | 163 | xmldict['institution_name'] = INSTITUTION_NAME |
---|
[15746] | 164 | xmldict['fedex_amt'] = 100 * fedex_amt |
---|
[15224] | 165 | xmldict['institution_amt'] = 100 * ( |
---|
[15746] | 166 | self.context.amount_auth - provider_amt - fedex_amt - GATEWAY_AMT) |
---|
[15512] | 167 | |
---|
[15224] | 168 | xmltext = """<payment_item_detail> |
---|
| 169 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> |
---|
| 170 | <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" /> |
---|
| 171 | <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" /> |
---|
| 172 | </item_details> |
---|
| 173 | </payment_item_detail>""" % xmldict |
---|
[14121] | 174 | |
---|
[15512] | 175 | if provider_amt == 0.0: |
---|
| 176 | xmltext = """<payment_item_detail> |
---|
| 177 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> |
---|
| 178 | <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" /> |
---|
| 179 | </item_details> |
---|
| 180 | </payment_item_detail>""" % xmldict |
---|
| 181 | |
---|
[15746] | 182 | if fedex_amt: |
---|
| 183 | xmltext = """<payment_item_detail> |
---|
| 184 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> |
---|
| 185 | <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" /> |
---|
| 186 | <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" /> |
---|
[16003] | 187 | <item_detail item_id="3" item_name="FedEx" item_amt="%(fedex_amt)d" bank_id="10" acct_num="0001115694" /> |
---|
[15746] | 188 | </item_details> |
---|
| 189 | </payment_item_detail>""" % xmldict |
---|
| 190 | |
---|
[14121] | 191 | if self.applicant.applicant_id.startswith('pg'): |
---|
| 192 | handbook_amount = 2000.0 |
---|
| 193 | xmldict['handbook_amount'] = 100 * handbook_amount |
---|
| 194 | xmldict['institution_amt'] = 100 * ( |
---|
| 195 | self.context.amount_auth - provider_amt - handbook_amount -GATEWAY_AMT) |
---|
| 196 | xmltext = """<payment_item_detail> |
---|
[11846] | 197 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s"> |
---|
| 198 | <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" /> |
---|
| 199 | <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" /> |
---|
[16895] | 200 | <item_detail item_id="3" item_name="PG Handbook" item_amt="%(handbook_amount)d" bank_id="51" acct_num="5210006575" /> |
---|
[11846] | 201 | </item_details> |
---|
| 202 | </payment_item_detail>""" % xmldict |
---|
[14121] | 203 | |
---|
[11846] | 204 | self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext |
---|
| 205 | self.context.provider_amt = provider_amt |
---|
| 206 | self.context.gateway_amt = GATEWAY_AMT |
---|
[15473] | 207 | xmlitems = '' |
---|
| 208 | xmldoc = minidom.parseString(xmltext) |
---|
| 209 | itemlist = xmldoc.getElementsByTagName('item_detail') |
---|
| 210 | for s in itemlist: |
---|
| 211 | xmlitems += "%s: %s, N%s, %s (%s) " % ( |
---|
| 212 | s.attributes['item_id'].value, |
---|
| 213 | s.attributes['item_name'].value, |
---|
| 214 | int(s.attributes['item_amt'].value)/100, |
---|
| 215 | s.attributes['acct_num'].value, |
---|
| 216 | s.attributes['bank_id'].value, |
---|
| 217 | ) |
---|
| 218 | self.context.p_split_data = xmlitems |
---|
[15761] | 219 | self.amount_auth = int(100 * self.context.amount_auth) |
---|
[11846] | 220 | hashargs = ( |
---|
| 221 | self.context.p_id + |
---|
[13532] | 222 | self.product_id + |
---|
[11846] | 223 | self.pay_item_id + |
---|
| 224 | str(int(self.amount_auth)) + |
---|
| 225 | self.site_redirect_url + |
---|
| 226 | self.mac) |
---|
| 227 | self.hashvalue = hashlib.sha512(hashargs).hexdigest() |
---|
| 228 | |
---|
| 229 | return |
---|
| 230 | |
---|
[11868] | 231 | class CustomInterswitchPageStudent(InterswitchPageStudent): |
---|
| 232 | """ View which sends a POST request to the Interswitch |
---|
| 233 | CollegePAY payment gateway. |
---|
| 234 | """ |
---|
| 235 | grok.context(ICustomStudentOnlinePayment) |
---|
| 236 | action = POST_ACTION |
---|
| 237 | site_name = SITE_NAME |
---|
| 238 | currency = CURRENCY |
---|
[14248] | 239 | pay_item_id = '000' |
---|
[11846] | 240 | |
---|
[11868] | 241 | def update(self): |
---|
[12975] | 242 | error = self.init_update() |
---|
| 243 | if error: |
---|
| 244 | self.flash(error, type='danger') |
---|
| 245 | self.redirect(self.url(self.context, '@@index')) |
---|
| 246 | return |
---|
[15761] | 247 | self.context.r_company = u'interswitch' |
---|
[11868] | 248 | student = self.student |
---|
[13408] | 249 | p_session = self.context.p_session |
---|
[13400] | 250 | try: |
---|
[13408] | 251 | academic_session = grok.getSite()['configuration'][str(p_session)] |
---|
[13400] | 252 | except KeyError: |
---|
[13407] | 253 | self.flash(_(u'Session configuration object is not available.'), |
---|
| 254 | type='danger') |
---|
[13400] | 255 | self.redirect(self.url(self.context, '@@index')) |
---|
| 256 | return |
---|
[13532] | 257 | if contr_agreement_student(student) == 'first': |
---|
[13382] | 258 | self.product_id = PRODUCT_ID_PT |
---|
[13606] | 259 | self.mac = MAC_PT |
---|
[13382] | 260 | else: |
---|
| 261 | self.product_id = PRODUCT_ID_REGULAR |
---|
[13606] | 262 | self.mac = MAC_REGULAR |
---|
[13382] | 263 | |
---|
[12975] | 264 | # To guarantee that cleared students pay both acceptance fee |
---|
| 265 | # and school fees, the page can only be accessed |
---|
| 266 | # for school fee payments if acceptance/clearance fee has |
---|
| 267 | # been successfully queried/paid beforehand. This |
---|
| 268 | # requirement applies to students in state 'cleared' and |
---|
[14380] | 269 | # entry_session greater than 2012 only. |
---|
[13400] | 270 | if self.context.p_category.startswith('schoolfee') and \ |
---|
[12975] | 271 | student.state == CLEARED and \ |
---|
| 272 | student.entry_session > 2012: |
---|
| 273 | acceptance_fee_paid = False |
---|
| 274 | for ticket in student['payments'].values(): |
---|
| 275 | if ticket.p_state == 'paid' and \ |
---|
[13400] | 276 | ticket.p_category.startswith('clearance'): |
---|
[12975] | 277 | acceptance_fee_paid = True |
---|
| 278 | break |
---|
| 279 | if not acceptance_fee_paid: |
---|
| 280 | self.flash( |
---|
| 281 | _('Please pay acceptance fee first.'), type="danger") |
---|
| 282 | self.redirect(self.url(self.context, '@@index')) |
---|
| 283 | return |
---|
| 284 | |
---|
[11868] | 285 | xmldict = self.xmldict |
---|
[12729] | 286 | xmltext = "" |
---|
[14945] | 287 | xmldict['institution_acct'] = '1010827641' |
---|
| 288 | xmldict['institution_bank_id'] = '117' |
---|
[11868] | 289 | xmldict['detail_ref'] = self.context.p_id |
---|
| 290 | xmldict['provider_acct'] = PROVIDER_ACCT |
---|
| 291 | xmldict['provider_bank_id'] = PROVIDER_BANK_ID |
---|
| 292 | xmldict['provider_item_name'] = PROVIDER_ITEM_NAME |
---|
| 293 | xmldict['institution_item_name'] = self.category |
---|
| 294 | xmldict['institution_name'] = INSTITUTION_NAME |
---|
[13381] | 295 | provider_amt = 0.0 |
---|
[12729] | 296 | |
---|
[13400] | 297 | # Schoolfee |
---|
| 298 | if self.context.p_category.startswith('schoolfee'): |
---|
[13532] | 299 | if contr_agreement_student(student) == 'first': |
---|
[13403] | 300 | # First agreement |
---|
[15479] | 301 | provider_amt = 1900.0 |
---|
[15387] | 302 | joint_venture_amt = 0.0 |
---|
| 303 | aaue_share_amt = 0.0 |
---|
[13414] | 304 | student_union_due_amt = gateway_net_amt( |
---|
| 305 | academic_session.union_fee) |
---|
| 306 | student_welfare_assurance_amt = gateway_net_amt( |
---|
| 307 | academic_session.welfare_fee) |
---|
[15180] | 308 | sports_amt = gateway_net_amt( |
---|
| 309 | academic_session.sports_fee) |
---|
| 310 | library_amt = gateway_net_amt( |
---|
| 311 | academic_session.library_fee) |
---|
[15181] | 312 | library_amt_pg = gateway_net_amt( |
---|
[15971] | 313 | academic_session.library_pg_fee) |
---|
[14980] | 314 | xmldict['student_union_bank_id'] = '31' |
---|
| 315 | xmldict['student_union_acct'] = '0051005007' |
---|
[15384] | 316 | xmldict['aaue_share_bank_id'] = '117' |
---|
| 317 | xmldict['aaue_share_acct'] = '1010827641' |
---|
| 318 | xmldict['joint_venture_bank_id'] = '117' |
---|
| 319 | xmldict['joint_venture_acct'] = '1010827641' |
---|
[15359] | 320 | xmldict['institution_acct'] = '1014847058' |
---|
| 321 | xmldict['institution_bank_id'] = '7' |
---|
[16681] | 322 | self.pay_item_id = '105' |
---|
[13379] | 323 | if student.current_mode == 'found': |
---|
| 324 | self.pay_item_id = '103' |
---|
[16681] | 325 | elif student.current_mode == 'ijmbe': |
---|
[16691] | 326 | self.pay_item_id = '103' |
---|
[16681] | 327 | xmldict['institution_bank_id'] = '123' |
---|
| 328 | xmldict['institution_acct'] = '1012278272' |
---|
[13400] | 329 | else: |
---|
[13403] | 330 | # Second agreement |
---|
[15384] | 331 | joint_venture_amt = 1000.0 |
---|
| 332 | aaue_share_amt = 1500.0 |
---|
[15479] | 333 | provider_amt = 1500.0 |
---|
[13414] | 334 | student_union_due_amt = gateway_net_amt( |
---|
| 335 | academic_session.union_fee) |
---|
| 336 | student_welfare_assurance_amt = gateway_net_amt( |
---|
| 337 | academic_session.welfare_fee) |
---|
[15180] | 338 | sports_amt = gateway_net_amt( |
---|
| 339 | academic_session.sports_fee) |
---|
| 340 | library_amt = gateway_net_amt( |
---|
| 341 | academic_session.library_fee) |
---|
[15181] | 342 | library_amt_pg = gateway_net_amt( |
---|
[15971] | 343 | academic_session.library_pg_fee) |
---|
[14980] | 344 | xmldict['student_union_bank_id'] = '7' |
---|
| 345 | xmldict['student_union_acct'] = '1019763348' |
---|
[15384] | 346 | xmldict['aaue_share_bank_id'] = '117' |
---|
| 347 | xmldict['aaue_share_acct'] = '1010827641' |
---|
| 348 | xmldict['joint_venture_bank_id'] = '117' |
---|
| 349 | xmldict['joint_venture_acct'] = '1010827641' |
---|
[13644] | 350 | self.pay_item_id = '107' |
---|
[13527] | 351 | if student.is_postgrad: |
---|
| 352 | self.pay_item_id = '111' |
---|
[15460] | 353 | xmldict['institution_acct'] = '5210006575' |
---|
| 354 | xmldict['institution_bank_id'] = '51' |
---|
[13400] | 355 | |
---|
| 356 | xmldict['provider_amt'] = 100 * provider_amt |
---|
[15384] | 357 | xmldict['joint_venture_amt'] = 100 * joint_venture_amt |
---|
| 358 | xmldict['aaue_share_amt'] = 100 * aaue_share_amt |
---|
[13732] | 359 | if self.context.p_item == 'Balance': |
---|
| 360 | xmldict['institution_amt'] = 100 * ( |
---|
| 361 | gateway_net_amt(self.context.amount_auth)) |
---|
[15479] | 362 | elif self.context.p_category == 'schoolfee_2': |
---|
| 363 | xmldict['institution_amt'] = 100 * gateway_net_amt( |
---|
| 364 | self.context.amount_auth) |
---|
| 365 | xmltext = """<payment_item_detail> |
---|
| 366 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 367 | <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" /> |
---|
| 368 | </item_details> |
---|
| 369 | </payment_item_detail>""" % xmldict |
---|
[14987] | 370 | elif self.context.p_category in ('schoolfee_incl', 'schoolfee_1') \ |
---|
| 371 | and student.current_mode != 'ijmbe': |
---|
[13400] | 372 | # Schoolfee including additional fees |
---|
[13379] | 373 | xmldict['student_union_due_amt'] = 100 * student_union_due_amt |
---|
| 374 | xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt |
---|
[15192] | 375 | |
---|
[15976] | 376 | if student.entry_session >= 2018 and student.is_fresh: |
---|
[15192] | 377 | xmldict['sports_amt'] = 100 * sports_amt |
---|
| 378 | if student.is_postgrad: |
---|
| 379 | xmldict['library_amt'] = 100 * library_amt_pg |
---|
| 380 | else: |
---|
| 381 | xmldict['library_amt'] = 100 * library_amt |
---|
| 382 | xmldict['institution_amt'] = 100 * ( |
---|
| 383 | gateway_net_amt(self.context.amount_auth) |
---|
| 384 | - provider_amt |
---|
[15384] | 385 | - joint_venture_amt |
---|
| 386 | - aaue_share_amt |
---|
[15192] | 387 | - student_union_due_amt |
---|
| 388 | - student_welfare_assurance_amt |
---|
| 389 | - sports_amt |
---|
| 390 | - library_amt) |
---|
| 391 | xmltext = """<payment_item_detail> |
---|
[11868] | 392 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 393 | <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" /> |
---|
[12729] | 394 | <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" /> |
---|
[15387] | 395 | <item_detail item_id="3" item_name="Student Union" item_amt="%(student_union_due_amt)d" bank_id="%(student_union_bank_id)s" acct_num="%(student_union_acct)s" /> |
---|
| 396 | <item_detail item_id="4" item_name="Student Welfare Assurance" item_amt="%(student_welfare_assurance_amt)d" bank_id="123" acct_num="1006407792" /> |
---|
| 397 | <item_detail item_id="5" item_name="Sports Development Fee" item_amt="%(sports_amt)d" bank_id="123" acct_num="1006407792" /> |
---|
| 398 | <item_detail item_id="6" item_name="Library Development Fee" item_amt="%(library_amt)d" bank_id="8" acct_num="2000122995" />""" % xmldict |
---|
| 399 | if contr_agreement_student(student) == 'second': |
---|
| 400 | xmltext += """" |
---|
| 401 | <item_detail item_id="7" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="%(joint_venture_bank_id)s" acct_num="%(joint_venture_acct)s" /> |
---|
| 402 | <item_detail item_id="8" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="%(aaue_share_bank_id)s" acct_num="%(aaue_share_acct)s" /> |
---|
[11868] | 403 | </item_details> |
---|
| 404 | </payment_item_detail>""" % xmldict |
---|
[15387] | 405 | else: |
---|
| 406 | xmltext += """" |
---|
| 407 | </item_details> |
---|
[15396] | 408 | </payment_item_detail>""" |
---|
[15192] | 409 | else: |
---|
| 410 | xmldict['institution_amt'] = 100 * ( |
---|
| 411 | gateway_net_amt(self.context.amount_auth) |
---|
| 412 | - provider_amt |
---|
[15384] | 413 | - joint_venture_amt |
---|
| 414 | - aaue_share_amt |
---|
[15192] | 415 | - student_union_due_amt |
---|
| 416 | - student_welfare_assurance_amt) |
---|
| 417 | xmltext = """<payment_item_detail> |
---|
| 418 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 419 | <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" /> |
---|
| 420 | <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" /> |
---|
[15387] | 421 | <item_detail item_id="3" item_name="Student Union" item_amt="%(student_union_due_amt)d" bank_id="%(student_union_bank_id)s" acct_num="%(student_union_acct)s" /> |
---|
| 422 | <item_detail item_id="4" item_name="Student Welfare Assurance" item_amt="%(student_welfare_assurance_amt)d" bank_id="123" acct_num="1006407792" />""" % xmldict |
---|
| 423 | if contr_agreement_student(student) == 'second': |
---|
| 424 | xmltext += """" |
---|
| 425 | <item_detail item_id="5" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="%(joint_venture_bank_id)s" acct_num="%(joint_venture_acct)s" /> |
---|
| 426 | <item_detail item_id="6" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="%(aaue_share_bank_id)s" acct_num="%(aaue_share_acct)s" /> |
---|
[15192] | 427 | </item_details> |
---|
| 428 | </payment_item_detail>""" % xmldict |
---|
[15387] | 429 | else: |
---|
| 430 | xmltext += """" |
---|
| 431 | </item_details> |
---|
[15396] | 432 | </payment_item_detail>""" |
---|
[15387] | 433 | elif contr_agreement_student(student) == 'second': |
---|
| 434 | # Schoolfee without Student Union Fee ands Student Welfare Assurance |
---|
[15384] | 435 | xmldict['institution_amt'] = 100 * ( |
---|
| 436 | gateway_net_amt(self.context.amount_auth) |
---|
[15387] | 437 | - provider_amt |
---|
| 438 | - joint_venture_amt |
---|
| 439 | - aaue_share_amt) |
---|
[15384] | 440 | xmltext = """<payment_item_detail> |
---|
| 441 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 442 | <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" /> |
---|
| 443 | <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" /> |
---|
[15387] | 444 | <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" /> |
---|
| 445 | <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" /> |
---|
[15384] | 446 | </item_details> |
---|
| 447 | </payment_item_detail>""" % xmldict |
---|
[13400] | 448 | else: |
---|
| 449 | xmldict['institution_amt'] = 100 * ( |
---|
[13414] | 450 | gateway_net_amt(self.context.amount_auth) |
---|
[15387] | 451 | - provider_amt) |
---|
[13400] | 452 | xmltext = """<payment_item_detail> |
---|
| 453 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 454 | <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" /> |
---|
| 455 | <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" /> |
---|
| 456 | </item_details> |
---|
| 457 | </payment_item_detail>""" % xmldict |
---|
| 458 | |
---|
| 459 | |
---|
| 460 | # Clearance |
---|
| 461 | elif self.context.p_category.startswith('clearance'): |
---|
[16283] | 462 | xmldict['institution_acct'] = '1010835352' |
---|
[15467] | 463 | provider_amt = 0.0 |
---|
[13532] | 464 | if contr_agreement_student(student) == 'first': |
---|
[13403] | 465 | # First agreement |
---|
[16681] | 466 | xmldict['institution_acct'] = '1014847058' |
---|
| 467 | xmldict['institution_bank_id'] = '7' |
---|
| 468 | self.pay_item_id = '104' |
---|
[13379] | 469 | if student.current_mode == 'found': |
---|
| 470 | self.pay_item_id = '102' |
---|
[16681] | 471 | elif student.current_mode == 'ijmbe': |
---|
[16689] | 472 | self.pay_item_id = '102' |
---|
[16681] | 473 | xmldict['institution_bank_id'] = '123' |
---|
| 474 | xmldict['institution_acct'] = '1012278272' |
---|
[13400] | 475 | else: |
---|
[13403] | 476 | # Second agreement |
---|
[13400] | 477 | self.pay_item_id = '102' |
---|
[13527] | 478 | if student.is_postgrad: |
---|
| 479 | self.pay_item_id = '110' |
---|
[15463] | 480 | xmldict['institution_acct'] = '5210006575' |
---|
| 481 | xmldict['institution_bank_id'] = '51' |
---|
[15467] | 482 | # ivama: Acceptance fee split is unique to "ug_ft" |
---|
| 483 | # The reason for split is perculiar to them only... |
---|
| 484 | # That amount was deducted from UTME application fee because |
---|
| 485 | # some regulatory body have pegged the application fee which |
---|
| 486 | # didn't affect another programmes. |
---|
| 487 | if student.current_mode == 'ug_ft': |
---|
| 488 | provider_amt = 1500.0 |
---|
| 489 | xmldict['provider_amt'] = 100 * provider_amt |
---|
[13410] | 490 | if self.context.p_category.endswith('_incl'): |
---|
[13400] | 491 | # Clearance including additional fees |
---|
[13414] | 492 | gown_fee_amt = gateway_net_amt(academic_session.matric_gown_fee) |
---|
| 493 | aaue_lf_fee_amt = gateway_net_amt(academic_session.lapel_fee) |
---|
[13379] | 494 | xmldict['gown_fee_amt'] = 100 * gown_fee_amt |
---|
[13414] | 495 | xmldict['aaue_lf_fee_amt'] = 100 * aaue_lf_fee_amt |
---|
[13379] | 496 | xmldict['institution_amt'] = 100 * ( |
---|
[13414] | 497 | gateway_net_amt(self.context.amount_auth) |
---|
[13409] | 498 | - gown_fee_amt |
---|
[15190] | 499 | - aaue_lf_fee_amt |
---|
| 500 | - provider_amt) |
---|
[13379] | 501 | xmltext = """<payment_item_detail> |
---|
[11868] | 502 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 503 | <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" /> |
---|
[16283] | 504 | <item_detail item_id="2" item_name="Matriculation Gown Fee" item_amt="%(gown_fee_amt)d" bank_id="117" acct_num=" 1010835352" /> |
---|
| 505 | <item_detail item_id="3" item_name="AAU File-Lapel Fee" item_amt="%(aaue_lf_fee_amt)d" bank_id="117" acct_num=" 1010835352" />""" % xmldict |
---|
[15467] | 506 | if provider_amt: |
---|
[15391] | 507 | xmltext += """" |
---|
[15168] | 508 | <item_detail item_id="4" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> |
---|
[11868] | 509 | </item_details> |
---|
| 510 | </payment_item_detail>""" % xmldict |
---|
[15391] | 511 | else: |
---|
| 512 | xmltext += """" |
---|
| 513 | </item_details> |
---|
[15396] | 514 | </payment_item_detail>""" |
---|
[13400] | 515 | |
---|
[15375] | 516 | elif student.current_mode == 'bridge': |
---|
| 517 | # Clearance without any surcharge |
---|
| 518 | xmldict['institution_amt'] = 100 * gateway_net_amt( |
---|
| 519 | self.context.amount_auth) |
---|
| 520 | xmltext = """<payment_item_detail> |
---|
| 521 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 522 | <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" /> |
---|
| 523 | </item_details> |
---|
| 524 | </payment_item_detail>""" % xmldict |
---|
| 525 | |
---|
[13381] | 526 | else: |
---|
[13400] | 527 | # Clearance without additional fees |
---|
[13381] | 528 | xmldict['institution_amt'] = 100 * ( |
---|
[15190] | 529 | gateway_net_amt(self.context.amount_auth) |
---|
| 530 | - provider_amt) |
---|
[15168] | 531 | xmltext = """<payment_item_detail> |
---|
| 532 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
[15396] | 533 | <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" />""" % xmldict |
---|
[15467] | 534 | if provider_amt: |
---|
[15391] | 535 | xmltext += """" |
---|
[15168] | 536 | <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" /> |
---|
| 537 | </item_details> |
---|
| 538 | </payment_item_detail>""" % xmldict |
---|
[15391] | 539 | else: |
---|
| 540 | xmltext += """" |
---|
| 541 | </item_details> |
---|
[15396] | 542 | </payment_item_detail>""" |
---|
[13379] | 543 | |
---|
[13403] | 544 | # Union Dues |
---|
[13400] | 545 | elif self.context.p_category == 'union': |
---|
| 546 | self.pay_item_id = '103' |
---|
| 547 | xmldict['institution_amt'] = 100 * ( |
---|
[13414] | 548 | gateway_net_amt(self.context.amount_auth)) |
---|
[14980] | 549 | if contr_agreement_student(student) == 'first': |
---|
| 550 | # First agreement |
---|
| 551 | xmldict['institution_acct'] = '0051005007' |
---|
| 552 | xmldict['institution_bank_id'] = '31' |
---|
| 553 | else: |
---|
| 554 | # Second agreement |
---|
| 555 | xmldict['institution_bank_id'] = '7' |
---|
| 556 | xmldict['institution_acct'] = '1019763348' |
---|
[13379] | 557 | |
---|
[13403] | 558 | # Lapel/File |
---|
[13400] | 559 | elif self.context.p_category == 'lapel': |
---|
| 560 | self.pay_item_id = '104' |
---|
| 561 | xmldict['institution_amt'] = 100 * ( |
---|
[13414] | 562 | gateway_net_amt(self.context.amount_auth)) |
---|
[13381] | 563 | |
---|
[13403] | 564 | # Welfare Assurance |
---|
[13400] | 565 | elif self.context.p_category == 'welfare': |
---|
| 566 | self.pay_item_id = '105' |
---|
[14979] | 567 | xmldict['institution_acct'] = '1006407792' |
---|
| 568 | xmldict['institution_bank_id'] = '123' |
---|
[13400] | 569 | xmldict['institution_amt'] = 100 * ( |
---|
[13414] | 570 | gateway_net_amt(self.context.amount_auth)) |
---|
[13381] | 571 | |
---|
[14234] | 572 | # ID Card |
---|
| 573 | elif self.context.p_category == 'id_card': |
---|
| 574 | self.pay_item_id = '000' |
---|
| 575 | xmldict['institution_amt'] = 100 * ( |
---|
| 576 | gateway_net_amt(self.context.amount_auth)) |
---|
| 577 | |
---|
[13400] | 578 | # Matric Gown |
---|
| 579 | elif self.context.p_category == 'matric_gown': |
---|
| 580 | self.pay_item_id = '106' |
---|
| 581 | xmldict['institution_amt'] = 100 * ( |
---|
[13414] | 582 | gateway_net_amt(self.context.amount_auth)) |
---|
[13381] | 583 | |
---|
[13400] | 584 | # Concessional |
---|
| 585 | elif self.context.p_category == 'concessional': |
---|
| 586 | self.pay_item_id = '107' |
---|
| 587 | xmldict['institution_amt'] = 100 * ( |
---|
[13414] | 588 | gateway_net_amt(self.context.amount_auth)) |
---|
[13381] | 589 | |
---|
[13400] | 590 | # Hostel Maintenance |
---|
| 591 | elif self.context.p_category == 'hostel_maintenance': |
---|
[14223] | 592 | provider_amt = 500.0 |
---|
[13400] | 593 | self.pay_item_id = '109' |
---|
[16661] | 594 | xmldict['institution_acct'] = '1006406795' |
---|
| 595 | xmldict['institution_bank_id'] = '123' |
---|
[14223] | 596 | xmldict['provider_amt'] = 100 * provider_amt |
---|
[13400] | 597 | xmldict['institution_amt'] = 100 * ( |
---|
[14223] | 598 | gateway_net_amt(self.context.amount_auth) - provider_amt) |
---|
[13400] | 599 | xmltext = """<payment_item_detail> |
---|
[13383] | 600 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 601 | <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" /> |
---|
[14223] | 602 | <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" /> |
---|
[13383] | 603 | </item_details> |
---|
| 604 | </payment_item_detail>""" % xmldict |
---|
| 605 | |
---|
[14258] | 606 | # GST Fees |
---|
| 607 | elif self.context.p_category.startswith('gst_'): |
---|
[14687] | 608 | if contr_agreement_student(student) == 'first': |
---|
| 609 | self.pay_item_id = '115' |
---|
| 610 | else: |
---|
| 611 | self.pay_item_id = '116' |
---|
[14979] | 612 | xmldict['institution_acct'] = '1010893123' |
---|
| 613 | xmldict['institution_bank_id'] = '117' |
---|
[14258] | 614 | xmldict['institution_amt'] = 100 * ( |
---|
| 615 | gateway_net_amt(self.context.amount_auth)) |
---|
| 616 | |
---|
| 617 | # ENT Fees |
---|
| 618 | elif self.context.p_category.startswith('ent_'): |
---|
[14687] | 619 | if contr_agreement_student(student) == 'first': |
---|
| 620 | self.pay_item_id = '114' |
---|
| 621 | else: |
---|
| 622 | self.pay_item_id = '118' |
---|
[14979] | 623 | xmldict['institution_acct'] = '6220029828' |
---|
| 624 | xmldict['institution_bank_id'] = '51' |
---|
[14258] | 625 | xmldict['institution_amt'] = 100 * ( |
---|
| 626 | gateway_net_amt(self.context.amount_auth)) |
---|
| 627 | |
---|
| 628 | # Faculty and Departmental Dues |
---|
| 629 | elif self.context.p_category == 'fac_dep': |
---|
[15742] | 630 | xmldict['institution_acct'] = '1016425386' |
---|
| 631 | xmldict['institution_bank_id'] = '117' |
---|
[14258] | 632 | self.pay_item_id = '117' |
---|
| 633 | xmldict['institution_amt'] = 100 * ( |
---|
| 634 | gateway_net_amt(self.context.amount_auth)) |
---|
| 635 | |
---|
[14376] | 636 | # Restitution Fee |
---|
| 637 | elif self.context.p_category == 'restitution': |
---|
| 638 | self.pay_item_id = '117' |
---|
| 639 | xmldict['institution_amt'] = 100 * ( |
---|
| 640 | gateway_net_amt(self.context.amount_auth)) |
---|
| 641 | |
---|
[16021] | 642 | # Faculty Laboratory Due |
---|
[16080] | 643 | elif self.context.p_category in ('lab_1', 'lab_2'): |
---|
[16021] | 644 | xmldict['institution_acct'] = '1016425386' |
---|
| 645 | xmldict['institution_bank_id'] = '117' |
---|
| 646 | self.pay_item_id = '117' |
---|
| 647 | xmldict['institution_amt'] = 100 * ( |
---|
| 648 | gateway_net_amt(self.context.amount_auth)) |
---|
| 649 | |
---|
[15971] | 650 | # Sports Fee |
---|
[15978] | 651 | #elif self.context.p_category == 'sports': |
---|
| 652 | # self.pay_item_id = '105' |
---|
| 653 | # xmldict['institution_amt'] = 100 * ( |
---|
| 654 | # gateway_net_amt(self.context.amount_auth)) |
---|
[15971] | 655 | |
---|
| 656 | # Library Fee |
---|
[15978] | 657 | #elif self.context.p_category == 'library': |
---|
| 658 | # self.pay_item_id = '105' |
---|
| 659 | # xmldict['institution_amt'] = 100 * ( |
---|
| 660 | # gateway_net_amt(self.context.amount_auth)) |
---|
[15971] | 661 | |
---|
| 662 | # Library PG Fee |
---|
[15978] | 663 | #elif self.context.p_category == 'library_pg': |
---|
| 664 | # self.pay_item_id = '105' |
---|
| 665 | # xmldict['institution_amt'] = 100 * ( |
---|
| 666 | # gateway_net_amt(self.context.amount_auth)) |
---|
| 667 | |
---|
[15992] | 668 | # Sports & Library Fee temporarily in 2020 |
---|
[15978] | 669 | elif self.context.p_category == 'sports_library': |
---|
[15976] | 670 | self.pay_item_id = '105' |
---|
[15992] | 671 | xmldict['sports_amt'] = 100 * 3000.0 |
---|
| 672 | xmldict['library_amt'] = 100 * 1000.0 |
---|
| 673 | xmltext = """<payment_item_detail> |
---|
| 674 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 675 | <item_detail item_id="1" item_name="Sports Development Fee" item_amt="%(sports_amt)d" bank_id="123" acct_num="1006407792" /> |
---|
| 676 | <item_detail item_id="2" item_name="Library Development Fee" item_amt="%(library_amt)d" bank_id="8" acct_num="2000122995" /> |
---|
| 677 | </item_details> |
---|
| 678 | </payment_item_detail>""" % xmldict |
---|
[15971] | 679 | |
---|
[14676] | 680 | # Late Registration Fee |
---|
| 681 | elif self.context.p_category == 'late_registration': |
---|
[14686] | 682 | if contr_agreement_student(student) == 'first': |
---|
| 683 | self.pay_item_id = '113' |
---|
| 684 | else: |
---|
| 685 | self.pay_item_id = '123' |
---|
[14676] | 686 | xmldict['institution_amt'] = 100 * ( |
---|
| 687 | gateway_net_amt(self.context.amount_auth)) |
---|
[15463] | 688 | if student.is_postgrad: |
---|
| 689 | xmldict['institution_acct'] = '5210006575' |
---|
| 690 | xmldict['institution_bank_id'] = '51' |
---|
[14945] | 691 | if not xmltext: |
---|
[14676] | 692 | xmltext = """<payment_item_detail> |
---|
| 693 | <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> |
---|
| 694 | <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" /> |
---|
| 695 | </item_details> |
---|
| 696 | </payment_item_detail>""" % xmldict |
---|
[11868] | 697 | self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext |
---|
| 698 | self.context.provider_amt = provider_amt |
---|
[15761] | 699 | self.context.gateway_amt = self.context.amount_auth - gateway_net_amt( |
---|
| 700 | self.context.amount_auth) |
---|
[15471] | 701 | xmlitems = '' |
---|
| 702 | xmldoc = minidom.parseString(xmltext) |
---|
| 703 | itemlist = xmldoc.getElementsByTagName('item_detail') |
---|
| 704 | for s in itemlist: |
---|
| 705 | xmlitems += "%s: %s, N%s, %s (%s) " % ( |
---|
| 706 | s.attributes['item_id'].value, |
---|
| 707 | s.attributes['item_name'].value, |
---|
| 708 | int(s.attributes['item_amt'].value)/100, |
---|
| 709 | s.attributes['acct_num'].value, |
---|
| 710 | s.attributes['bank_id'].value, |
---|
| 711 | ) |
---|
| 712 | self.context.p_split_data = xmlitems |
---|
[15761] | 713 | self.amount_auth = int(100 * self.context.amount_auth) |
---|
[11868] | 714 | hashargs = ( |
---|
| 715 | self.context.p_id + |
---|
[13382] | 716 | self.product_id + |
---|
[11868] | 717 | self.pay_item_id + |
---|
| 718 | str(int(self.amount_auth)) + |
---|
| 719 | self.site_redirect_url + |
---|
| 720 | self.mac) |
---|
| 721 | self.hashvalue = hashlib.sha512(hashargs).hexdigest() |
---|
| 722 | return |
---|
| 723 | |
---|
| 724 | |
---|
[11846] | 725 | class CustomInterswitchPaymentRequestWebservicePageApplicant( |
---|
| 726 | InterswitchPaymentRequestWebservicePageApplicant): |
---|
[13586] | 727 | """Request webservice view for the CollegePAY gateway |
---|
| 728 | """ |
---|
| 729 | grok.context(ICustomApplicantOnlinePayment) |
---|
| 730 | gateway_host = HOST |
---|
| 731 | gateway_url = URL |
---|
| 732 | https = HTTPS |
---|
[13379] | 733 | |
---|
[13586] | 734 | @property |
---|
[13606] | 735 | def mac(self): |
---|
| 736 | if contr_agreement_applicant(self.context.__parent__) == 'first': |
---|
| 737 | return MAC_PT |
---|
| 738 | return MAC_REGULAR |
---|
| 739 | |
---|
| 740 | @property |
---|
[13586] | 741 | def product_id(self): |
---|
| 742 | if contr_agreement_applicant(self.context.__parent__) == 'first': |
---|
| 743 | return PRODUCT_ID_PT |
---|
| 744 | return PRODUCT_ID_REGULAR |
---|
| 745 | |
---|
| 746 | class CustomInterswitchPaymentVerifyWebservicePageApplicant( |
---|
| 747 | InterswitchPaymentVerifyWebservicePageApplicant): |
---|
| 748 | """Payment verify view for the CollegePAY gateway |
---|
[11846] | 749 | """ |
---|
| 750 | grok.context(ICustomApplicantOnlinePayment) |
---|
| 751 | gateway_host = HOST |
---|
[13586] | 752 | gateway_url = URL |
---|
[11916] | 753 | https = HTTPS |
---|
[11868] | 754 | |
---|
[13532] | 755 | @property |
---|
[13606] | 756 | def mac(self): |
---|
| 757 | if contr_agreement_applicant(self.context.__parent__) == 'first': |
---|
| 758 | return MAC_PT |
---|
| 759 | return MAC_REGULAR |
---|
| 760 | |
---|
| 761 | @property |
---|
[13532] | 762 | def product_id(self): |
---|
| 763 | if contr_agreement_applicant(self.context.__parent__) == 'first': |
---|
| 764 | return PRODUCT_ID_PT |
---|
| 765 | return PRODUCT_ID_REGULAR |
---|
| 766 | |
---|
[11868] | 767 | class CustomInterswitchPaymentRequestWebservicePageStudent( |
---|
| 768 | InterswitchPaymentRequestWebservicePageStudent): |
---|
[13586] | 769 | """Request webservice view for the CollegePAY gateway |
---|
[11868] | 770 | """ |
---|
| 771 | grok.context(ICustomStudentOnlinePayment) |
---|
| 772 | gateway_host = HOST |
---|
[13586] | 773 | gateway_url = URL |
---|
[11916] | 774 | https = HTTPS |
---|
[13379] | 775 | |
---|
| 776 | @property |
---|
[13606] | 777 | def mac(self): |
---|
| 778 | if contr_agreement_student(self.context.student) == 'first': |
---|
| 779 | return MAC_PT |
---|
| 780 | return MAC_REGULAR |
---|
| 781 | |
---|
| 782 | @property |
---|
[13379] | 783 | def product_id(self): |
---|
[13532] | 784 | if contr_agreement_student(self.context.student) == 'first': |
---|
[13379] | 785 | return PRODUCT_ID_PT |
---|
| 786 | return PRODUCT_ID_REGULAR |
---|
[13586] | 787 | |
---|
| 788 | class CustomInterswitchPaymentVerifyWebservicePageStudent( |
---|
| 789 | InterswitchPaymentVerifyWebservicePageStudent): |
---|
| 790 | """Payment verify view for the CollegePAY gateway |
---|
| 791 | """ |
---|
| 792 | grok.context(ICustomStudentOnlinePayment) |
---|
| 793 | gateway_host = HOST |
---|
| 794 | gateway_url = URL |
---|
| 795 | https = HTTPS |
---|
| 796 | |
---|
| 797 | @property |
---|
[13606] | 798 | def mac(self): |
---|
| 799 | if contr_agreement_student(self.context.student) == 'first': |
---|
| 800 | return MAC_PT |
---|
| 801 | return MAC_REGULAR |
---|
| 802 | |
---|
| 803 | @property |
---|
[13586] | 804 | def product_id(self): |
---|
| 805 | if contr_agreement_student(self.context.student) == 'first': |
---|
| 806 | return PRODUCT_ID_PT |
---|
| 807 | return PRODUCT_ID_REGULAR |
---|