[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): |
---|
[7021] | 6 | d = {} |
---|
| 7 | d['surcharge_1'] = d['surcharge_2'] = d['surcharge_3'] = 0 |
---|
| 8 | d['p_item'] = u'' |
---|
| 9 | d['amount'] = 0 |
---|
| 10 | d['error'] = u'' |
---|
| 11 | d['p_session'] = student['studycourse'].current_session |
---|
| 12 | session = str(d['p_session']) |
---|
[6925] | 13 | try: |
---|
| 14 | academic_session = getSite()['configuration'][session] |
---|
| 15 | except KeyError: |
---|
[7021] | 16 | d['error'] = u'Session configuration object is not available.' |
---|
| 17 | return d |
---|
[6902] | 18 | if category == 'transfer': |
---|
[7021] | 19 | d['amount'] = academic_session.transfer_fee |
---|
[6902] | 20 | elif category == 'gown': |
---|
[7021] | 21 | d['amount'] = academic_session.gown_fee |
---|
| 22 | elif category == 'bed_allocation': |
---|
| 23 | d['amount'] = academic_session.booking_fee |
---|
[6902] | 24 | elif category == 'hostel_maintenance': |
---|
[7021] | 25 | d['amount'] = academic_session.maint_fee |
---|
[6950] | 26 | elif category == 'clearance': |
---|
[7021] | 27 | d['p_item'] = student['studycourse'].certificate.code |
---|
| 28 | d['amount'] = academic_session.clearance_fee |
---|
[6902] | 29 | elif category == 'schoolfee': |
---|
[7021] | 30 | d['surcharge_1'] = academic_session.surcharge_1 |
---|
| 31 | d['surcharge_2'] = academic_session.surcharge_2 |
---|
| 32 | d['amount'] = getSchoolFee(student, d['surcharge_1'] + d['surcharge_2']) |
---|
[6926] | 33 | code = student['studycourse'].certificate.code |
---|
[6902] | 34 | #session_string = academic_sessions_vocab.by_value[p_session + 1].title |
---|
[7021] | 35 | d['p_item'] = code |
---|
| 36 | d['p_session'] += 1 |
---|
| 37 | if d['amount'] == 0: |
---|
| 38 | d['error'] = u'Amount could not be determined.' |
---|
| 39 | return d |
---|
[6902] | 40 | |
---|
| 41 | def getSchoolFee(student, surcharge): |
---|
| 42 | study_mode = student['studycourse'].certificate.study_mode |
---|
[7021] | 43 | entry_mode = student['studycourse'].entry_mode |
---|
[6902] | 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 |
---|