Changeset 15734 for main/kofacustom.nigeria
- Timestamp:
- 1 Nov 2019, 11:39:34 (5 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/helpers.py
r15730 r15734 30 30 from waeup.kofa.utils.helpers import extract_formvars 31 31 from kofacustom.nigeria.interfaces import MessageFactory as _ 32 33 ERROR_PART1 = ( 34 'PayeeName=N/A~' 35 + 'Faculty=N/A~' 36 + 'Department=N/A~' 37 + 'Level=N/A~' 38 + 'ProgrammeType=N/A~' 39 + 'StudyType=N/A~' 40 + 'Session=N/A~' 41 + 'PayeeID=N/A~' 42 + 'Amount=N/A~' 43 + 'FeeStatus=') 44 ERROR_PART2 = ( 45 '~Semester=N/A~' 46 + 'PaymentType=N/A~' 47 + 'MatricNumber=N/A~' 48 + 'Email=N/A~' 49 + 'PhoneNumber=N/A') 32 50 33 51 def write_payments_log(id, payment): -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/payoutletwebservice.py
r15702 r15734 23 23 from waeup.kofa.payments.interfaces import IPayer 24 24 from waeup.kofa.webservices import PaymentDataWebservice 25 26 ERROR_PART1 = ( 27 'PayeeName=N/A~' 28 + 'Faculty=N/A~' 29 + 'Department=N/A~' 30 + 'Level=N/A~' 31 + 'ProgrammeType=N/A~' 32 + 'StudyType=N/A~' 33 + 'Session=N/A~' 34 + 'PayeeID=N/A~' 35 + 'Amount=N/A~' 36 + 'FeeStatus=') 37 ERROR_PART2 = ( 38 '~Semester=N/A~' 39 + 'PaymentType=N/A~' 40 + 'MatricNumber=N/A~' 41 + 'Email=N/A~' 42 + 'PhoneNumber=N/A') 25 from kofacustom.nigeria.etranzact.helpers import ERROR_PART1, ERROR_PART2 43 26 44 27 class NigeriaPaymentDataWebservice(PaymentDataWebservice): … … 74 57 return 75 58 payment_cats_dict = getUtility(IKofaUtils).PAYMENT_CATEGORIES 76 if PAYMENT_TYPE not in self.CATEGORY_MAPPING.keys() \77 and PAYMENT_TYPE.lower() not in payment_cats_dict.keys() :59 if not PAYMENT_TYPE or (PAYMENT_TYPE not in self.CATEGORY_MAPPING.keys() \ 60 and PAYMENT_TYPE.lower() not in payment_cats_dict.keys()): 78 61 self.output = ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2 79 62 return -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py
r15730 r15734 32 32 from kofacustom.nigeria.students.payments import NigeriaStudentOnlinePayment 33 33 from kofacustom.nigeria.testing import FunctionalLayer 34 from kofacustom.nigeria.etranzact.helpers import query_history, query_payoutlet 34 from kofacustom.nigeria.etranzact.helpers import ( 35 query_history, query_payoutlet, ERROR_PART1, ERROR_PART2) 35 36 36 37 #from kofacustom.nigeria.etranzact.helpers import (query_etranzact) … … 269 270 self.assertEqual(self.payment.r_desc, 'Test Test Test-CLEARANCE -001-p5723474039401') 270 271 return 272 273 def test_webservice(self): 274 self.browser.open( 275 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOLFEE' 276 % self.payment.p_id) 277 self.assertEqual(self.browser.contents, 278 'PayeeName=Anna Tester~' 279 'Faculty=fac1~Department=dep1~' 280 'Level=100~ProgrammeType=CERT1~' 281 'StudyType=ug_ft~Session=2004/2005~' 282 'PayeeID=%s~' 283 'Amount=40000.0~FeeStatus=unpaid~' 284 'Semester=N/A~PaymentType=School Fee~' 285 'MatricNumber=234~Email=aa@aa.ng~' 286 'PhoneNumber=1234' % self.payment.p_id) 287 self.browser.open('http://localhost/app/feerequest') 288 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2) 289 290 self.browser.open('http://localhost/app/feerequest?NONSENSE=nonsense') 291 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Missing PAYEE_ID' + ERROR_PART2) 292 293 self.browser.open( 294 'http://localhost/app/feerequest?PAYEE_ID=nonsense&PAYMENT_TYPE=SCHOOLFEE') 295 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYEE_ID' + ERROR_PART2) 296 297 self.browser.open( 298 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=NONSENSE' 299 % self.payment.p_id) 300 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2) 301 302 self.browser.open( 303 'http://localhost/app/feerequest?PAYEE_ID=%s' % self.payment.p_id) 304 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Invalid PAYMENT_TYPE' + ERROR_PART2) 305 306 self.browser.open( 307 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=CLEARANCE' 308 % self.payment.p_id) 309 self.assertEqual(self.browser.contents, ERROR_PART1 + 'Wrong PAYMENT_TYPE' + ERROR_PART2) 310 311 # Change payment state 312 self.student['payments'][self.payment.p_id].p_state = 'paid' 313 314 self.browser.open( 315 'http://localhost/app/feerequest?PAYEE_ID=%s&PAYMENT_TYPE=SCHOOLFEE' 316 % self.payment.p_id) 317 self.assertEqual(self.browser.contents, ERROR_PART1 + 'PAYEE_ID already used' + ERROR_PART2)
Note: See TracChangeset for help on using the changeset viewer.