Changeset 10030
- Timestamp:
- 17 Mar 2013, 08:40:59 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/payment.py
r9984 r10030 27 27 from waeup.kofa.interfaces import MessageFactory as _ 28 28 from waeup.kofa.payments import OnlinePayment 29 from waeup.kofa.payments.interfaces import IPay mentWebservice29 from waeup.kofa.payments.interfaces import IPayer 30 30 from waeup.kofa.applicants.interfaces import IApplicantOnlinePayment 31 31 from waeup.kofa.utils.helpers import attrs_to_fields … … 78 78 ApplicantOnlinePayment, omit=['display_item']) 79 79 80 class Pay mentWebservice(grok.Adapter):81 """An adapter to publish applicant data through a webservice.80 class Payer(grok.Adapter): 81 """An adapter to publish applicant data through a simple webservice. 82 82 """ 83 83 grok.context(IApplicantOnlinePayment) 84 grok.implements(IPay mentWebservice)84 grok.implements(IPayer) 85 85 86 86 @property 87 87 def display_fullname(self): 88 "Name of paye e"88 "Name of payer" 89 89 return self.context.__parent__.display_fullname 90 90 91 91 @property 92 92 def id(self): 93 "Id of paye e"93 "Id of payer" 94 94 return self.context.__parent__.applicant_id 95 95 96 96 @property 97 97 def reg_number(self): 98 "Reg number of paye e"98 "Reg number of payer" 99 99 return self.context.__parent__.reg_number 100 100 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r9929 r10030 37 37 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 38 38 from waeup.kofa.app import University 39 from waeup.kofa.payments.interfaces import IPay mentWebservice39 from waeup.kofa.payments.interfaces import IPayer 40 40 from waeup.kofa.configuration import SessionConfiguration 41 41 from waeup.kofa.applicants.container import ApplicantsContainer … … 758 758 self.assertEqual(payment.p_category,'application') 759 759 self.assertEqual(payment.amount_auth,200.0) 760 # Applicant is paye eof the payment ticket.760 # Applicant is payer of the payment ticket. 761 761 self.assertEqual( 762 IPay mentWebservice(payment).display_fullname, 'John Anthony Tester')762 IPayer(payment).display_fullname, 'John Anthony Tester') 763 763 self.assertEqual( 764 IPay mentWebservice(payment).id, self.applicant.applicant_id)765 self.assertEqual(IPay mentWebservice(payment).faculty, '')766 self.assertEqual(IPay mentWebservice(payment).department, '')764 IPayer(payment).id, self.applicant.applicant_id) 765 self.assertEqual(IPayer(payment).faculty, '') 766 self.assertEqual(IPayer(payment).department, '') 767 767 # The pdf payment slip can't yet be opened 768 768 #self.browser.open(payment_url + '/payment_receipt.pdf') -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_payment.py
r9533 r10030 22 22 from zope.interface import verify 23 23 from waeup.kofa.applicants.payment import ( 24 ApplicantOnlinePayment, ApplicantOnlinePaymentFactory, Pay mentWebservice)25 from waeup.kofa.payments.interfaces import IOnlinePayment, IPay mentWebservice24 ApplicantOnlinePayment, ApplicantOnlinePaymentFactory, Payer) 25 from waeup.kofa.payments.interfaces import IOnlinePayment, IPayer 26 26 27 27 class ApplicantOnlinePaymentFactoryTest(unittest.TestCase): … … 39 39 assert implemented_by.isOrExtends(IOnlinePayment) 40 40 41 def test_ webservice_interface(self):42 verify.verifyClass(IPay mentWebservice, PaymentWebservice)41 def test_payer_interface(self): 42 verify.verifyClass(IPayer, Payer) -
main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py
r9984 r10030 134 134 "Approve an online payment and set to paid." 135 135 136 class IPaymentWebservice(IKofaObject): 137 """An interface for a webservice. 136 class IPayer(IKofaObject): 137 """An interface for an adapter to publish student and applicant data 138 through a simple webservice. 138 139 139 140 """ 140 display_fullname = Attribute('Name of paye e')141 id = Attribute('Id of paye e')142 reg_number = Attribute('Reg number of paye e')143 matric_number = Attribute('Matric number of paye e')144 faculty = Attribute('Faculty of paye e')145 department = Attribute('Department of paye e')141 display_fullname = Attribute('Name of payer') 142 id = Attribute('Id of payer') 143 reg_number = Attribute('Reg number of payer') 144 matric_number = Attribute('Matric number of payer') 145 faculty = Attribute('Faculty of payer') 146 department = Attribute('Department of payer') -
main/waeup.kofa/trunk/src/waeup/kofa/students/payments.py
r9984 r10030 26 26 IStudentPaymentsContainer, IStudentNavigation, IStudentOnlinePayment) 27 27 from waeup.kofa.payments import PaymentsContainer, OnlinePayment 28 from waeup.kofa.payments.interfaces import IPay mentWebservice28 from waeup.kofa.payments.interfaces import IPayer 29 29 from waeup.kofa.utils.helpers import attrs_to_fields 30 30 from waeup.kofa.accesscodes import create_accesscode … … 142 142 StudentOnlinePayment, omit=['display_item']) 143 143 144 class Pay mentWebservice(grok.Adapter):145 """An adapter to publish student data through a webservice.144 class Payer(grok.Adapter): 145 """An adapter to publish student data through a simple webservice. 146 146 """ 147 147 grok.context(IStudentOnlinePayment) 148 grok.implements(IPay mentWebservice)148 grok.implements(IPayer) 149 149 150 150 @property 151 151 def display_fullname(self): 152 "Name of paye e"152 "Name of payer" 153 153 return self.context.student.display_fullname 154 154 155 155 @property 156 156 def id(self): 157 "Id of paye e"157 "Id of payer" 158 158 return self.context.student.student_id 159 159 160 160 @property 161 161 def matric_number(self): 162 "Matric number or reg number of paye e"162 "Matric number or reg number of payer" 163 163 return self.context.student.matric_number 164 164 165 165 @property 166 166 def reg_number(self): 167 "Reg number or reg number of paye e"167 "Reg number or reg number of payer" 168 168 return self.context.student.reg_number 169 169 170 170 @property 171 171 def faculty(self): 172 "Faculty of paye e"172 "Faculty of payer" 173 173 return self.context.student.faccode 174 174 175 175 @property 176 176 def department(self): 177 "Department of paye e"177 "Department of payer" 178 178 return self.context.student.depcode 179 179 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r10016 r10030 38 38 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 39 39 from waeup.kofa.app import University 40 from waeup.kofa.payments.interfaces import IPay mentWebservice40 from waeup.kofa.payments.interfaces import IPayer 41 41 from waeup.kofa.students.interfaces import IStudentsUtils 42 42 from waeup.kofa.students.student import Student … … 2313 2313 self.assertEqual(self.student['payments'][value].p_level, 200) 2314 2314 2315 # Student is the paye eof the payment ticket.2316 webservice = IPaymentWebservice(self.student['payments'][value])2317 self.assertEqual( webservice.display_fullname, 'Anna Tester')2318 self.assertEqual( webservice.id, self.student_id)2319 self.assertEqual( webservice.faculty, 'fac1')2320 self.assertEqual( webservice.department, 'dep1')2315 # Student is the payer of the payment ticket. 2316 payer = IPayer(self.student['payments'][value]) 2317 self.assertEqual(payer.display_fullname, 'Anna Tester') 2318 self.assertEqual(payer.id, self.student_id) 2319 self.assertEqual(payer.faculty, 'fac1') 2320 self.assertEqual(payer.department, 'dep1') 2321 2321 2322 2322 # We simulate the approval … … 2795 2795 2796 2796 class PublicPagesTests(StudentsFullSetup): 2797 # Tests for s webservices2797 # Tests for simple webservices 2798 2798 2799 2799 layer = FunctionalLayer -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_payment.py
r9533 r10030 23 23 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 24 24 from waeup.kofa.students.payments import ( 25 StudentOnlinePayment, StudentOnlinePaymentFactory, Pay mentWebservice)26 from waeup.kofa.payments.interfaces import IOnlinePayment, IPay mentWebservice25 StudentOnlinePayment, StudentOnlinePaymentFactory, Payer) 26 from waeup.kofa.payments.interfaces import IOnlinePayment, IPayer 27 27 from waeup.kofa.students.interfaces import IStudentNavigation 28 28 … … 49 49 assert implemented_by.isOrExtends(IStudentNavigation) 50 50 51 def test_ webservice_interface(self):52 verify.verifyClass(IPay mentWebservice, PaymentWebservice)51 def test_payer_interface(self): 52 verify.verifyClass(IPayer, Payer) -
main/waeup.kofa/trunk/src/waeup/kofa/webservices.py
r10007 r10030 20 20 from zope.component import getUtility 21 21 from zope.catalog.interfaces import ICatalog 22 from waeup.kofa.payments.interfaces import IPay mentWebservice22 from waeup.kofa.payments.interfaces import IPayer 23 23 from waeup.kofa.interfaces import IUniversity, academic_sessions_vocab 24 24 25 # Kofa's webservices to requery payments from outside 25 class PaymentDataWebservice(grok.View): 26 """A simple webservice to publish payment and payer details on request from 27 accepted IP addresses without authentication. 26 28 27 class KofaPaymentRequest(grok.View): 28 29 """ 29 30 grok.context(IUniversity) 30 31 grok.name('paymentrequest') … … 40 41 real_ip = self.request.get('HTTP_X_FORWARDED_FOR', None) 41 42 if real_ip: 42 self.context.logger.info(' KofaPaymentRequestcalled: %s' % real_ip)43 self.context.logger.info('PaymentDataWebservice called: %s' % real_ip) 43 44 if real_ip and self.ACCEPTED_IP: 44 45 if real_ip not in self.ACCEPTED_IP: … … 52 53 return 53 54 try: 54 owner = IPay mentWebservice(results[0])55 owner = IPayer(results[0]) 55 56 full_name = owner.display_fullname 56 57 reg_number = owner.reg_number
Note: See TracChangeset for help on using the changeset viewer.