Ignore:
Timestamp:
4 Apr 2014, 05:59:43 (11 years ago)
Author:
Henrik Bettermann
Message:

Multiple payments in special application containers enabled.
Special payment applicants remain in state started after payment.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
5 edited

Legend:

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

    r11570 r11575  
    630630
    631631    def update(self):
    632         for key in self.context.keys():
    633             ticket = self.context[key]
    634             if ticket.p_state == 'paid':
    635                   self.flash(
    636                       _('This type of payment has already been made.'),
    637                       type='warning')
    638                   self.redirect(self.url(self.context))
    639                   return
     632        if not self.context.special:
     633            for key in self.context.keys():
     634                ticket = self.context[key]
     635                if ticket.p_state == 'paid':
     636                      self.flash(
     637                          _('This type of payment has already been made.'),
     638                          type='warning')
     639                      self.redirect(self.url(self.context))
     640                      return
    640641        applicants_utils = getUtility(IApplicantsUtils)
    641642        container = self.context.__parent__
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/payment.py

    r11570 r11575  
    4444        """Process applicant after payment was approved.
    4545        """
    46         wf_info = IWorkflowInfo(self.__parent__)
    47         try:
    48             wf_info.fireTransition('approve')
    49         except InvalidTransitionError:
    50             msg = log = 'Error: %s' % sys.exc_info()[1]
    51             return msg, log
     46        if not self.__parent__.special:
     47            wf_info = IWorkflowInfo(self.__parent__)
     48            try:
     49                wf_info.fireTransition('approve')
     50            except InvalidTransitionError:
     51                msg = log = 'Error: %s' % sys.exc_info()[1]
     52                return msg, log
    5253        log = 'payment approved: %s' % self.p_id
    5354        msg = _('Payment approved')
     
    5758        """Process applicant after payment was made.
    5859        """
    59         wf_info = IWorkflowInfo(self.__parent__)
    60         try:
    61             wf_info.fireTransition('pay')
    62         except InvalidTransitionError:
    63             msg = log = 'Error: %s' % sys.exc_info()[1]
    64             return msg, log
     60        if not self.__parent__.special:
     61            wf_info = IWorkflowInfo(self.__parent__)
     62            try:
     63                wf_info.fireTransition('pay')
     64            except InvalidTransitionError:
     65                msg = log = 'Error: %s' % sys.exc_info()[1]
     66                return msg, log
    6567        log = 'successful payment: %s' % self.p_id
    6668        msg = _('Successful payment')
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r11253 r11575  
    943943        configuration.academic_session = session_1
    944944        configuration.transcript_fee = 200.0
     945        configuration.clearance_fee = 300.0
    945946        self.app['configuration'].addSessionConfiguration(configuration)
    946947
     
    974975        self.assertTrue(
    975976            '<span>200.0</span>' in self.browser.contents)
    976         self.browser.getLink("Logout").click()
    977         # Login as manager
    978         #self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    979         #self.browser.open(applicant_path + '/manage')
    980         # When unselecting special_application, the payment ticket
    981         # can still be created.
    982         #self.browser.getControl(name="form.special_application").value = [
    983         #    '']
    984         #self.browser.getControl("Save").click()
    985         #self.browser.getControl("Add online payment ticket").click()
    986         #self.assertMatches('...Payment ticket created...',
    987         #                   self.browser.contents)
    988         #self.assertMatches('...<span>--</span>...',
    989         #                   self.browser.contents)
     977        self.assertEqual(len(self.special_applicant.keys()), 1)
     978        # The applicant's workflow remain started ...
     979        self.special_applicant.values()[0].approveApplicantPayment()
     980        self.assertEqual(self.special_applicant.state, 'started')
     981        self.browser.open(applicant_path + '/edit')
     982        # ... so that he can create further tickets.
     983        self.browser.getControl(name="form.special_application").value = [
     984            'clearance']
     985        self.browser.getControl("Save").click()
     986        self.browser.getControl("Add online payment ticket").click()
     987        self.assertMatches('...Payment ticket created...',
     988                           self.browser.contents)
     989        self.browser.open(applicant_path)
     990        self.assertTrue(
     991            '<td>Acceptance Fee</td>' in self.browser.contents)
     992        self.assertEqual(len(self.special_applicant.keys()), 2)
    990993        return
    991994
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py

    r11254 r11575  
    5656        payment.p_session = container.year
    5757        payment.amount_auth = 0.0
    58         if container.prefix.startswith('special'):
     58        if applicant.special:
    5959            if applicant.special_application:
    6060                fee_name = applicant.special_application + '_fee'
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r11451 r11575  
    159159    SPECIAL_APP_DICT = {
    160160        'transcript': 'Transcript Fee Payment',
     161        'clearance': 'Acceptance Fee',
    161162        }
    162163
Note: See TracChangeset for help on using the changeset viewer.