Changeset 14788
- Timestamp:
- 9 Aug 2017, 14:03:33 (7 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/helpers.py
r14769 r14788 116 116 payment.r_company = u'remita' 117 117 if payment.r_code not in ('00', '01'): 118 msg = _('Unsuccessful callback: ${a}', mapping = {'a': payment.r_desc})119 log = 'unsuccessful callbackfor %s payment %s: %s' % (118 msg = _('Unsuccessful response: ${a}', mapping = {'a': payment.r_desc}) 119 log = 'unsuccessful response for %s payment %s: %s' % ( 120 120 payment.p_category, payment.p_id, payment.r_desc) 121 121 payment.p_state = 'failed' … … 123 123 return False, msg, log 124 124 if round(payment.r_amount_approved, 0) != round(payment.amount_auth, 0): 125 msg = _(' Callbackamount does not match.')126 log = 'wrong callbackfor %s payment %s: %s' % (125 msg = _('Response amount does not match.') 126 log = 'wrong response for %s payment %s: %s' % ( 127 127 payment.p_category, payment.p_id, str(jr)) 128 128 payment.p_state = 'failed' … … 130 130 return False, msg, log 131 131 if jr['orderId'] != payment.p_id: 132 msg = _(' Callbackorder id does not match.')133 log = 'wrong callbackfor %s payment %s: %s' % (132 msg = _('Response order id does not match.') 133 log = 'wrong response for %s payment %s: %s' % ( 134 134 payment.p_category, payment.p_id, str(jr)) 135 135 payment.p_state = 'failed' … … 139 139 if not verify: 140 140 payment.payment_date = datetime.utcnow() 141 msg = _('Successful callbackreceived')142 log = 'valid callbackfor %s payment %s: %s' % (141 msg = _('Successful response received') 142 log = 'valid response for %s payment %s: %s' % ( 143 143 payment.p_category, payment.p_id, str(jr)) 144 144 notify(grok.ObjectModifiedEvent(payment)) -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/tests.py
r14787 r14788 166 166 assert qr == ( 167 167 False, 168 u'Unsuccessful callback: ${a}',169 u'unsuccessful callbackfor schoolfee payment %s: Transaction Pending'168 u'Unsuccessful response: ${a}', 169 u'unsuccessful response for schoolfee payment %s: Transaction Pending' 170 170 % self.payment.p_id) 171 171 … … 182 182 verify=False) 183 183 assert qr[0] == True 184 assert qr[1] == u'Successful callbackreceived'184 assert qr[1] == u'Successful response received' 185 185 186 186 @external_test … … 211 211 self.payment.r_pay_reference = self.rrr 212 212 self.browser.getLink("Requery Remita Payment Status").click() 213 self.assertTrue(' Callbackamount does not match.'213 self.assertTrue('Response amount does not match.' 214 214 in self.browser.contents) 215 215 self.payment.amount_auth = self.amount 216 216 self.browser.getLink("Requery Remita Payment Status").click() 217 self.assertTrue(' Callbackorder id does not match.'217 self.assertTrue('Response order id does not match.' 218 218 in self.browser.contents) 219 219 self.payment.p_id = self.orderId … … 224 224 self.assertEqual(self.payment.r_code, '01') 225 225 self.browser.getLink("Verify Remita Payment Status").click() 226 self.assertTrue('Successful callbackreceived' in self.browser.contents)226 self.assertTrue('Successful response received' in self.browser.contents) 227 227 return 228 228 … … 268 268 self.assertTrue( 269 269 'zope.anybody - kofacustom.nigeria.remita.webservices.PaymentNotificationListenerWebservice' 270 ' - K1000000 - valid callbackfor schoolfee payment %s: '270 ' - K1000000 - valid response for schoolfee payment %s: ' 271 271 % self.orderId in logcontent) 272 272 self.assertTrue( … … 321 321 self.assertTrue( 322 322 'zope.anybody - kofacustom.nigeria.remita.webservices.PaymentNotificationListenerWebservice' 323 ' - %s - valid callbackfor application payment %s: '323 ' - %s - valid response for application payment %s: ' 324 324 % (self.applicant.applicant_id, self.orderId) in logcontent) 325 325 self.assertTrue( -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/webservices.py
r14786 r14788 96 96 continue 97 97 ticket = results[0] 98 if ticket.p_state == 'waived': 99 failed += 1 100 continue 101 waspaid = (ticket.p_state == 'paid') 98 102 success, msg, log = query_remita( 99 103 ticket, self.merchantId, self.api_key, … … 105 109 ticket.student.writeLogMessage(self, log) 106 110 successful += 1 107 write_payments_log(ticket.student.student_id, ticket) 108 flashtype, msg, log = ticket.doAfterStudentPayment() 109 if log is not None: 110 ticket.student.writeLogMessage(self, log) 111 if not waspaid: 112 write_payments_log(ticket.student.student_id, ticket) 113 flashtype, msg, log = ticket.doAfterStudentPayment() 114 if log is not None: 115 ticket.student.writeLogMessage(self, log) 111 116 else: 112 117 applicant = ticket.__parent__ 113 118 applicant.writeLogMessage(self, log) 114 119 successful += 1 115 write_payments_log(applicant.applicant_id, ticket) 116 flashtype, msg, log = ticket.doAfterApplicantPayment() 117 if log is not None: 118 applicant.writeLogMessage(self, log) 120 if not waspaid: 121 write_payments_log(applicant.applicant_id, ticket) 122 flashtype, msg, log = ticket.doAfterApplicantPayment() 123 if log is not None: 124 applicant.writeLogMessage(self, log) 119 125 self.output = '%s (%s)' % (successful, failed + successful) 120 126 return
Note: See TracChangeset for help on using the changeset viewer.