Changeset 15361 for main/kofacustom.edopoly/trunk/src
- Timestamp:
- 22 Mar 2019, 11:07:57 (6 years ago)
- Location:
- main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_utils.py
r15344 r15361 58 58 self.assertEqual(msg, None) 59 59 return 60 61 def test_set_payment_details(self): 62 self.student['studycourse'].certificate.school_fee_1 = 6666.0 63 self.student['studycourse'].certificate.study_mode = 'nd_pt' 64 IWorkflowState(self.student).setState('returning') 65 #self.student.nationality = u'NG' 66 #self.student.lga = 'ebonyi_ukaba' 67 utils = getUtility(IStudentsUtils) 68 configuration = createObject('waeup.SessionConfiguration') 69 configuration.academic_session = 2005 70 self.app['configuration'].addSessionConfiguration(configuration) 71 self.app['configuration']['2004'].ict_entre_fee = 170.0 72 self.app['configuration']['2005'].ict_entre_fee = 180.0 73 error, payment = utils.setPaymentDetails('schoolfee',self.student) 74 self.assertEqual(error, u'Pay ICT fee(s) first.') 75 error, payment = utils.setPaymentDetails('ict_entre',self.student) 76 self.assertEqual(error, None) 77 self.assertEqual(payment.p_level, 200) 78 self.assertEqual(payment.p_session, 2005) 79 self.assertEqual(payment.amount_auth, 180.0) 80 payment.p_state = 'paid' 81 self.student['payments']['any_key'] = payment 82 error, payment = utils.setPaymentDetails('schoolfee',self.student) 83 self.assertEqual(error, None) 84 self.assertEqual(payment.p_level, 200) 85 self.assertEqual(payment.p_session, 2005) 86 self.assertEqual(payment.amount_auth, 6666.0) 87 88 IWorkflowState(self.student).setState('cleared') 89 error, payment = utils.setPaymentDetails('ict_entre',self.student) 90 self.assertEqual(error, None) 91 self.assertEqual(payment.p_level, 100) 92 self.assertEqual(payment.p_session, 2004) 93 self.assertEqual(payment.amount_auth, 170.0) 94 payment.p_state = 'paid' 95 self.student['payments']['any_key_2'] = payment 96 error, payment = utils.setPaymentDetails('schoolfee',self.student) 97 self.assertEqual(error, None) 98 self.assertEqual(payment.p_level, 100) 99 self.assertEqual(payment.p_session, 2004) 100 self.assertEqual(payment.amount_auth, 6666.0) -
main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py
r15344 r15361 92 92 req_payments = ('ict_entre', 'logbook_combo') 93 93 req_payments_titles = 'ICT and Logbook' 94 # All ND and HND part time do not pay for LOGBOOK 95 if student.current_mode.endswith('_pt'): 96 req_payments = ('ict_entre',) 97 req_payments_titles = 'ICT' 98 # HND1 and HND2 full time do not pay for LOGBOOK 99 elif student.current_mode == 'hnd_ft' and student.state in ( 100 CLEARED, RETURNING): 101 req_payments = ('ict_entre',) 102 req_payments_titles = 'ICT' 103 # ND2 FULL TIME do not pay LOGBOOK 104 elif student.current_mode == 'nd_ft' and student.state == RETURNING: 105 req_payments = ('ict_entre',) 106 req_payments_titles = 'ICT' 107 num = 0 94 108 if len(student['payments']): 95 # All ND and HND part time do not pay for LOGBOOK96 if student.current_mode.endswith('_pt'):97 req_payments = ('ict_entre',)98 req_payments_titles = 'ICT'99 # HND1 and HND2 full time do not pay for LOGBOOK100 elif student.current_mode == 'hnd_ft' and student.state in (101 CLEARED, RETURNING):102 req_payments = ('ict_entre',)103 req_payments_titles = 'ICT'104 # ND2 FULL TIME do not pay LOGBOOK105 elif student.current_mode == 'nd_ft' and student.state == RETURNING:106 req_payments = ('ict_entre',)107 req_payments_titles = 'ICT'108 num = 0109 109 for ticket in student['payments'].values(): 110 110 if ticket.p_state == 'paid' and \ … … 117 117 118 118 def setPaymentDetails(self, category, student, 119 previous_session , previous_level):119 previous_session=None, previous_level=None): 120 120 """Create a payment ticket and set the payment data of a 121 121 student for the payment category specified. … … 141 141 p_level = student['studycourse'].current_level 142 142 p_current = True 143 # The following three fees are part of the school fee which must be 144 # paid before tuition fee. They are paid for next session. 145 if category in ('ict_entre', 'logbook_combo', 'siwess_combo') and \ 146 student.state == RETURNING and not previous_session: 147 p_session, p_level = self.getReturningData(student) 143 148 academic_session = self._getSessionConfiguration(p_session) 144 149 if academic_session == None: 145 150 return _(u'Session configuration object is not available.'), None 146 151 # Determine fee. 147 # The following three fees are part of the school fee which must be148 # paid before tuition fee.149 if category in ('ict_entre', 'logbook_combo', 'siwess_combo') and \150 student.state == RETURNING and not previous_session:151 p_session, p_level = self.getReturningData(student)152 152 if category == 'schoolfee': 153 153 try: … … 159 159 amount = getattr(certificate, 'school_fee_1', 0.0) 160 160 else: 161 amount = getattr(certificate, 'school_fee_1', 0.0) 162 if student.state == RETURNING: 161 if student.state == CLEARED: 162 amount = getattr(certificate, 'school_fee_1', 0.0) 163 elif student.state == RETURNING: 164 amount = getattr(certificate, 'school_fee_1', 0.0) 163 165 # In case of returning school fee payment the 164 166 # payment session and level contain the values of … … 171 173 u'Session configuration object is not available.' 172 174 ), None 173 174 175 elif student.is_postgrad and student.state == PAID: 175 176 # Returning postgraduate students also pay for the 176 177 # next session but their level always remains the 177 178 # same. 179 amount = getattr(certificate, 'school_fee_1', 0.0) 178 180 p_session += 1 179 181 academic_session = self._getSessionConfiguration(p_session)
Note: See TracChangeset for help on using the changeset viewer.