Changeset 8428 for main/waeup.kofa/trunk


Ignore:
Timestamp:
12 May 2012, 07:01:04 (13 years ago)
Author:
Henrik Bettermann
Message:

Payment methods do now all return a success flag, a flash message string and a log string. All these adjustments are necessary for waeup.uniben.

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

    r8422 r8428  
    599599
    600600    def update(self):
    601         success, msg = self.context.approveApplicantPayment()
    602         if success:
     601        success, msg, log = self.context.approveApplicantPayment()
     602        if log is not None:
    603603            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    604             self.context.__parent__.loggerInfo(
    605                 ob_class, 'valid callback: %s' % self.context.p_id)
     604            self.context.__parent__.loggerInfo(ob_class, log)
    606605        self.flash(msg)
    607606        return
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/payment.py

    r8422 r8428  
    4545            wf_info.fireTransition('pay')
    4646        except InvalidTransitionError:
    47             return False, 'Error: %s' % sys.exc_info()[1]
    48         return True, _('Valid callback received.')
     47            msg = log = 'Error: %s' % sys.exc_info()[1]
     48            return False, msg, log
     49        log = 'successful payment: %s' % self.p_id
     50        msg = _('Successful payment')
     51        return False, msg, log
    4952
    5053    def approveApplicantPayment(self):
     
    5255        """
    5356        if self.p_state == 'paid':
    54             return False, _('This ticket has already been paid.')
     57            return False, _('This ticket has already been paid.'), None
    5558        self.approve()
    5659        return self.doAfterApplicantPayment()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r8420 r8428  
    11381138
    11391139    def update(self):
    1140         success, msg = self.context.approveStudentPayment()
    1141         if success:
    1142             write_log_message(self,'valid callback: %s' % self.context.p_id)
     1140        success, msg, log = self.context.approveStudentPayment()
     1141        if log is not None:
     1142            write_log_message(self,log)
    11431143        self.flash(msg)
    11441144        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/payments.py

    r8422 r8428  
    6969                'CLR',0,self.amount_auth,student.student_id)
    7070            if error:
    71                 return False, _('Valid callback received. ${a}',
    72                     mapping = {'a':error})
     71                return False, error, error
    7372            self.ac = pin
    7473        elif self.p_category == 'schoolfee':
     
    7776                'SFE',0,self.amount_auth,student.student_id)
    7877            if error:
    79                 return False, _('Valid callback received. ${a}',
    80                     mapping = {'a':error})
     78                return False, error, error
    8179            self.ac = pin
    8280        elif self.p_category == 'bed_allocation':
     
    8583                'HOS',0,self.amount_auth,student.student_id)
    8684            if error:
    87                 return False, _('Valid callback received. ${a}',
    88                     mapping = {'a':error})
     85                return False, error, error
    8986            self.ac = pin
    90         return True, _('Valid callback received.')
     87        log = 'successful payment: %s' % self.p_id
     88        msg = _('Successful payment')
     89        return True, msg, log
    9190
    9291    def approveStudentPayment(self):
     
    9493        """
    9594        if self.p_state == 'paid':
    96             return False, _('This ticket has already been paid.')
     95            return False, _('This ticket has already been paid.'), None
    9796        self.approve()
    9897        return self.doAfterStudentPayment()
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8420 r8428  
    12931293        self.browser.open(payment_url)
    12941294        self.browser.getLink("Approve payment").click()
    1295         self.assertMatches('...Valid callback received...',
     1295        self.assertMatches('...Successful payment...',
    12961296                          self.browser.contents)
    12971297
     
    13441344        self.browser.getLink(value).click()
    13451345        self.browser.open(self.browser.url + '/approve')
    1346         self.assertMatches('...Valid callback received...',
     1346        self.assertMatches('...Successful payment...',
    13471347                          self.browser.contents)
    13481348        expected = '''...
     
    13831383        # In the base package they can 'use' a fake approval view
    13841384        self.browser.open(payment_url + '/fake_approve')
    1385         self.assertMatches('...Valid callback received...',
     1385        self.assertMatches('...Successful payment...',
    13861386                          self.browser.contents)
    13871387        expected = '''...
     
    14571457        self.assertEqual(len(self.app['accesscodes']['SFE-0']),0)
    14581458        self.browser.open(self.browser.url + '/fake_approve')
    1459         self.assertMatches('...Valid callback received...',
     1459        self.assertMatches('...Successful payment...',
    14601460                          self.browser.contents)
    14611461
Note: See TracChangeset for help on using the changeset viewer.