Changeset 12973 for main/kofacustom.nigeria/trunk/src/kofacustom
- Timestamp:
- 21 May 2015, 11:00:24 (10 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/__init__.py
-
Property
svn:keywords
set to
Id
-
Property
svn:keywords
set to
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py
r12509 r12973 17 17 ## 18 18 import grok 19 from datetime import datetime, timedelta 19 20 from zope.component import getUtility 20 21 from waeup.kofa.interfaces import IKofaUtils … … 165 166 if self.context.p_state == 'paid': 166 167 return _("Payment ticket can't be re-sent to CollegePAY.") 168 tz = getUtility(IKofaUtils).tzinfo 169 time_delta = datetime.utcnow() - self.context.creation_date 170 if time_delta.seconds > 3600: 171 return _("This payment ticket is too old. Please create a new ticket.") 167 172 student = self.context.student 168 173 certificate = getattr(student['studycourse'],'certificate',None) … … 224 229 return _("Payment ticket can't be send to CollegePAY. " 225 230 "Application period has expired.") 231 tz = getUtility(IKofaUtils).tzinfo 232 time_delta = datetime.utcnow() - self.context.creation_date 233 if time_delta.seconds > 3600: 234 return _("This payment ticket is too old. Please create a new ticket.") 226 235 self.applicant = self.context.__parent__ 227 236 self.amount_auth = int(100 * self.context.amount_auth) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/tests.py
r11767 r12973 17 17 ## 18 18 import os 19 from datetime import datetime 19 from datetime import datetime, timedelta, date 20 20 from zope.component import createObject, getUtility 21 21 from zope.catalog.interfaces import ICatalog … … 52 52 self.browser.contents) 53 53 self.payment_url = self.browser.url 54 self.payment = self.student['payments'][self.value] 54 55 55 56 def test_interswitch_form(self): … … 94 95 self.browser.contents) 95 96 97 def test_interswitch_form_ticket_expired(self): 98 # Manager can access InterswitchForm 99 self.browser.getLink("CollegePAY", index=0).click() 100 self.assertMatches('...<input type="hidden" name="pay_item_id" />...', 101 self.browser.contents) 102 self.assertMatches('...Total Amount Authorized:...', 103 self.browser.contents) 104 self.assertEqual(self.student.current_mode, 'ug_ft') 105 self.assertMatches( 106 '...<input type="hidden" name="amount" value="4000000" />...', 107 self.browser.contents) 108 delta = timedelta(minutes=61) 109 self.payment.creation_date -= delta 110 self.browser.open(self.payment_url) 111 self.browser.getLink("CollegePAY", index=0).click() 112 self.assertMatches( 113 '...This payment ticket is too old. Please create a new ticket...', 114 self.browser.contents) 115 delta = timedelta(minutes=2) 116 self.payment.creation_date += delta 117 self.browser.open(self.payment_url) 118 self.browser.getLink("CollegePAY", index=0).click() 119 self.assertMatches('...Total Amount Authorized:...', 120 self.browser.contents) 121 96 122 class InterswitchTestsApplicants(ApplicantsFullSetup): 97 123 """Tests for the Interswitch payment gateway. … … 116 142 self.assertMatches('...ticket created...', 117 143 self.browser.contents) 118 #ctrl = self.browser.getControl(name='val_id') 119 #value = ctrl.options[0] 120 #self.browser.getLink(value).click() 144 self.payment = self.applicant.values()[0] 121 145 self.payment_url = self.browser.url 122 146 … … 134 158 '...<input type="hidden" name="amount" value="100000" />...', 135 159 self.browser.contents) 160 delta = timedelta(minutes=61) 161 self.payment.creation_date -= delta 162 self.browser.open(self.payment_url) 163 self.browser.getLink("CollegePAY", index=0).click() 164 self.assertMatches( 165 '...This payment ticket is too old. Please create a new ticket...', 166 self.browser.contents) 167 delta = timedelta(minutes=2) 168 self.payment.creation_date += delta 169 self.browser.getLink("CollegePAY", index=0).click() 170 self.assertMatches('...Total Amount Authorized:...', 171 self.browser.contents) 136 172
Note: See TracChangeset for help on using the changeset viewer.