Ignore:
Timestamp:
13 Jun 2012, 06:32:13 (13 years ago)
Author:
Henrik Bettermann
Message:

Let's better use an adapter for the webservice.

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

Legend:

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

    r8702 r8703  
    2727from waeup.kofa.interfaces import MessageFactory as _
    2828from waeup.kofa.payments import OnlinePayment
     29from waeup.kofa.payments.interfaces import IPaymentWebservice
    2930from waeup.kofa.applicants.interfaces import IApplicantOnlinePayment
    3031from waeup.kofa.utils.helpers import attrs_to_fields
     
    7475        return self.doAfterApplicantPaymentApproval()
    7576
    76     def getOwner(self):
    77         """Return applicant.
    78         """
    79         return self.__parent__
     77ApplicantOnlinePayment = attrs_to_fields(ApplicantOnlinePayment)
    8078
    81 ApplicantOnlinePayment = attrs_to_fields(ApplicantOnlinePayment)
     79class PaymentWebservice(grok.Adapter):
     80    """An adapter to publish applicant data through a webservice.
     81    """
     82    grok.context(IApplicantOnlinePayment)
     83    grok.implements(IPaymentWebservice)
     84
     85    @property
     86    def payee(self):
     87        return self.context.__parent__.display_fullname
    8288
    8389# Applicant online payments must be importable. So we might need a factory.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r8702 r8703  
    3535from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
    3636from waeup.kofa.app import University
     37from waeup.kofa.payments.interfaces import IPaymentWebservice
    3738from waeup.kofa.configuration import SessionConfiguration
    3839from waeup.kofa.applicants.container import ApplicantsContainer
     
    730731        self.assertEqual(payment.p_category,'application')
    731732        self.assertEqual(payment.amount_auth,200.0)
    732         # Applicant is owner of the payment ticket.
    733         self.assertEqual(payment.getOwner(), self.applicant)
     733        # Applicant is payee of the payment ticket.
     734        self.assertEqual(IPaymentWebservice(payment).payee, 'John Tester')
    734735        # The pdf payment slip can't yet be opened
    735736        #self.browser.open(payment_url + '/payment_receipt.pdf')
Note: See TracChangeset for help on using the changeset viewer.