Changeset 9513
- Timestamp:
- 2 Nov 2012, 16:58:01 (12 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
r9459 r9513 464 464 self.assertEqual(error, None) 465 465 466 # In Uniben we have pg and special pg students.467 # They pay the same but their workflow is different.466 # In Uniben students can pay school fee in all states no matter 467 # if they are ug or pg students. 468 468 IWorkflowState(self.student).setState('school fee paid') 469 self.certificate.study_mode = 'special_pg_pt' 469 470 self.student.is_staff = False 470 471 self.student.nationality = u'NG' 471 472 self.certificate.school_fee_2 = 10000.0 473 472 474 error, payment = utils.setPaymentDetails( 473 475 'schoolfee', self.student, None, None) 474 self.assertEqual(payment, None) 475 self.assertTrue('not be determined' in error) 476 self.certificate.study_mode = 'pg_pt' 477 self.assertTrue(self.student.is_postgrad) 478 self.assertFalse(self.student.is_special_postgrad) 476 self.assertEqual(payment.p_level, None) 477 self.assertEqual(payment.p_session, 2005) 478 self.assertEqual(payment.amount_auth, 10000.0) 479 self.assertEqual(payment.p_item, u'CERT1') 480 self.assertEqual(error, None) 481 482 IWorkflowState(self.student).setState('courses registered') 479 483 error, payment = utils.setPaymentDetails( 480 484 'schoolfee', self.student, None, None) 481 self.assertEqual(payment.p_level, 100)485 self.assertEqual(payment.p_level, None) 482 486 self.assertEqual(payment.p_session, 2005) 483 487 self.assertEqual(payment.amount_auth, 10000.0) 484 488 self.assertEqual(payment.p_item, u'CERT1') 485 489 self.assertEqual(error, None) 486 self.certificate.study_mode = 'special_pg_pt' 487 self.assertTrue(self.student.is_postgrad) 488 self.assertTrue(self.student.is_special_postgrad) 490 491 IWorkflowState(self.student).setState('courses validated') 489 492 error, payment = utils.setPaymentDetails( 490 493 'schoolfee', self.student, None, None) 491 self.assertTrue('not be determined' in error) 492 IWorkflowState(self.student).setState('returning') 493 error, payment = utils.setPaymentDetails( 494 'schoolfee', self.student, None, None) 495 self.assertEqual(payment.p_level, 200) 494 self.assertEqual(payment.p_level, None) 496 495 self.assertEqual(payment.p_session, 2005) 497 496 self.assertEqual(payment.amount_auth, 10000.0) -
main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
r9459 r9513 21 21 from reportlab.lib.styles import getSampleStyleSheet 22 22 from reportlab.platypus import Paragraph, Image, Table, Spacer 23 from waeup.kofa.interfaces import IKofaUtils, CLEARED, RETURNING, PAID 23 from waeup.kofa.interfaces import (IKofaUtils, 24 CLEARED, RETURNING, PAID, REGISTERED, VALIDATED) 24 25 from kofacustom.nigeria.students.utils import NigeriaStudentsUtils 25 26 from waeup.kofa.accesscodes import create_accesscode … … 125 126 else: 126 127 amount = getattr(certificate, 'school_fee_1', 0.0) 128 elif student.state in (PAID, REGISTERED, VALIDATED): 129 # Students are either postgraduate or are paying in advance. 130 # Both are paying for next session. 131 p_session += 1 132 # We don't know which level the student is paying for. 133 p_level = None 134 try: 135 academic_session = grok.getSite()[ 136 'configuration'][str(p_session)] 137 except KeyError: 138 return _(u'Session configuration object is not available.'), None 139 if student.is_foreigner: 140 amount = getattr(certificate, 'school_fee_4', 0.0) 141 else: 142 amount = getattr(certificate, 'school_fee_2', 0.0) 127 143 elif student.state == RETURNING: 128 144 # In case of returning school fee payment the payment session … … 130 146 # has paid for. 131 147 p_session, p_level = self.getReturningData(student) 132 if student.is_foreigner:133 amount = getattr(certificate, 'school_fee_4', 0.0)134 else:135 amount = getattr(certificate, 'school_fee_2', 0.0)136 148 try: 137 149 academic_session = grok.getSite()[ … … 139 151 except KeyError: 140 152 return _(u'Session configuration object is not available.'), None 141 elif student.state == PAID and student.is_postgrad and \142 not student.is_special_postgrad:143 # Regular returning postgraduate students also pay144 # for the next session but their level always remains the same.145 p_session += 1146 153 if student.is_foreigner: 147 154 amount = getattr(certificate, 'school_fee_4', 0.0) 148 155 else: 149 156 amount = getattr(certificate, 'school_fee_2', 0.0) 150 try:151 academic_session = grok.getSite()[152 'configuration'][str(p_session)]153 except KeyError:154 return _(u'Session configuration object is not available.'), None155 157 # Give 50% school fee discount to staff members. 156 158 if student.is_staff:
Note: See TracChangeset for help on using the changeset viewer.