Changeset 17057


Ignore:
Timestamp:
5 Aug 2022, 16:34:49 (2 years ago)
Author:
Henrik Bettermann
Message:

Restructure school fee calculation completely.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
6 edited

Legend:

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

    r16898 r17057  
    208208        self.certificate.study_mode = 'ug_pt'
    209209        self.student['studycourse'].entry_session = 2013
    210         self.student['studycourse'].certificate.school_fee_1 = 50200.0
     210        self.student['studycourse'].certificate.school_fee_3 = 50200.0
    211211        self.app['configuration']['2004'].union_fee = 1000.0
    212212        self.app['configuration']['2004'].welfare_fee = 500.0
     
    247247        self.certificate.study_mode = 'ug_ft'
    248248        self.student['studycourse'].entry_session = 2013
    249         self.student['studycourse'].certificate.school_fee_1 = 51750.0
     249        self.student['studycourse'].certificate.school_fee_3 = 51750.0
    250250        # Manager can access InterswitchForm
    251251        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
  • main/waeup.aaue/trunk/src/waeup/aaue/locales/en/LC_MESSAGES/waeup.kofa.po

    r16419 r17057  
    135135#: school_fee_1
    136136msgid "Initial School Fee"
    137 msgstr "School Fees New Students"
     137msgstr "Current School Fees"
    138138
    139139#: school_fee_2
    140140msgid "Returning School Fee"
    141 msgstr "School Fees Returning Students (> 2014)"
     141msgstr "School Fees 2015-2019"
    142142
    143143#: school_fee_3
    144144msgid "Foreigner Initial School Fee"
    145 msgstr "School Fees Returning Students"
     145msgstr "School Fees till 2015"
    146146
    147147#: school_fee_4
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r16967 r17057  
    179179        cpt_value = ctrl.options[0]
    180180        # School fee payment ticket can be added ...
    181         self.student['studycourse'].certificate.school_fee_1 = 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')
     
    233233        self.app['configuration'].addSessionConfiguration(configuration_1)
    234234        self.student['studycourse'].certificate.study_mode = 'ug_pt'
    235         self.student['studycourse'].certificate.school_fee_1 = 6666.0
     235        self.student['studycourse'].certificate.school_fee_2 = 6666.0
    236236        self.app['configuration']['2015'].union_fee = 1250.0
    237237        self.app['configuration']['2015'].welfare_fee = 750.0
     
    329329
    330330    def test_manage_payments_bypass_ac_creation(self):
    331         self.student['studycourse'].certificate.school_fee_1 = 6666.0
     331        self.student['studycourse'].certificate.school_fee_3 = 6666.0
    332332        self.student.nationality = u'NG'
    333333        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    563563
    564564    def test_payment_disabled(self):
     565        self.student['studycourse'].certificate.school_fee_3 = 6666.0
    565566        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    566567        self.browser.open(self.payments_path)
     
    648649        self.student['studycourse'].current_session = 2018
    649650        self.student['studycourse'].entry_mode = 'ug_ft'
    650         self.student['studycourse'].certificate.school_fee_1 = 50200.0
     651        self.student['studycourse'].certificate.school_fee_2 = 50200.0
    651652        self.app['configuration']['2018'].union_fee = 1200.0
    652653        self.app['configuration']['2018'].welfare_fee = 700.0
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_utils.py

    r15871 r17057  
    7474        self.assertEqual(payment.p_level, 100)
    7575        self.assertEqual(payment.p_session, 2004)
    76         self.assertEqual(payment.amount_auth, 26666.0)
     76        self.assertEqual(payment.amount_auth, 28888.0)
    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, 6765.0)
     86        self.assertEqual(payment.amount_auth, 8987.0)
    8787        IWorkflowState(self.student).setState('returning')
    8888        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     
    164164        self.assertEqual(payment.p_level, 100)
    165165        self.assertEqual(payment.p_session, 2004)
    166         self.assertEqual(payment.amount_auth, 6666.0)
     166        self.assertEqual(payment.amount_auth, 8888.0)
    167167        self.assertEqual(payment.p_item, u'CERT1')
    168168        self.assertEqual(error, None)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r16936 r17057  
    400400                    return _("You are not allowed "
    401401                             "to pay by instalments."), None
     402            # We determine the base amount first
     403            if student.entry_session < 2015:
     404                amount = getattr(certificate, 'school_fee_3', 0.0)
     405            elif student.entry_session < 2020:
     406                amount = getattr(certificate, 'school_fee_2', 0.0)
     407            else:
     408                amount = getattr(certificate, 'school_fee_1', 0.0)
    402409            if previous_session:
    403410                # Students can pay for previous sessions in all
    404411                # workflow states.  Fresh students are excluded by the
    405412                # update method of the PreviousPaymentAddFormPage.
    406                 if previous_level == 100:
    407                     amount = getattr(certificate, 'school_fee_1', 0.0)
    408                 else:
    409                     if student.entry_session in (2015, 2016):
    410                         amount = getattr(certificate, 'school_fee_2', 0.0)
    411                     else:
    412                         amount = getattr(certificate, 'school_fee_3', 0.0)
    413             elif student.state == CLEARED and category != 'schoolfee_2':
    414                 amount = getattr(certificate, 'school_fee_1', 0.0)
     413                pass
     414            elif student.state == CLEARED:
    415415                # Cut school fee by 50%
    416                 if category == 'schoolfee_1' and amount:
    417                     amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
    418             elif student.is_fresh and category == 'schoolfee_2':
    419                 amount = getattr(certificate, 'school_fee_1', 0.0)
    420                 # Cut school fee by 50%
    421                 if amount:
     416                if category in ('schoolfee_1', 'schoolfee_2') and amount:
    422417                    amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
    423418            elif student.state == RETURNING and category != 'schoolfee_2':
     
    433428                except KeyError:
    434429                    return _(u'Session configuration object is not available.'), None
    435                 if student.entry_session >= 2015:
    436                     amount = getattr(certificate, 'school_fee_2', 0.0)
    437                 else:
    438                     amount = getattr(certificate, 'school_fee_3', 0.0)
    439430                # Cut school fee by 50%
    440431                if category == 'schoolfee_1' and amount:
    441432                    amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
    442             elif category == 'schoolfee_2':
    443                 amount = getattr(certificate, 'school_fee_2', 0.0)
    444                 # Cut school fee by 50%
    445                 if amount:
    446                     amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
     433            elif category == 'schoolfee_2' and amount:
     434                amount = gateway_net_amt(amount) / 2 + GATEWAY_AMT
    447435            else:
    448436                return _('Wrong state.'), None
Note: See TracChangeset for help on using the changeset viewer.