Ignore:
Timestamp:
28 Jun 2020, 20:42:53 (4 years ago)
Author:
Henrik Bettermann
Message:

Compulsory payments before tution fee can be made.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_utils.py

    r15870 r16136  
    3939        self.assertEqual(msg, None)
    4040        return
     41
     42    def test_set_payment_details(self):
     43        self.app['configuration']['2004'].book = 150.0
     44        self.app['configuration']['2004'].develop = 90.0
     45        self.app['configuration']['2004'].registration = 180.0
     46        self.app['configuration']['2004'].municipal_fresh = 280.0
     47        self.app['configuration']['2004'].pcf = 380.0
     48        self.student['studycourse'].certificate.school_fee_2 = 6666.0
     49        IWorkflowState(self.student).setState('cleared')
     50        utils = getUtility(IStudentsUtils)
     51        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     52        self.assertEqual(error,
     53            'Registration Fee, Book Deposit, Development Fee, Municipal Fee, '
     54            'Parents Consultative Forum (PCF) Fee must be paid before Tution Fee.')
     55        reg_payment = createObject('waeup.StudentOnlinePayment')
     56        reg_payment.p_category = u'registration'
     57        reg_payment.p_id = u'anyid'
     58        reg_payment.p_state = u'paid'
     59        reg_payment.p_session = 2004
     60        self.student['payments']['anykey'] = reg_payment
     61        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     62        self.assertEqual(error,
     63            'Book Deposit, Development Fee, Municipal Fee, Parents Consultative '
     64            'Forum (PCF) Fee must be paid before Tution Fee.')
     65        IWorkflowState(self.student).setState('returning')
     66        configuration = createObject('waeup.SessionConfiguration')
     67        configuration.academic_session = 2005
     68        self.app['configuration'].addSessionConfiguration(configuration)
     69        self.app['configuration']['2005'].registration = 170.0
     70        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     71        self.assertEqual(error,
     72            'Registration Fee, Book Deposit, Development Fee, Municipal Fee, '
     73            'Parents Consultative Forum (PCF) Fee must be paid before Tution Fee.')
     74        reg_payment.p_session = 2005
     75        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     76        self.assertEqual(error,
     77            'Book Deposit, Development Fee, Municipal Fee, Parents Consultative '
     78            'Forum (PCF) Fee must be paid before Tution Fee.')
     79        pcf_payment = createObject('waeup.StudentOnlinePayment')
     80        pcf_payment.p_category = u'parentsconsult'
     81        pcf_payment.p_id = u'anyid'
     82        pcf_payment.p_state = u'paid'
     83        pcf_payment.p_session = 2005
     84        self.student['payments']['anykey2'] = pcf_payment
     85        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     86        self.assertEqual(error,
     87            'Book Deposit, Development Fee, Municipal Fee must be paid before Tution Fee.')
     88        munic_payment = createObject('waeup.StudentOnlinePayment')
     89        munic_payment.p_category = u'municipal_fresh'
     90        munic_payment.p_id = u'anyid'
     91        munic_payment.p_state = u'paid'
     92        munic_payment.p_session = 2005
     93        self.student['payments']['anykey3'] = munic_payment
     94        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     95        self.assertEqual(error,
     96            'Book Deposit, Development Fee must be paid before Tution Fee.')
     97        book_payment = createObject('waeup.StudentOnlinePayment')
     98        book_payment.p_category = u'book'
     99        book_payment.p_id = u'anyid'
     100        book_payment.p_state = u'paid'
     101        book_payment.p_session = 2005
     102        self.student['payments']['anykey4'] = book_payment
     103        develop_payment = createObject('waeup.StudentOnlinePayment')
     104        develop_payment.p_category = u'develop'
     105        develop_payment.p_id = u'anyid'
     106        develop_payment.p_state = u'paid'
     107        develop_payment.p_session = 2005
     108        self.student['payments']['anykey5'] = develop_payment
     109        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     110        self.assertEqual(error, None)
     111        self.assertEqual(payment.p_level, 200)
     112        self.assertEqual(payment.p_session, 2005)
     113        self.assertEqual(payment.amount_auth, 6666.0)
     114        return
Note: See TracChangeset for help on using the changeset viewer.