Changeset 15360 for main


Ignore:
Timestamp:
22 Mar 2019, 07:05:00 (6 years ago)
Author:
Henrik Bettermann
Message:

Configure dep_sug payment requirement properly.

Location:
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students
Files:
2 edited

Legend:

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

    r15345 r15360  
    6666        self.assertEqual(msg, None)
    6767        return
     68
     69    def test_set_payment_details(self):
     70        self.student['studycourse'].certificate.school_fee_1 = 6666.0
     71        self.student['studycourse'].certificate.school_fee_2 = 7777.0
     72        self.student['studycourse'].certificate.school_fee_3 = 8888.0
     73        self.student['studycourse'].certificate.school_fee_4 = 9999.0
     74        self.student['studycourse'].certificate.study_mode = 'hnd_ft'
     75        self.student.nationality = u'NG'
     76        self.student.lga = 'ebonyi_ukaba'
     77        utils = getUtility(IStudentsUtils)
     78        configuration = createObject('waeup.SessionConfiguration')
     79        configuration.academic_session = 2005
     80        self.app['configuration'].addSessionConfiguration(configuration)
     81        error, payment = utils.setPaymentDetails('dep_sug',self.student)
     82        self.assertEqual(payment.p_level, 100)
     83        self.assertEqual(payment.p_session, 2004)
     84        IWorkflowState(self.student).setState('returning')
     85        # Returning students are paying for next session
     86        error, payment = utils.setPaymentDetails('dep_sug',self.student)
     87        self.assertEqual(payment.p_level, 200)
     88        self.assertEqual(payment.p_session, 2005)
     89        self.assertEqual(payment.amount_auth, 3150.0)
     90        # Students can pay school fee if dep_sug has been paid first.
     91        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     92        self.assertEqual(error, u'You have to pay NADESU/SA/SUG Dues first.')
     93        error, payment = utils.setPaymentDetails('dep_sug',self.student)
     94        self.student['payments']['any_key'] = payment
     95        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     96        self.assertEqual(error, u'You have to pay NADESU/SA/SUG Dues first.')
     97        self.student['payments']['any_key'].p_state = 'paid'
     98        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     99        self.assertEqual(error, None)
     100        self.assertEqual(payment.p_level, 200)
     101        self.assertEqual(payment.p_session, 2005)
     102        self.assertEqual(payment.amount_auth, 9999.0)
     103
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py

    r15347 r15360  
    3939
    4040    def _dep_sug_paymentMade(self, student, session):
     41        if student.state == RETURNING:
     42            session += 1
    4143        if len(student['payments']):
    4244            for ticket in student['payments'].values():
     
    99101
    100102    def setPaymentDetails(self, category, student,
    101             previous_session, previous_level):
     103            previous_session=None, previous_level=None):
    102104        """Create a payment ticket and set the payment data of a
    103105        student for the payment category specified.
     
    224226            #    amount = 1650.0 # includes GATEWAY_AMT
    225227                amount = 0.0
     228            if student.state == RETURNING and not previous_session:
     229                p_session, p_level = self.getReturningData(student)
    226230        else:
    227231            fee_name = category + '_fee'
Note: See TracChangeset for help on using the changeset viewer.