Ignore:
Timestamp:
6 May 2014, 06:20:46 (11 years ago)
Author:
Henrik Bettermann
Message:
  • Do not create activation code when paying acceptance (= clearance) fee payment tickets.
  • Cleared students must pay acceptance fee before paying school fees.
Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py

    r11554 r11622  
    5555        IWorkflowState(self.student).setState('cleared')
    5656        self.browser.open(self.payments_path + '/addop')
     57        self.browser.getControl(name="form.p_category").value = ['clearance']
     58        self.browser.getControl("Create ticket").click()
     59        self.assertMatches('...ticket created...',
     60                           self.browser.contents)
     61        ctrl = self.browser.getControl(name='val_id')
     62        value = ctrl.options[0]
     63        self.student['payments'][value].approve()
     64
     65        self.browser.open(self.payments_path + '/addop')
    5766        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    5867        self.browser.getControl("Create ticket").click()
    5968        self.assertMatches('...ticket created...',
    6069                           self.browser.contents)
    61 
    6270        ctrl = self.browser.getControl(name='val_id')
    63         value = ctrl.options[0]
     71        value = ctrl.options[1]
    6472        self.p_id = value
    6573        self.browser.getLink(value).click()
  • main/waeup.aaue/trunk/src/waeup/aaue/students/payments.py

    r9990 r11622  
    2626    StudentOnlinePayment, StudentOnlinePaymentFactory)
    2727from waeup.kofa.utils.helpers import attrs_to_fields
     28from waeup.kofa.accesscodes import create_accesscode
    2829from waeup.aaue.students.interfaces import ICustomStudentOnlinePayment
    2930
     
    4344        return
    4445
    45     @property
    46     def student(self):
    47         return self.__parent__.__parent__
     46    def _createActivationCodes(self):
     47        student = self.student
     48        if self.p_category in ('schoolfee', 'schoolfee_1'):
     49            # Create SFE access code
     50            pin, error = create_accesscode(
     51                'SFE',0,self.amount_auth,student.student_id)
     52            if error:
     53                return error
     54            self.ac = pin
     55        elif self.p_category == 'bed_allocation':
     56            # Create HOS access code
     57            pin, error = create_accesscode(
     58                'HOS',0,self.amount_auth,student.student_id)
     59            if error:
     60                return error
     61            self.ac = pin
     62        elif self.p_category == 'transcript':
     63            # Create TSC access code
     64            pin, error = create_accesscode(
     65                'TSC',0,self.amount_auth,student.student_id)
     66            if error:
     67                return error
     68            self.ac = pin
     69        return None
    4870
    4971CustomStudentOnlinePayment = attrs_to_fields(
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r11621 r11622  
    136136        self.app['configuration']['2004'].school_fee = 6666.0
    137137        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    138         self.browser.getControl("Create ticket").click()
    139         self.assertMatches('...ticket created...',
    140                            self.browser.contents)
     138        # Accepotance fee must be paid first
     139        self.browser.getControl("Create ticket").click()
     140        self.assertMatches('...Please pay acceptance fee first...',
     141                           self.browser.contents)
     142        self.app['configuration']['2004'].clearance_fee = 666.0
     143        self.browser.getControl(name="form.p_category").value = ['clearance']
     144        self.browser.getControl("Create ticket").click()
    141145        ctrl = self.browser.getControl(name='val_id')
    142146        value = ctrl.options[0]
     147        self.student['payments'][value].approveStudentPayment()
     148        self.browser.open(self.payments_path + '/addop')
     149        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     150        self.browser.getControl("Create ticket").click()
     151        self.assertMatches('...ticket created...',
     152                           self.browser.contents)
     153        ctrl = self.browser.getControl(name='val_id')
     154        value = ctrl.options[1]
    143155        self.browser.getLink(value).click()
    144156        self.assertMatches('...Amount Authorized...',
    145157                           self.browser.contents)
    146         # Managers can open payment slip
     158        # Managers can open school fee payment slip
    147159        self.browser.getLink("Download payment slip").click()
    148160        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    149161        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    150162        # Set ticket paid
    151         ticket = self.student['payments'].items()[0][1]
    152         ticket.p_state = 'paid'
     163        ticket = self.student['payments'][value].approveStudentPayment()
    153164        self.browser.open(self.payments_path + '/addop')
    154165        self.browser.getControl(name="form.p_category").value = ['schoolfee']
    155166        self.browser.getControl("Create ticket").click()
    156167        self.assertMatches('...This type of payment has already been made...',
    157                            self.browser.contents)
    158         self.browser.open(self.payments_path + '/addop')
    159         self.browser.getControl(name="form.p_category").value = ['clearance']
    160         self.browser.getControl("Create ticket").click()
    161         self.assertMatches('...ticket created...',
    162168                           self.browser.contents)
    163169
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_utils.py

    r11621 r11622  
    5656
    5757        IWorkflowState(self.student).setState('cleared')
     58        error, payment = utils.setPaymentDetails('schoolfee',self.student)
     59        # Acceptance fee must be paid first.
     60        self.assertEqual(error, 'Please pay acceptance fee first.')
     61        payment = createObject('waeup.StudentOnlinePayment')
     62        payment.p_category = 'clearance'
     63        self.student['payments']['any_id'] = payment
     64        payment.approveStudentPayment()
     65        # No activation code created.
     66        self.assertEqual(payment.ac, None)
     67        # School fee can be set.
    5868        error, payment = utils.setPaymentDetails('schoolfee',self.student)
    5969        self.assertEqual(payment.p_level, 100)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r11620 r11622  
    109109        new_session = student['studycourse'].current_session + 1
    110110        return new_session, new_level
     111
     112    def _acceptanceFeePaid(self, student):
     113        if len(student['payments']):
     114            for ticket in student['payments'].values():
     115                if ticket.p_state == 'paid' and \
     116                    ticket.p_category == 'clearance':
     117                    return True
     118        return False
    111119
    112120    def setPaymentDetails(self, category, student,
     
    151159                return _('Study course data are incomplete.'), None
    152160            if student.state == CLEARED:
     161                if not self._acceptanceFeePaid(student):
     162                    return _('Please pay acceptance fee first.'), None
    153163                if student.faccode == 'FP':
    154164                    amount = 84000.0
Note: See TracChangeset for help on using the changeset viewer.