Ignore:
Timestamp:
22 Mar 2022, 12:46:49 (3 years ago)
Author:
Henrik Bettermann
Message:

Implement NCE Third Semester school fee payment.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py

    r16365 r16899  
    129129        self.assertMatches('...ticket created...',
    130130                           self.browser.contents)
    131         self.certificate.study_mode = 'nce_sw'
    132         self.browser.open(self.payments_path + '/addop')
    133         self.browser.getControl(name="form.p_category").value = ['third_semester']
    134         self.browser.getControl("Create ticket").click()
    135         self.assertMatches('...could not be determined...',
    136                            self.browser.contents)
    137         self.certificate.study_mode = 'nce_ft'
    138         self.browser.open(self.payments_path + '/addop')
    139         self.browser.getControl(name="form.p_category").value = ['third_semester']
    140         self.student['studycourse'].current_level = 300
    141         self.browser.getControl("Create ticket").click()
    142         self.assertMatches('...Make NCE 3 school fee payment first...', self.browser.contents)
     131        #self.certificate.study_mode = 'nce_sw'
     132        #self.browser.open(self.payments_path + '/addop')
     133        #self.browser.getControl(name="form.p_category").value = ['third_semester']
     134        #self.browser.getControl("Create ticket").click()
     135        #self.assertMatches('...could not be determined...',
     136        #                   self.browser.contents)
     137        #self.certificate.study_mode = 'nce_ft'
     138        #self.browser.open(self.payments_path + '/addop')
     139        #self.browser.getControl(name="form.p_category").value = ['third_semester']
     140        #self.student['studycourse'].current_level = 300
     141        #self.browser.getControl("Create ticket").click()
     142        #self.assertMatches('...Amount could not be determined...', self.browser.contents)
    143143        self.browser.open(self.payments_path + '/addop')
    144144        self.browser.getControl(
     
    290290        self.assertEqual(error, None)
    291291
    292         error, payment = utils.setPaymentDetails('third_semester',self.student)
    293         self.assertEqual(error, u'Amount could not be determined.')
    294         self.student['studycourse'].current_level = 300
    295         error, payment = utils.setPaymentDetails('third_semester',self.student)
    296         self.assertEqual(error, u'Make NCE 3 school fee payment first.')
    297         payment = createObject('waeup.StudentOnlinePayment')
    298         payment.p_category = u'schoolfee'
    299         payment.p_session = self.student.current_session
    300         payment.p_item = u'My Certificate'
    301         payment.p_id = u'anyid'
    302         self.student['payments']['anykey'] = payment
    303         payment.p_state = 'paid'
    304         payment.p_level = 300
    305         error, payment = utils.setPaymentDetails('third_semester',self.student)
    306         self.assertEqual(payment.p_level, 300)
    307         self.assertEqual(payment.p_session, 2004)
    308         self.assertEqual(payment.amount_auth, 7938)
    309         self.assertEqual(payment.p_item, u'')
    310         self.assertEqual(error, None)
     292        #error, payment = utils.setPaymentDetails('third_semester',self.student)
     293        #self.assertEqual(error, u'Amount could not be determined.')
     294        #self.student['studycourse'].current_level = 300
     295        #error, payment = utils.setPaymentDetails('third_semester',self.student)
     296        #self.assertEqual(error, u'Amount could not be determined.')
     297        #payment = createObject('waeup.StudentOnlinePayment')
     298        #payment.p_category = u'schoolfee'
     299        #payment.p_session = self.student.current_session
     300        #payment.p_item = u'My Certificate'
     301        #payment.p_id = u'anyid'
     302        #self.student['payments']['anykey'] = payment
     303        #payment.p_state = 'paid'
     304        #payment.p_level = 300
     305        #error, payment = utils.setPaymentDetails('third_semester',self.student)
     306        #self.assertEqual(payment.p_level, 300)
     307        #self.assertEqual(payment.p_session, 2004)
     308        #self.assertEqual(payment.amount_auth, 7938)
     309        #self.assertEqual(payment.p_item, u'')
     310        #self.assertEqual(error, None)
    311311
    312312        self.certificate.study_mode = u'nce_sw'
    313313        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
    314         self.assertEqual(payment.p_level, 300)
     314        self.assertEqual(payment.p_level, 100)
    315315        self.assertEqual(payment.p_session, 2004)
    316316        self.assertEqual(payment.amount_auth, 547.5)  # 62.5% * 876
     
    319319
    320320        error, payment = utils.setPaymentDetails('bed_allocation',self.student)
    321         self.assertEqual(payment.p_level, 300)
     321        self.assertEqual(payment.p_level, 100)
    322322        self.assertEqual(payment.p_session, 2004)
    323323        self.assertEqual(payment.amount_auth, 150)
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/utils.py

    r16891 r16899  
    7272        return new_session, new_level
    7373
    74     def _nce3PaymentMade(self, student, p_level):
    75         if len(student['payments']):
    76             for ticket in student['payments'].values():
    77                 if ticket.p_state in ('paid', 'scholarship', 'waived') and \
    78                     ticket.p_level == p_level and \
    79                     ticket.p_category == 'schoolfee':
    80                     return True
    81         return False
     74    #def _nce3PaymentMade(self, student, p_level):
     75    #    if len(student['payments']):
     76    #        for ticket in student['payments'].values():
     77    #            if ticket.p_state in ('paid', 'scholarship', 'waived') and \
     78    #                ticket.p_level == p_level and \
     79    #                ticket.p_category == 'schoolfee':
     80    #                return True
     81    #    return False
    8282
    8383    def setPaymentDetails(self, category, student,
     
    126126            if student.state not in (ADMITTED, CLEARANCE, REQUESTED, CLEARED):
    127127                return _(u'Acceptance Fee payments not allowed.'), None
    128         elif category == 'third_semester' and student.current_mode == 'nce_ft' \
    129             and p_level in (300, 310, 320, 400, 410, 420):
    130             if not self._nce3PaymentMade(student, p_level):
    131                 return _(u'Make NCE 3 school fee payment first.'), None
    132             if student.depcode in ARTS:
    133                 amount = 7688.0
    134             else:
    135                 amount = 7938.0
    136             no_additional_courses = 0
    137             courses_level = student['studycourse'].get(str(p_level))
    138             if courses_level and len(courses_level)> 6:
    139                 no_additional_courses = len(courses_level)-6
    140                 amount += 2000.0 * no_additional_courses
     128        #elif category == 'third_semester' and student.current_mode == 'nce_ft' \
     129        #    and p_level in (300, 310, 320, 400, 410, 420):
     130        #    #if not self._nce3PaymentMade(student, p_level):
     131        #    #    return _(u'Make NCE 3 school fee payment first.'), None
     132        #    no_additional_courses = 0
     133        #    courses_level = student['studycourse'].get(str(p_level))
     134        #    if courses_level and len(courses_level)> 6:
     135        #        no_additional_courses = len(courses_level)-6
     136        #        amount = 2000.0 * no_additional_courses
    141137        elif category.startswith('schoolfee'):
    142138            if category == 'schoolfee_pde1':
     
    145141                if student.state != CLEARED:
    146142                        return _('You are not a fresh student.'), None
     143            if category == 'schoolfee_third':
     144                if not student.current_mode == 'nce_ft' \
     145                    or not p_level in (300, 310, 320, 400, 410, 420):
     146                    return _('You are not an NCE 3 student.'), None
    147147            p_item =  student.certcode
    148148            if not p_item:
     
    211211                    else:
    212212                        amount = 25000
     213                # NCE III third semester
     214                elif category == 'schoolfee_third':
     215                    amount = 7000
    213216                # NCE III
    214217                elif student.current_level in (200, 210, 220):
Note: See TracChangeset for help on using the changeset viewer.