Changeset 8268


Ignore:
Timestamp:
25 Apr 2012, 06:02:54 (13 years ago)
Author:
Henrik Bettermann
Message:

Store payment level in student payments.

For school fee paments p_session and p_level are calculated as defined
in w.k.students.utils

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8262 r8268  
    10771077            pay_details  = students_utils.getPaymentDetails(
    10781078                p_category,student)
    1079         except AttributeError:
     1079        except (AttributeError, TypeError):
    10801080            self.flash(
    10811081                _('Study course data are incomplete.'))
     
    11041104        payment.p_item = p_item
    11051105        payment.p_session = p_session
     1106        payment.p_level = pay_details['p_level']
    11061107        payment.amount_auth = pay_details['amount']
    11071108        payment = self._fillCustomFields(payment, pay_details)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r8245 r8268  
    502502    """
    503503
    504 IStudentOnlinePayment['p_session'].order = IStudentOnlinePayment[
    505     'p_item'].order
     504    p_level = schema.Int(
     505        title = _(u'Payment Level'),
     506        required = False,
     507        readonly = True,
     508        )
     509
     510IStudentOnlinePayment['p_level'].order = IStudentOnlinePayment[
     511    'p_session'].order
    506512
    507513
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8264 r8268  
    14241424        self.assertMatches('...Amount Authorized...',
    14251425                           self.browser.contents)
     1426        # Payment session and level have been calculated as defined
     1427        # in w.k.students.utils
     1428        self.assertEqual(self.student['payments'][value].p_session, 2005)
     1429        self.assertEqual(self.student['payments'][value].p_level, 200)
    14261430
    14271431        # Students can open the callback view which simulates a valid callback
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r8261 r8268  
    227227    grok.implements(IStudentsUtils)
    228228
     229    def getReturningData(self, student):
     230        """ This method defines what happens after school fee payment
     231        depending on the student's senate verdict.
     232
     233        In the base configuration current level is always increased
     234        by 100 no matter which verdict has been assigned.
     235        """
     236        new_level = student['studycourse'].current_level + 100
     237        new_session = student['studycourse'].current_session + 1
     238        return new_session, new_level
     239
    229240    def setReturningData(self, student):
    230241        """ This method defines what happens after school fee payment
    231         depending on the student's senate verdict.
     242        depending on the student's senate verdict. It folllows
     243        the same algorithm as getReturningData but it also sets the new
     244        values
    232245
    233246        In the base configuration current level is always increased
    234247        by 100 no matter which verdict has been assigned.
    235248        """
    236         student['studycourse'].current_level += 100
    237         student['studycourse'].current_session += 1
     249        new_session, new_level = self.getReturningData(student)
     250        student['studycourse'].current_level = new_level
     251        student['studycourse'].current_session = new_session
    238252        verdict = student['studycourse'].current_verdict
    239253        student['studycourse'].current_verdict = '0'
     
    250264        d['error'] = u''
    251265        d['p_session'] = student['studycourse'].current_session
     266        d['p_level'] = student['studycourse'].current_level
    252267        session = str(d['p_session'])
    253268        try:
     
    259274            d['amount'] = academic_session.school_fee_base
    260275            d['p_item'] = student['studycourse'].certificate.code
     276            # In case of school fee payment the payment session and level
     277            # contain the values of the session the student has paid for
     278            d['p_session'], d['p_level'] = self.getReturningData(student)
    261279        elif category == 'clearance':
    262280            d['p_item'] = student['studycourse'].certificate.code
Note: See TracChangeset for help on using the changeset viewer.