Changeset 10978 for main/waeup.aaue/trunk/src
- Timestamp:
- 24 Jan 2014, 11:35:27 (11 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/etranzact
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py
r10954 r10978 40 40 from waeup.aaue.applicants.interfaces import ICustomApplicantOnlinePayment 41 41 42 ERROR_PART1 = ( 43 'PayeeName=N/A~' 44 + 'Faculty=N/A~' 45 + 'Department=N/A~' 46 + 'Level=N/A~' 47 + 'ProgrammeType=N/A~' 48 + 'StudyType=N/A~' 49 + 'Session=N/A~' 50 + 'PayeeID=N/A~' 51 + 'Amount=N/A~' 52 + 'FeeStatus=') 53 ERROR_PART2 = ( 54 '~Semester=N/A~' 55 + 'PaymentType=N/A~' 56 + 'MatricNumber=N/A~' 57 + 'Email=N/A~' 58 + 'PhoneNumber=N/A') 59 42 60 class CustomPaymentDataWebservice(PaymentDataWebservice): 43 61 """A simple webservice to publish payment and payer details on request from … … 55 73 def update(self, PAYEE_ID=None, PAYMENT_TYPE=None): 56 74 if PAYEE_ID == None: 57 self.output = 'Missing PAYEE_ID' # '-1'75 self.output = ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2 58 76 return 59 77 real_ip = self.request.get('HTTP_X_FORWARDED_FOR', None) … … 64 82 if real_ip and self.ACCEPTED_IP: 65 83 if real_ip not in self.ACCEPTED_IP: 66 self.output = 'Wrong IP address' # '-2'84 self.output = ERROR_PART1 + 'Wrong IP address' + ERROR_PART2 67 85 return 68 86 if PAYMENT_TYPE not in ('SCHOOL-FEE', 'ACCEPTANCE-FEE', 'APPLICATION-FEE'): 69 self.output = 'Invalid PAYMENT_TYPE' # '-3'87 self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2 70 88 return 71 89 … … 85 103 results = list(cat.searchResults(p_id=(PAYEE_ID, PAYEE_ID))) 86 104 if len(results) != 1: 87 self.output = 'Invalid PAYEE_ID' # '-1'105 self.output = ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2 88 106 return 89 107 if PAYMENT_TYPE == 'SCHOOL-FEE' \ 90 108 and not results[0].p_category.startswith('schoolfee'): 91 self.output = 'Wrong PAYMENT_TYPE' # '-5'109 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 92 110 return 93 111 if PAYMENT_TYPE == 'ACCEPTANCE-FEE' \ 94 112 and not results[0].p_category == 'clearance': 95 self.output = 'Wrong PAYMENT_TYPE' # '-6'113 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 96 114 return 97 115 if PAYMENT_TYPE == 'APPLICATION-FEE' \ 98 116 and not results[0].p_category == 'application': 99 self.output = 'Wrong PAYMENT_TYPE' # '-7'117 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 100 118 return 101 119 try: … … 110 128 level = owner.current_level 111 129 except (TypeError, AttributeError): 112 self.output = 'Unknown error, please contact Kofa administrator' # '-8'130 self.output = ERROR_PART1 + 'Unknown error' + ERROR_PART2 113 131 return 114 132 amount = results[0].amount_auth -
main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py
r10954 r10978 21 21 from waeup.kofa.configuration import SessionConfiguration 22 22 from waeup.aaue.testing import FunctionalLayer 23 from waeup.aaue.etranzact.browser import ERROR_PART1, ERROR_PART2 23 24 24 25 … … 108 109 109 110 self.browser.open('http://localhost/app/feerequest') 110 self.assertEqual(self.browser.contents, 'Missing PAYEE_ID')111 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2) 111 112 self.browser.open('http://localhost/app/feerequest?NONSENSE=nonsense') 112 self.assertEqual(self.browser.contents, 'Missing PAYEE_ID')113 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2) 113 114 self.browser.open( 114 115 'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=SCHOOL-FEE') 115 self.assertEqual(self.browser.contents, 'Invalid PAYEE_ID')116 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2) 116 117 self.browser.open( 117 118 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=NONSENSE' 118 119 % self.p_id) 119 self.assertEqual(self.browser.contents, 'Invalid PAYMENT_TYPE')120 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2) 120 121 self.browser.open( 121 122 'http://localhost/app/feerequest?PAYEE_ID=%s' 122 123 % self.p_id) 123 self.assertEqual(self.browser.contents, 'Invalid PAYMENT_TYPE')124 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2) 124 125 self.browser.open( 125 126 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=ACCEPTANCE-FEE' 126 127 % self.p_id) 127 self.assertEqual(self.browser.contents, 'Wrong PAYMENT_TYPE')128 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2) 128 129 self.browser.open( 129 130 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=APPLICATION-FEE' 130 131 % self.p_id) 131 self.assertEqual(self.browser.contents, 'Wrong PAYMENT_TYPE')132 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2) 132 133 133 134
Note: See TracChangeset for help on using the changeset viewer.