- Timestamp:
- 12 Dec 2016, 12:02:31 (8 years ago)
- Location:
- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/utils.py
r14333 r14336 18 18 from time import time 19 19 from zope.component import createObject, getUtility 20 from waeup.kofa.fees import FeeTable 20 21 from waeup.kofa.interfaces import (IKofaUtils, 21 22 ADMITTED, CLEARED, RETURNING, PAID, REGISTERED, VALIDATED) 22 23 from kofacustom.nigeria.students.utils import NigeriaStudentsUtils 23 24 from kofacustom.coewarri.interfaces import MessageFactory as _ 25 from kofacustom.coewarri.interswitch.browser import GATEWAY_AMT 24 26 25 27 … … 31 33 return 'non-local' 32 34 35 PAYMENT_LEVELS = (100, 110, 200, 210, 300, 310, 400, 410, 500, 999) 36 37 FEES_PARAMS = ( 38 ('local', 'non-local'), 39 ('nce_ft', 'nce_pt', 'ug_ft'), 40 PAYMENT_LEVELS 41 ) 42 43 FEES_VALUES = ( 44 ( # 100 110 200 210 300 310 400 410 500 999 45 (42000.0, 42000.0, 20600.0, 20600.0, 18100.0, 18100.0, 0.0, 0.0, 0.0, 0.0), # nce_ft 46 (55200.0, 55200.0, 42200.0, 42200.0, 44700.0, 44700.0, 42200.0, 42200.0, 0.0, 0.0), # nce_pt 47 (69200.0, 69200.0, 63100.0, 63100.0, 63100.0, 63100.0, 62100.0, 62100.0, 0.0, 0.0), # ug_ft 48 ), # local 49 ( # 50 (54600.0, 54600.0, 22600.0, 22600.0, 20100.0, 20100.0, 0.0, 0.0, 0.0, 0.0), # nce_ft 51 (55200.0, 55200.0, 42200.0, 42200.0, 44700.0, 44700.0, 42200.0, 42200.0, 0.0, 0.0), # nce_pt 52 (79200.0, 79200.0, 63100.0, 63100.0, 63100.0, 63100.0, 62100.0, 62100.0, 0.0, 0.0), # ug_ft 53 ), # non-local 54 ) 55 56 SCHOOL_FEES = FeeTable(FEES_PARAMS, FEES_VALUES) 57 33 58 class CustomStudentsUtils(NigeriaStudentsUtils): 34 59 """A collection of customized methods. … … 37 62 38 63 def setPaymentDetails(self, category, student, 39 previous_session , previous_level):64 previous_session=None, previous_level=None): 40 65 """Create a payment ticket and set the payment data of a 41 66 student for the payment category specified. … … 43 68 p_item = u'' 44 69 amount = 0.0 45 if previous_session: 46 if previous_session < student['studycourse'].entry_session: 47 return _('The previous session must not fall below ' 48 'your entry session.'), None 49 if category == 'schoolfee': 50 # School fee is always paid for the following session 51 if previous_session > student['studycourse'].current_session: 52 return _('This is not a previous session.'), None 53 else: 54 if previous_session > student['studycourse'].current_session - 1: 55 return _('This is not a previous session.'), None 56 p_session = previous_session 57 p_level = previous_level 58 p_current = False 59 else: 60 p_session = student['studycourse'].current_session 61 p_level = student['studycourse'].current_level 62 p_current = True 70 p_session = student['studycourse'].current_session 71 p_level = student['studycourse'].current_level 72 p_current = True 63 73 academic_session = self._getSessionConfiguration(p_session) 64 74 if academic_session == None: … … 71 81 except (AttributeError, TypeError): 72 82 return _('Study course data are incomplete.'), None 73 if previous_session: 74 # Students can pay for previous sessions in all 75 # workflow states. Fresh students are excluded by the 76 # update method of the PreviousPaymentAddFormPage. 77 if previous_level == 100: 78 amount = getattr(certificate, 'school_fee_1', 0.0) 79 else: 80 amount = getattr(certificate, 'school_fee_2', 0.0) 81 else: 82 if student.state == CLEARED: 83 amount = getattr(certificate, 'school_fee_1', 0.0) 84 elif student.state == RETURNING: 85 # In case of returning school fee payment the 86 # payment session and level contain the values of 87 # the session the student has paid for. Payment 88 # session is always next session. 89 p_session, p_level = self.getReturningData(student) 90 academic_session = self._getSessionConfiguration(p_session) 91 if academic_session == None: 92 return _( 93 u'Session configuration object is not available.' 94 ), None 95 amount = getattr(certificate, 'school_fee_2', 0.0) 96 elif student.is_postgrad and student.state == PAID: 97 # Returning postgraduate students also pay for the 98 # next session but their level always remains the 99 # same. 100 p_session += 1 101 academic_session = self._getSessionConfiguration(p_session) 102 if academic_session == None: 103 return _( 104 u'Session configuration object is not available.' 105 ), None 106 amount = getattr(certificate, 'school_fee_2', 0.0) 83 if student.state == RETURNING: 84 # Override p_session and p_level 85 p_session, p_level = self.getReturningData(student) 86 academic_session = self._getSessionConfiguration(p_session) 87 if academic_session == None: 88 return _(u'Session configuration object ' 89 'is not available.'), None 90 if student.state in (RETURNING, CLEARED): 91 if p_level in PAYMENT_LEVELS: 92 amount = SCHOOL_FEES.get_fee( 93 ( 94 local_nonlocal(student), 95 student.current_mode, 96 p_level) 97 ) 98 amount += GATEWAY_AMT 107 99 elif category == 'clearance': 108 100 try: … … 111 103 return _('Study course data are incomplete.'), None 112 104 amount = academic_session.clearance_fee 105 if local_nonlocal(student) == 'non-local': 106 amount += 5000.0 113 107 elif category == 'bed_allocation': 114 108 p_item = self.getAccommodationDetails(student)['bt']
Note: See TracChangeset for help on using the changeset viewer.