Changeset 17963


Ignore:
Timestamp:
26 Nov 2024, 02:34:19 (7 weeks ago)
Author:
Henrik Bettermann
Message:

Let JUPEB students pay by instalments.

Location:
main/waeup.uniben/trunk/src/waeup/uniben
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/remita/browser.py

    r17955 r17963  
    153153        reduced_inst_amt = 0.0
    154154        lab_amt = 0.0
    155         if self.context.p_category == 'schoolfee' and \
     155        if self.context.p_category in ('schoolfee', 'schoolfee_1') and \
    156156            not self.context.p_item == 'Balance':
    157157            provider_amt = self.dynamic_provider_amt(self.context.student)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/payments.py

    r17747 r17963  
    6262        log = 'successful %s payment: %s' % (self.p_category, self.p_id)
    6363        msg = _('Payment successfully completed')
    64         if self.p_category in ('schoolfee',):
     64        if self.p_category in ('schoolfee', 'schoolfee_1'):
    6565            msg += _('. Please proceed to library clearance, register your '
    6666                   'courses online and proceed to your '
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r17885 r17963  
    810810        return
    811811
     812    def test_set_payment_details_jupeb(self):
     813        # JUPEB students can pay by instalments
     814        utils = getUtility(IStudentsUtils)
     815        self.certificate.study_mode = 'found'
     816        IWorkflowState(self.student).setState('cleared')
     817        error, payment = utils.setPaymentDetails(
     818            'schoolfee', self.student, None, None, None)
     819        self.assertEqual(payment.p_level, 100)
     820        self.assertEqual(payment.p_session, 2004)
     821        self.assertEqual(payment.amount_auth, 220000.0)
     822        self.assertEqual(payment.p_item, u'CERT1')
     823        self.assertEqual(error, None)
     824        error, payment = utils.setPaymentDetails(
     825            'schoolfee_1', self.student, None, None, None)
     826        self.assertEqual(payment.p_level, 100)
     827        self.assertEqual(payment.p_session, 2004)
     828        self.assertEqual(payment.amount_auth, 110000.0)
     829        self.assertEqual(payment.p_item, u'CERT1')
     830        self.assertEqual(error, None)
     831        return
     832        error, payment = utils.setPaymentDetails(
     833            'secondinstall', self.student, None, None, None)
     834        self.assertEqual(payment.p_level, 100)
     835        self.assertEqual(payment.p_session, 2004)
     836        self.assertEqual(payment.amount_auth, 110000.0)
     837        self.assertEqual(payment.p_item, u'CERT1')
     838        self.assertEqual(error, None)
     839
    812840    def test_edit_level_by_co(self):
    813841        # Create clearance officer
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r17930 r17963  
    493493            else:
    494494                amount = 60000.0
     495
     496        elif student.state == CLEARED \
     497                and student.is_jupeb and category in ('schoolfee', 'schoolfee_1',
     498                                                      'secondinstall'):
     499            try:
     500                certificate = student['studycourse'].certificate
     501                p_item = certificate.code
     502            except (AttributeError, TypeError):
     503                return _('Study course data are incomplete.'), None
     504            amount = 220000.0
     505            if category in ('schoolfee_1', 'secondinstall'):
     506                amount /= 2
     507
    495508        elif category == 'schoolfee':
    496509            try:
     
    580593            if student.is_staff:
    581594                amount /= 2
    582 
    583595        else:
    584596            fee_name = category + '_fee'
  • main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py

    r17916 r17963  
    7474    PAYMENT_CATEGORIES = {
    7575        'schoolfee': 'School Fee',
     76        'schoolfee_1': 'School Fee (1st instalment)',
     77        'secondinstall':'School Fee (2nd instalment)',
    7678        'clearance': 'Acceptance Fee',
    7779        'bed_allocation': 'Bed Allocation Fee',
     
    126128    REPORTABLE_PAYMENT_CATEGORIES = {
    127129        'schoolfee': 'School Fee',
     130        'schoolfee_1': 'School Fee (1st instalment)',
     131        'secondinstall':'School Fee (2nd instalment)',
    128132        'clearance': 'Acceptance Fee',
    129133        'bed_allocation': 'Bed Allocation Fee',
     
    133137
    134138    def selectable_payment_categories(self, student):
    135         return self.SELECTABLE_PAYMENT_CATEGORIES
     139        spc = deepcopy(self.SELECTABLE_PAYMENT_CATEGORIES)
     140        if student.is_jupeb:
     141            spc[schoolfee_1] =  'School Fee (1st instalment)'
     142            spc[secondinstal] = 'School Fee (2nd instalment)'
     143        return spc
    136144
    137145    PREVIOUS_PAYMENT_CATEGORIES = deepcopy(SELECTABLE_PAYMENT_CATEGORIES)
     
    147155        'sf_return': 'School Fee - Returning',
    148156        'maint_all': 'Accomm. Fee - All',
    149         'cl_all':    'Accept. Fee- All',
     157        'cl_all':    'Accept. Fee - All',
    150158        'cl_jupeb':  'Accept. Fee - JUPEB',
    151159        'cl_allexj': 'Accept. Fee - All except JUPEB',
Note: See TracChangeset for help on using the changeset viewer.