- Timestamp:
- 5 Nov 2019, 23:19:58 (5 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py
r15727 r15755 34 34 from kofacustom.nigeria.interfaces import MessageFactory as _ 35 35 36 GATEWAY_AMT = 300.0 37 36 38 # Buttons 37 39 … … 306 308 xml_data = None 307 309 hashvalue = None 310 gateway_amt = GATEWAY_AMT 308 311 309 312 def init_update(self): … … 317 320 if time_delta.days > 7: 318 321 return _("This payment ticket is too old. Please create a new ticket.") 322 if self.context.r_company and self.context.r_company != 'interswitch': 323 return _("Payment ticket has been used for another payment gateway.") 319 324 student = self.context.student 320 325 certificate = getattr(student['studycourse'],'certificate',None) … … 326 331 self.context.p_item, self.context.p_session): 327 332 return _("This type of payment has already been made.") 328 self.amount_auth = int(100 * self.context.amount_auth)329 333 xmldict = {} 330 334 if certificate is not None: … … 341 345 self.student = student 342 346 self.xmldict = xmldict 343 self.context.r_company = u'interswitch'344 347 return 345 348 … … 351 354 self.flash(error, type='danger') 352 355 self.redirect(self.url(self.context, '@@index')) 356 # Already now it becomes an Interswitch payment. We set the net amount 357 # and add the gateway amount. 358 if not self.context.r_company: 359 self.context.net_amt = self.context.amount_auth 360 self.context.amount_auth += self.gateway_amt 361 self.context.gateway_amt = self.gateway_amt 362 self.context.r_company = u'interswitch' 363 self.amount_auth = int(100 * self.context.amount_auth) 353 364 return 354 365 … … 363 374 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)') 364 375 submit_button = _('Submit') 365 hashvalue = None366 376 367 377 action = None … … 371 381 product_id = None 372 382 xml_data = None 383 hashvalue = None 384 gateway_amt = GATEWAY_AMT 373 385 374 386 def init_update(self): … … 379 391 return _("Payment ticket can't be send to CollegePAY. " 380 392 "Application period has expired.") 393 if self.context.r_company and self.context.r_company != 'interswitch': 394 return _("Payment ticket has been used for another payment gateway.") 381 395 tz = getUtility(IKofaUtils).tzinfo 382 396 time_delta = datetime.utcnow() - self.context.creation_date … … 384 398 return _("This payment ticket is too old. Please create a new ticket.") 385 399 self.applicant = self.context.__parent__ 386 self.amount_auth = int(100 * self.context.amount_auth)387 400 self.category = self.context.category 388 401 tz = getUtility(IKofaUtils).tzinfo … … 390 403 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z") 391 404 self.site_redirect_url = self.url(self.context, 'request_webservice') 392 self.context.r_company = u'interswitch'393 405 return 394 406 … … 400 412 self.flash(error, type='danger') 401 413 self.redirect(self.url(self.context, '@@index')) 402 return 414 # Already now it becomes an Interswitch payment. We set the net amount 415 # and add the gateway amount. 416 if not self.context.r_company: 417 self.context.net_amt = self.context.amount_auth 418 self.context.amount_auth += self.gateway_amt 419 self.context.gateway_amt = self.gateway_amt 420 self.context.r_company = u'interswitch' 421 self.amount_auth = int(100 * self.context.amount_auth) 422 return -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/tests.py
r15702 r15755 103 103 # Split amounts have been set. 104 104 self.assertEqual(self.student['payments'][value].provider_amt, 0.0) 105 self.assertEqual(self.student['payments'][value].gateway_amt, 0.0)105 self.assertEqual(self.student['payments'][value].gateway_amt, 300.0) 106 106 self.assertMatches('...<input type="hidden" name="pay_item_id" />...', 107 107 self.browser.contents) 108 self.assert Matches(109 ' ...<input type="hidden" name="amount" value="2000000" />...',108 self.assertTrue( 109 '<input type="hidden" name="amount" value="2030000" />' in 110 110 self.browser.contents) 111 111 … … 118 118 self.browser.contents) 119 119 self.assertEqual(self.student.current_mode, 'ug_ft') 120 self.assert Matches(121 ' ...<input type="hidden" name="amount" value="4000000" />...',120 self.assertTrue( 121 '<input type="hidden" name="amount" value="4030000" />' in 122 122 self.browser.contents) 123 123 delta = timedelta(days=8)
Note: See TracChangeset for help on using the changeset viewer.