Changeset 14765 for main/kofacustom.nigeria/trunk/src/kofacustom
- Timestamp:
- 4 Aug 2017, 05:04:42 (7 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita
- Files:
-
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/browser_templates/goto_remita.pt
r14764 r14765 35 35 Customer Name:</td> 36 36 <td> 37 <span tal:replace="view/ student/display_fullname">CUSTNAME</span>37 <span tal:replace="view/customer/display_fullname">CUSTNAME</span> 38 38 </td> 39 39 </tr> … … 42 42 Email Address:</td> 43 43 <td> 44 <span tal:replace="view/ student/email">EMAIL</span>44 <span tal:replace="view/customer/email">EMAIL</span> 45 45 </td> 46 46 </tr> -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/studentsbrowser.py
r14764 r14765 27 27 from waeup.kofa.students.interfaces import IStudentsUtils 28 28 from waeup.kofa.students.browser import OnlinePaymentDisplayFormPage as OPDPStudent 29 from waeup.kofa.applicants.browser import OnlinePaymentDisplayFormPage as OPDPApplicant30 29 from kofacustom.nigeria.remita.helpers import ( 31 30 get_JSON_POST_response, query_remita, write_payments_log) 32 31 from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment 33 32 from kofacustom.nigeria.students.interfaces import INigeriaStudentOnlinePayment 34 from kofacustom.nigeria.applicants.interfaces import INigeriaApplicantOnlinePayment35 33 from kofacustom.nigeria.interfaces import MessageFactory as _ 34 35 grok.templatedir('browser_templates') 36 36 37 37 def module_activated(session): … … 123 123 self.flash(_('Remita Retrieval Reference not found.'), type='danger') 124 124 return 125 126 125 # Remita sends a POST request which may contain more information 127 126 # if a payment was not successful. … … 130 129 self.flash('Transaction status message from Remita: %s' 131 130 % resp.get('status'), type='warning') 132 133 131 success, msg, log = query_remita( 134 132 self.context, … … 139 137 self.https, 140 138 False) 141 142 139 student.writeLogMessage(self, log) 143 140 if not success: … … 160 157 grok.context(INigeriaStudentOnlinePayment) 161 158 grok.name('verify_payment_status') 162 grok.require('waeup. payStudent')159 grok.require('waeup.manageStudent') 163 160 164 161 # Here we use Remita test portal data … … 180 177 self.flash(_('Remita Retrieval Reference not found.'), type='danger') 181 178 return 182 183 179 # Remita sends a POST request which may contain more information 184 180 # if a payment was not successful. … … 187 183 self.flash('Transaction status message from Remita: %s' 188 184 % resp.get('status'), type='warning') 189 190 185 success, msg, log = query_remita( 191 186 self.context, … … 196 191 self.https, 197 192 True) 198 199 193 student.writeLogMessage(self, log) 200 194 if not success: 201 195 self.flash(msg, type='danger') 202 196 return 203 write_payments_log(student.student_id, self.context) 204 flashtype, msg, log = self.context.doAfterStudentPayment() 205 if log is not None: 206 student.writeLogMessage(self, log) 207 self.flash(msg, type=flashtype) 197 self.flash(msg) 208 198 return 209 199 … … 220 210 grok.context(INigeriaOnlinePayment) 221 211 grok.name('goto_remita') 222 grok.template(' student_goto_remita')212 grok.template('goto_remita') 223 213 grok.require('waeup.payStudent') 224 214 label = _('Pay via Remita') … … 255 245 if time_delta.days > 7: 256 246 return _("This payment ticket is too old. Please create a new ticket.") 257 student = self.context.student 258 certificate = getattr(student['studycourse'],'certificate',None) 247 certificate = getattr(self.context.student['studycourse'],'certificate',None) 259 248 if certificate is None: 260 249 return _("Study course data are incomplete.") 261 250 kofa_utils = getUtility(IKofaUtils) 262 251 student_utils = getUtility(IStudentsUtils) 263 if student_utils.samePaymentMade(s tudent, self.context.p_category,252 if student_utils.samePaymentMade(self.context.student, self.context.p_category, 264 253 self.context.p_item, self.context.p_session): 265 254 return _("This type of payment has already been made.") 266 255 self.responseurl = self.url(self.context, 'request_payment_status') 267 self.student = student268 256 resp = get_JSON_POST_response( 269 257 merchantId=self.merchantId, … … 276 264 url=self.init_url, 277 265 https=self.https, 278 fullname=self. student.display_fullname,279 email=self. student.email,266 fullname=self.context.student.display_fullname, 267 email=self.context.student.email, 280 268 lineitems=self.lineitems) 281 269 if resp.get('error'): … … 288 276 hashargs = self.merchantId + self.rrr + self.api_key 289 277 self.hashvalue = hashlib.sha512(hashargs).hexdigest() 278 self.customer = self.context.student 290 279 return 291 280 -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/tests.py
r14756 r14765 122 122 123 123 # successful transaction 124 # (hopefully this transaction remain in the Remita database)124 # (hopefully this transaction remains in the Remita database) 125 125 orderId = '3456346346' 126 126 rrr = u'280007640804' … … 185 185 @external_test 186 186 def test_remita_form(self): 187 # Manager can access InterswitchForm187 # Manager can access Remita form 188 188 self.browser.getLink("Pay via Remita").click() 189 189 # The RRR has been retrieved … … 197 197 @external_test 198 198 def test_requery_verify_payment_status(self): 199 # Manager can access InterswitchForm199 # Manager can access Remita form 200 200 self.browser.getLink("Requery Remita Payment Status").click() 201 201 self.assertTrue('Remita Retrieval Reference not found.' … … 216 216 self.assertEqual(self.payment.r_code, '01') 217 217 self.browser.getLink("Verify Remita Payment Status").click() 218 self.assertTrue('Successful payment' in self.browser.contents)218 self.assertTrue('Successful callback received' in self.browser.contents) 219 219 return
Note: See TracChangeset for help on using the changeset viewer.