Changeset 9613 for main/waeup.fceokene/trunk/src
- Timestamp:
- 11 Nov 2012, 06:09:18 (12 years ago)
- Location:
- main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/browser.py
r9440 r9613 182 182 site_name = SITE_NAME 183 183 currency = CURRENCY 184 pay_item_id = ' 8302'184 pay_item_id = '' 185 185 product_id = PRODUCT_ID 186 186 187 187 def update(self): 188 #if self.context.p_state != 'unpaid':189 188 if self.context.p_state == 'paid': 190 189 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) … … 214 213 xmldict['provider_amt'] = 100 * 500 215 214 # Institution data 216 studycourse = student['studycourse'] 217 if student.current_mode in ('ug_sw','prence',): 218 xmldict['institution_acct'] = "6216801025" 215 xmldict['fceokene_acct'] = "0000000000000" 216 xmldict['institution_bank_id'] = '0' 217 xmldict['institution_item_name'] = self.category 218 xmldict['institution_name'] = INSTITUTION_NAME 219 if self.context.p_category == 'schoolfee': 220 self.pay_item_id = '8302' 221 studycourse = student['studycourse'] 222 if student.current_mode in ('ug_sw','prence',): 223 xmldict['institution_acct'] = "6216801025" 224 xmldict['institution_bank_id'] = '117' 225 elif student.current_mode in ('ug_ft',) and \ 226 student['studycourse'].current_verdict == 'O': 227 xmldict['institution_acct'] = "6216801025" 228 xmldict['institution_bank_id'] = '117' 229 elif student.current_mode in ('ug_ft',): 230 xmldict['institution_acct'] = "6216801033" 231 xmldict['institution_bank_id'] = '117' 232 elif student.current_mode in ('pd_ft',): 233 xmldict['institution_acct'] = "6216801025" 234 xmldict['institution_bank_id'] = '117' 235 xmldict['fceokene_split'] = 100 * 1400 236 xmldict['institution_amt'] = 100 * ( 237 self.context.amount_auth - 500 - 150 - 1400) 238 elif 'maintenance' in self.context.p_category: 239 self.pay_item_id = '8300' 240 xmldict['institution_amt'] = 100 * ( 241 self.context.amount_auth - 150) 242 xmldict['institution_acct'] = "1012044132" 219 243 xmldict['institution_bank_id'] = '117' 220 elif student.current_mode in ('ug_ft',) and \ 221 student['studycourse'].current_verdict == 'O': 222 xmldict['institution_acct'] = "6216801025" 223 xmldict['institution_bank_id'] = '117' 224 elif student.current_mode in ('ug_ft',): 225 xmldict['institution_acct'] = "6216801033" 226 xmldict['institution_bank_id'] = '117' 227 elif student.current_mode in ('pd_ft',): 228 xmldict['institution_acct'] = "6216801025" 229 xmldict['institution_bank_id'] = '117' 230 else: 231 xmldict['fceokene_acct'] = "0000000000000" 232 xmldict['institution_bank_id'] = '0' 233 xmldict['fceokene_split'] = 100 * 1400 234 xmldict['institution_amt'] = 100 * ( 235 self.context.amount_auth - 500 - 150 - 1400) 236 xmldict['institution_item_name'] = self.context.p_category 237 xmldict['institution_name'] = INSTITUTION_NAME 244 xmldict['institution_amt'] = 100 * ( 245 self.context.amount_auth - 150) 238 246 # Interswitch amount is not part of the xml data 239 xmltext = """<payment_item_detail> 247 248 if self.context.p_category == 'schoolfee': 249 xmltext = """<payment_item_detail> 240 250 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 241 251 <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" /> … … 244 254 </item_details> 245 255 </payment_item_detail>""" % xmldict 256 257 elif 'maintenance' in self.context.p_category: 258 xmltext = """<payment_item_detail> 259 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 260 <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" /> 261 </item_details> 262 </payment_item_detail>""" % xmldict 263 246 264 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 247 265 return … … 321 339 student.writeLogMessage(self, log) 322 340 if not success: 323 self.flash(msg) 341 msg = self.request['QUERY_STRING'].replace('%20',' ') 342 self.flash(_('Response from Interswitch: ') + msg) 324 343 return 325 344 success, msg, log = self.context.doAfterStudentPayment() -
main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/tests.py
r9455 r9613 50 50 IWorkflowState(self.student).setState('cleared') 51 51 self.browser.open(self.payments_path + '/addop') 52 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 52 53 self.browser.getControl("Create ticket").click() 53 54 self.assertMatches('...ticket created...', … … 77 78 def test_interswitch_form(self): 78 79 80 # Manager can access InterswitchForm for the created school fee ticket 81 self.browser.getLink("CollegePAY", index=0).click() 82 self.assertMatches('...Total Amount Authorized:...', 83 self.browser.contents) 84 self.assertMatches( 85 '...<input type="hidden" name="amount" value="1249500.0" />...', 86 self.browser.contents) 87 self.assertMatches( 88 '...item_name="School Fee" item_amt="1044500" bank_id="117" acct_num="6216801033"...', 89 self.browser.contents) 90 self.assertMatches( 91 '...item_name="FCEOkene Split" item_amt="140000" bank_id="117" acct_num="6216801058"...', 92 self.browser.contents) 93 self.assertMatches( 94 '...item_name="BT Education" item_amt="50000" bank_id="31" acct_num="0026781725"...', 95 self.browser.contents) 96 97 # Let's do the same for maintenance fee payment 98 99 self.browser.open(self.payments_path) 100 self.browser.open(self.payments_path + '/addop') 101 self.browser.getControl( 102 name="form.p_category").value = ['hostel_maintenance'] 103 self.browser.getControl("Create ticket").click() 104 self.assertMatches('...You have not yet booked accommodation...', 105 self.browser.contents) 106 # Students have to book bed first 107 self.browser.open(self.acco_path) 108 IWorkflowState(self.student).setState('admitted') 109 self.browser.getLink("Book accommodation").click() 110 self.assertFalse('Activation Code:' in self.browser.contents) 111 self.browser.getControl("Create bed ticket").click() 112 # Bed is randomly selected but, since there is only 113 # one bed for this student, we know that ... 114 self.assertMatches('...Hall 1, Block A, Room 101, Bed A...', 115 self.browser.contents) 116 self.assertMatches('...ticket created...', 117 self.browser.contents) 118 self.browser.open(self.payments_path + '/addop') 119 self.browser.getControl( 120 name="form.p_category").value = ['hostel_maintenance'] 121 self.browser.getControl("Create ticket").click() 122 self.assertMatches('...ticket created...', 123 self.browser.contents) 124 ctrl = self.browser.getControl(name='val_id') 125 value = ctrl.options[1] 126 self.browser.getLink(value).click() 127 self.assertMatches('...Amount Authorized...', 128 self.browser.contents) 129 self.assertMatches( 130 '...<span>4000.0</span>...', 131 self.browser.contents) 132 self.payment_url = self.browser.url 79 133 # Manager can access InterswitchForm 80 134 self.browser.getLink("CollegePAY", index=0).click() 135 # The total amount to be processed by Interswitch 136 # has been reduced by the Interswitch fee of 150 Nairas 81 137 self.assertMatches('...Total Amount Authorized:...', 82 138 self.browser.contents) 83 139 self.assertMatches( 84 '...<input type="hidden" name="amount" value="1249500.0" />...', 85 self.browser.contents) 86 self.assertMatches( 87 '...item_name="schoolfee" item_amt="1044500" bank_id="117" acct_num="6216801033"...', 88 self.browser.contents) 89 self.assertMatches( 90 '...item_name="FCEOkene Split" item_amt="140000" bank_id="117" acct_num="6216801058"...', 91 self.browser.contents) 92 self.assertMatches( 93 '...item_name="BT Education" item_amt="50000" bank_id="31" acct_num="0026781725"...', 94 self.browser.contents) 140 '...<input type="hidden" name="amount" value="400000.0" />...', 141 self.browser.contents) 142 self.assertMatches( 143 '...item_name="Hostel Maintenance Fee" item_amt="385000" bank_id="117" acct_num="1012044132"...', 144 self.browser.contents) 145 # BT does nor charge a fee for maintenance fee 146 self.assertFalse("BT Education" in self.browser.contents) 95 147 96 148 # @external_test
Note: See TracChangeset for help on using the changeset viewer.