Changeset 9513 for main


Ignore:
Timestamp:
2 Nov 2012, 16:58:01 (12 years ago)
Author:
Henrik Bettermann
Message:

In Uniben students can pay for next session in all states > cleared.

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

Legend:

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

    r9459 r9513  
    464464        self.assertEqual(error, None)
    465465
    466         # In Uniben we have pg and special pg students.
    467         # They pay the same but their workflow is different.
     466        # In Uniben students can pay school fee in all states no matter
     467        # if they are ug or pg students.
    468468        IWorkflowState(self.student).setState('school fee paid')
     469        self.certificate.study_mode = 'special_pg_pt'
    469470        self.student.is_staff = False
    470471        self.student.nationality = u'NG'
    471472        self.certificate.school_fee_2 = 10000.0
     473
    472474        error, payment = utils.setPaymentDetails(
    473475            'schoolfee', self.student, None, None)
    474         self.assertEqual(payment, None)
    475         self.assertTrue('not be determined' in error)
    476         self.certificate.study_mode = 'pg_pt'
    477         self.assertTrue(self.student.is_postgrad)
    478         self.assertFalse(self.student.is_special_postgrad)
     476        self.assertEqual(payment.p_level, None)
     477        self.assertEqual(payment.p_session, 2005)
     478        self.assertEqual(payment.amount_auth, 10000.0)
     479        self.assertEqual(payment.p_item, u'CERT1')
     480        self.assertEqual(error, None)
     481
     482        IWorkflowState(self.student).setState('courses registered')
    479483        error, payment = utils.setPaymentDetails(
    480484            'schoolfee', self.student, None, None)
    481         self.assertEqual(payment.p_level, 100)
     485        self.assertEqual(payment.p_level, None)
    482486        self.assertEqual(payment.p_session, 2005)
    483487        self.assertEqual(payment.amount_auth, 10000.0)
    484488        self.assertEqual(payment.p_item, u'CERT1')
    485489        self.assertEqual(error, None)
    486         self.certificate.study_mode = 'special_pg_pt'
    487         self.assertTrue(self.student.is_postgrad)
    488         self.assertTrue(self.student.is_special_postgrad)
     490
     491        IWorkflowState(self.student).setState('courses validated')
    489492        error, payment = utils.setPaymentDetails(
    490493            'schoolfee', self.student, None, None)
    491         self.assertTrue('not be determined' in error)
    492         IWorkflowState(self.student).setState('returning')
    493         error, payment = utils.setPaymentDetails(
    494             'schoolfee', self.student, None, None)
    495         self.assertEqual(payment.p_level, 200)
     494        self.assertEqual(payment.p_level, None)
    496495        self.assertEqual(payment.p_session, 2005)
    497496        self.assertEqual(payment.amount_auth, 10000.0)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r9459 r9513  
    2121from reportlab.lib.styles import getSampleStyleSheet
    2222from reportlab.platypus import Paragraph, Image, Table, Spacer
    23 from waeup.kofa.interfaces import IKofaUtils, CLEARED, RETURNING, PAID
     23from waeup.kofa.interfaces import (IKofaUtils,
     24    CLEARED, RETURNING, PAID, REGISTERED, VALIDATED)
    2425from kofacustom.nigeria.students.utils import NigeriaStudentsUtils
    2526from waeup.kofa.accesscodes import create_accesscode
     
    125126                    else:
    126127                        amount = getattr(certificate, 'school_fee_1', 0.0)
     128                elif student.state in (PAID, REGISTERED, VALIDATED):
     129                    # Students are either postgraduate or are paying in advance.
     130                    # Both are paying for next session.
     131                    p_session += 1
     132                    # We don't know which level the student is paying for.
     133                    p_level = None
     134                    try:
     135                        academic_session = grok.getSite()[
     136                            'configuration'][str(p_session)]
     137                    except KeyError:
     138                        return _(u'Session configuration object is not available.'), None
     139                    if student.is_foreigner:
     140                        amount = getattr(certificate, 'school_fee_4', 0.0)
     141                    else:
     142                        amount = getattr(certificate, 'school_fee_2', 0.0)
    127143                elif student.state == RETURNING:
    128144                    # In case of returning school fee payment the payment session
     
    130146                    # has paid for.
    131147                    p_session, p_level = self.getReturningData(student)
    132                     if student.is_foreigner:
    133                         amount = getattr(certificate, 'school_fee_4', 0.0)
    134                     else:
    135                         amount = getattr(certificate, 'school_fee_2', 0.0)
    136148                    try:
    137149                        academic_session = grok.getSite()[
     
    139151                    except KeyError:
    140152                        return _(u'Session configuration object is not available.'), None
    141                 elif student.state == PAID  and student.is_postgrad and \
    142                     not student.is_special_postgrad:
    143                     # Regular returning postgraduate students also pay
    144                     # for the next session but their level always remains the same.
    145                     p_session += 1
    146153                    if student.is_foreigner:
    147154                        amount = getattr(certificate, 'school_fee_4', 0.0)
    148155                    else:
    149156                        amount = getattr(certificate, 'school_fee_2', 0.0)
    150                     try:
    151                         academic_session = grok.getSite()[
    152                             'configuration'][str(p_session)]
    153                     except KeyError:
    154                         return _(u'Session configuration object is not available.'), None
    155157            # Give 50% school fee discount to staff members.
    156158            if student.is_staff:
Note: See TracChangeset for help on using the changeset viewer.