Ignore:
Timestamp:
23 Jul 2022, 16:21:58 (2 years ago)
Author:
Henrik Bettermann
Message:

Revert changes in students section.

Location:
main/kofacustom.edocons/trunk/src/kofacustom/edocons
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/interswitch/tests.py

    r17029 r17031  
    5959        self.student.nationality = u'NG'
    6060        self.browser.open(self.payments_path + '/addop')
    61         self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     61        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    6262        self.browser.getControl("Create ticket").click()
    6363        self.assertMatches('...ticket created...',
     
    7070                           self.browser.contents)
    7171        self.assertTrue(
    72             '<span>220000.0</span>' in self.browser.contents)
     72            '<span>40000.0</span>' in self.browser.contents)
    7373        self.payment_url = self.browser.url
    7474        self.browser.getLink("Pay via Interswitch CollegePAY", index=0).click()
     
    7777        self.assertEqual(self.student.current_mode, 'ug_ft')
    7878        self.assertTrue(
    79             '<input type="hidden" name="amount" value="22030000" />' in
    80             self.browser.contents)
    81         self.assertTrue(
    82             'item_name="School Fee - 1st instalment" item_amt="22000000" bank_id="31" acct_num="1489560452"' in
     79            '<input type="hidden" name="amount" value="4030000" />' in
     80            self.browser.contents)
     81        self.assertTrue(
     82            'item_name="School Fee (total amount)" item_amt="4000000" bank_id="31" acct_num="1489560452"' in
     83            self.browser.contents)
     84        self.browser.open(self.payments_path + '/addop')
     85        self.browser.getControl(name="form.p_category").value = ['schoolfee_1']
     86        self.browser.getControl("Create ticket").click()
     87        self.assertMatches('...ticket created...',
     88                           self.browser.contents)
     89        self.browser.open(self.payments_path)
     90        ctrl = self.browser.getControl(name='val_id')
     91        self.value = ctrl.options[1]
     92        self.browser.getLink(self.value).click()
     93        self.assertMatches('...Amount Authorized...',
     94                           self.browser.contents)
     95        self.assertTrue(
     96            '<span>26400.0</span>' in self.browser.contents)
     97        self.payment_url = self.browser.url
     98        self.browser.getLink("Pay via Interswitch CollegePAY", index=0).click()
     99        self.assertMatches('...<input type="hidden" name="pay_item_id" value="Default_Payable_MX26002" />...',
     100                           self.browser.contents)
     101        self.assertEqual(self.student.current_mode, 'ug_ft')
     102        self.assertTrue(
     103            '<input type="hidden" name="amount" value="2670000" />' in
     104            self.browser.contents)
     105        self.assertTrue(
     106            'item_name="School Fee (66% - 1st instalment)" item_amt="2640000" bank_id="31" acct_num="1489560452"' in
    83107            self.browser.contents)
    84108
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/utils.py

    r17029 r17031  
    6060            return _(u'Session configuration object is not available.'), None
    6161        # Determine fee.
    62         if category in ('schoolfee_1', 'secondinstal'):
    63             if student.state == CLEARED:
    64                 pass
    65             elif student.state == RETURNING:
    66                 # In case of returning school fee payment the
    67                 # payment session and level contain the values of
    68                 # the session the student has paid for. Payment
    69                 # session is always next session.
    70                 p_session, p_level = self.getReturningData(student)
    71                 academic_session = self._getSessionConfiguration(p_session)
    72                 if academic_session == None:
    73                     return _(
    74                         u'Session configuration object is not available.'
    75                         ), None
    76             elif student.is_postgrad and student.state == PAID:
    77                 # Returning postgraduate students also pay for the
    78                 # next session but their level always remains the
    79                 # same.
    80                 p_session += 1
    81                 academic_session = self._getSessionConfiguration(p_session)
    82                 if academic_session == None:
    83                     return _(
    84                         u'Session configuration object is not available.'
    85                         ), None
     62        if category in ('schoolfee', 'schoolfee_1', 'secondinstal'):
     63            try:
     64                certificate = student['studycourse'].certificate
     65                p_item = certificate.code
     66            except (AttributeError, TypeError):
     67                return _('Study course data are incomplete.'), None
     68            if previous_session:
     69                # Students can pay for previous sessions in all
     70                # workflow states.  Fresh students are excluded by the
     71                # update method of the PreviousPaymentAddFormPage.
     72                amount = getattr(certificate, 'school_fee_1', 0.0)
    8673            else:
    87                 return _('School fee payment not allowed. Wrong state.'), None
    88             if category == 'schoolfee_1':
    89                 amount = 220000.0
    90             elif category == 'secondinstal':
    91                 amount = 100000.0
     74                if category == 'secondinstal':
     75                    amount = 0.34 * getattr(certificate, 'school_fee_1', 0.0)
     76                else:
     77                    if student.state == CLEARED:
     78                        amount = getattr(certificate, 'school_fee_1', 0.0)
     79                    elif student.state == RETURNING:
     80                        # In case of returning school fee payment the
     81                        # payment session and level contain the values of
     82                        # the session the student has paid for. Payment
     83                        # session is always next session.
     84                        p_session, p_level = self.getReturningData(student)
     85                        academic_session = self._getSessionConfiguration(p_session)
     86                        if academic_session == None:
     87                            return _(
     88                                u'Session configuration object is not available.'
     89                                ), None
     90                        amount = getattr(certificate, 'school_fee_1', 0.0)
     91                    elif student.is_postgrad and student.state == PAID:
     92                        # Returning postgraduate students also pay for the
     93                        # next session but their level always remains the
     94                        # same.
     95                        p_session += 1
     96                        academic_session = self._getSessionConfiguration(p_session)
     97                        if academic_session == None:
     98                            return _(
     99                                u'Session configuration object is not available.'
     100                                ), None
     101                        amount = getattr(certificate, 'school_fee_1', 0.0)
     102                    if category == 'schoolfee_1':
     103                        amount *= 0.66
    92104        elif category == 'clearance':
    93105            try:
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/utils/utils.py

    r17029 r17031  
    2626    PAYMENT_CATEGORIES = {
    2727        'schoolfee': 'School Fee (total amount)',
    28         'schoolfee_1': 'School Fee - 1st instalment',
    29         'secondinstal': 'School Fee - 2nd instalment',
     28        'schoolfee_1': 'School Fee (66% - 1st instalment)',
     29        'secondinstal': 'School Fee (34% - 2nd instalment)',
    3030        'clearance': 'Acceptance Fee',
    3131        'hostel':'Hostel Fee',
     
    4242
    4343    SELECTABLE_PAYMENT_CATEGORIES = {
    44         #'schoolfee': 'School Fee (total amount)',
    45         'schoolfee_1': 'School Fee - 1st instalment',
    46         'secondinstal': 'School Fee - 2nd instalment',
     44        'schoolfee': 'School Fee (total amount)',
     45        'schoolfee_1': 'School Fee (66% - 1st instalment)',
     46        'secondinstal': 'School Fee (34% - 2nd instalment)',
    4747        'hostel':'Hostel Fee',
    4848        }
Note: See TracChangeset for help on using the changeset viewer.