[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 |
---|
[6950] | 25 | elif category == 'clearance': |
---|
| 26 | p_item = student['studycourse'].certificate.code |
---|
| 27 | amount = academic_session.clearance |
---|
[6902] | 28 | elif category == 'schoolfee': |
---|
[6925] | 29 | surcharge_1 = academic_session.surcharge_1 |
---|
| 30 | surcharge_2 = academic_session.surcharge_2 |
---|
[6926] | 31 | amount = getSchoolFee(student, surcharge_1 + surcharge_2) |
---|
| 32 | code = student['studycourse'].certificate.code |
---|
[6902] | 33 | #session_string = academic_sessions_vocab.by_value[p_session + 1].title |
---|
| 34 | p_item = code |
---|
| 35 | p_session += 1 |
---|
[6925] | 36 | if amount ==0: |
---|
| 37 | error = u'Amount could not be determined.' |
---|
| 38 | return (amount, p_item, p_session, |
---|
| 39 | surcharge_1, surcharge_2, surcharge_3, error) |
---|
[6902] | 40 | |
---|
| 41 | def getSchoolFee(student, surcharge): |
---|
| 42 | study_mode = student['studycourse'].certificate.study_mode |
---|
| 43 | entry_mode = student.entry_mode |
---|
| 44 | state = student.state |
---|
| 45 | #lga = student.lga |
---|
| 46 | lga = 'nothing' |
---|
| 47 | current_level = student['studycourse'].current_level |
---|
| 48 | |
---|
| 49 | if study_mode.endswith('_ft'): |
---|
| 50 | # fresh |
---|
[6925] | 51 | if state == CLEARED: |
---|
| 52 | return 40000 - surcharge |
---|
[6902] | 53 | # returning |
---|
[6925] | 54 | elif state == RETURNING: |
---|
| 55 | return 20000 - surcharge |
---|
[6902] | 56 | else: |
---|
| 57 | return 0 |
---|
| 58 | else: |
---|
| 59 | return 0 |
---|