[6925] | 1 | from grok import getSite |
---|
[6902] | 2 | from waeup.sirp.students.vocabularies import academic_sessions_vocab |
---|
[6925] | 3 | from waeup.sirp.students.workflow import CLEARED, RETURNING |
---|
[6902] | 4 | |
---|
| 5 | def getPaymentDetails(category, student): |
---|
[6925] | 6 | |
---|
[6902] | 7 | surcharge_1 = surcharge_2 = surcharge_3 = 0 |
---|
| 8 | p_item = u'' |
---|
[6925] | 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) |
---|
[6902] | 19 | if category == 'transfer': |
---|
[6925] | 20 | amount = academic_session.transfer |
---|
[6902] | 21 | elif category == 'gown': |
---|
[6925] | 22 | amount = academic_session.gown |
---|
[6902] | 23 | elif category == 'hostel_maintenance': |
---|
[6925] | 24 | amount = academic_session.hostelmaintenance |
---|
[6902] | 25 | elif category == 'schoolfee': |
---|
[6925] | 26 | surcharge_1 = academic_session.surcharge_1 |
---|
| 27 | surcharge_2 = academic_session.surcharge_2 |
---|
[6926] | 28 | amount = getSchoolFee(student, surcharge_1 + surcharge_2) |
---|
| 29 | code = student['studycourse'].certificate.code |
---|
[6902] | 30 | #session_string = academic_sessions_vocab.by_value[p_session + 1].title |
---|
| 31 | p_item = code |
---|
| 32 | p_session += 1 |
---|
[6925] | 33 | if amount ==0: |
---|
| 34 | error = u'Amount could not be determined.' |
---|
| 35 | return (amount, p_item, p_session, |
---|
| 36 | surcharge_1, surcharge_2, surcharge_3, error) |
---|
[6902] | 37 | |
---|
| 38 | def getSchoolFee(student, surcharge): |
---|
| 39 | study_mode = student['studycourse'].certificate.study_mode |
---|
| 40 | entry_mode = student.entry_mode |
---|
| 41 | state = student.state |
---|
| 42 | #lga = student.lga |
---|
| 43 | lga = 'nothing' |
---|
| 44 | current_level = student['studycourse'].current_level |
---|
| 45 | |
---|
| 46 | if study_mode.endswith('_ft'): |
---|
| 47 | # fresh |
---|
[6925] | 48 | if state == CLEARED: |
---|
| 49 | return 40000 - surcharge |
---|
[6902] | 50 | # returning |
---|
[6925] | 51 | elif state == RETURNING: |
---|
| 52 | return 20000 - surcharge |
---|
[6902] | 53 | else: |
---|
| 54 | return 0 |
---|
| 55 | else: |
---|
| 56 | return 0 |
---|