Changeset 11633 for main/waeup.uniben/trunk
- Timestamp:
- 13 May 2014, 07:53:40 (11 years ago)
- Location:
- main/waeup.uniben/trunk
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/CHANGES.txt
r11611 r11633 4 4 1.2dev (unreleased) 5 5 =================== 6 7 * Use base classes InterswitchPageApplicant and InterswitchPageStudent from 8 kofacustom.nigeria. 6 9 7 10 * Viewlets for left thumb fingerprint minutiae file uploads added. -
main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser.py
r11478 r11633 18 18 import httplib 19 19 import grok 20 from zope.component import getUtility21 20 from kofacustom.nigeria.interswitch.browser import ( 22 21 InterswitchPaymentRequestWebservicePageApplicant, 23 InterswitchPaymentRequestWebservicePageStudent 22 InterswitchPaymentRequestWebservicePageStudent, 23 InterswitchPageStudent, InterswitchPageApplicant, 24 24 ) 25 from waeup.kofa.browser.layout import KofaPage26 from waeup.kofa.interfaces import IKofaUtils27 from waeup.kofa.utils.helpers import to_timezone28 25 from waeup.uniben.students.interfaces import ICustomStudentOnlinePayment 29 26 from waeup.uniben.applicants.interfaces import ICustomApplicantOnlinePayment … … 49 46 httplib.HTTPConnection.debuglevel = 0 50 47 51 class InterswitchPageStudent(KofaPage):48 class CustomInterswitchPageStudent(InterswitchPageStudent): 52 49 """ View which sends a POST request to the Interswitch 53 50 CollegePAY payment gateway. 54 51 """ 55 52 grok.context(ICustomStudentOnlinePayment) 56 grok.name('goto_interswitch')57 grok.template('student_goto_interswitch')58 grok.require('waeup.payStudent')59 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')60 submit_button = _('Submit')61 53 action = POST_ACTION 62 54 site_name = SITE_NAME … … 65 57 66 58 def update(self): 67 #if self.context.p_state != 'unpaid': 68 if self.context.p_state == 'paid': 69 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 70 self.redirect(self.url(self.context, '@@index')) 71 return 72 73 student = self.student = self.context.student 74 certificate = getattr(student['studycourse'],'certificate',None) 75 if certificate is None: 76 self.flash(_("Study course data are incomplete.")) 77 self.redirect(self.url(self.context, '@@index')) 78 return 79 self.amount_auth = 100 * self.context.amount_auth 80 xmldict = {} 81 if certificate is not None: 82 xmldict['department'] = certificate.__parent__.__parent__.code 83 xmldict['faculty'] = certificate.__parent__.__parent__.__parent__.code 84 else: 85 xmldict['department'] = None 86 xmldict['faculty'] = None 87 self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category] 88 tz = getUtility(IKofaUtils).tzinfo 89 self.local_date_time = to_timezone( 90 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z") 91 self.site_redirect_url = self.url(self.context, 'request_webservice') 59 student, certificate, xmldict = super( 60 CustomInterswitchPageStudent, self).update() 92 61 # Provider data 93 62 xmldict['detail_ref'] = self.context.p_id … … 165 134 return 166 135 167 class InterswitchPageApplicant(KofaPage):136 class CustomInterswitchPageApplicant(InterswitchPageApplicant): 168 137 """ View which sends a POST request to the Interswitch 169 138 CollegePAY payment gateway. 170 139 """ 171 140 grok.context(ICustomApplicantOnlinePayment) 172 grok.require('waeup.payApplicant')173 grok.template('applicant_goto_interswitch')174 grok.name('goto_interswitch')175 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')176 submit_button = _('Submit')177 141 action = POST_ACTION 178 142 site_name = SITE_NAME … … 182 146 183 147 def update(self): 184 if self.context.p_state != 'unpaid': 185 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 186 self.redirect(self.url(self.context, '@@index')) 187 return 188 if self.context.__parent__.__parent__.expired \ 189 and self.context.__parent__.__parent__.strict_deadline: 190 self.flash(_("Payment ticket can't be send to CollegePAY. " 191 "Application period has expired.")) 192 self.redirect(self.url(self.context, '@@index')) 193 return 194 self.applicant = self.context.__parent__ 195 self.amount_auth = 100 * self.context.amount_auth 148 super(CustomInterswitchPageApplicant, self).update() 196 149 xmldict = {} 197 self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category]198 tz = getUtility(IKofaUtils).tzinfo199 self.local_date_time = to_timezone(200 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")201 self.site_redirect_url = self.url(self.context, 'request_webservice')202 150 provider_amt = 400.0 203 151 if self.applicant.applicant_id.startswith('pg'): … … 233 181 return 234 182 235 class InterswitchPaymentRequestWebservicePageStudent(183 class CustomInterswitchPaymentRequestWebservicePageStudent( 236 184 InterswitchPaymentRequestWebservicePageStudent): 237 185 """ Request webservice view for the CollegePAY gateway … … 242 190 gateway_url = URL 243 191 244 class InterswitchPaymentRequestWebservicePageApplicant(192 class CustomInterswitchPaymentRequestWebservicePageApplicant( 245 193 InterswitchPaymentRequestWebservicePageApplicant): 246 194 """ Request webservice view for the CollegePAY gateway -
main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py
r11478 r11633 361 361 self.assertTrue( 362 362 'zope.mgr - ' 363 'waeup.uniben.interswitch.browser. InterswitchPaymentRequestWebservicePageStudent - '363 'waeup.uniben.interswitch.browser.CustomInterswitchPaymentRequestWebservicePageStudent - ' 364 364 'B1000000 - successful schoolfee payment: p3547789850240\n' 365 365 in logcontent)
Note: See TracChangeset for help on using the changeset viewer.