Ignore:
Timestamp:
12 May 2013, 05:28:42 (12 years ago)
Author:
Henrik Bettermann
Message:

Configure school fee payment by installments.

File:
1 edited

Legend:

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

    r10157 r10173  
    119119        # ... and voila next session registration is allowed
    120120        self.assertTrue(self.student['studycourse'].next_session_allowed)
     121
     122    def test_set_payment_details(self):
     123        self.certificate.school_fee_1 = 100.0
     124        self.certificate.school_fee_2 = 200.0
     125        utils = getUtility(IStudentsUtils)
     126
     127        IWorkflowState(self.student).setState('cleared')
     128        self.certificate.study_mode = 'ug_ft'
     129        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     130        self.assertEqual(payment.p_level, 100)
     131        self.assertEqual(payment.p_session, 2004)
     132        self.assertEqual(payment.amount_auth, 100.0)
     133        self.assertEqual(payment.p_item, u'CERT1')
     134        self.assertEqual(error, None)
     135
     136        IWorkflowState(self.student).setState('returning')
     137        configuration = createObject('waeup.SessionConfiguration')
     138        configuration.academic_session = 2005
     139        self.app['configuration'].addSessionConfiguration(configuration)
     140        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     141        self.assertEqual(payment.p_level, 200)
     142        self.assertEqual(payment.p_session, 2005)
     143        self.assertEqual(payment.amount_auth, 200.0)
     144        self.assertEqual(payment.p_item, u'CERT1')
     145        self.assertEqual(error, None)
     146
     147        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     148        self.assertEqual(error, u'Payment by instalments not allowed.')
     149        self.certificate.ratio = 0.0
     150        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     151        self.assertEqual(error, u'Payment by instalments not allowed.')
     152        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
     153        self.assertEqual(error, u'Payment by instalments not allowed.')
     154        self.certificate.ratio = 0.4
     155        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     156        self.assertEqual(error, u'Payment by instalments required.')
     157        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     158        self.assertEqual(payment.amount_auth, 80.0)
     159        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
     160        self.assertEqual(payment.amount_auth, 120.0)
     161        IWorkflowState(self.student).setState('cleared')
     162        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
     163        self.assertEqual(payment.amount_auth, 40.0)
     164        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
     165        self.assertEqual(payment.amount_auth, 60.0)
Note: See TracChangeset for help on using the changeset viewer.