- Timestamp:
- 20 Sep 2019, 13:14:07 (5 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/helpers.py
r15596 r15598 134 134 135 135 def process_response(payment, form, view, verify): 136 if not form or not form.get(' RESPONSE_CODE', None):136 if not form or not form.get('SUCCESS', None): 137 137 msg = _('No valid response from eTranzact.') 138 138 log = 'No valid response from eTranzact for payment %s' % payment.p_id … … 140 140 notify(grok.ObjectModifiedEvent(payment)) 141 141 return False, msg, log 142 success = form.get(' RESPONSE_CODE', None)142 success = form.get('SUCCESS', None) 143 143 # Compute final checksum 144 144 transaction_id = payment.p_id … … 155 155 notify(grok.ObjectModifiedEvent(payment)) 156 156 return False, msg, log 157 payment.r_code = form.get(' RESPONSE_CODE', None)157 payment.r_code = form.get('SUCCESS', None) 158 158 payment.r_desc = form.get('STATUS_REASON', None) # MESSAGE also available 159 159 payment.r_amount_approved = float(form.get('AMOUNT', None)) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py
r15596 r15598 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 52 TID = 'p5689785145198' 50 53 51 54 def external_test(func): … … 137 140 # So in this case transaction fails. 138 141 139 # Peter has manually created a successful payment. Let's use this one. 140 transaction_id = 'etz1568638104web' 141 raw, formvars = query_history(HOST, self.terminal_id, 142 transaction_id, HTTPS) 142 # We manually created and tried to pay a transaction 143 # which seems to be valid till next restart of the demo portal. 144 raw, formvars = query_history(HOST, self.terminal_id, TID, HTTPS) 143 145 # Now eTranzact is redirecting but the response is still useless 144 146 self.assertTrue('Redirecting...' in raw) 145 print query_response147 self.assertEqual(formvars['TRANSACTION_ID'], TID) 146 148 return 147 149 … … 162 164 #IWorkflowState(self.student).setState('started') 163 165 super(EtranzactTestsApplicants, self).fill_correct_values() 164 self.applicantscontainer.application_fee = 1000.0166 self.applicantscontainer.application_fee = 3333.0 165 167 self.browser.getControl(name="form.nationality").value = ['NG'] 166 168 self.browser.getControl(name="transition").value = ['start'] … … 177 179 self.browser.getLink("Pay via eTranzact").click() 178 180 self.assertTrue("Pay now" in self.browser.contents) 179 181 # Means of testing end here. 182 # We requery an existing paiment now. 183 self.payment.p_id = TID 184 self.browser.open(self.payment_url) 185 self.browser.getLink("Requery eTranzact History").click() 186 self.assertTrue('Wrong checksum.' in self.browser.contents) 187 # ... probably because responseurl of the transaction stored in the 188 # system and the responseurl generated in process_response are 189 # different 190 # Means of testing end here again. 180 191 return 181 192
Note: See TracChangeset for help on using the changeset viewer.