from grok import getSite from waeup.sirp.students.vocabularies import academic_sessions_vocab from waeup.sirp.students.workflow import CLEARED, RETURNING def getPaymentDetails(category, student): surcharge_1 = surcharge_2 = surcharge_3 = 0 p_item = u'' amount = 0 error = u'' p_session = student['studycourse'].current_session session = str(p_session) try: academic_session = getSite()['configuration'][session] except KeyError: error = u'Session configuration object is not available.' return (amount, p_item, p_session, surcharge_1, surcharge_2, surcharge_3, error) if category == 'transfer': amount = academic_session.transfer elif category == 'gown': amount = academic_session.gown elif category == 'hostel_maintenance': amount = academic_session.hostelmaintenance elif category == 'clearance': p_item = student['studycourse'].certificate.code amount = academic_session.clearance elif category == 'schoolfee': surcharge_1 = academic_session.surcharge_1 surcharge_2 = academic_session.surcharge_2 amount = getSchoolFee(student, surcharge_1 + surcharge_2) code = student['studycourse'].certificate.code #session_string = academic_sessions_vocab.by_value[p_session + 1].title p_item = code p_session += 1 if amount ==0: error = u'Amount could not be determined.' return (amount, p_item, p_session, surcharge_1, surcharge_2, surcharge_3, error) def getSchoolFee(student, surcharge): study_mode = student['studycourse'].certificate.study_mode entry_mode = student.entry_mode state = student.state #lga = student.lga lga = 'nothing' current_level = student['studycourse'].current_level if study_mode.endswith('_ft'): # fresh if state == CLEARED: return 40000 - surcharge # returning elif state == RETURNING: return 20000 - surcharge else: return 0 else: return 0