Changeset 13784 for main/waeup.aaue/trunk/src/waeup/aaue
- Timestamp:
- 19 Mar 2016, 12:51:01 (9 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
r13783 r13784 85 85 self.output = ERROR_PART1 + 'Wrong IP address' + ERROR_PART2 86 86 return 87 if PAYMENT_TYPE not in ( 88 'SCHOOL-FEE-NEW', 89 'SCHOOL-FEE-RETURNING', 90 'SCHOOL-FEE-PLUS-NEW', 91 'SCHOOL-FEE-PLUS-RETURNING', 92 'SCHOOL-FEE-PG-NEW', 93 'SCHOOL-FEE-PG-RETURNING', 94 'SCHOOL-FEE-FIRST-INSTALMENT-PLUS', 95 'SCHOOL-FEE-SECOND-INSTALMENT', 96 'SCHOOL-FEE-BALANCE', 97 'ACCEPTANCE-FEE', 98 'ACCEPTANCE-FEE-PLUS', 99 'ACCEPTANCE-FEE-PG', 100 'APPLICATION-FEE', 101 'LATE-REGISTRATION', 102 'AAU-STUDENT-WELFARE-ASSURANCE', 103 'HOSTEL-ACCOMMODATION-FEE', 104 'AAU-LAPEL-FILE-FEE', 105 'MATRICULATION-GOWN-FEE', 106 'CONCESSIONAL-FEE', 107 'STUDENTS-UNION-DUES', 108 'MEDICAL-STUDENT-ASSURANCE-FEE'): 87 category_mapping = { 88 'SCHOOL-FEE-NEW': ('schoolfee',), 89 'SCHOOL-FEE-RETURNING': ('schoolfee',), 90 'SCHOOL-FEE-PLUS-NEW': ('schoolfee_incl',), 91 'SCHOOL-FEE-PLUS-RETURNING': ('schoolfee_incl',), 92 'SCHOOL-FEE-PG-NEW': ('schoolfee',), 93 'SCHOOL-FEE-PG-RETURNING': ('schoolfee',), 94 'SCHOOL-FEE-FIRST-INSTALMENT-PLUS': ('schoolfee_1',), 95 'SCHOOL-FEE-SECOND-INSTALMENT': ('schoolfee_2',), 96 'SCHOOL-FEE-BALANCE': ('schoolfee','schoolfee_incl', 97 'schoolfee_1','schoolfee_2'), 98 'ACCEPTANCE-FEE': ('clearance',), 99 'ACCEPTANCE-FEE-PLUS': ('clearance_incl',), 100 'ACCEPTANCE-FEE-PG': ('clearance',), 101 'APPLICATION-FEE': ('application',), 102 'LATE-REGISTRATION': ('late_registration',), 103 'AAU-STUDENT-WELFARE-ASSURANCE': ('welfare',), 104 'HOSTEL-ACCOMMODATION-FEE': ('hostel_maintenance',), 105 'AAU-LAPEL-FILE-FEE': ('lapel',), 106 'MATRICULATION-GOWN-FEE': ('matric_gown',), 107 'CONCESSIONAL-FEE': ('concessional',), 108 'STUDENTS-UNION-DUES': ('union',), 109 } 110 111 if PAYMENT_TYPE not in category_mapping.keys(): 109 112 self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2 110 113 return … … 130 133 amount = results[0].amount_auth 131 134 payment_type = results[0].category 135 p_category = results[0].p_category 132 136 programme_type = results[0].p_item 133 137 if not programme_type: … … 136 140 results[0].p_session).title 137 141 status = results[0].p_state 142 138 143 if status == 'paid': 139 144 self.output = ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2 140 145 return 141 if PAYMENT_TYPE.startswith('SCHOOL-FEE') \ 142 and not results[0].p_category.startswith('schoolfee'): 143 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 144 return 145 if '-FIRST' in PAYMENT_TYPE and not '_1' in results[0].p_category: 146 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 147 return 148 if '-SECOND' in PAYMENT_TYPE and not '_2' in results[0].p_category: 146 if p_category not in category_mapping[PAYMENT_TYPE]: 149 147 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 150 148 return 151 149 if student and PAYMENT_TYPE.endswith('-RETURNING') \ 152 150 and student.state == CLEARED: 153 self.output = ERROR_PART1 + ' Wrong PAYMENT_TYPE' + ERROR_PART2151 self.output = ERROR_PART1 + 'Not a returning student' + ERROR_PART2 154 152 return 155 153 if student and PAYMENT_TYPE.endswith('-NEW') \ 156 154 and student.state != CLEARED: 157 self.output = ERROR_PART1 + ' Wrong PAYMENT_TYPE' + ERROR_PART2155 self.output = ERROR_PART1 + 'Not a new student' + ERROR_PART2 158 156 return 159 157 if student and '-PG' in PAYMENT_TYPE and not student.is_postgrad: 160 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 158 self.output = ERROR_PART1 + 'Not a postgrad student' + ERROR_PART2 159 return 160 if student and '-PG' not in PAYMENT_TYPE and student.is_postgrad: 161 self.output = ERROR_PART1 + 'Postgrad student' + ERROR_PART2 161 162 return 162 163 if '-BALANCE' in PAYMENT_TYPE and results[0].p_item != 'Balance': 163 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 164 return 165 if '-PLUS' in PAYMENT_TYPE and not 'incl' in results[0].p_category: 166 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 167 return 168 if PAYMENT_TYPE.startswith('ACCEPTANCE-FEE') \ 169 and not results[0].p_category.startswith('clearance'): 170 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 171 return 172 if PAYMENT_TYPE == 'LATE-ADMISSION-PROCESSING' \ 173 and not results[0].p_category == 'late_registration': 174 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 175 return 176 if PAYMENT_TYPE == 'AAU-STUDENT-WELFARE-ASSURANCE' \ 177 and not results[0].p_category == 'welfare': 178 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 179 return 180 if PAYMENT_TYPE == 'HOSTEL-ACCOMMODATION-FEE' \ 181 and not results[0].p_category == 'hostel_maintenance': 182 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 183 return 184 if PAYMENT_TYPE == 'AAU-LAPEL-FILE-FEE' \ 185 and not results[0].p_category == 'lapel': 186 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 187 return 188 if PAYMENT_TYPE == 'MATRICULATION-GOWN-FEE' \ 189 and not results[0].p_category == 'matric_gown': 190 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 191 return 192 if PAYMENT_TYPE == 'CONCESSIONAL-FEE' \ 193 and not results[0].p_category == 'concessional': 194 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 195 return 196 if PAYMENT_TYPE == 'STUDENTS-UNION-DUES' \ 197 and not results[0].p_category == 'union': 198 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 199 return 200 if PAYMENT_TYPE == 'MEDICAL-STUDENT-ASSURANCE-FEE' \ 201 and not results[0].p_category == 'medical': 202 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 203 return 204 if PAYMENT_TYPE == 'APPLICATION-FEE' \ 205 and not results[0].p_category == 'application': 206 self.output = ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2 207 return 164 self.output = ERROR_PART1 + 'Not a balance payment' + ERROR_PART2 165 return 166 if not '-BALANCE' in PAYMENT_TYPE and results[0].p_item == 'Balance': 167 self.output = ERROR_PART1 + 'Balance payment' + ERROR_PART2 168 return 169 208 170 try: 209 171 owner = IPayer(results[0]) -
main/waeup.aaue/trunk/src/waeup/aaue/etranzact/tests.py
r13421 r13784 72 72 value2 = ctrl.options[1] 73 73 self.p_id = value2 74 self.payment = self.student['payments'][value2] 74 75 self.browser.getLink(value2).click() 75 76 self.assertMatches('...Amount Authorized...', … … 94 95 def test_webservice(self): 95 96 self.browser.open( 96 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE- NEW'97 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-PLUS-NEW' 97 98 % self.p_id) 98 99 self.assertEqual(self.browser.contents, … … 115 116 self.browser.open('http://localhost/app/feerequest') 116 117 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2) 118 117 119 self.browser.open('http://localhost/app/feerequest?NONSENSE=nonsense') 118 120 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2) 121 119 122 self.browser.open( 120 123 'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=SCHOOL-FEE-NEW') 121 124 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2) 125 122 126 self.browser.open( 123 127 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=NONSENSE' 124 128 % self.p_id) 125 129 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2) 130 126 131 self.browser.open( 127 132 'http://localhost/app/feerequest?PAYEE_ID=%s' 128 133 % self.p_id) 129 134 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2) 135 130 136 self.browser.open( 131 137 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=ACCEPTANCE-FEE' 132 138 % self.p_id) 133 139 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2) 140 134 141 self.browser.open( 135 142 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=APPLICATION-FEE' 136 143 % self.p_id) 137 144 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2) 145 138 146 self.student['payments'][self.p_id].p_state = 'paid' 139 147 self.browser.open( … … 148 156 % self.p_id) 149 157 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2) 158 159 self.browser.open( 160 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-BALANCE' 161 % self.p_id) 162 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Not a balance payment' + ERROR_PART2) 163 self.payment.p_item = u'Balance' 164 self.browser.open( 165 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-PLUS-RETURNING' 166 % self.p_id) 167 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Balance payment' + ERROR_PART2) 168 self.payment.p_item = u'CERT1' 169 170 self.payment.p_category = 'schoolfee' 171 self.certificate.study_mode = 'special_pg_ft' 150 172 self.browser.open( 151 173 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-RETURNING' 152 174 % self.p_id) 153 175 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Postgrad student' + ERROR_PART2) 176 177 self.certificate.study_mode = 'ug_ft' 178 self.browser.open( 179 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOL-FEE-RETURNING' 180 % self.p_id) 154 181 self.assertEqual(self.browser.contents, 155 182 'PayeeName=Anna Tester~' … … 164 191 'FeeStatus=unpaid~' 165 192 'Semester=N/A~' 166 'PaymentType=School Fee Plus~'193 'PaymentType=School Fee~' 167 194 'MatricNumber=E1000000~' 168 195 'Email=aa@aa.ng~'
Note: See TracChangeset for help on using the changeset viewer.