Changeset 17431


Ignore:
Timestamp:
16 Jun 2023, 11:43:53 (17 months ago)
Author:
Henrik Bettermann
Message:

Rewrite payment configuration.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py

    r17083 r17431  
    7171        self.browser.getControl("Save").click()
    7272
    73     def test_interswitch_form_regular(self):
     73    def deactivated_test_interswitch_form_regular(self):
    7474        self.browser.getControl("Add online").click()
    7575        self.assertTrue('ticket created' in self.browser.contents)
     
    101101            in self.browser.contents)
    102102
    103     def test_interswitch_form_pg(self):
     103    def deactivated_test_interswitch_form_pg(self):
    104104        self.applicant.applicant_id = u'pg_anything'
    105105        self.browser.getControl("Add online").click()
     
    135135            in self.browser.contents)
    136136
    137     def test_interswitch_form_utme(self):
     137    def deactivated_test_interswitch_form_utme(self):
    138138        self.applicant.applicant_id = u'utme_anything'
    139139        self.browser.getControl("Add online").click()
     
    166166            in self.browser.contents)
    167167
    168     def test_interswitch_form_bridge(self):
     168    def deactivated_test_interswitch_form_bridge(self):
    169169        self.applicant.applicant_id = u'bridge_xyz'
    170170        self.browser.getControl("Add online").click()
     
    205205        self.app['configuration']['2004'].interswitch_enabled = True
    206206
    207     def test_interswitch_form_pt_school_fees(self):
     207    def disabled_test_interswitch_form_pt_school_fees(self):
    208208        self.certificate.study_mode = 'ug_pt'
    209209        self.student['studycourse'].entry_session = 2013
     
    232232        self.student['payments']['xyz'] = acc_payment
    233233        self.browser.getLink("Pay via Interswitch", index=0).click()
    234         self.assertTrue('<input type="hidden" name="pay_item_id" value="105" />'
    235                         in self.browser.contents)
    236234        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
    237235        self.assertEqual(self.student.current_mode, 'ug_pt')
     
    246244    def test_interswitch_form_regular_school_fees(self):
    247245        self.certificate.study_mode = 'ug_ft'
    248         self.student['studycourse'].entry_session = 2013
    249         self.student['studycourse'].certificate.school_fee_3 = 51750.0
     246        #self.student['studycourse'].entry_session = 2013
     247        #self.student['studycourse'].certificate.school_fee_3 = 51750.0
    250248        # Manager can access InterswitchForm
    251249        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    260258        self.assertTrue('Amount Authorized' in
    261259                           self.browser.contents)
    262         self.assertTrue('<span>51750.0</span>' in self.browser.contents)
    263         self.payment_url = self.browser.url
    264         self.browser.getLink("Pay via Interswitch", index=0).click()
    265         self.assertTrue(
    266             'Please pay acceptance fee first' in self.browser.contents)
    267         acc_payment = createObject('waeup.StudentOnlinePayment')
    268         acc_payment.p_state = 'paid'
    269         acc_payment.p_category = 'clearance'
    270         self.student['payments']['xyz'] = acc_payment
    271         self.browser.getLink("Pay via Interswitch", index=0).click()
    272         self.assertTrue('<input type="hidden" name="pay_item_id" value="107" />'
    273                         in self.browser.contents)
     260        self.assertTrue('<span>239500.0</span>' in self.browser.contents)
     261        self.payment_url = self.browser.url
     262        self.browser.getLink("Pay via Interswitch", index=0).click()
     263        #self.assertTrue(
     264        #    'Please pay acceptance fee first' in self.browser.contents)
     265        #acc_payment = createObject('waeup.StudentOnlinePayment')
     266        #acc_payment.p_state = 'paid'
     267        #acc_payment.p_category = 'clearance'
     268        #self.student['payments']['xyz'] = acc_payment
     269        #self.browser.getLink("Pay via Interswitch", index=0).click()
    274270        self.assertTrue('Total Amount Authorized:'
    275271                        in self.browser.contents)
    276272        self.assertEqual(self.student.current_mode, 'ug_ft')
    277273        self.assertTrue(
    278             '<input type="hidden" name="amount" value="5175000" />'
    279             in self.browser.contents)
    280         self.assertTrue(
    281             'item_name="School Fee Plus" item_amt="4755000" bank_id="117" '
    282             'acct_num="1010827641"' in self.browser.contents)
    283 
    284     def test_interswitch_form_pt_acceptance_fees(self):
     274            '<input type="hidden" name="amount" value="24220000" />'
     275            in self.browser.contents)
     276        self.assertTrue(
     277            'item_name="Faculty Fee (tuition)" item_amt="18400000" bank_id="7" '
     278            'acct_num="1022438743"' in self.browser.contents)
     279
     280        self.student['studycourse'].entry_session = 2015
     281        self.browser.open(self.payments_path + '/addop')
     282        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
     283        self.browser.getControl("Create ticket").click()
     284        self.assertTrue('ticket created' in
     285                           self.browser.contents)
     286        self.assertTrue('<span>92000.0</span>' in self.browser.contents)
     287        self.payment_url = self.browser.url
     288        self.browser.getLink("Pay via Interswitch", index=0).click()
     289        self.assertTrue(
     290            '<input type="hidden" name="amount" value="9220000" />'
     291            in self.browser.contents)
     292        self.assertTrue(
     293            'item_name="School Fee (2nd instalment)" item_amt="9200000" bank_id="7" acct_num="1022438743"' in self.browser.contents)
     294
     295        self.browser.open(self.payments_path + '/addop')
     296        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     297        self.browser.getControl("Create ticket").click()
     298        self.assertTrue('ticket created' in
     299                           self.browser.contents)
     300        self.assertTrue('<span>147500.0</span>' in self.browser.contents)
     301        self.payment_url = self.browser.url
     302        self.browser.getLink("Pay via Interswitch", index=0).click()
     303        self.assertTrue(
     304            '<input type="hidden" name="amount" value="15020000" />'
     305            in self.browser.contents)
     306        self.assertTrue(
     307            'item_name="Faculty Fee (lmsplus)" item_amt="2000000" bank_id="7" acct_num="1022438743"' in self.browser.contents)
     308        self.assertTrue(
     309            'item_name="Faculty Fee (tuition)" item_amt="9200000" bank_id="7" acct_num="1022438743"' in self.browser.contents)
     310
     311        self.browser.open(self.payments_path + '/addop')
     312        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
     313        self.browser.getControl("Create ticket").click()
     314        self.assertTrue('ticket created' in
     315                           self.browser.contents)
     316        self.assertTrue('<span>92000.0</span>' in self.browser.contents)
     317        self.payment_url = self.browser.url
     318        self.browser.getLink("Pay via Interswitch", index=0).click()
     319        self.assertTrue(
     320            '<input type="hidden" name="amount" value="9220000" />'
     321            in self.browser.contents)
     322        self.assertTrue(
     323            'item_name="School Fee (2nd instalment)" item_amt="9200000" bank_id="7" acct_num="1022438743"' in self.browser.contents)
     324
     325    def disabled_test_interswitch_form_pt_acceptance_fees(self):
    285326        self.certificate.study_mode = 'ug_pt'
    286327        self.app['configuration']['2004'].clearance_fee_ug_pt = 40200.0
     
    301342        self.payment_url = self.browser.url
    302343        self.browser.getLink("Pay via Interswitch", index=0).click()
    303         self.assertTrue('<input type="hidden" name="pay_item_id" value="104" />' in
    304                            self.browser.contents)
    305344        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
    306345        self.assertTrue(
     
    314353    def test_interswitch_form_regular_acceptance_fees(self):
    315354        self.certificate.study_mode = 'ug_ft'
    316         self.app['configuration']['2004'].clearance_fee = 43050.0
     355        #self.app['configuration']['2004'].clearance_fee = 43050.0
    317356        # Manager can access InterswitchForm
    318357        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    325364        self.assertTrue('ticket created' in self.browser.contents)
    326365        self.assertTrue('Amount Authorized' in self.browser.contents)
    327         self.assertTrue('<span>43050.0</span>' in self.browser.contents)
    328         self.payment_url = self.browser.url
    329         self.browser.getLink("Pay via Interswitch", index=0).click()
    330         self.assertTrue('<input type="hidden" name="pay_item_id" value="102" />'
    331                         in self.browser.contents)
    332         self.assertTrue('Total Amount Authorized:' in self.browser.contents)
    333         self.assertTrue(
    334             '<input type="hidden" name="amount" value="4305000" />'
    335             in self.browser.contents)
    336         self.assertTrue(
    337             'item_name="Acceptance Fee Plus" item_amt="4135000" bank_id="117" '
    338             'acct_num="1010835352"' in self.browser.contents)
    339 
    340     def test_interswitch_form_concessional_fees(self):
     366        self.assertTrue('<span>16800.0</span>' in self.browser.contents)
     367        self.browser.getLink("Pay via Interswitch", index=0).click()
     368        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
     369        self.assertTrue(
     370            '<input type="hidden" name="amount" value="1850000" />'
     371            in self.browser.contents)
     372        self.assertTrue(self.student['payments'].values()[0].net_amt == 16800)
     373        self.assertTrue(
     374            'item_name="Acceptance Fee (acceptance)" item_amt="1400000" bank_id="8" '
     375            'acct_num="2000249757"' in self.browser.contents)
     376
     377        self.certificate.study_mode = 'bridge'
     378        self.browser.open(self.payments_path + '/addop')
     379        self.browser.getControl(name="form.p_category").value = ['clearance']
     380        self.browser.getControl("Create ticket").click()
     381        self.assertTrue('ticket created' in self.browser.contents)
     382        self.assertTrue('Amount Authorized' in self.browser.contents)
     383        self.assertTrue('<span>14000.0</span>' in self.browser.contents)
     384        self.browser.getLink("Pay via Interswitch", index=0).click()
     385        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
     386        self.assertTrue(
     387            '<input type="hidden" name="amount" value="1570000" />'
     388            in self.browser.contents)
     389        self.assertTrue(self.student['payments'].values()[1].net_amt == 14000)
     390        self.assertTrue(
     391            'item_name="Acceptance Fee" item_amt="1400000" bank_id="8" '
     392            'acct_num="2000249757"' in self.browser.contents)
     393
     394    def deactivated_test_interswitch_form_concessional_fees(self):
    341395        self.certificate.study_mode = 'ug_ft'
    342396        self.app['configuration']['2004'].concessional_fee = 1567.0
     
    356410        self.certificate.study_mode = 'ug_ft'
    357411        self.browser.getLink("Pay via Interswitch", index=0).click()
    358         self.assertTrue('<input type="hidden" name="pay_item_id" value="107" />'
    359                            in self.browser.contents)
    360412        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
    361413        self.assertTrue(
     
    367419            in self.browser.contents)
    368420
    369     def test_interswitch_form_ticket_expired(self):
     421    def deactivated_test_interswitch_form_ticket_expired(self):
    370422        self.certificate.study_mode = 'ug_pt'
    371423        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    380432        self.browser.open(self.payments_path + '/xyz')
    381433        self.browser.getLink("Pay via Interswitch", index=0).click()
    382         self.assertTrue('<input type="hidden" name="pay_item_id" value="104" />'
    383                         in self.browser.contents)
    384434        self.assertTrue('Total Amount Authorized:' in self.browser.contents)
    385435        self.assertEqual(self.student.current_mode, 'ug_pt')
  • main/waeup.aaue/trunk/src/waeup/aaue/locales/en/LC_MESSAGES/waeup.kofa.po

    r17425 r17431  
    127127#: school_fee_1
    128128msgid "Initial School Fee"
    129 msgstr "Current School Fees"
     129msgstr "School Fees 1 (not used)"
    130130
    131131#: school_fee_2
    132132msgid "Returning School Fee"
    133 msgstr "School Fees 2015-2020"
     133msgstr "School Fees 2 (not used)"
    134134
    135135#: school_fee_3
    136136msgid "Foreigner Initial School Fee"
    137 msgstr "School Fees till 2015"
     137msgstr "School Fees 3 (not used)"
    138138
    139139#: school_fee_4
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r17430 r17431  
    9090    ICustomStudentBase,
    9191    ICustomStudentStudyCourse)
    92 from waeup.aaue.interswitch.browser import gateway_net_amt
    9392from waeup.aaue.interfaces import MessageFactory as _
    9493
     
    340339        if self.context.p_category in ('schoolfee_incl', 'schoolfee_1') \
    341340            and academic_session:
    342             #welfare_fee = gateway_net_amt(academic_session.welfare_fee)
    343             #union_fee = gateway_net_amt(academic_session.union_fee)
    344341            if self.context.student.entry_session == 2016 \
    345342                and self.context.student.entry_mode == 'ug_ft' \
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r17057 r17431  
    179179        cpt_value = ctrl.options[0]
    180180        # School fee payment ticket can be added ...
    181         self.student['studycourse'].certificate.school_fee_3 = 6666.0
     181        #self.student['studycourse'].certificate.school_fee_3 = 6666.0
    182182        self.student.nationality = u'NG'
    183183        self.browser.open(self.payments_path + '/addop')
     
    222222                           self.browser.contents)
    223223        self.browser.open(self.payments_path + '/addop')
    224         self.browser.getControl(name="form.p_category").value = ['late_registration']
    225         self.browser.getControl("Create ticket").click()
    226         self.assertMatches('...ticket created...',
    227                            self.browser.contents)
     224        #self.browser.getControl(name="form.p_category").value = ['late_registration']
     225        #self.browser.getControl("Create ticket").click()
     226        #self.assertMatches('...ticket created...',
     227        #                   self.browser.contents)
    228228        return
    229229
     
    233233        self.app['configuration'].addSessionConfiguration(configuration_1)
    234234        self.student['studycourse'].certificate.study_mode = 'ug_pt'
    235         self.student['studycourse'].certificate.school_fee_2 = 6666.0
    236         self.app['configuration']['2015'].union_fee = 1250.0
    237         self.app['configuration']['2015'].welfare_fee = 750.0
     235        #self.student['studycourse'].certificate.school_fee_2 = 6666.0
     236        #self.app['configuration']['2015'].union_fee = 1250.0
     237        #self.app['configuration']['2015'].welfare_fee = 750.0
    238238        self.student.nationality = u'NG'
    239239        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    282282        self.assertEqual(self.student['payments'].values()[0].p_category, 'schoolfee_1')
    283283        self.assertEqual(self.student['payments'].values()[1].p_category, 'schoolfee_2')
    284         # (6666-200)/2 + 1250 + 750 - 400 + 200
    285         self.assertEqual(self.student['payments'].values()[0].amount_auth, 5033.0)
    286         # (6666-200)/2 + 200
    287         self.assertEqual(self.student['payments'].values()[1].amount_auth, 3433.0)
     284        self.assertEqual(self.student['payments'].values()[0].amount_auth, 147500.0)
     285        self.assertEqual(self.student['payments'].values()[1].amount_auth, 92000.0)
    288286        # The  two payments belong to the same session and level.
    289287        self.assertEqual(self.student['payments'].values()[0].p_session, 2015)
     
    296294        configuration_2.academic_session = 2016
    297295        self.app['configuration'].addSessionConfiguration(configuration_2)
    298         self.student['studycourse'].certificate.school_fee_2 = 5666.0
    299         self.app['configuration']['2016'].union_fee = 1250.0
    300         self.app['configuration']['2016'].welfare_fee = 750.0
     296        #self.student['studycourse'].certificate.school_fee_2 = 5666.0
     297        #self.app['configuration']['2016'].union_fee = 1250.0
     298        #self.app['configuration']['2016'].welfare_fee = 750.0
    301299        self.student.father_name = u'Albert'
    302300        IWorkflowState(self.student).setState('returning')
     
    317315        self.browser.getControl("Create ticket").click()
    318316        self.assertTrue('ticket created' in self.browser.contents)
    319         # (5666-200)/2 + 1250 + 750 - 400 + 200
    320         self.assertEqual(self.student['payments'].values()[2].amount_auth, 4533.0)
    321         # (5666-200)/2 + 200
    322         self.assertEqual(self.student['payments'].values()[3].amount_auth, 2933.0)
     317        self.assertEqual(self.student['payments'].values()[2].amount_auth, 147500.0)
     318        self.assertEqual(self.student['payments'].values()[3].amount_auth, 92000.0)
    323319        # The last two payments belong to the same session and level.
    324320        self.assertEqual(self.student['payments'].values()[2].p_session, 2016)
     
    329325
    330326    def test_manage_payments_bypass_ac_creation(self):
    331         self.student['studycourse'].certificate.school_fee_3 = 6666.0
     327        #self.student['studycourse'].certificate.school_fee_3 = 6666.0
    332328        self.student.nationality = u'NG'
    333329        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    365361        logcontent = open(logfile).read()
    366362        self.assertTrue(
    367             '"zope.mgr",E1000000,%s,schoolfee_incl,6666.0,AP,,,,,,\n' % value
     363            '"zope.mgr",E1000000,%s,schoolfee_incl,239500.0,AP,,,,,,\n' % value
    368364            in logcontent)
    369365        # Student is in state school fee paid, no activation
     
    563559
    564560    def test_payment_disabled(self):
    565         self.student['studycourse'].certificate.school_fee_3 = 6666.0
     561        #self.student['studycourse'].certificate.school_fee_3 = 6666.0
    566562        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    567563        self.browser.open(self.payments_path)
     
    621617        self.student['accommodation'].addBedTicket(bedticket)
    622618
    623     def test_maintenance_fee_payment(self):
     619    def deactivated_test_maintenance_fee_payment(self):
    624620        self.certificate.study_mode = 'ug_ft'
    625621        self.student['studycourse'].entry_session = 2013
     
    649645        self.student['studycourse'].current_session = 2018
    650646        self.student['studycourse'].entry_mode = 'ug_ft'
    651         self.student['studycourse'].certificate.school_fee_2 = 50200.0
     647        #self.student['studycourse'].certificate.school_fee_2 = 50200.0
    652648        self.app['configuration']['2018'].union_fee = 1200.0
    653649        self.app['configuration']['2018'].welfare_fee = 700.0
     
    672668        self.browser.getLink(value).click()
    673669        self.assertTrue('Amount Authorized' in self.browser.contents)
    674         # 50200 + 1200 + 700 + 300 + 300- 800 = 51900
    675         self.assertEqual(self.student['payments'][value].amount_auth, 51900.0)
     670        self.assertEqual(self.student['payments'][value].amount_auth, 239500.0)
    676671        self.student['payments'][value].r_company = u'interswitch'
    677672        self.browser.getLink("Download").click()
     
    692687        return
    693688
    694     def test_late_registration(self):
     689    def deactivated_test_late_registration(self):
    695690        delta = timedelta(days=10)
    696691        self.app['configuration'][
     
    982977            in self.browser.contents)
    983978        # 2nd instalment has to be paid first
    984         self.certificate.school_fee_3 = 678.0
     979        #self.certificate.school_fee_3 = 678.0
    985980        self.browser.open(self.payments_path + '/addop')
    986981        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
     
    993988        return
    994989
    995     def test_student_GST_registration(self):
     990    def deactivated_test_student_GST_registration(self):
    996991        configuration_1 = createObject('waeup.SessionConfiguration')
    997992        configuration_1.academic_session = 2016
     
    10871082        return
    10881083
    1089     def test_course_registration_forbidden_2(self):
     1084    def deactivated_test_course_registration_forbidden_2(self):
    10901085        IWorkflowState(self.student).setState('school fee paid')
    10911086        self.student['studycourse'].entry_session = 2004
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_utils.py

    r17057 r17431  
    5252        self.app['configuration']['2004'].booking_fee = 150.0
    5353        self.app['configuration']['2004'].maint_fee = 180.0
    54         self.app['configuration']['2004'].clearance_fee_pg = 1234.0
    55         self.app['configuration']['2004'].clearance_fee_fp = 3456.0
    56         self.student['studycourse'].certificate.school_fee_1 = 6666.0
    57         self.student['studycourse'].certificate.school_fee_2 = 7777.0
    58         self.student['studycourse'].certificate.school_fee_3 = 8888.0
     54        #self.app['configuration']['2004'].clearance_fee_pg = 1234.0
     55        #self.app['configuration']['2004'].clearance_fee_fp = 3456.0
     56        #self.student['studycourse'].certificate.school_fee_1 = 6666.0
     57        #self.student['studycourse'].certificate.school_fee_2 = 7777.0
     58        #self.student['studycourse'].certificate.school_fee_3 = 8888.0
    5959        self.student['studycourse'].certificate.study_mode = 'special_pg_ft'
    6060        self.student.nationality = u'NG'
     
    7474        self.assertEqual(payment.p_level, 100)
    7575        self.assertEqual(payment.p_session, 2004)
    76         self.assertEqual(payment.amount_auth, 28888.0)
     76        self.assertEqual(payment.amount_auth, 204000.0) # tuition plus penalty
    7777        self.assertEqual(payment.p_item, u'CERT1')
    7878        self.assertEqual(error, None)
     
    8484        self.student.lga = 'edo_afuze'
    8585        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    86         self.assertEqual(payment.amount_auth, 8987.0)
     86        self.assertEqual(payment.amount_auth, 184099.0)
    8787        IWorkflowState(self.student).setState('returning')
    8888        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     
    9494        self.assertEqual(payment.p_level, 200)
    9595        self.assertEqual(payment.p_session, 2005)
    96         self.assertEqual(payment.amount_auth, 8976.0)
    97         self.assertEqual(payment.p_item, u'CERT1')
    98         self.assertEqual(error, None)
    99 
    100         configuration = createObject('waeup.SessionConfiguration')
    101         configuration.academic_session = 2016
    102         self.app['configuration'].addSessionConfiguration(configuration)
    103         configuration = createObject('waeup.SessionConfiguration')
    104         configuration.academic_session = 2017
    105         self.app['configuration'].addSessionConfiguration(configuration)
    106         configuration = createObject('waeup.SessionConfiguration')
    107         configuration.academic_session = 2018
    108         self.app['configuration'].addSessionConfiguration(configuration)
    109         self.student['studycourse'].current_session = 2017
    110         self.student['studycourse'].entry_session = 2015
    111         error, payment = utils.setPaymentDetails('schoolfee',self.student)
    112         self.assertEqual(payment.p_level, 200)
    113         self.assertEqual(payment.p_session, 2018)
    114         self.assertEqual(payment.amount_auth, 7777.0)
    115         self.assertEqual(payment.p_item, u'CERT1')
    116         self.assertEqual(error, None)
    117         self.student['studycourse'].entry_session = 2014
    118         error, payment = utils.setPaymentDetails('schoolfee',self.student)
    119         self.assertEqual(payment.p_level, 200)
    120         self.assertEqual(payment.p_session, 2018)
    121         self.assertEqual(payment.amount_auth, 8888.0)
     96        self.assertEqual(payment.amount_auth, 184088.0)
    12297        self.assertEqual(payment.p_item, u'CERT1')
    12398        self.assertEqual(error, None)
     
    133108        self.assertEqual(payment.p_level, 100)
    134109        self.assertEqual(payment.p_session, 2004)
    135         self.assertEqual(payment.amount_auth, 1234.0)
    136         self.assertEqual(payment.p_item, u'CERT1')
    137         self.assertEqual(error, None)
    138 
    139         self.app['faculties']['fac1'].code = u'FP'
    140         error, payment = utils.setPaymentDetails('clearance',self.student)
    141         self.assertEqual(payment.p_level, 100)
    142         self.assertEqual(payment.p_session, 2004)
    143         self.assertEqual(payment.amount_auth, 3456.0)
    144         self.assertEqual(payment.p_item, u'CERT1')
    145         self.assertEqual(error, None)
    146 
    147         error, payment = utils.setPaymentDetails('restitution',self.student)
    148         self.assertEqual(error, 'Restitution fee payment not required.')
    149         self.student['studycourse'].certificate.study_mode = 'ug_ft'
    150         configuration = createObject('waeup.SessionConfiguration')
    151         self.app['configuration']['2016'].restitution_fee = 1111.0
    152         self.student['studycourse'].current_session = 2016
    153         error, payment = utils.setPaymentDetails('restitution',self.student)
    154         self.assertEqual(payment.p_level, 100)
    155         self.assertEqual(payment.p_session, 2016)
    156         self.assertEqual(payment.amount_auth, 1111.0)
    157         self.assertEqual(payment.p_item, u'')
     110        self.assertEqual(payment.amount_auth, 14000.0)
     111        self.assertEqual(payment.p_item, u'CERT1')
    158112        self.assertEqual(error, None)
    159113
     
    164118        self.assertEqual(payment.p_level, 100)
    165119        self.assertEqual(payment.p_session, 2004)
    166         self.assertEqual(payment.amount_auth, 8888.0)
     120        self.assertEqual(payment.amount_auth, 184099.0)
    167121        self.assertEqual(payment.p_item, u'CERT1')
    168122        self.assertEqual(error, None)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r17266 r17431  
    1717##
    1818import grok
     19import os
     20import csv
    1921from time import time
    2022from zope.component import createObject, queryUtility
     
    2628from waeup.kofa.accesscodes import create_accesscode
    2729from waeup.kofa.students.utils import trans
    28 from waeup.aaue.interswitch.browser import gateway_net_amt, GATEWAY_AMT
    2930from waeup.aaue.interfaces import MessageFactory as _
    3031
    3132MINIMUM_UNITS_THRESHOLD = 15
     33
     34schoolfees_path = os.path.join(
     35    os.path.dirname(__file__), 'schoolfees.csv')
     36reader = csv.DictReader(open(schoolfees_path, 'rb'))
     37SCHOOLFEES = {item['code']:(item['tuition'], item.values()) for item in reader}
     38acceptancefees_path = os.path.join(
     39    os.path.dirname(__file__), 'acceptancefees.csv')
     40reader = csv.DictReader(open(acceptancefees_path, 'rb'))
     41ACCEPTANCEFEES = {item['code']:(item['acceptance'], item.values()) for item in reader}
    3242
    3343class CustomStudentsUtils(NigeriaStudentsUtils):
     
    312322            p_item = acco_details['bt']
    313323            amount = academic_session.booking_fee
    314         elif category == 'restitution':
    315             if student.current_session != 2016 \
    316                 or student.current_mode not in ('ug_ft', 'dp_ft') \
    317                 or student.is_fresh:
    318                 return _(u'Restitution fee payment not required.'), None
    319             amount = academic_session.restitution_fee
    320324        elif category == 'hostel_maintenance':
    321325            amount = 0.0
     
    338342            if student.state not in (ADMITTED, CLEARANCE, REQUESTED, CLEARED):
    339343                return _(u'Acceptance Fee payments not allowed.'), None
     344            try:
     345                certificate = student['studycourse'].certificate
     346                p_item = certificate.code
     347            except (AttributeError, TypeError):
     348                return _('Study course data are incomplete.'), None
    340349            if student.current_mode in (
    341350                'ug_ft', 'ug_pt', 'de_ft', 'de_pt',
     
    343352                and category != 'clearance_incl':
    344353                    return _("Additional fees must be included."), None
    345             if student.current_mode == 'ijmbe':
    346                 amount = academic_session.clearance_fee_ijmbe
    347             elif student.current_mode == 'bridge':
    348                 amount = academic_session.clearance_fee_bridge
    349             elif student.current_mode == 'dp_ft':
    350                 amount = academic_session.clearance_fee_dp
    351             elif student.faccode == 'FP':
    352                 amount = academic_session.clearance_fee_fp
    353             elif student.current_mode in ('ug_pt', 'de_pt', 'ug_dsh', 'de_dsh'):
    354                 amount = academic_session.clearance_fee_ug_pt
    355             elif student.current_mode == 'special_pg_pt':
    356                 amount = academic_session.clearance_fee_pg_pt
    357             elif student.faccode == 'FCS':
    358                 # Students in clinical medical sciences pay the medical
    359                 # acceptance fee
    360                 amount = academic_session.clearance_fee_med
    361354            elif student.current_mode == 'special_pg_ft':
    362355                if category != 'clearance':
    363356                    return _("No additional fees required."), None
    364                 amount = academic_session.clearance_fee_pg
    365             else:
    366                 amount = academic_session.clearance_fee
    367             p_item = student['studycourse'].certificate.code
    368             if amount in (0.0, None):
    369                 return _(u'Amount could not be determined.'), None
    370             # Add Matric Gown Fee and Lapel Fee
     357            try:
     358                acceptancefees_entry = ACCEPTANCEFEES[student.certcode]
     359            except KeyError:
     360                return _('Acceptance fees not yet fixed.'), None
    371361            if category == 'clearance_incl':
    372                 amount += gateway_net_amt(academic_session.matric_gown_fee) + \
    373                     gateway_net_amt(academic_session.lapel_fee)
     362                for item in acceptancefees_entry[1]:
     363                    try:
     364                        amount += int(item)
     365                    except:
     366                        pass
     367            else:
     368                amount = float(acceptancefees_entry[0])
    374369        elif category == 'late_registration':
    375370            if student.is_postgrad:
     
    388383            except (AttributeError, TypeError):
    389384                return _('Study course data are incomplete.'), None
     385            try:
     386                schoolfees_entry = SCHOOLFEES[student.certcode]
     387            except KeyError:
     388                return _('School fees not yet fixed.'), None
    390389            if student.is_postgrad and category != 'schoolfee':
    391390                return _("No additional fees required."), None
     
    404403                    return _("You are not allowed "
    405404                             "to pay by instalments."), None
    406             # We determine the base amount first
    407             if student.entry_session < 2015:
    408                 amount = getattr(certificate, 'school_fee_3', 0.0)
    409             elif student.entry_session < 2021:
    410                 amount = getattr(certificate, 'school_fee_2', 0.0)
    411             else:
    412                 amount = getattr(certificate, 'school_fee_1', 0.0)
     405            additional = 0.0
     406            for item in schoolfees_entry[1]:
     407                try:
     408                    additional += int(item)
     409                except:
     410                    pass
     411            amount = float(schoolfees_entry[0])
     412            additional -= amount
    413413            if previous_session:
    414414                # Students can pay for previous sessions in all
     
    419419                # Cut school fee by 50%
    420420                if category in ('schoolfee_1', 'schoolfee_2') and amount:
    421                     amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
     421                    amount /= 2
    422422            elif student.state == RETURNING and category != 'schoolfee_2':
    423423                if not student.father_name:
     
    434434                # Cut school fee by 50%
    435435                if category == 'schoolfee_1' and amount:
    436                     amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
     436                    amount /= 2
    437437            elif category == 'schoolfee_2' and amount:
    438                 amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
     438                amount /= 2
    439439            else:
    440440                return _('Wrong state.'), None
    441441            if amount in (0.0, None):
    442442                return _(u'Amount could not be determined.'), None
    443             # Add Student Union Fee, Student Id Card Fee, Sports Dev. Fee,
    444             # Library Dev. Fee and Welfare Assurance
    445             if category in ('schoolfee_incl', 'schoolfee_1') \
    446                 and student.current_mode != 'ijmbe':
    447                 amount += gateway_net_amt(academic_session.welfare_fee) + \
    448                     gateway_net_amt(academic_session.union_fee)
    449                 if student.entry_session >= 2018 and student.is_fresh:
    450                     amount += gateway_net_amt(academic_session.sports_fee)
    451                     if student.is_postgrad:
    452                         amount += gateway_net_amt(academic_session.library_pg_fee)
    453                     else:
    454                         amount += gateway_net_amt(academic_session.library_fee)
    455                 if student.entry_session >= 2021 \
    456                     and student.current_mode == 'ug_ft':
    457                     amount += gateway_net_amt(academic_session.lms_sund_fee)
     443            # Add additional fees
     444            if category in ('schoolfee_incl', 'schoolfee_1'):
     445                amount += additional
    458446            # Add non-indigenous fee and session specific penalty fees
    459447            if student.is_postgrad:
     
    463451            else:
    464452                amount += academic_session.penalty_ug
    465         #elif category == ('fac_dep'):
    466         #    if student.faccode in ('FAT', 'FED', 'FLW', 'FMS', 'FSS'):
    467         #        amount = 4200.0
    468         #    elif student.faccode in ('FAG', 'FBM', 'FCS',
    469         #                             'FES', 'FET', 'FLS', 'FPS'):
    470         #        amount = 5200.0
    471         #    elif student.faccode == 'FAG' and student.current_level == 400:
    472         #        amount = 10200.0
    473         #    elif student.depcode == 'VTE':
    474         #        amount = 5200.0
    475         #    if student.entry_session >= 2019:
    476         #        amount += gateway_net_amt(academic_session.ict_fee)
    477         elif category == 'sports_library': # temporarily in 2020
    478             if student.is_postgrad:
    479                 amount = academic_session.sports_fee + gateway_net_amt(
    480                     academic_session.library_pg_fee)
    481             else:
    482                 amount = academic_session.sports_fee + gateway_net_amt(
    483                     academic_session.library_fee)
    484453        elif not student.is_postgrad:
    485454            fee_name = category + '_fee'
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r17099 r17431  
    9393        'clearance': 'Acceptance Fee without additional fees',
    9494        'clearance_incl': 'Acceptance Fee incl. additional fees',
    95         'hostel_maintenance': 'Hostel Accommodation Fee',
     95        ##'hostel_maintenance': 'Hostel Accommodation Fee',
    9696        #'application': 'Application Fee',
    9797        #'bed_allocation': 'Bed Allocation Fee',
    9898        #'transfer': 'Transfer Fee',
    99         'transcript_local': 'Local Transcript Fee',
    100         'transcript_inter': 'International Transcript Fee',
    101         'late_registration': 'Late Course Registration Fee',
     99        ##'transcript_local': 'Local Transcript Fee',
     100        ##'transcript_inter': 'International Transcript Fee',
     101        ##'late_registration': 'Late Course Registration Fee',
    102102        #'welfare': 'Student Welfare Assurance Fee',
    103103        #'union': 'Student Union Dues',
    104104        #'lapel': 'Lapel/File Fee',
    105105        #'matric_gown': 'Matriculation Gown Fee',
    106         'concessional': 'Concessional Fee',
     106        ##'concessional': 'Concessional Fee',
    107107        #'id_card': 'Student ID Card',
    108         'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
    109         'gst_text_book_1': 'Text Book Fee GST101 GST102',
    110         'gst_text_book_2': 'Text Book Fee GST111 GST112',
    111         'gst_text_book_3': 'Text Book Fee GST222',
    112         'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
    113         'gst_registration_2': 'Registration Fee GST222',
    114         'ent_text_book_1': 'Text Book Fee ENT201',
    115         'ent_text_book_2': 'Text Book Fee ENT211',
    116         'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
    117         'ent_registration_1': 'Registration Fee ENT201',
    118         'ent_registration_2': 'Registration Fee ENT211',
    119         'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
    120         'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
    121         #'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
    122         'ict': 'ICT/Affidavit Dues',
    123         #'affidavit': 'Affidavit Dues',
    124         'restitution': 'Restitution Fee',
    125         'sports': 'Sports Fee',
    126         'library': 'UG Library Fee',
    127         'library_pg': 'PG Library Fee',
    128         'sports_library': 'Sports Development and Library Fee',
    129         'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
    130         'lab_2': 'Laboratory Due (BIO101/BIO111)',
    131         'lms_sund': 'LMS plus Sundry Fees (new UG students only)',
    132         'access_card': 'AAU Access Card Fee',
     108        ##'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
     109        ##'gst_text_book_1': 'Text Book Fee GST101 GST102',
     110        ##'gst_text_book_2': 'Text Book Fee GST111 GST112',
     111        ##'gst_text_book_3': 'Text Book Fee GST222',
     112        ##'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
     113        ##'gst_registration_2': 'Registration Fee GST222',
     114        ##'ent_text_book_1': 'Text Book Fee ENT201',
     115        ##'ent_text_book_2': 'Text Book Fee ENT211',
     116        ##'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
     117        ##'ent_registration_1': 'Registration Fee ENT201',
     118        ##'ent_registration_2': 'Registration Fee ENT211',
     119        ##'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
     120        ##'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
     121        ##'fac_dep': 'Faculty and Departmental Dues (incl. ICT/Affidavit Dues)',
     122        ##'ict': 'ICT/Affidavit Dues',
     123        ##'affidavit': 'Affidavit Dues',
     124        ##'restitution': 'Restitution Fee',
     125        ##'sports': 'Sports Fee',
     126        ##'library': 'UG Library Fee',
     127        ##'library_pg': 'PG Library Fee',
     128        ##'sports_library': 'Sports Development and Library Fee',
     129        ##'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
     130        ##'lab_2': 'Laboratory Due (BIO101/BIO111)',
     131        ##'lms_sund': 'LMS plus Sundry Fees (new UG students only)',
     132        ##'access_card': 'AAU Access Card Fee',
    133133        }
    134134
     
    141141        'clearance': 'Acceptance Fee',
    142142        'schoolfee': 'School Fee',
    143         'late_registration': 'Late Course Registration Fee',
    144         'sports': 'Sports Fee',
    145         'library': 'UG Library Fee',
    146         'library_pg': 'PG Library Fee',
    147         'sports_library': 'Sports Development and Library Fee',
     143        ##'late_registration': 'Late Course Registration Fee',
     144        ##'sports': 'Sports Fee',
     145        ##'library': 'UG Library Fee',
     146        ##'library_pg': 'PG Library Fee',
     147        ##'sports_library': 'Sports Development and Library Fee',
    148148        }
    149149
     
    153153        'schoolfee_1': 'School Fee (1st instalment)',
    154154        'schoolfee_2': 'School Fee (2nd instalment)',
    155         'sports': 'Sports Fee',
    156         'library': 'UG Library Fee',
    157         'library_pg': 'PG Library Fee',
    158         'sports_library': 'Sports Development and Library Fee',
    159         'exam': 'IJMBE Examination Fee',
     155        ##'sports': 'Sports Fee',
     156        ##'library': 'UG Library Fee',
     157        ##'library_pg': 'PG Library Fee',
     158        ##'sports_library': 'Sports Development and Library Fee',
     159        ##'exam': 'IJMBE Examination Fee',
    160160        }
    161161
     
    163163        'clearance_incl': 'Acceptance Fee Plus',
    164164        'schoolfee_incl': 'School Fee Plus',
    165         'ent_text_book_1': 'Text Book Fee ENT201',
    166         'ent_text_book_2': 'Text Book Fee ENT211',
    167         'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
    168         'ent_registration_1': 'Registration Fee ENT201',
    169         'ent_registration_2': 'Registration Fee ENT211',
    170         'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
    171         'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
    172         'gst_registration_2': 'Registration Fee GST222',
    173         'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
    174         'gst_text_book_1': 'Text Book Fee GST101 GST102',
    175         'gst_text_book_2': 'Text Book Fee GST111 GST112',
    176         'gst_text_book_3': 'Text Book Fee GST222',
    177         'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
    178         'late_registration': 'Late Course Registration Fee',
    179         'sports': 'Sports Fee',
    180         'library': 'UG Library Fee',
    181         'library_pg': 'PG Library Fee',
    182         'sports_library': 'Sports Development and Library Fee',
    183         'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
    184         'lab_2': 'Laboratory Due (BIO101/BIO111)',
     165        ##'ent_text_book_1': 'Text Book Fee ENT201',
     166        ##'ent_text_book_2': 'Text Book Fee ENT211',
     167        ##'ent_text_book_0': 'Text Book Fee for ENT201 and ENT211',
     168        ##'ent_registration_1': 'Registration Fee ENT201',
     169        ##'ent_registration_2': 'Registration Fee ENT211',
     170        ##'ent_registration_0': 'Registration Fee for ENT201 and ENT211',
     171        ##'gst_registration_1': 'Registration Fee GST101 GST102 GST111 GST112',
     172        ##'gst_registration_2': 'Registration Fee GST222',
     173        ##'gst_text_book_0': 'Text Book Fee GST101 GST102 GST111 GST112',
     174        ##'gst_text_book_1': 'Text Book Fee GST101 GST102',
     175        ##'gst_text_book_2': 'Text Book Fee GST111 GST112',
     176        ##'gst_text_book_3': 'Text Book Fee GST222',
     177        ##'ent_combined': 'Registration and Textbook Fee for ENT201 and ENT211',
     178        ##'late_registration': 'Late Course Registration Fee',
     179        ##'sports': 'Sports Fee',
     180        ##'library': 'UG Library Fee',
     181        ##'library_pg': 'PG Library Fee',
     182        ##'sports_library': 'Sports Development and Library Fee',
     183        ##'lab_1': 'Faculty Laboratory Due (CHM102/PHY103/CSC101)',
     184        ##'lab_2': 'Laboratory Due (BIO101/BIO111)',
    185185        }
    186186
     
    208208        }
    209209
    210     BALANCE_PAYMENT_CATEGORIES = {
     210    BALANCE_PAYMENT_CATEGORIES = {}
     211
     212    XXXBALANCE_PAYMENT_CATEGORIES = {
    211213        'schoolfee': 'School Fee',
    212214        'clearance': 'Acceptance Fee',
Note: See TracChangeset for help on using the changeset viewer.