Changeset 15702 for main/kofacustom.nigeria
- Timestamp:
- 25 Oct 2019, 09:59:20 (5 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria
- Files:
-
- 3 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/applicantsbrowser.py
r15600 r15702 40 40 try: 41 41 return getattr(grok.getSite()['configuration'][str(session)], 42 'etranzact_ enabled', False)42 'etranzact_webconnect_enabled', False) 43 43 except KeyError: 44 44 return False … … 50 50 grok.require('waeup.payApplicant') 51 51 icon = 'actionicon_pay.png' 52 text = _('Pay via eTranzact')52 text = _('Pay via Etranzact') 53 53 target = 'goto_etranzact' 54 54 … … 67 67 grok.require('waeup.payApplicant') 68 68 icon = 'actionicon_call.png' 69 text = _('Requery eTranzact History')69 text = _('Requery Etranzact History') 70 70 target = 'requery_history' 71 71 … … 79 79 80 80 class EtranzactPageApplicant(KofaPage): 81 """ View which sends a POST request to the eTranzact payment gateway.81 """ View which sends a POST request to the Etranzact payment gateway. 82 82 """ 83 83 grok.context(INigeriaApplicantOnlinePayment) … … 85 85 grok.template('goto_etranzact') 86 86 grok.require('waeup.payApplicant') 87 label = _('Pay via eTranzact')87 label = _('Pay via Etranzact') 88 88 submit_button = _('Pay now') 89 89 … … 102 102 def init_update(self): 103 103 if self.context.p_state == 'paid': 104 return _("Payment ticket can't be re-sent to eTranzact.")104 return _("Payment ticket can't be re-sent to Etranzact.") 105 105 now = datetime.utcnow() 106 106 if self.context.creation_date.tzinfo is not None: … … 112 112 # In contrast to the procedure in the Remita and Interswitch modules, 113 113 # we do not call requery_history but receive and evaluate 114 # the response form from eTranzact directly. This is possible115 # because eTranzact provides the FINAL_CHECKSUM hash value114 # the response form from Etranzact directly. This is possible 115 # because Etranzact provides the FINAL_CHECKSUM hash value 116 116 # which authenticates the response. 117 117 self.responseurl = self.url(self.context, 'receive_etranzact') 118 # Already now it becomes a eTranzact payment118 # Already now it becomes a Etranzact payment 119 119 self.context.r_company = u'etranzact' 120 120 hashargs = self.amount + self.terminal_id+self.transaction_id \ … … 166 166 167 167 class EtranzactRequestPaymentStatusPageApplicant(UtilityView, grok.View): 168 """ Request webservice view for the eTranzact gateway.168 """ Request webservice view for the Etranzact gateway. 169 169 """ 170 170 grok.context(INigeriaApplicantOnlinePayment) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/helpers.py
r15598 r15702 135 135 def process_response(payment, form, view, verify): 136 136 if not form or not form.get('SUCCESS', None): 137 msg = _('No valid response from eTranzact.')138 log = 'No valid response from eTranzact for payment %s' % payment.p_id137 msg = _('No valid response from Etranzact.') 138 log = 'No valid response from Etranzact for payment %s' % payment.p_id 139 139 payment.p_state = 'failed' 140 140 notify(grok.ObjectModifiedEvent(payment)) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/studentsbrowser.py
r15600 r15702 40 40 try: 41 41 return getattr(grok.getSite()['configuration'][str(session)], 42 'etranzact_ enabled', False)42 'etranzact_webconnect_enabled', False) 43 43 except KeyError: 44 44 return False … … 50 50 grok.require('waeup.payStudent') 51 51 icon = 'actionicon_pay.png' 52 text = _('Pay via eTranzact')52 text = _('Pay via Etranzact') 53 53 target = 'goto_etranzact' 54 54 … … 67 67 grok.require('waeup.payStudent') 68 68 icon = 'actionicon_call.png' 69 text = _('Requery eTranzact History')69 text = _('Requery Etranzact History') 70 70 target = 'requery_history' 71 71 … … 79 79 80 80 class EtranzactPageStudent(KofaPage): 81 """ View which sends a POST request to the eTranzact payment gateway.81 """ View which sends a POST request to the Etranzact payment gateway. 82 82 """ 83 83 grok.context(INigeriaStudentOnlinePayment) … … 85 85 grok.template('goto_etranzact') 86 86 grok.require('waeup.payStudent') 87 label = _('Pay via eTranzact')87 label = _('Pay via Etranzact') 88 88 submit_button = _('Pay now') 89 89 … … 102 102 def init_update(self): 103 103 if self.context.p_state == 'paid': 104 return _("Payment ticket can't be re-sent to eTranzact.")104 return _("Payment ticket can't be re-sent to Etranzact.") 105 105 now = datetime.utcnow() 106 106 if self.context.creation_date.tzinfo is not None: … … 112 112 # In contrast to the procedure in the Remita and Interswitch modules, 113 113 # we do not call requery_history but receive and evaluate 114 # the response form from eTranzact directly. This is possible115 # because eTranzact provides the FINAL_CHECKSUM hash value114 # the response form from Etranzact directly. This is possible 115 # because Etranzact provides the FINAL_CHECKSUM hash value 116 116 # which authenticates the response. 117 117 self.responseurl = self.url(self.context, 'receive_etranzact') 118 # Already now it becomes a eTranzact payment118 # Already now it becomes a Etranzact payment 119 119 self.context.r_company = u'etranzact' 120 120 hashargs = self.amount + self.terminal_id+self.transaction_id \ … … 166 166 167 167 class EtranzactRequestPaymentStatusPageStudent(UtilityView, grok.View): 168 """ Request webservice view for the eTranzact gateway.168 """ Request webservice view for the Etranzact gateway. 169 169 """ 170 170 grok.context(INigeriaStudentOnlinePayment) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py
r15600 r15702 48 48 SECRET_KEY = 'DEMO_KEY' 49 49 LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png' 50 51 # Valid transaction id in eTranzact system 50 PAYOUTLET_QUERY_URL = 'http://demo.etranzact.com/WebConnectPlus/query.jsp' 51 52 # Valid transaction id in Etranzact system 52 53 TID = 'p5689785145198' 53 54 … … 143 144 # which seems to be valid till next restart of the demo portal. 144 145 raw, formvars = query_history(HOST, self.terminal_id, TID, HTTPS) 145 # Now eTranzact is redirecting but the response is still useless146 # Now Etranzact is redirecting but the response is still useless 146 147 self.assertTrue('Redirecting...' in raw) 147 148 self.assertEqual(formvars['TRANSACTION_ID'], TID) … … 158 159 configuration = SessionConfiguration() 159 160 configuration.academic_session = datetime.now().year - 2 160 configuration.etranzact_enabled = True 161 configuration.etranzact_webconnect_enabled = True 162 configuration.etranzact_payoutlet_enabled = True 161 163 self.app['configuration'].addSessionConfiguration(configuration) 162 164 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 176 178 @external_test 177 179 def test_applicant_views(self): 178 # Manager can access eTranzact form179 self.browser.getLink("Pay via eTranzact").click()180 # Manager can access Etranzact form 181 self.browser.getLink("Pay via Etranzact").click() 180 182 self.assertTrue("Pay now" in self.browser.contents) 181 183 # Means of testing end here. … … 183 185 self.payment.p_id = TID 184 186 self.browser.open(self.payment_url) 185 self.browser.getLink("Requery eTranzact History").click()187 self.browser.getLink("Requery Etranzact History").click() 186 188 self.assertTrue('Wrong checksum.' in self.browser.contents) 187 189 # ... probably because responseurl of the transaction stored in the … … 199 201 def setUp(self): 200 202 super(EtranzactTestsStudents, self).setUp() 201 self.app['configuration']['2004'].etranzact_enabled = True 203 self.app['configuration']['2004'].etranzact_webconnect_enabled = True 204 self.app['configuration']['2004'].etranzact_payoutlet_enabled = True 202 205 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 203 206 self.browser.open(self.payments_path) … … 218 221 self.payment = self.student['payments'][self.value] 219 222 220 221 223 @external_test 222 224 def test_student_views(self): 223 # Manager can access eTranzact form224 self.browser.getLink("Pay via eTranzact").click()225 # Manager can access Etranzact form 226 self.browser.getLink("Pay via Etranzact").click() 225 227 self.assertTrue("Pay now" in self.browser.contents) 226 228 # Means of testing end here. … … 228 230 self.payment.p_id = TID 229 231 self.browser.open(self.payment_url) 230 self.browser.getLink("Requery eTranzact History").click()232 self.browser.getLink("Requery Etranzact History").click() 231 233 self.assertTrue('Wrong checksum.' in self.browser.contents) 232 234 # ... probably because responseurl and amount stored in the … … 235 237 # Means of testing end here again. 236 238 return 239 240 @external_test 241 def test_student_payoutlet_views(self): 242 self.browser.getLink("Enter Etranzact PIN").click() 243 self.browser.getControl(name="confirmation_number").value = '1234' 244 self.browser.getControl("Submit to Etranzact").click() -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interfaces.py
r15585 r15702 129 129 ) 130 130 131 etranzact_enabled = schema.Bool( 132 title = _(u'eTranzact integration enabled'), 131 etranzact_webconnect_enabled = schema.Bool( 132 title = _(u'Etranzact Webconnect integration enabled'), 133 default = False, 134 ) 135 136 etranzact_payoutlet_enabled = schema.Bool( 137 title = _(u'Etranzact Payoutlet integration enabled'), 133 138 default = False, 134 139 ) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py
r15529 r15702 49 49 grok.require('waeup.payStudent') 50 50 icon = 'actionicon_pay.png' 51 text = _(' CollegePAY')51 text = _('Pay via Interswitch') 52 52 target = 'goto_interswitch' 53 53 … … 78 78 grok.require('waeup.payStudent') 79 79 icon = 'actionicon_call.png' 80 text = _('Requery CollegePAY')80 text = _('Requery Interswitch History') 81 81 target = 'request_webservice' 82 82 -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/tests.py
r14737 r15702 71 71 def test_interswitch_form(self): 72 72 # Manager can access InterswitchForm 73 self.browser.getLink(" CollegePAY", index=0).click()73 self.browser.getLink("Pay via Interswitch", index=0).click() 74 74 # The total amount to be processed by Interswitch 75 75 # has been reduced by the Interswitch fee of 150 Nairas … … 100 100 self.assertEqual(self.student['payments'][value].gateway_amt, 0.0) 101 101 self.browser.getLink(value).click() 102 self.browser.getLink(" CollegePAY", index=0).click()102 self.browser.getLink("Pay via Interswitch", index=0).click() 103 103 # Split amounts have been set. 104 104 self.assertEqual(self.student['payments'][value].provider_amt, 0.0) … … 112 112 def test_interswitch_form_ticket_expired(self): 113 113 # Manager can access InterswitchForm 114 self.browser.getLink(" CollegePAY", index=0).click()114 self.browser.getLink("Pay via Interswitch", index=0).click() 115 115 self.assertMatches('...<input type="hidden" name="pay_item_id" />...', 116 116 self.browser.contents) … … 124 124 self.payment.creation_date -= delta 125 125 self.browser.open(self.payment_url) 126 self.browser.getLink(" CollegePAY", index=0).click()126 self.browser.getLink("Pay via Interswitch", index=0).click() 127 127 self.assertMatches( 128 128 '...This payment ticket is too old. Please create a new ticket...', … … 131 131 self.payment.creation_date += delta 132 132 self.browser.open(self.payment_url) 133 self.browser.getLink(" CollegePAY", index=0).click()133 self.browser.getLink("Pay via Interswitch", index=0).click() 134 134 self.assertMatches('...Total Amount Authorized:...', 135 135 self.browser.contents) … … 139 139 # We should not have TZ data in timestamps processed, but it looks 140 140 # like we get some with imports :-/ 141 self.browser.getLink(" CollegePAY", index=0).click()141 self.browser.getLink("Pay via Interswitch", index=0).click() 142 142 delta = timedelta(days=8) 143 143 self.payment.creation_date -= delta … … 146 146 self.payment.creation_date) 147 147 self.browser.open(self.payment_url) 148 self.browser.getLink(" CollegePAY", index=0).click()148 self.browser.getLink("Pay via Interswitch", index=0).click() 149 149 self.assertMatches( 150 150 '...This payment ticket is too old. Please create a new ticket...', … … 153 153 self.payment.creation_date += delta 154 154 self.browser.open(self.payment_url) 155 self.browser.getLink(" CollegePAY", index=0).click()155 self.browser.getLink("Pay via Interswitch", index=0).click() 156 156 self.assertMatches('...Total Amount Authorized:...', 157 157 self.browser.contents) … … 240 240 self.browser.contents) 241 241 # Manager can access InterswitchForm 242 self.browser.getLink(" CollegePAY", index=0).click()242 self.browser.getLink("Pay via Interswitch", index=0).click() 243 243 self.assertMatches('...Total Amount Authorized:...', 244 244 self.browser.contents) … … 249 249 self.payment.creation_date -= delta 250 250 self.browser.open(self.payment_url) 251 self.browser.getLink(" CollegePAY", index=0).click()251 self.browser.getLink("Pay via Interswitch", index=0).click() 252 252 self.assertMatches( 253 253 '...This payment ticket is too old. Please create a new ticket...', … … 255 255 delta = timedelta(days=2) 256 256 self.payment.creation_date += delta 257 self.browser.getLink(" CollegePAY", index=0).click()258 self.assertMatches('...Total Amount Authorized:...', 259 self.browser.contents) 260 257 self.browser.getLink("Pay via Interswitch", index=0).click() 258 self.assertMatches('...Total Amount Authorized:...', 259 self.browser.contents) 260 -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/payments/interfaces.py
r14738 r15702 78 78 vocabulary = SimpleKofaVocabulary( 79 79 (_('Interswitch'), 'interswitch'), 80 (_(' eTranzact'), 'etranzact'),80 (_('Etranzact'), 'etranzact'), 81 81 (_('Remita'), 'remita'), 82 82 (_('Scratch Card'), 'sc'),
Note: See TracChangeset for help on using the changeset viewer.