Changeset 8703 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 13 Jun 2012, 06:32:13 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/payment.py
r8702 r8703 27 27 from waeup.kofa.interfaces import MessageFactory as _ 28 28 from waeup.kofa.payments import OnlinePayment 29 from waeup.kofa.payments.interfaces import IPaymentWebservice 29 30 from waeup.kofa.applicants.interfaces import IApplicantOnlinePayment 30 31 from waeup.kofa.utils.helpers import attrs_to_fields … … 74 75 return self.doAfterApplicantPaymentApproval() 75 76 76 def getOwner(self): 77 """Return applicant. 78 """ 79 return self.__parent__ 77 ApplicantOnlinePayment = attrs_to_fields(ApplicantOnlinePayment) 80 78 81 ApplicantOnlinePayment = attrs_to_fields(ApplicantOnlinePayment) 79 class 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 82 88 83 89 # 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 35 35 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 36 36 from waeup.kofa.app import University 37 from waeup.kofa.payments.interfaces import IPaymentWebservice 37 38 from waeup.kofa.configuration import SessionConfiguration 38 39 from waeup.kofa.applicants.container import ApplicantsContainer … … 730 731 self.assertEqual(payment.p_category,'application') 731 732 self.assertEqual(payment.amount_auth,200.0) 732 # Applicant is ownerof 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') 734 735 # The pdf payment slip can't yet be opened 735 736 #self.browser.open(payment_url + '/payment_receipt.pdf') -
main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py
r8702 r8703 93 93 ) 94 94 95 def getOwner():96 "Payments usually have an owner."97 98 99 95 class ISCPayment(IPayment): 100 96 """A scratch card payment. … … 144 140 def approve(): 145 141 "Approve an online payment and set to paid." 142 143 class IPaymentWebservice(IKofaObject): 144 """An interface for a webservice. 145 146 """ 147 148 def payee(): 149 "Payments are usually paid by a payee." -
main/waeup.kofa/trunk/src/waeup/kofa/payments/payment.py
r8702 r8703 52 52 return payment_categories.getTermByToken(self.p_category).title 53 53 54 def getOwner(self):55 "Payments usually have an owner."56 return None57 58 54 # not used 59 55 class SCPayment(Payment): -
main/waeup.kofa/trunk/src/waeup/kofa/students/payments.py
r8702 r8703 26 26 IStudentPaymentsContainer, IStudentNavigation, IStudentOnlinePayment) 27 27 from waeup.kofa.payments import PaymentsContainer, OnlinePayment 28 from waeup.kofa.payments.interfaces import IPaymentWebservice 28 29 from waeup.kofa.utils.helpers import attrs_to_fields 29 30 from waeup.kofa.accesscodes import create_accesscode … … 59 60 except AttributeError: 60 61 return None 61 62 def getOwner(self):63 return self.getStudent()64 62 65 63 def doAfterStudentPayment(self): … … 132 130 StudentOnlinePayment = attrs_to_fields(StudentOnlinePayment) 133 131 132 class PaymentWebservice(grok.Adapter): 133 """An adapter to publish student data through a webservice. 134 """ 135 grok.context(IStudentOnlinePayment) 136 grok.implements(IPaymentWebservice) 137 138 @property 139 def payee(self): 140 return self.context.getStudent().display_fullname 141 134 142 # Student online payments must be importable. So we might need a factory. 135 143 class StudentOnlinePaymentFactory(grok.GlobalUtility): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r8702 r8703 36 36 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 37 37 from waeup.kofa.app import University 38 from waeup.kofa.payments.interfaces import IPaymentWebservice 38 39 from waeup.kofa.students.student import Student 39 40 from waeup.kofa.students.studylevel import StudentStudyLevel … … 1473 1474 self.assertEqual(self.student['payments'][value].p_level, 200) 1474 1475 1475 # Student is owner of the payment ticket. 1476 self.assertEqual(self.student['payments'][value].getOwner(), self.student) 1476 # Student is the payee of the payment ticket. 1477 self.assertEqual(IPaymentWebservice( 1478 self.student['payments'][value]).payee, 'Anna Tester') 1477 1479 1478 1480 # We simulate the approval
Note: See TracChangeset for help on using the changeset viewer.