Changeset 14241 for main/waeup.aaue/trunk/src
- Timestamp:
- 30 Oct 2016, 10:47:18 (8 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r14238 r14241 224 224 225 225 def test_for_instalment_payments(self): 226 227 configuration_1 = createObject('waeup.SessionConfiguration') 228 configuration_1.academic_session = 2015 229 self.app['configuration'].addSessionConfiguration(configuration_1) 226 230 self.student['studycourse'].certificate.study_mode = 'ug_pt' 227 231 self.student['studycourse'].certificate.school_fee_1 = 6666.0 228 self.app['configuration']['20 04'].union_fee = 1250.0229 self.app['configuration']['20 04'].welfare_fee = 750.0232 self.app['configuration']['2015'].union_fee = 1250.0 233 self.app['configuration']['2015'].welfare_fee = 750.0 230 234 self.student.nationality = u'NG' 231 235 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 239 243 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 240 244 self.browser.getControl("Create ticket").click() 241 self.assertTrue( 242 'Wrong state. Only students in state \'cleared\' are allowed to pay by instalments' 245 self.assertTrue('You are not allowed to pay by instalments.' 243 246 in self.browser.contents) 244 247 IWorkflowState(self.student).setState('cleared') 248 self.student['studycourse'].entry_session = 2015 249 self.student['studycourse'].current_session = 2015 245 250 self.browser.open(self.payments_path + '/addop') 246 251 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] … … 274 279 # (6666-250)/2 + 250 275 280 self.assertEqual(self.student['payments'].values()[1].amount_auth, 3458.0) 281 # The two payments belong to the same session and level. 282 self.assertEqual(self.student['payments'].values()[0].p_session, 2015) 283 self.assertEqual(self.student['payments'].values()[0].p_level, 100) 284 self.assertEqual(self.student['payments'].values()[1].p_session, 2015) 285 self.assertEqual(self.student['payments'].values()[1].p_level, 100) 286 287 # Returning student 288 configuration_2 = createObject('waeup.SessionConfiguration') 289 configuration_2.academic_session = 2016 290 self.app['configuration'].addSessionConfiguration(configuration_2) 291 self.student['studycourse'].certificate.school_fee_2 = 5666.0 292 self.app['configuration']['2016'].union_fee = 1250.0 293 self.app['configuration']['2016'].welfare_fee = 750.0 294 self.student.father_name = u'Albert' 295 IWorkflowState(self.student).setState('returning') 296 self.browser.open(self.payments_path + '/addop') 297 self.browser.getControl(name="form.p_category").value = ['schoolfee_1'] 298 self.browser.getControl("Create ticket").click() 299 self.browser.open(self.payments_path + '/addop') 300 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 301 self.browser.getControl("Create ticket").click() 302 # Student is still in the first session. 303 self.assertTrue('This type of payment' in self.browser.contents) 304 self.browser.open(self.payments_path) 305 ctrl = self.browser.getControl(name='val_id') 306 p_id = ctrl.options[2] 307 self.browser.open(self.payments_path + '/' + p_id + '/approve') 308 self.browser.open(self.payments_path + '/addop') 309 self.browser.getControl(name="form.p_category").value = ['schoolfee_2'] 310 self.browser.getControl("Create ticket").click() 311 self.assertTrue('ticket created' in self.browser.contents) 312 # (5666-250)/2 + 1250 + 750 - 500 + 250 313 self.assertEqual(self.student['payments'].values()[2].amount_auth, 4458.0) 314 # (5666-250)/2 + 250 315 self.assertEqual(self.student['payments'].values()[3].amount_auth, 2958.0) 316 # The last two payments belong to the same session and level. 317 self.assertEqual(self.student['payments'].values()[2].p_session, 2016) 318 self.assertEqual(self.student['payments'].values()[2].p_level, 200) 319 self.assertEqual(self.student['payments'].values()[3].p_session, 2016) 320 self.assertEqual(self.student['payments'].values()[3].p_level, 200) 276 321 return 277 322 … … 711 756 def test_student_2nd_semester_course_registration(self): 712 757 IWorkflowState(self.student).setState('school fee paid') 758 self.student['studycourse'].entry_session = 2015 713 759 self.course.semester = 2 714 760 self.browser.open(self.login_path) -
main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py
r14239 r14241 262 262 return _("Part-time students are not allowed " 263 263 "to pay by instalments."), None 264 if category == 'schoolfee_1' and student.state != CLEARED: 265 return _("Wrong state. Only students in state 'cleared' " 266 "are allowed to pay by instalments."), None 267 if category == 'schoolfee_2' and not student.is_fresh: 268 return _("Only new students " 269 "are allowed to pay by instalments."), None 270 if student.state == CLEARED or category == 'schoolfee_2': 264 if student.entry_session < 2015: 265 return _("You are not allowed " 266 "to pay by instalments."), None 267 if student.state == CLEARED: 271 268 amount = getattr(certificate, 'school_fee_1', 0.0) 272 269 # Cut school fee by 50% 273 if category in ('schoolfee_1', 'schoolfee_2'): 274 if amount: 275 amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT 270 if category == 'schoolfee_1' and amount: 271 amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT 272 elif student.is_fresh and category == 'schoolfee_2': 273 amount = getattr(certificate, 'school_fee_1', 0.0) 274 # Cut school fee by 50% 275 if amount: 276 amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT 276 277 elif student.state == RETURNING: 277 278 if not student.father_name: … … 286 287 except KeyError: 287 288 return _(u'Session configuration object is not available.'), None 288 if student.entry_session == 2015:289 if student.entry_session >= 2015: 289 290 amount = getattr(certificate, 'school_fee_2', 0.0) 291 # Cut school fee by 50% 292 if category in ('schoolfee_1', 'schoolfee_2') and amount: 293 amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT 290 294 else: 291 295 amount = getattr(certificate, 'school_fee_3', 0.0) 296 elif category == 'schoolfee_2': 297 amount = getattr(certificate, 'school_fee_2', 0.0) 298 # Cut school fee by 50% 299 if amount: 300 amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT 292 301 else: 293 302 return _('Wrong state.'), None
Note: See TracChangeset for help on using the changeset viewer.