Ignore:
Timestamp:
30 Nov 2015, 14:56:37 (9 years ago)
Author:
Henrik Bettermann
Message:

Implement school fee payments by instalment.

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

Legend:

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

    r13438 r13512  
    218218            xmldict['joint_venture_amt'] = 100 * joint_venture_amt
    219219            xmldict['aaue_share_amt'] = 100 * aaue_share_amt
    220             if self.context.p_category == 'schoolfee_incl':
     220            if self.context.p_category in ('schoolfee_incl', 'schoolfee_1'):
    221221                # Schoolfee including additional fees
    222222                xmldict['student_union_due_amt'] = 100 * student_union_due_amt
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r13489 r13512  
    144144            academic_session = None
    145145        text =  '\n\n The Amount Authorized is inclusive of: '
    146         if self.context.p_category == 'schoolfee_incl' and academic_session:
     146        if self.context.p_category in ('schoolfee_incl', 'schoolfee_1') \
     147            and academic_session:
    147148            welfare_fee = gateway_net_amt(academic_session.welfare_fee)
    148149            union_fee = gateway_net_amt(academic_session.union_fee)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/payments.py

    r13400 r13512  
    4949    def redeemTicket(self):
    5050        student = self.student
    51         if self.p_category.startswith('schoolfee'):
     51        if self.p_category in ('schoolfee', 'schoolfee_incl', 'schoolfee_1') :
    5252            # Bypass activation code creation if next session
    5353            # can be started directly.
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13489 r13512  
    178178        self.assertMatches('...ticket created...',
    179179                           self.browser.contents)
    180 
    181     def deactivated_test_for_instalment_payments(self):
     180        return
     181
     182    def test_for_instalment_payments(self):
     183        self.student['studycourse'].certificate.school_fee_1 = 6666.0
     184        self.app['configuration']['2004'].union_fee = 1250.0
     185        self.app['configuration']['2004'].welfare_fee = 750.0
     186        self.student.nationality = u'NG'
    182187        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    183         self.browser.open(self.payments_path)
    184188        self.browser.open(self.payments_path + '/addop')
    185189        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    186190        self.browser.getControl("Create ticket").click()
    187         self.assertMatches('...ticket created...',
    188                            self.browser.contents)
     191        self.assertTrue(
     192            'Wrong state. Only students in state \'cleared\' are allowed to pay by instalments'
     193            in self.browser.contents)
     194        IWorkflowState(self.student).setState('cleared')
     195        self.browser.open(self.payments_path + '/addop')
     196        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     197        self.browser.getControl("Create ticket").click()
     198        self.assertTrue('ticket created' in self.browser.contents)
    189199        # We can't add the 2nd instalment ticket because the
    190200        # first one has not yet been approved.
    191         self.browser.open(self.payments_path + '/addop')
    192         self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
    193         self.browser.getControl("Create ticket").click()
    194         self.assertMatches('...1st school fee instalment has not yet been paid...',
    195                            self.browser.contents)
     201        #self.browser.open(self.payments_path + '/addop')
     202        #self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
     203        #self.browser.getControl("Create ticket").click()
     204        #self.assertMatches('...1st school fee instalment has not yet been paid...',
     205        #                   self.browser.contents)
    196206        # Ok, then we approve the first instalment ...
    197207        self.browser.open(self.payments_path)
     
    203213        self.browser.getControl(name="form.p_category").value = ['schoolfee_2']
    204214        self.browser.getControl("Create ticket").click()
    205         self.assertMatches('...ticket created...',
    206                            self.browser.contents)
     215        self.assertTrue('ticket created' in self.browser.contents)
    207216        # ... approve the second instalment ...
    208217        ctrl = self.browser.getControl(name='val_id')
    209218        p_id = ctrl.options[1]
    210219        self.browser.open(self.payments_path + '/' + p_id + '/approve')
    211         # ... and finally add the 1st instalment for the next session
    212         # provided that student is returning.
    213         IWorkflowState(self.student).setState('returning')
    214         self.browser.open(self.payments_path + '/addop')
    215         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    216         self.browser.getControl("Create ticket").click()
    217         self.assertMatches('...Session configuration object is not...',
    218                            self.browser.contents)
    219         # Uups, we forgot to add a session configuration for next session
    220         configuration = createObject('waeup.SessionConfiguration')
    221         configuration.academic_session = 2005
    222         self.app['configuration'].addSessionConfiguration(configuration)
    223         self.app['configuration']['2005'].school_base = 7777.0
    224         self.browser.open(self.payments_path + '/addop')
    225         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
    226         self.browser.getControl("Create ticket").click()
    227         self.assertMatches('...ticket created...',
    228                            self.browser.contents)
    229         # If the session configuration doesn't exist an error message will
    230         # be shown. No other requirement is being checked.
    231         del self.app['configuration']['2004']
    232         self.browser.open(self.payments_path)
    233         self.browser.getLink("Add current session payment ticket").click()
    234         self.browser.getControl("Create ticket").click()
    235         self.assertMatches('...Session configuration object is not...',
    236                            self.browser.contents)
     220        self.assertEqual(self.student['payments'].values()[0].p_category, 'schoolfee_1')
     221        self.assertEqual(self.student['payments'].values()[1].p_category, 'schoolfee_2')
     222        # 6666/2 + 1250 + 750 - 500
     223        self.assertEqual(self.student['payments'].values()[0].amount_auth, 4833.0)
     224        # 6666/2
     225        self.assertEqual(self.student['payments'].values()[1].amount_auth, 3333.0)
     226        return
    237227
    238228    def test_manage_payments_bypass_ac_creation(self):
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r13506 r13512  
    178178            except (AttributeError, TypeError):
    179179                return _('Study course data are incomplete.'), None
    180             if student.state == CLEARED:
     180            if student.state == CLEARED or category == 'schoolfee_2':
    181181                if student.is_foreigner:
    182182                    amount = getattr(certificate, 'school_fee_3', 0.0)
    183183                else:
    184184                    amount = getattr(certificate, 'school_fee_1', 0.0)
     185                # Cut school fee by 50%
     186                if category in ('schoolfee_1', 'schoolfee_2'):
     187                    amount = amount / 2
     188            elif category == 'schoolfee_1':
     189                return _("Wrong state. Only students in state 'cleared' "
     190                         "are allowed to pay by instalments."), None
    185191            elif student.state == RETURNING:
    186192                if not student.father_name:
     
    204210                return _(u'Amount could not be determined.'), None
    205211            # Add Student Union Fee and Welfare Assurance
    206             if category == 'schoolfee_incl':
     212            if category in ('schoolfee_incl', 'schoolfee_1'):
    207213                amount += gateway_net_amt(academic_session.welfare_fee) + \
    208214                    gateway_net_amt(academic_session.union_fee)
  • main/waeup.aaue/trunk/src/waeup/aaue/utils/utils.py

    r13498 r13512  
    2929    PAYMENT_CATEGORIES = {
    3030        'schoolfee': 'School Fee',
    31         'schoolfee_1': 'School Fee 1st instalment',
    32         'schoolfee_2': 'School Fee 2nd instalment',
     31        'schoolfee_1': 'School Fee Plus (1st instalment)',
     32        'schoolfee_2': 'School Fee (2nd instalment)',
    3333        'schoolfee_incl': 'School Fee Plus',
    3434        'clearance': 'Acceptance Fee',
     
    4949    SELECTABLE_PAYMENT_CATEGORIES = {
    5050        'schoolfee': 'School Fee without additional fees',
    51         #'schoolfee_1': 'School Fee 1st instalment',
    52         #'schoolfee_2': 'School Fee 2nd instalment',
     51        'schoolfee_1': 'School Fee (1st instalment) + Student Union Dues + Welfare Assurance Fee',
     52        'schoolfee_2': 'School Fee (2nd instalment)',
    5353        'schoolfee_incl': 'School Fee + Student Union Dues + Welfare Assurance Fee',
    5454        'clearance': 'Acceptance Fee without additional fees',
Note: See TracChangeset for help on using the changeset viewer.