source: main/waeup.custom/trunk/src/waeup/custom/students/utils.py @ 6923

Last change on this file since 6923 was 6902, checked in by Henrik Bettermann, 13 years ago

Add customization of OnlinePaymentAddFormPage?. Works perfectly with UI but not in tests. test_manage_payments in w.c.students.tests ignores the customization of OnlinePaymentAddFormPage? and thus fails.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1from waeup.sirp.students.vocabularies import academic_sessions_vocab
2
3def getPaymentDetails(category, student):
4    p_session = student['studycourse'].current_session
5    surcharge_1 = surcharge_2 = surcharge_3 = 0
6    p_item = u''
7    if category == 'transfer':
8        amount = 500
9    elif category == 'gown':
10        amount = 500
11    elif category == 'hostel_maintenance':
12        amount = 300
13    elif category == 'schoolfee':
14        surcharge_1 = 1500 # BT amount
15        surcharge_2 = 300 # Interswitch amount
16        try:
17            amount = getSchoolFee(student, surcharge_1 + surcharge_2)
18            code = student['studycourse'].certificate.code
19        except AttributeError:
20            return 0, None, None, 0, 0, 0
21        #session_string = academic_sessions_vocab.by_value[p_session + 1].title
22        p_item = code
23        p_session += 1
24    return amount, p_item, p_session, surcharge_1, surcharge_2, surcharge_3
25
26def getSchoolFee(student, surcharge):
27    study_mode = student['studycourse'].certificate.study_mode
28    entry_mode = student.entry_mode
29    state = student.state
30    #lga = student.lga
31    lga = 'nothing'
32    current_level = student['studycourse'].current_level
33    CLEARED = 'cleared'
34
35    if study_mode.endswith('_ft'):
36        # fresh remedial
37        if current_level == 0 and state == CLEARED:
38            if entry_mode == 'rmd_ft':
39                return 80200 - surcharge
40            else:
41                return 74200 - surcharge
42        # fresh
43        elif state == CLEARED:
44            if study_mode == 'jm_ft':
45                return 72700 - surcharge
46            elif lga == 'foreigner':
47                return 131500 - surcharge
48            else:
49                return 41500 - surcharge
50        # returning
51        elif state == 'returning':
52            if study_mode == 'jm_ft':
53                return 32500 - surcharge
54            elif lga == 'foreigner':
55                return 109500 - surcharge
56            else:
57                return 19500 - surcharge
58        else:
59            return 0
60    else:
61        return 0
Note: See TracBrowser for help on using the repository browser.