Changeset 11634
- Timestamp:
- 13 May 2014, 09:58:50 (11 years ago)
- Location:
- main/waeup.kwarapoly/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kwarapoly/trunk/CHANGES.txt
r11629 r11634 4 4 1.2dev (unreleased) 5 5 =================== 6 7 * Use base classes InterswitchPageApplicant and InterswitchPageStudent from 8 kofacustom.nigeria. 6 9 7 10 * More special payment fee categories added. -
main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py
r11629 r11634 23 23 from kofacustom.nigeria.interswitch.browser import ( 24 24 InterswitchPaymentRequestWebservicePageStudent, 25 InterswitchPaymentRequestWebservicePageApplicant 25 InterswitchPaymentRequestWebservicePageApplicant, 26 InterswitchPageStudent, InterswitchPageApplicant, 26 27 ) 27 from waeup.kofa.browser.layout import KofaPage, UtilityView28 from waeup.kofa.interfaces import IKofaUtils29 from waeup.kofa.utils.helpers import to_timezone30 28 from waeup.kwarapoly.students.interfaces import ICustomStudentOnlinePayment 31 29 from waeup.kwarapoly.applicants.interfaces import ICustomApplicantOnlinePayment … … 53 51 httplib.HTTPConnection.debuglevel = 0 54 52 55 class InterswitchPageStudent(KofaPage):53 class CustomInterswitchPageStudent(InterswitchPageStudent): 56 54 """ View which sends a POST request to the Interswitch 57 55 CollegePAY payment gateway. 58 56 """ 59 57 grok.context(ICustomStudentOnlinePayment) 60 grok.name('goto_interswitch')61 58 grok.template('student_goto_interswitch') 62 grok.require('waeup.payStudent')63 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')64 submit_button = _('Submit')65 59 action = POST_ACTION 66 60 site_name = SITE_NAME … … 73 67 74 68 def update(self): 75 #if self.context.p_state != 'unpaid': 76 if self.context.p_state == 'paid': 77 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 78 self.redirect(self.url(self.context, '@@index')) 79 return 80 81 student = self.student = self.context.student 82 certificate = getattr(student['studycourse'],'certificate',None) 83 self.amount_auth = 100 * self.context.amount_auth 84 xmldict = {} 85 if certificate is not None: 86 xmldict['department'] = certificate.__parent__.__parent__.code 87 xmldict['faculty'] = certificate.__parent__.__parent__.__parent__.code 88 else: 89 xmldict['department'] = None 90 xmldict['faculty'] = None 91 self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category] 92 tz = getUtility(IKofaUtils).tzinfo 93 self.local_date_time = to_timezone( 94 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z") 95 self.site_redirect_url = self.url(self.context, 'request_webservice') 69 student, certificate, xmldict = super( 70 CustomInterswitchPageStudent, self).update() 96 71 # Provider data 97 72 xmldict['detail_ref'] = self.context.p_id … … 243 218 return 244 219 245 class InterswitchPageApplicant(KofaPage):220 class CustomInterswitchPageApplicant(InterswitchPageApplicant): 246 221 """ View which sends a POST request to the Interswitch 247 222 CollegePAY payment gateway. 248 223 """ 249 224 grok.context(ICustomApplicantOnlinePayment) 250 grok.require('waeup.payApplicant')251 225 grok.template('applicant_goto_interswitch') 252 grok.name('goto_interswitch')253 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')254 submit_button = _('Submit')255 226 action = POST_ACTION 256 227 site_name = SITE_NAME … … 264 235 265 236 def update(self): 266 if self.context.p_state != 'unpaid': 267 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 268 self.redirect(self.url(self.context, '@@index')) 269 return 270 if self.context.__parent__.__parent__.expired \ 271 and self.context.__parent__.__parent__.strict_deadline: 272 self.flash(_("Payment ticket can't be send to CollegePAY. " 273 "Application period has expired.")) 274 self.redirect(self.url(self.context, '@@index')) 275 return 276 self.applicant = self.context.__parent__ 277 self.amount_auth = 100 * self.context.amount_auth 237 super(CustomInterswitchPageApplicant, self).update() 278 238 xmldict = {} 279 self.category = getUtility(280 IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category]281 tz = getUtility(IKofaUtils).tzinfo282 self.local_date_time = to_timezone(283 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")284 self.site_redirect_url = self.url(self.context, 'request_webservice')285 239 provider_amt = 300.0 286 240 dalash_amt = 200.0 … … 416 370 return 417 371 418 class InterswitchPaymentRequestWebservicePageStudent(372 class CustomInterswitchPaymentRequestWebservicePageStudent( 419 373 InterswitchPaymentRequestWebservicePageStudent): 420 374 """ Request webservice view for the CollegePAY gateway … … 425 379 gateway_url = URL 426 380 427 class InterswitchPaymentRequestWebservicePageApplicant(381 class CustomInterswitchPaymentRequestWebservicePageApplicant( 428 382 InterswitchPaymentRequestWebservicePageApplicant): 429 383 """ Request webservice view for the CollegePAY gateway
Note: See TracChangeset for help on using the changeset viewer.