- Timestamp:
- 6 Jul 2021, 05:52:21 (3 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
r16515 r16528 361 361 notify(grok.ObjectModifiedEvent(payment)) 362 362 return False, msg, log 363 if payment.r_amount_approved != payment. amount_auth:364 msg = _('Callback amount does not match .')363 if payment.r_amount_approved != payment.net_amt: 364 msg = _('Callback amount does not match net amount.') 365 365 log = 'unsuccessful callback for %s payment %s: callback amount %s does not match' % ( 366 366 payment.p_category, payment.p_id, amount) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/paydirectbrowser.py
r16496 r16528 26 26 from waeup.kofa.browser.layout import UtilityView, KofaPage, KofaFormPage, action 27 27 from waeup.kofa.browser.viewlets import ManageActionButton 28 from waeup.kofa.payments.interfaces import IPayer 28 29 from waeup.kofa.students.interfaces import IStudentsUtils 29 30 from waeup.kofa.students.browser import OnlinePaymentDisplayFormPage as OPDPStudent … … 117 118 self.gateway_url, True) 118 119 if result_xml.startswith('Connection error'): 120 IPayer(self.context).payer.writeLogMessage(self, result_xml) 119 121 return result_xml 120 122 doc=parseString(result_xml) 121 123 if not doc.getElementsByTagName('ResponseCode'): 124 IPayer(self.context).payer.writeLogMessage(self, 'invalid callback') 122 125 return _('Invalid callback from Interswitch') 123 126 rc = doc.getElementsByTagName('ResponseCode')[0].firstChild.data 127 IPayer(self.context).payer.writeLogMessage(self, 'response code: %s' % rc) 124 128 if rc not in ('100', '108'): 125 129 return 'Error response code from Interswitch: %s' % rc … … 148 152 @action('Requery now', style='primary') 149 153 def fetch(self): 150 student = self.context.student151 154 success, msg, log = fetch_booking_details( 152 155 self.context, self.merchant_id, self.gateway_host, 153 156 self.gateway_url, self.https) 154 student.writeLogMessage(self, log)157 IPayer(self.context).payer.writeLogMessage(self, log) 155 158 if not success: 156 159 self.flash(msg, type='warning') 157 160 self.redirect(self.url(self.context, '@@index')) 158 161 return 159 write_payments_log( student.student_id, self.context)160 flashtype, msg, log = self.context.doAfterStudentPayment()162 write_payments_log(IPayer(self.context).id, self.context) 163 flashtype, msg, log = IPayer(self.context).doAfterPayment() 161 164 if log is not None: 162 student.writeLogMessage(self, log)165 IPayer(self.context).payer.writeLogMessage(self, log) 163 166 self.flash(msg, type=flashtype) 164 self.redirect(self.url(self.context, '@@index'))165 167 return 166 168 … … 192 194 self.context.gateway_amt = self.gateway_amt 193 195 self.context.r_company = u'interswitch' 194 return195 196 @action('Requery now', style='primary')197 def fetch(self):198 applicant = self.context.__parent__199 success, msg, log = fetch_booking_details(200 self.context, self.merchant_id, self.gateway_host,201 self.gateway_url, self.https)202 applicant.writeLogMessage(self, log)203 if not success:204 self.flash(msg, type='warning')205 self.redirect(self.url(self.context, '@@index'))206 return207 write_payments_log(applicant.applicant_id, self.context)208 flashtype, msg, log = self.context.doAfterApplicantPayment()209 if log is not None:210 applicant.writeLogMessage(self, log)211 self.flash(msg, type=flashtype)212 196 return 213 197 -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/tests.py
r16514 r16528 303 303 payment.p_session = self.student.current_session 304 304 payment.p_item = u'My Certificate' 305 # p6214352306153 has been manu ylly set completed by Interswitch305 # p6214352306153 has been manually set completed by Interswitch 306 306 payment.p_id = u'p6214352306153' 307 payment.amount_auth = 700.0 # 300 will be added307 payment.amount_auth = 10.0 # 300 will be added 308 308 self.student['payments'][payment.p_id] = payment 309 309 result_xml = get_SOAP_response_paydirect( … … 314 314 amount=float(doc.getElementsByTagName('Amount')[0].firstChild.data) 315 315 self.assertEqual(status, 'Completed') 316 self.assertEqual(amount, payment.amount_auth + 300)316 self.assertEqual(amount, 1000) 317 317 self.assertEqual(refnumber, '60336214352306153') 318 318 # Now we login and check what will happen with the student after payment … … 321 321 self.browser.getLink("Pay via Interswitch PAYDirect").click() 322 322 # 300 has been added 323 self.assertEqual(payment.amount_auth, 1000) 323 self.assertEqual(payment.amount_auth, 310) 324 self.assertEqual(payment.net_amt, 10) 324 325 # Reference number has been saved 325 326 self.browser.getControl("Requery").click()
Note: See TracChangeset for help on using the changeset viewer.