Changeset 10736 for main/waeup.kwarapoly/trunk/src/waeup
- Timestamp:
- 10 Nov 2013, 07:46:56 (11 years ago)
- Location:
- main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py
r10667 r10736 112 112 xmldict['institution_item_name'] = self.category 113 113 xmldict['institution_name'] = INSTITUTION_NAME 114 xmldict['institution_amt'] = 0.0 115 dalash_amt = 200.0 116 provider_amt = 300.0 117 gateway_amt = GATEWAY_AMT 114 118 self.pay_item_id = '000' 115 119 if self.context.p_category == 'schoolfee': 116 provider_amt = 1200.0117 xmldict['provider_amt'] = 100 * provider_amt118 120 self.pay_item_id = '101' 119 121 dalash_amt = 1800.0 120 xmldict['dalash_amt'] = 100 * dalash_amt 121 xmldict['institution_amt'] = 100 * ( 122 self.context.amount_auth - provider_amt - 123 GATEWAY_AMT - dalash_amt) 122 provider_amt = 1200.0 124 123 if xmldict['faculty'] in ('CPGS',): 125 124 xmldict['institution_acct'] = "1771180233" … … 145 144 xmldict['institution_bank_id'] = '8' 146 145 self.pay_item_id = '108' 147 146 elif self.context.p_category == 'certificate': 147 self.pay_item_id = '111' 148 xmldict['institution_acct'] = "0131959715" 149 xmldict['institution_bank_id'] = '10' 150 elif self.context.p_category == 'state_result': 151 self.pay_item_id = '112' 152 xmldict['institution_acct'] = "0131959715" 153 xmldict['institution_bank_id'] = '10' 154 elif self.context.p_category == 'transcript_local': 155 self.pay_item_id = '113' 156 xmldict['institution_acct'] = "0131959715" 157 xmldict['institution_bank_id'] = '10' 158 elif self.context.p_category == 'transcript_foreign': 159 self.pay_item_id = '114' 160 xmldict['institution_acct'] = "0131959715" 161 xmldict['institution_bank_id'] = '10' 162 elif self.context.p_category == 'ver_result': 163 self.pay_item_id = '115' 164 xmldict['institution_acct'] = "0131959715" 165 xmldict['institution_bank_id'] = '10' 166 elif self.context.p_category == 'change_course': 167 self.pay_item_id = '116' 168 xmldict['institution_acct'] = "0131959715" 169 xmldict['institution_bank_id'] = '10' 170 elif self.context.p_category == 'change_inst': 171 self.pay_item_id = '117' 172 xmldict['institution_acct'] = "0131959715" 173 xmldict['institution_bank_id'] = '10' 174 elif self.context.p_category == 'jamb_reject': 175 self.pay_item_id = '118' 176 xmldict['institution_acct'] = "0131959715" 177 xmldict['institution_bank_id'] = '10' 178 elif self.context.p_category == 'cert_of_cert': 179 self.pay_item_id = '119' 180 xmldict['institution_acct'] = "0131959715" 181 xmldict['institution_bank_id'] = '10' 182 elif self.context.p_category == 'ref_let': 183 self.pay_item_id = '120' 184 xmldict['institution_acct'] = "0131959715" 185 xmldict['institution_bank_id'] = '10' 186 elif self.context.p_category == 'proc_cert': 187 self.pay_item_id = '121' 188 xmldict['institution_acct'] = "0131959715" 189 xmldict['institution_bank_id'] = '10' 190 elif self.context.p_category == 'loss_idcard': 191 self.pay_item_id = '122' 192 xmldict['institution_acct'] = "0131959715" 193 xmldict['institution_bank_id'] = '10' 194 dalash_amt = 6.0 195 xmldict['dalash_amt'] = 100 * dalash_amt 196 provider_amt = 9.0 197 gateway_amt = 15.0 198 elif self.context.p_category == 'loss_examcard': 199 self.pay_item_id = '123' 200 xmldict['institution_acct'] = "0131959715" 201 xmldict['institution_bank_id'] = '10' 202 dalash_amt = 3.0 203 xmldict['dalash_amt'] = 100 * dalash_amt 204 provider_amt = 4.5 205 gateway_amt = 7.5 206 elif self.context.p_category == 'loss_result': 207 self.pay_item_id = '124' 208 xmldict['institution_acct'] = "0131959715" 209 xmldict['institution_bank_id'] = '10' 210 elif self.context.p_category == 'loss_receipt': 211 self.pay_item_id = '125' 212 xmldict['institution_acct'] = "0131959715" 213 xmldict['institution_bank_id'] = '10' 214 elif self.context.p_category == 'loss_clearance': 215 self.pay_item_id = '126' 216 xmldict['institution_acct'] = "0131959715" 217 xmldict['institution_bank_id'] = '10' 218 elif self.context.p_category == 'conv_brochure': 219 self.pay_item_id = '127' 220 xmldict['institution_acct'] = "0131959715" 221 xmldict['institution_bank_id'] = '10' 148 222 elif 'maintenance' in self.context.p_category: 149 223 self.pay_item_id = '102' 150 224 xmldict['institution_acct'] = "0039050937" 151 225 xmldict['institution_bank_id'] = '31' 152 xmldict['institution_amt'] = 100 * (153 self.context.amount_auth - GATEWAY_AMT)154 226 dalash_amt = 0.0 155 227 provider_amt = 0.0 228 229 230 xmldict['dalash_amt'] = 100 * dalash_amt 231 xmldict['provider_amt'] = 100 * provider_amt 232 xmldict['institution_amt'] = 100 * ( 233 self.context.amount_auth - provider_amt - 234 gateway_amt - dalash_amt) 235 156 236 157 237 hashargs = ( … … 166 246 # Interswitch amount is not part of the xml data 167 247 168 if self.context.p_category == 'schoolfee': 248 if 'maintenance' in self.context.p_category: 249 xmltext = """<payment_item_detail> 250 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 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" /> 252 </item_details> 253 </payment_item_detail>""" % xmldict 254 255 else: 169 256 xmltext = """<payment_item_detail> 170 257 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> … … 175 262 </payment_item_detail>""" % xmldict 176 263 177 elif 'maintenance' in self.context.p_category:178 xmltext = """<payment_item_detail>179 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">180 <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" />181 </item_details>182 </payment_item_detail>""" % xmldict183 184 264 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 185 265 self.context.provider_amt = provider_amt 186 self.context.gateway_amt = GATEWAY_AMT266 self.context.gateway_amt = gateway_amt 187 267 self.context.thirdparty_amt = dalash_amt 188 268 return -
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/tests.py
r10682 r10736 261 261 '...item_name="BT Education" item_amt="120000" bank_id="117" acct_num="1010764827"...', 262 262 self.browser.contents) 263 264 def test_interswitch_form_new_payment_cats(self): 265 # only a few categories covered 266 267 self.app['configuration']['2004'].certificate_fee = 6800.0 268 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 269 self.browser.open(self.payments_path + '/addop') 270 self.browser.getControl(name="form.p_category").value = ['certificate'] 271 self.browser.getControl("Create ticket").click() 272 self.assertMatches('...ticket created...', self.browser.contents) 273 ctrl = self.browser.getControl(name='val_id') 274 value = ctrl.options[0] 275 self.browser.getLink(value).click() 276 self.assertMatches('...Amount Authorized...', self.browser.contents) 277 self.assertMatches( 278 '...<span>6800.0</span>...', self.browser.contents) 279 self.browser.getLink("CollegePAY", index=0).click() 280 self.assertEqual(self.student['payments'][value].amount_auth, 6800.0) 281 self.assertEqual(self.student['payments'][value].provider_amt, 300.0) 282 self.assertEqual(self.student['payments'][value].gateway_amt, 300.0) 283 self.assertEqual(self.student['payments'][value].thirdparty_amt, 200.0) 284 285 self.app['configuration']['2004'].transcript_local_fee = 5000.0 286 self.browser.open(self.payments_path + '/addop') 287 self.browser.getControl(name="form.p_category").value = ['transcript_local'] 288 self.browser.getControl("Create ticket").click() 289 ctrl = self.browser.getControl(name='val_id') 290 value = ctrl.options[1] 291 self.browser.getLink(value).click() 292 self.assertMatches('...Amount Authorized...', self.browser.contents) 293 self.assertMatches( 294 '...<span>5000.0</span>...', self.browser.contents) 295 self.payment_url = self.browser.url 296 self.browser.getLink("CollegePAY", index=0).click() 297 self.assertEqual(self.student['payments'][value].amount_auth, 5000.0) 298 self.assertEqual(self.student['payments'][value].provider_amt, 300.0) 299 self.assertEqual(self.student['payments'][value].gateway_amt, 300.0) 300 self.assertEqual(self.student['payments'][value].thirdparty_amt, 200.0) 301 302 self.app['configuration']['2004'].loss_idcard_fee = 1000.0 303 self.browser.open(self.payments_path + '/addop') 304 self.browser.getControl(name="form.p_category").value = ['loss_idcard'] 305 self.browser.getControl("Create ticket").click() 306 ctrl = self.browser.getControl(name='val_id') 307 value = ctrl.options[2] 308 self.browser.getLink(value).click() 309 self.assertMatches('...Amount Authorized...', self.browser.contents) 310 self.assertMatches( 311 '...<span>1000.0</span>...', self.browser.contents) 312 self.payment_url = self.browser.url 313 self.browser.getLink("CollegePAY", index=0).click() 314 self.assertEqual(self.student['payments'][value].amount_auth, 1000.0) 315 self.assertEqual(self.student['payments'][value].provider_amt, 9.0) 316 self.assertEqual(self.student['payments'][value].gateway_amt, 15.0) 317 self.assertEqual(self.student['payments'][value].thirdparty_amt, 6.0) 318 319 self.app['configuration']['2004'].loss_examcard_fee = 500.0 320 self.browser.open(self.payments_path + '/addop') 321 self.browser.getControl(name="form.p_category").value = ['loss_examcard'] 322 self.browser.getControl("Create ticket").click() 323 ctrl = self.browser.getControl(name='val_id') 324 value = ctrl.options[3] 325 self.browser.getLink(value).click() 326 self.assertMatches('...Amount Authorized...', self.browser.contents) 327 self.assertMatches( 328 '...<span>500.0</span>...', self.browser.contents) 329 self.payment_url = self.browser.url 330 self.browser.getLink("CollegePAY", index=0).click() 331 self.assertEqual(self.student['payments'][value].amount_auth, 500.0) 332 self.assertEqual(self.student['payments'][value].provider_amt, 4.5) 333 self.assertEqual(self.student['payments'][value].gateway_amt, 7.5) 334 self.assertEqual(self.student['payments'][value].thirdparty_amt, 3) 335 336 self.app['configuration']['2004'].change_inst_fee = 6000.0 337 self.browser.open(self.payments_path + '/addop') 338 self.browser.getControl(name="form.p_category").value = ['change_inst'] 339 self.browser.getControl("Create ticket").click() 340 ctrl = self.browser.getControl(name='val_id') 341 value = ctrl.options[4] 342 self.browser.getLink(value).click() 343 self.assertMatches('...Amount Authorized...', self.browser.contents) 344 self.assertMatches( 345 '...<span>6000.0</span>...', self.browser.contents) 346 self.payment_url = self.browser.url 347 self.browser.getLink("CollegePAY", index=0).click() 348 self.assertEqual(self.student['payments'][value].amount_auth, 6000.0) 349 self.assertEqual(self.student['payments'][value].provider_amt, 300.0) 350 self.assertEqual(self.student['payments'][value].gateway_amt, 300.0) 351 self.assertEqual(self.student['payments'][value].thirdparty_amt, 200.0) 352 353 self.app['configuration']['2004'].loss_result_fee = 7000.0 354 self.browser.open(self.payments_path + '/addop') 355 self.browser.getControl(name="form.p_category").value = ['loss_result'] 356 self.browser.getControl("Create ticket").click() 357 ctrl = self.browser.getControl(name='val_id') 358 value = ctrl.options[5] 359 self.browser.getLink(value).click() 360 self.assertMatches('...Amount Authorized...', self.browser.contents) 361 self.assertMatches( 362 '...<span>7000.0</span>...', self.browser.contents) 363 self.payment_url = self.browser.url 364 self.browser.getLink("CollegePAY", index=0).click() 365 self.assertEqual(self.student['payments'][value].amount_auth, 7000.0) 366 self.assertEqual(self.student['payments'][value].provider_amt, 300.0) 367 self.assertEqual(self.student['payments'][value].gateway_amt, 300.0) 368 self.assertEqual(self.student['payments'][value].thirdparty_amt, 200.0) 263 369 264 370 @external_test
Note: See TracChangeset for help on using the changeset viewer.