Changeset 13400 for main/waeup.aaue/trunk/src
- Timestamp:
- 6 Nov 2015, 18:29:20 (9 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py
r13397 r13400 132 132 self.redirect(self.url(self.context, '@@index')) 133 133 return 134 134 135 student = self.student 135 136 if school(student) == 'PT': 136 current_session = student['studycourse'].current_session 137 try: 138 academic_session = grok.getSite()['configuration'][str(current_session)] 139 except KeyError: 140 self.flash(_(u'Session configuration object is not available.'), type='danger') 141 self.redirect(self.url(self.context, '@@index')) 142 return 143 if school(student) == 'pt': 137 144 self.product_id = PRODUCT_ID_PT 138 145 else: … … 145 152 # requirement applies to students in state 'cleared' and 146 153 # entry_session greater than 2013 only. 147 if self.context.p_category == 'schoolfee'and \154 if self.context.p_category.startswith('schoolfee') and \ 148 155 student.state == CLEARED and \ 149 156 student.entry_session > 2012: … … 151 158 for ticket in student['payments'].values(): 152 159 if ticket.p_state == 'paid' and \ 153 ticket.p_category == 'clearance':160 ticket.p_category.startswith('clearance'): 154 161 acceptance_fee_paid = True 155 162 break … … 171 178 provider_amt = 0.0 172 179 173 # PT 174 if school(student) == 'pt': 175 if self.context.p_category == 'schoolfee': 180 # Schoolfee 181 if self.context.p_category.startswith('schoolfee'): 182 if school(student) == 'pt': 183 # PT schoolfee settings 184 provider_amt = 1900.0 185 joint_venture_amt = 1100.0 186 aaue_share_amt = 1000.0 187 student_union_due_amt = academic_session.union_fee 188 student_welfare_assurance_amt = academic_session.welfare_fee 176 189 xmldict['institution_bank_id'] = '7' 177 190 xmldict['institution_acct'] = '1014847058' … … 180 193 else: 181 194 self.pay_item_id = '105' 182 provider_amt = 1900.0 183 joint_venture_amt = 1100.0 184 aaue_share_amt = 1000.0 185 student_union_due_amt = 1000.0 186 student_welfare_assurance_amt = 500.0 187 xmldict['provider_amt'] = 100 * provider_amt 188 xmldict['joint_venture_amt'] = 100 * joint_venture_amt 189 xmldict['aaue_share_amt'] = 100 * aaue_share_amt 195 else: 196 # REGULAR schoolfee settings 197 provider_amt = 1500.0 198 joint_venture_amt = 1000.0 199 aaue_share_amt = 1500.0 200 student_union_due_amt = academic_session.union_fee 201 student_welfare_assurance_amt = academic_session.welfare_fee 202 xmldict['institution_bank_id'] = '117' 203 xmldict['institution_acct'] = '1010827641' 204 self.pay_item_id = '101' 205 206 xmldict['provider_amt'] = 100 * provider_amt 207 xmldict['joint_venture_amt'] = 100 * joint_venture_amt 208 xmldict['aaue_share_amt'] = 100 * aaue_share_amt 209 if self.context.p_category == 'schoolfee_incl': 210 # Schoolfee including additional fees 190 211 xmldict['student_union_due_amt'] = 100 * student_union_due_amt 191 212 xmldict['student_welfare_assurance_amt'] = 100 * student_welfare_assurance_amt … … 208 229 </item_details> 209 230 </payment_item_detail>""" % xmldict 210 elif self.context.p_category == 'clearance': 231 else: 232 # Schoolfee without additional fees 233 xmldict['institution_amt'] = 100 * ( 234 self.context.amount_auth 235 - provider_amt 236 - joint_venture_amt 237 - aaue_share_amt 238 - GATEWAY_AMT) 239 xmltext = """<payment_item_detail> 240 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 241 <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" /> 242 <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" /> 243 <item_detail item_id="3" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="51" acct_num="5060023759" /> 244 <item_detail item_id="4" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="51" acct_num="5060020947" /> 245 </item_details> 246 </payment_item_detail>""" % xmldict 247 248 249 # Clearance 250 elif self.context.p_category.startswith('clearance'): 251 if school(student) == 'pt': 252 # PT clearance settings 211 253 if student.current_mode == 'found': 212 254 self.pay_item_id = '102' … … 215 257 xmldict['institution_acct'] = '1014066976' 216 258 xmldict['institution_bank_id'] = '117' 217 gown_fee_amt = 2000.0 218 aaue_fl_fee_amt = 800.0 259 else: 260 # REGULAR clearance settings 261 self.pay_item_id = '102' 262 xmldict['institution_acct'] = '1010827641' 263 xmldict['institution_bank_id'] = '117' 264 265 266 if self.context.p_category == 'clearance_incl': 267 # Clearance including additional fees 268 gown_fee_amt = academic_session.matric_gown_fee 269 aaue_fl_fee_amt = academic_session.lapel_fee 219 270 xmldict['gown_fee_amt'] = 100 * gown_fee_amt 220 271 xmldict['aaue_fl_fee_amt'] = 100 * aaue_fl_fee_amt … … 231 282 </item_details> 232 283 </payment_item_detail>""" % xmldict 284 233 285 else: 234 self.flash('Not applicable', type='danger') 235 self.redirect(self.url(self.context, '@@index')) 236 return 237 238 # REGULAR 239 else: 240 if self.context.p_category == 'schoolfee': 241 self.pay_item_id = '101' 242 xmldict['institution_bank_id'] = '117' 243 xmldict['institution_acct'] = '1010827641' 244 provider_amt = 1500.0 245 xmldict['provider_amt'] = 100 * provider_amt 246 aaue_share_amt = 1500.0 247 xmldict['aaue_share_amt'] = 100 * aaue_share_amt 248 joint_venture_amt = 1000.0 249 xmldict['joint_venture_amt'] = 100 * joint_venture_amt 286 # Clearance without additional fees 250 287 xmldict['institution_amt'] = 100 * ( 251 288 self.context.amount_auth 252 - provider_amt253 - joint_venture_amt254 - aaue_share_amt255 289 - GATEWAY_AMT) 256 290 xmltext = """<payment_item_detail> 257 291 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 258 292 <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" /> 259 <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" /> 260 <item_detail item_id="3" item_name="Joint Venture" item_amt="%(joint_venture_amt)d" bank_id="117" acct_num="1014066969" /> 261 <item_detail item_id="4" item_name="AAUE Share" item_amt="%(aaue_share_amt)d" bank_id="11" acct_num="0030656377" /> 262 </item_details> 263 </payment_item_detail>""" % xmldict 264 265 elif self.context.p_category == 'clearance': 266 self.pay_item_id = '102' 267 xmldict['institution_acct'] = '1010827641' 268 xmldict['institution_bank_id'] = '117' 269 xmldict['institution_amt'] = 100 * ( 270 self.context.amount_auth - GATEWAY_AMT) 271 xmltext = """<payment_item_detail> 272 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 273 <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" /> 274 </item_details> 275 </payment_item_detail>""" % xmldict 276 277 elif self.context.p_category == 'union': 278 self.pay_item_id = '103' 279 xmldict['institution_acct'] = '1006360118' 280 xmldict['institution_bank_id'] = '123' 281 xmldict['institution_amt'] = 100 * ( 282 self.context.amount_auth - GATEWAY_AMT) 283 xmltext = """<payment_item_detail> 284 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 285 <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" /> 286 </item_details> 287 </payment_item_detail>""" % xmldict 288 289 elif self.context.p_category == 'lapel': 290 self.pay_item_id = '104' 291 xmldict['institution_acct'] = '4010660109' 292 xmldict['institution_bank_id'] = '51' 293 xmldict['institution_amt'] = 100 * ( 294 self.context.amount_auth - GATEWAY_AMT) 295 xmltext = """<payment_item_detail> 296 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 297 <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" /> 298 </item_details> 299 </payment_item_detail>""" % xmldict 300 301 elif self.context.p_category == 'welfare': 302 self.pay_item_id = '105' 303 xmldict['institution_acct'] = '1006407792' 304 xmldict['institution_bank_id'] = '123' 305 xmldict['institution_amt'] = 100 * ( 306 self.context.amount_auth - GATEWAY_AMT) 307 xmltext = """<payment_item_detail> 308 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 309 <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" /> 310 </item_details> 311 </payment_item_detail>""" % xmldict 312 313 elif self.context.p_category == 'matric_gown': 314 self.pay_item_id = '106' 315 xmldict['institution_acct'] = '5060023429' 316 xmldict['institution_bank_id'] = '51' 317 xmldict['institution_amt'] = 100 * ( 318 self.context.amount_auth - GATEWAY_AMT) 319 xmltext = """<payment_item_detail> 320 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 321 <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" /> 322 </item_details> 323 </payment_item_detail>""" % xmldict 324 325 elif self.context.p_category == 'concessional': 326 self.pay_item_id = '107' 327 xmldict['institution_acct'] = '1010835352' 328 xmldict['institution_bank_id'] = '117' 329 xmldict['institution_amt'] = 100 * ( 330 self.context.amount_auth - GATEWAY_AMT) 331 xmltext = """<payment_item_detail> 332 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 333 <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" /> 334 </item_details> 335 </payment_item_detail>""" % xmldict 336 337 elif self.context.p_category == 'medical': 338 self.pay_item_id = '108' 339 xmldict['institution_acct'] = '1010827641' 340 xmldict['institution_bank_id'] = '117' 341 xmldict['institution_amt'] = 100 * ( 342 self.context.amount_auth - GATEWAY_AMT) 343 xmltext = """<payment_item_detail> 344 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 345 <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" /> 346 </item_details> 347 </payment_item_detail>""" % xmldict 348 349 elif self.context.p_category == 'hostel_maintenance': 350 self.pay_item_id = '109' 351 xmldict['institution_acct'] = '1006406795' 352 xmldict['institution_bank_id'] = '123' 353 xmldict['institution_amt'] = 100 * ( 354 self.context.amount_auth - GATEWAY_AMT) 355 xmltext = """<payment_item_detail> 293 </item_details> 294 </payment_item_detail>""" % xmldict 295 296 # Union Due 297 elif self.context.p_category == 'union': 298 self.pay_item_id = '103' 299 xmldict['institution_acct'] = '1006360118' 300 xmldict['institution_bank_id'] = '123' 301 xmldict['institution_amt'] = 100 * ( 302 self.context.amount_auth - GATEWAY_AMT) 303 xmltext = """<payment_item_detail> 304 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 305 <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" /> 306 </item_details> 307 </payment_item_detail>""" % xmldict 308 309 # Lapel 310 elif self.context.p_category == 'lapel': 311 self.pay_item_id = '104' 312 xmldict['institution_acct'] = '4010660109' 313 xmldict['institution_bank_id'] = '51' 314 xmldict['institution_amt'] = 100 * ( 315 self.context.amount_auth - GATEWAY_AMT) 316 xmltext = """<payment_item_detail> 317 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 318 <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" /> 319 </item_details> 320 </payment_item_detail>""" % xmldict 321 322 # Welfare 323 elif self.context.p_category == 'welfare': 324 self.pay_item_id = '105' 325 xmldict['institution_acct'] = '1006407792' 326 xmldict['institution_bank_id'] = '123' 327 xmldict['institution_amt'] = 100 * ( 328 self.context.amount_auth - GATEWAY_AMT) 329 xmltext = """<payment_item_detail> 330 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 331 <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" /> 332 </item_details> 333 </payment_item_detail>""" % xmldict 334 335 # Matric Gown 336 elif self.context.p_category == 'matric_gown': 337 self.pay_item_id = '106' 338 xmldict['institution_acct'] = '5060023429' 339 xmldict['institution_bank_id'] = '51' 340 xmldict['institution_amt'] = 100 * ( 341 self.context.amount_auth - GATEWAY_AMT) 342 xmltext = """<payment_item_detail> 343 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 344 <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" /> 345 </item_details> 346 </payment_item_detail>""" % xmldict 347 348 # Concessional 349 elif self.context.p_category == 'concessional': 350 self.pay_item_id = '107' 351 xmldict['institution_acct'] = '1010835352' 352 xmldict['institution_bank_id'] = '117' 353 xmldict['institution_amt'] = 100 * ( 354 self.context.amount_auth - GATEWAY_AMT) 355 xmltext = """<payment_item_detail> 356 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 357 <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" /> 358 </item_details> 359 </payment_item_detail>""" % xmldict 360 361 # Medical 362 elif self.context.p_category == 'medical': 363 self.pay_item_id = '108' 364 xmldict['institution_acct'] = '1010827641' 365 xmldict['institution_bank_id'] = '117' 366 xmldict['institution_amt'] = 100 * ( 367 self.context.amount_auth - GATEWAY_AMT) 368 xmltext = """<payment_item_detail> 369 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 370 <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" /> 371 </item_details> 372 </payment_item_detail>""" % xmldict 373 374 # Hostel Maintenance 375 elif self.context.p_category == 'hostel_maintenance': 376 self.pay_item_id = '109' 377 xmldict['institution_acct'] = '1006406795' 378 xmldict['institution_bank_id'] = '123' 379 xmldict['institution_amt'] = 100 * ( 380 self.context.amount_auth - GATEWAY_AMT) 381 xmltext = """<payment_item_detail> 356 382 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 357 383 <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" /> -
main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py
r13388 r13400 105 105 self.certificate.study_mode = 'ug_pt' 106 106 self.student['studycourse'].entry_session = 2013 107 self.student['studycourse'].certificate.school_fee_1 = 51750.0 107 self.student['studycourse'].certificate.school_fee_1 = 50250.0 108 self.app['configuration']['2004'].union_fee = 1000.0 109 self.app['configuration']['2004'].welfare_fee = 500.0 108 110 # Manager can access InterswitchForm 109 111 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 112 114 self.student.nationality = u'NG' 113 115 self.browser.open(self.payments_path + '/addop') 114 self.browser.getControl(name="form.p_category").value = ['schoolfee ']116 self.browser.getControl(name="form.p_category").value = ['schoolfee_incl'] 115 117 self.browser.getControl("Create ticket").click() 116 118 self.assertTrue('ticket created' in self.browser.contents) … … 137 139 in self.browser.contents) 138 140 self.assertTrue( 139 'item_name="School Fee" item_amt="4600000" bank_id="7" ' 141 'item_name="School Fee plus Student Union Dues and Welfare Ass." ' 142 'item_amt="4600000" bank_id="7" ' 140 143 'acct_num="1014847058"' in self.browser.contents) 141 144 … … 184 187 def test_interswitch_form_pt_acceptance_fees(self): 185 188 self.certificate.study_mode = 'ug_pt' 186 self.app['configuration']['2004'].clearance_fee_pt = 43050.0 189 self.app['configuration']['2004'].clearance_fee_pt = 40250.0 190 self.app['configuration']['2004'].matric_gown_fee = 2000.0 191 self.app['configuration']['2004'].lapel_fee = 800.0 187 192 # Manager can access InterswitchForm 188 193 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 191 196 self.student.nationality = u'NG' 192 197 self.browser.open(self.payments_path + '/addop') 193 self.browser.getControl(name="form.p_category").value = ['clearance ']198 self.browser.getControl(name="form.p_category").value = ['clearance_incl'] 194 199 self.browser.getControl("Create ticket").click() 195 200 self.assertTrue('ticket created' in self.browser.contents) … … 208 213 in self.browser.contents) 209 214 self.assertTrue( 210 'item_name="Acceptance Fee" item_amt="4000000" bank_id="117" ' 215 'item_name="Acceptance Fee plus Matric Gown Fee and Lapel Fee" ' 216 'item_amt="4000000" bank_id="117" ' 211 217 'acct_num="1014066976"' in self.browser.contents) 212 218 … … 259 265 '<span>1567.0</span>' in self.browser.contents) 260 266 self.payment_url = self.browser.url 261 self.browser.getLink("CollegePAY", index=0).click()262 self.assertTrue('<div class="alert alert-danger">Not applicable</div>'263 in self.browser.contents)264 267 self.certificate.study_mode = 'ug_ft' 265 268 self.browser.getLink("CollegePAY", index=0).click() -
main/waeup.aaue/trunk/src/waeup/aaue/students/payments.py
r13049 r13400 49 49 def redeemTicket(self): 50 50 student = self.student 51 if self.p_category in ('schoolfee', 'schoolfee_1'):51 if self.p_category.startswith('schoolfee'): 52 52 # Bypass activation code creation if next session 53 53 # can be started directly. -
main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py
r13377 r13400 133 133 elif category == 'medical': 134 134 amount = academic_session.medical_fee 135 elif category == 'clearance':135 elif category.startswith('clearance'): 136 136 if student.faccode == 'FP': 137 137 amount = academic_session.clearance_fee_fp … … 143 143 amount = academic_session.clearance_fee 144 144 p_item = student['studycourse'].certificate.code 145 # Add Matric Gown Fee and Lapel Fee 146 if category == 'clearance_incl': 147 if amount is None: 148 # Otherwise we can't add somtehing 149 amount = 0.0 150 amount += academic_session.matric_gown_fee + academic_session.lapel_fee 145 151 elif category == 'late_registration': 146 152 amount = academic_session.late_registration_fee 147 elif category == 'schoolfee':153 elif category.startswith('schoolfee'): 148 154 try: 149 155 certificate = student['studycourse'].certificate … … 172 178 else: 173 179 return _('Wrong state.'), None 180 # Add Student Union Fee and Welfare Assurance 181 if category == 'schoolfee_incl': 182 if amount is None: 183 # Otherwise we can't add somtehing 184 amount = 0.0 185 amount += academic_session.welfare_fee + academic_session.union_fee 174 186 if amount in (0.0, None): 175 187 return _(u'Amount could not be determined.'), None -
main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py
r13374 r13400 31 31 'schoolfee_1': 'School Fee 1st instalment', 32 32 'schoolfee_2': 'School Fee 2nd instalment', 33 'schoolfee_incl': 'School Fee plus Student Union Dues and Welfare Ass.', 33 34 'clearance': 'Acceptance Fee', 35 'clearance_incl': 'Acceptance Fee plus Matric Gown Fee and Lapel Fee', 34 36 'hostel_maintenance': 'Hostel Maintenance Fee', 35 37 'application': 'Application Fee', … … 51 53 #'schoolfee_1': 'School Fee 1st instalment', 52 54 #'schoolfee_2': 'School Fee 2nd instalment', 55 'schoolfee_incl': 'School Fee plus Students Union Due and Welfare Ass.', 53 56 'clearance': 'Acceptance Fee', 57 'clearance_incl': 'Acceptance Fee plus Matric Gown Fee and Lapel Fee', 54 58 'hostel_maintenance': 'Hostel Maintenance Fee', 55 59 'application': 'Application Fee',
Note: See TracChangeset for help on using the changeset viewer.