Changeset 11635 for main/waeup.fceokene
- Timestamp:
- 13 May 2014, 10:20:30 (11 years ago)
- Location:
- main/waeup.fceokene/trunk
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/CHANGES.txt
r11562 r11635 4 4 1.2dev (unreleased) 5 5 =================== 6 7 * Use base classes InterswitchPageApplicant and InterswitchPageStudent from 8 kofacustom.nigeria. 6 9 7 10 * File input fields brought into shape with Bootstrap 3. -
main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/browser.py
r10528 r11635 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.fceokene.students.interfaces import ICustomStudentOnlinePayment 29 26 from waeup.fceokene.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 … … 66 58 67 59 def update(self): 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 self.amount_auth = 100 * self.context.amount_auth 76 xmldict = {} 77 if certificate is not None: 78 xmldict['department'] = certificate.__parent__.__parent__.code 79 xmldict['faculty'] = certificate.__parent__.__parent__.__parent__.code 80 else: 81 xmldict['department'] = None 82 xmldict['faculty'] = None 83 self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category] 84 tz = getUtility(IKofaUtils).tzinfo 85 self.local_date_time = to_timezone( 86 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z") 87 self.site_redirect_url = self.url(self.context, 'request_webservice') 60 student, certificate, xmldict = super( 61 CustomInterswitchPageStudent, self).update() 88 62 # Provider data 89 63 provider_amt = 1600.0 … … 162 136 return 163 137 164 class InterswitchPageApplicant(KofaPage):138 class CustomInterswitchPageApplicant(InterswitchPageApplicant): 165 139 """ View which sends a POST request to the Interswitch 166 140 CollegePAY payment gateway. 167 141 """ 168 142 grok.context(ICustomApplicantOnlinePayment) 169 grok.require('waeup.payApplicant')170 grok.template('applicant_goto_interswitch')171 grok.name('goto_interswitch')172 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')173 submit_button = _('Submit')174 143 action = POST_ACTION 175 144 site_name = SITE_NAME … … 179 148 180 149 def update(self): 181 if self.context.p_state != 'unpaid': 182 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 183 self.redirect(self.url(self.context, '@@index')) 184 return 185 if self.context.__parent__.__parent__.expired \ 186 and self.context.__parent__.__parent__.strict_deadline: 187 self.flash(_("Payment ticket can't be send to CollegePAY. " 188 "Application period has expired.")) 189 self.redirect(self.url(self.context, '@@index')) 190 return 191 self.applicant = self.context.__parent__ 192 self.amount_auth = 100 * self.context.amount_auth 150 super(CustomInterswitchPageApplicant, self).update() 193 151 xmldict = {} 194 self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category]195 tz = getUtility(IKofaUtils).tzinfo196 self.local_date_time = to_timezone(197 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")198 self.site_redirect_url = self.url(self.context, 'request_webservice')199 xmldict['detail_ref'] = self.context.p_id200 152 # Provider data 201 153 provider_amt = 500.0 154 xmldict['detail_ref'] = self.context.p_id 202 155 xmldict['provider_amt'] = 100 * provider_amt 203 156 xmldict['provider_acct'] = PROVIDER_ACCT … … 229 182 230 183 231 class InterswitchPaymentRequestWebservicePageStudent(184 class CustomInterswitchPaymentRequestWebservicePageStudent( 232 185 InterswitchPaymentRequestWebservicePageStudent): 233 186 """ Request webservice view for the CollegePAY gateway … … 238 191 gateway_url = URL 239 192 240 class InterswitchPaymentRequestWebservicePageApplicant(193 class CustomInterswitchPaymentRequestWebservicePageApplicant( 241 194 InterswitchPaymentRequestWebservicePageApplicant): 242 195 """ Request webservice view for the CollegePAY gateway -
main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/tests.py
r10835 r11635 297 297 self.assertTrue( 298 298 'zope.mgr - ' 299 'waeup.fceokene.interswitch.browser. InterswitchPaymentRequestWebservicePageStudent - '299 'waeup.fceokene.interswitch.browser.CustomInterswitchPaymentRequestWebservicePageStudent - ' 300 300 'K1000000 - successful schoolfee payment: p3536651296379\n' 301 301 in logcontent) … … 416 416 self.assertTrue( 417 417 'zope.mgr - ' 418 'waeup.fceokene.interswitch.browser. InterswitchPaymentRequestWebservicePageApplicant - '418 'waeup.fceokene.interswitch.browser.CustomInterswitchPaymentRequestWebservicePageApplicant - ' 419 419 '%s - successful payment: p3536651296379\n' 420 420 % self.applicant.applicant_id in logcontent)
Note: See TracChangeset for help on using the changeset viewer.