- Timestamp:
- 13 Dec 2022, 18:46:57 (2 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/helpers.py
r17219 r17221 414 414 return False, msg, log 415 415 416 # A typical JSON response ????????????????? 417 418 #payRef "FBN|WEB|MX76823|13-12-2022|935097929|608001" 419 #txnref "p6709347986663" 420 #amount "10000" 421 #apprAmt "10000" 422 #resp "00" 423 #desc "Approved+by+Financial+Institution" 424 #retRef "814212374638" 425 #cardNum "" 426 #mac "" 416 # A typical JSON response (test payment of Hector) 417 418 #{u'SplitAccounts': [], 419 #u'RemittanceAmount': 0, 420 #u'MerchantReference': u'p6709347986663', 421 #u'PaymentReference': u'FBN|WEB|MX76823|13-12-2022|935097929|608001', 422 #u'TransactionDate': u'2022-12-13T01:34:21', 423 #u'RetrievalReferenceNumber': u'814212374638', 424 #u'ResponseDescription': u'Approved by Financial Institution', 425 #u'Amount': 10000, 426 #u'CardNumber': u'', 427 #u'ResponseCode': u'00', 428 #u'BankCode': u'011'} 427 429 428 430 if not 'ResponseCode' in jr.keys() \ -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/tests.py
r16910 r17221 30 30 from kofacustom.nigeria.interswitch.helpers import ( 31 31 query_interswitch, get_SOAP_response_paydirect, SOAP_post, 32 create_paydirect_booking 32 create_paydirect_booking, 33 confirm_transaction 33 34 ) 34 35 from kofacustom.nigeria.testing import FunctionalLayer … … 37 38 # If you enable this, please make sure the external services 38 39 # do exist really and are not bothered by being spammed by a test programme. 39 EXTERNAL_TESTS_1 = True 40 EXTERNAL_TESTS_2 = True 40 EXTERNAL_TESTS_1 = False 41 EXTERNAL_TESTS_2 = False 42 EXTERNAL_TESTS_3 = True 41 43 42 44 PAYDIRECT_HOST = 'sandbox.interswitchng.com' … … 56 58 def external_test_2(func): 57 59 if not EXTERNAL_TESTS_2: 60 myself = __file__ 61 if myself.endswith('.pyc'): 62 myself = myself[:-1] 63 print "WARNING: external tests are skipped!" 64 print "WARNING: edit %s to enable them." % myself 65 return 66 return func 67 68 def external_test_3(func): 69 if not EXTERNAL_TESTS_3: 58 70 myself = __file__ 59 71 if myself.endswith('.pyc'): … … 401 413 self.assertMatches('...Total Amount Authorized:...', 402 414 self.browser.contents) 415 416 # WebCheckout tests 417 418 419 # https://webpay.interswitchng.com/collections/api/v1/gettransaction.json?merchantcode=MX76823&transactionreference=p6709347986663&amount=100 420 421 @external_test_3 422 def test_confirm_transaction(self): 423 host = 'webpay.interswitchng.com' 424 url = '/collections/api/v1/gettransaction.json' 425 https = True 426 merchant_code = 'MX76823' 427 payment = StudentOnlinePayment() 428 payment.p_id ='p4465649308559' 429 success, msg, log = confirm_transaction( 430 payment, merchant_code, host, url, https) 431 self.assertFalse(success) 432 self.assertTrue('Unsuccessful callback:' in msg) 433 self.assertTrue('Transaction not Found' in log) 434 435 payment.p_id ='p6709347986663' 436 payment.amount_auth = 1.0 437 success, msg, log = confirm_transaction( 438 payment, merchant_code, host, url, https) 439 self.assertTrue('Amount Inconsistency' in log) 440 payment.amount_auth = 100.0 441 success, msg, log = confirm_transaction( 442 payment, merchant_code, host, url, https) 443 self.assertEqual('Successful callback received', msg) 444 self.assertTrue(success) 445 self.assertTrue( 446 "{u'SplitAccounts': [], " 447 "u'RemittanceAmount': 0, " 448 "u'MerchantReference': u'p6709347986663', " 449 "u'PaymentReference': u'FBN|WEB|MX76823|13-12-2022|935097929|608001', " 450 "u'TransactionDate': u'2022-12-13T01:34:21', " 451 "u'RetrievalReferenceNumber': u'814212374638', " 452 "u'ResponseDescription': u'Approved by Financial Institution', " 453 "u'Amount': 10000, " 454 "u'CardNumber': u'', " 455 "u'ResponseCode': u'00', " 456 "u'BankCode': u'011'}" in log) 457 -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/webcheckoutbrowser.py
r17215 r17221 205 205 submit_button = _('Submit') 206 206 207 action = 'https://newwebpay.interswitchng.com/collections/w/pay'208 currency = '566'209 pay_item_id = 'Default_Payable_MX76823'210 merchant_code = 'MX76823'207 action = None 208 currency = None 209 pay_item_id = None 210 merchant_code = None 211 211 gateway_amt = GATEWAY_AMT 212 212 … … 261 261 grok.require('waeup.payApplicant') 262 262 263 merchant_code = 'MX76823'264 gateway_host = 'webpay.interswitchng.com'265 gateway_url = '/collections/api/v1/gettransaction.json'263 merchant_code = None 264 gateway_host = None 265 gateway_url = None 266 266 https = True 267 267 … … 295 295 return 296 296 297 class WebCheckoutConfirmTransaction RequestPageStudent(UtilityView, grok.View):297 class WebCheckoutConfirmTransactionPageStudent(UtilityView, grok.View): 298 298 """ Request webservice view for the WebCheckout gateway 299 299 """ … … 302 302 grok.require('waeup.payStudent') 303 303 304 merchant_code = 'MX76823'305 gateway_host = 'webpay.interswitchng.com'306 gateway_url = '/collections/api/v1/gettransaction.json'304 merchant_code = None 305 gateway_host = None 306 gateway_url = None 307 307 https = True 308 308
Note: See TracChangeset for help on using the changeset viewer.