Ignore:
Timestamp:
12 Jun 2015, 07:27:02 (9 years ago)
Author:
Henrik Bettermann
Message:

Bypass SFE access code creation also in AAUE.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/payments.py

    r12899 r13043  
    2222from zope.component.interfaces import IFactory
    2323from zope.interface import implementedBy
     24from zope.schema.interfaces import ConstraintNotSatisfied
     25from hurry.workflow.interfaces import IWorkflowInfo
    2426from waeup.kofa.students.interfaces import IStudentNavigation
    2527from waeup.kofa.students.payments import (
    2628    StudentOnlinePayment, StudentOnlinePaymentFactory)
     29from waeup.kofa.students.workflow import CLEARED
    2730from waeup.kofa.utils.helpers import attrs_to_fields
    2831from waeup.kofa.accesscodes import create_accesscode
     
    4447        return
    4548
    46     def _redeemTicket(self):
     49    def redeemTicket(self):
    4750        student = self.student
    4851        if self.p_category in ('schoolfee', 'schoolfee_1'):
     52            # Bypass activation code creation if next session
     53            # can be started directly.
     54            if student['studycourse'].next_session_allowed:
     55                try:
     56                    if student.state == CLEARED:
     57                        IWorkflowInfo(student).fireTransition(
     58                            'pay_first_school_fee')
     59                        return None
     60                    elif student.state == RETURNING:
     61                        IWorkflowInfo(student).fireTransition(
     62                            'pay_school_fee')
     63                        return None
     64                    elif student.state == PAID:
     65                        IWorkflowInfo(student).fireTransition(
     66                            'pay_pg_fee')
     67                        return None
     68                except ConstraintNotSatisfied:
     69                    pass
    4970            # Create SFE access code
    5071            pin, error = create_accesscode(
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13038 r13043  
    173173        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    174174        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    175         # If school fee ticket is paid ...
     175        # If school fee ticket is paid, the student is automatically set to
     176        # school fee paid...
    176177        ticket = self.student['payments'][sfpt_value].approveStudentPayment()
     178        self.assertEqual(self.student.state, 'school fee paid')
    177179        # ... no further school fee ticket can be added.
    178180        self.browser.open(self.payments_path + '/addop')
    179181        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    180182        self.browser.getControl("Create ticket").click()
    181         self.assertMatches('...This type of payment has already been made...',
     183        self.assertMatches('...Wrong state...',
    182184                           self.browser.contents)
    183185        self.browser.open(self.payments_path + '/addop')
Note: See TracChangeset for help on using the changeset viewer.