Changeset 10181 for main/waeup.aaua


Ignore:
Timestamp:
16 May 2013, 04:42:47 (11 years ago)
Author:
Henrik Bettermann
Message:

schoolfee_2 payment is state-independent.

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

Legend:

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

    r10180 r10181  
    157157        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
    158158        self.assertEqual(payment.amount_auth, 80.0)
    159         error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
    160         self.assertEqual(payment.amount_auth, 120.0)
    161159        IWorkflowState(self.student).setState('cleared')
    162160        error, payment = utils.setPaymentDetails('schoolfee_1',self.student)
    163161        self.assertEqual(payment.amount_auth, 40.0)
     162
     163        # schoolfee_2 payment is state-independent
     164        self.student['studycourse'].entry_session = 2003
     165        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
     166        self.assertEqual(payment.amount_auth, 120.0)
     167        self.student['studycourse'].entry_session = 2004
    164168        error, payment = utils.setPaymentDetails('schoolfee_2',self.student)
    165169        self.assertEqual(payment.amount_auth, 60.0)
  • main/waeup.aaua/trunk/src/waeup/aaua/students/utils.py

    r10180 r10181  
    5050            return _(u'Session configuration object is not available.'), None
    5151        # Determine fee.
    52         if category in ('schoolfee', 'schoolfee_1',  'schoolfee_2'):
    53             try:
    54                 certificate = student['studycourse'].certificate
    55                 p_item = certificate.code
    56             except (AttributeError, TypeError):
    57                 return _('Study course data are incomplete.'), None
    58             ratio = getattr(certificate, 'ratio', 0.0)
    59             if ratio is None:
    60                 ratio = 0.0
     52        try:
     53            certificate = student['studycourse'].certificate
     54            p_item = certificate.code
     55        except (AttributeError, TypeError):
     56            return _('Study course data are incomplete.'), None
     57        ratio = getattr(certificate, 'ratio', 0.0)
     58        if ratio is None:
     59            ratio = 0.0
     60        if category in ('schoolfee', 'schoolfee_1'):
    6161            if category == 'schoolfee' and ratio > 0:
    6262                return _('Payment by instalments required.'), None
    63             if category in ('schoolfee_1',  'schoolfee_2') and ratio == 0:
     63            if category =='schoolfee_1' and ratio == 0:
    6464                return _('Payment by instalments not allowed.'), None
    6565            if student.state == CLEARED:
     
    6868                elif category == 'schoolfee_1':
    6969                    amount = getattr(certificate, 'school_fee_1', 0.0) * ratio
    70                 elif category == 'schoolfee_2':
    71                     amount = getattr(certificate, 'school_fee_1', 0.0) * (1- ratio)
    7270            elif student.state == RETURNING:
    7371                # In case of returning school fee payment the
     
    8785                    if student['studycourse'].entry_session in (2005, 2006, 2007):
    8886                        amount -= 20000.0
    89                 elif category == 'schoolfee_2' and ratio:
    90                     amount = getattr(certificate, 'school_fee_2', 0.0) * (1- ratio)
    9187            elif student.is_postgrad and student.state == PAID:
    9288                # Returning postgraduate students also pay for the
     
    10399                elif category == 'schoolfee_1':
    104100                    amount = getattr(certificate, 'school_fee_2', 0.0) * ratio
    105                 elif category == 'schoolfee_2' and ratio:
    106                     amount = getattr(certificate, 'school_fee_2', 0.0) * (1- ratio)
     101        elif category ==  'schoolfee_2':
     102            if ratio == 0:
     103                return _('Payment by instalments not allowed.'), None
     104            if student['studycourse'].entry_session == student.current_session:
     105                amount = getattr(certificate, 'school_fee_1', 0.0) * (1- ratio)
     106            else:
     107                amount = getattr(certificate, 'school_fee_2', 0.0) * (1- ratio)
    107108        if amount in (0.0, None):
    108109            return _('Amount could not be determined.'), None
Note: See TracChangeset for help on using the changeset viewer.