Changeset 6925
- Timestamp:
- 22 Oct 2011, 07:29:31 (13 years ago)
- Location:
- main/waeup.custom/trunk/src/waeup/custom/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.custom/trunk/src/waeup/custom/students/browser.py
r6903 r6925 20 20 payment.surcharge_1, 21 21 payment.surcharge_2, 22 payment.surcharge_3) = getPaymentDetails( 22 payment.surcharge_3, 23 error) = getPaymentDetails( 23 24 data['p_category'],self.context.__parent__) 24 if payment.amount_auth == 0:25 self.flash( 'Payment amount could not be determined.')25 if error: 26 self.flash(error) 26 27 self.redirect(self.url(self.context, u'@@manage')) 27 28 return -
main/waeup.custom/trunk/src/waeup/custom/students/tests.py
r6903 r6925 1 1 from waeup.custom.testing import FunctionalLayer 2 2 from waeup.sirp.students.tests.test_browser import StudentsFullSetup 3 from waeup.custom.configuration import SessionConfiguration 3 4 4 5 class StudentUITests(StudentsFullSetup): … … 8 9 9 10 def test_manage_payments(self): 11 12 # Set up SessionConfiguration object 13 configuration = SessionConfiguration() 14 configuration.academic_session = 2004 15 configuration.fee_1 = 20000 16 self.app['configuration'].addSessionConfiguration(configuration) 17 10 18 # Managers can add online payment tickets 11 19 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 14 22 self.browser.getControl("Add online payment ticket").click() 15 23 self.browser.getControl("Create ticket").click() 16 self.assertMatches('... amount could not be determined...',24 self.assertMatches('...Amount could not be determined...', 17 25 self.browser.contents) 18 26 self.browser.open(self.manage_student_path) … … 29 37 self.assertMatches('...ticket created...', 30 38 self.browser.contents) 39 self.browser.open(self.manage_student_path) 40 self.browser.getControl(name="transition").value = ['pay_first_school_fee'] 41 self.browser.getControl("Save").click() 42 self.browser.getControl(name="transition").value = ['reset6'] 43 self.browser.getControl("Save").click() 44 self.browser.open(self.payments_student_path + '/addop') 45 self.browser.getControl("Create ticket").click() 46 self.assertMatches('...ticket created...', 47 self.browser.contents) -
main/waeup.custom/trunk/src/waeup/custom/students/utils.py
r6902 r6925 1 from grok import getSite 1 2 from waeup.sirp.students.vocabularies import academic_sessions_vocab 3 from waeup.sirp.students.workflow import CLEARED, RETURNING 2 4 3 5 def getPaymentDetails(category, student): 4 p_session = student['studycourse'].current_session 6 5 7 surcharge_1 = surcharge_2 = surcharge_3 = 0 6 8 p_item = u'' 9 amount = 0 10 error = u'' 11 p_session = student['studycourse'].current_session 12 session = str(p_session) 13 try: 14 academic_session = getSite()['configuration'][session] 15 except KeyError: 16 error = u'Session configuration object is not available.' 17 return (amount, p_item, p_session, 18 surcharge_1, surcharge_2, surcharge_3, error) 7 19 if category == 'transfer': 8 amount = 50020 amount = academic_session.transfer 9 21 elif category == 'gown': 10 amount = 50022 amount = academic_session.gown 11 23 elif category == 'hostel_maintenance': 12 amount = 30024 amount = academic_session.hostelmaintenance 13 25 elif category == 'schoolfee': 14 surcharge_1 = 1500 # BT amount15 surcharge_2 = 300 # Interswitch amount26 surcharge_1 = academic_session.surcharge_1 27 surcharge_2 = academic_session.surcharge_2 16 28 try: 17 29 amount = getSchoolFee(student, surcharge_1 + surcharge_2) 18 30 code = student['studycourse'].certificate.code 19 31 except AttributeError: 20 return 0, None, None, 0, 0, 0 32 return 0, None, None, 0, 0, 0, 'School Fee could not be determined.' 21 33 #session_string = academic_sessions_vocab.by_value[p_session + 1].title 22 34 p_item = code 23 35 p_session += 1 24 return amount, p_item, p_session, surcharge_1, surcharge_2, surcharge_3 36 if amount ==0: 37 error = u'Amount could not be determined.' 38 return (amount, p_item, p_session, 39 surcharge_1, surcharge_2, surcharge_3, error) 25 40 26 41 def getSchoolFee(student, surcharge): … … 31 46 lga = 'nothing' 32 47 current_level = student['studycourse'].current_level 33 CLEARED = 'cleared'34 48 35 49 if study_mode.endswith('_ft'): 36 # fresh remedial37 if current_level == 0 and state == CLEARED:38 if entry_mode == 'rmd_ft':39 return 80200 - surcharge40 else:41 return 74200 - surcharge42 50 # fresh 43 elif state == CLEARED: 44 if study_mode == 'jm_ft': 45 return 72700 - surcharge 46 elif lga == 'foreigner': 47 return 131500 - surcharge 48 else: 49 return 41500 - surcharge 51 if state == CLEARED: 52 return 40000 - surcharge 50 53 # returning 51 elif state == 'returning': 52 if study_mode == 'jm_ft': 53 return 32500 - surcharge 54 elif lga == 'foreigner': 55 return 109500 - surcharge 56 else: 57 return 19500 - surcharge 54 elif state == RETURNING: 55 return 20000 - surcharge 58 56 else: 59 57 return 0
Note: See TracChangeset for help on using the changeset viewer.