Ignore:
Timestamp:
11 May 2012, 16:32:07 (13 years ago)
Author:
Henrik Bettermann
Message:

Use same technique for approval of payments in students and in applicants.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
3 edited

Legend:

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

    r8420 r8422  
    599599
    600600    def update(self):
    601         self.wf_info = IWorkflowInfo(self.context.__parent__)
    602         try:
    603             self.wf_info.fireTransition('pay')
    604         except InvalidTransitionError:
    605             self.flash('Error: %s' % sys.exc_info()[1])
    606             return
    607         self.context.approve()
    608         ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    609         self.context.__parent__.loggerInfo(
    610             ob_class, 'valid callback: %s' % self.context.p_id)
    611         self.flash(_('Valid callback received.'))
     601        success, msg = self.context.approveApplicantPayment()
     602        if success:
     603            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
     604            self.context.__parent__.loggerInfo(
     605                ob_class, 'valid callback: %s' % self.context.p_id)
     606        self.flash(msg)
    612607        return
    613608
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r8388 r8422  
    517517
    518518    """
     519
     520    def doAfterApplicantPayment():
     521        """Process applicant after payment was made.
     522
     523        """
     524
     525    def approveApplicantPayment():
     526        """Approve payment and process applicant.
     527
     528        """
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/payment.py

    r8260 r8422  
    2020"""
    2121import grok
     22from hurry.workflow.interfaces import IWorkflowInfo
    2223from zope.component.interfaces import IFactory
    2324from zope.interface import implementedBy
     25from waeup.kofa.interfaces import MessageFactory as _
    2426from waeup.kofa.payments import OnlinePayment
    2527from waeup.kofa.applicants.interfaces import IApplicantOnlinePayment
     
    3537        super(ApplicantOnlinePayment, self).__init__()
    3638        return
     39
     40    def doAfterApplicantPayment(self):
     41        """Process applicant after payment was made.
     42        """
     43        wf_info = IWorkflowInfo(self.__parent__)
     44        try:
     45            wf_info.fireTransition('pay')
     46        except InvalidTransitionError:
     47            return False, 'Error: %s' % sys.exc_info()[1]
     48        return True, _('Valid callback received.')
     49
     50    def approveApplicantPayment(self):
     51        """Approve payment and process applicant.
     52        """
     53        if self.p_state == 'paid':
     54            return False, _('This ticket has already been paid.')
     55        self.approve()
     56        return self.doAfterApplicantPayment()
    3757
    3858ApplicantOnlinePayment = attrs_to_fields(ApplicantOnlinePayment)
Note: See TracChangeset for help on using the changeset viewer.