Changeset 11638
- Timestamp:
- 13 May 2014, 10:44:59 (11 years ago)
- Location:
- main/kofacustom.skeleton/trunk
- Files:
-
- 2 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.skeleton/trunk/CHANGES.txt
r11564 r11638 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/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch/browser.py
r10765 r11638 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 kofacustom.skeleton.students.interfaces import ICustomStudentOnlinePayment 29 26 from kofacustom.skeleton.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 … … 125 94 return 126 95 127 class InterswitchPageApplicant(KofaPage):96 class CustomInterswitchPageApplicant(InterswitchPageApplicant): 128 97 """ View which sends a POST request to the Interswitch 129 98 CollegePAY payment gateway. 130 99 """ 131 100 grok.context(ICustomApplicantOnlinePayment) 132 grok.require('waeup.payApplicant')133 grok.template('applicant_goto_interswitch')134 grok.name('goto_interswitch')135 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')136 submit_button = _('Submit')137 101 action = POST_ACTION 138 102 site_name = SITE_NAME … … 142 106 143 107 def update(self): 144 if self.context.p_state != 'unpaid': 145 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 146 self.redirect(self.url(self.context, '@@index')) 147 return 148 if self.context.__parent__.__parent__.expired \ 149 and self.context.__parent__.__parent__.strict_deadline: 150 self.flash(_("Payment ticket can't be send to CollegePAY. " 151 "Application period has expired.")) 152 self.redirect(self.url(self.context, '@@index')) 153 return 154 self.applicant = self.context.__parent__ 155 self.amount_auth = 100 * self.context.amount_auth 108 super(CustomInterswitchPageApplicant, self).update() 156 109 xmldict = {} 157 self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category]158 tz = getUtility(IKofaUtils).tzinfo159 self.local_date_time = to_timezone(160 self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")161 self.site_redirect_url = self.url(self.context, 'request_webservice')162 110 provider_amt = 400.0 163 111 xmldict['institution_acct'] = '00000000000' … … 183 131 return 184 132 185 class InterswitchPaymentRequestWebservicePageStudent(133 class CustomInterswitchPaymentRequestWebservicePageStudent( 186 134 InterswitchPaymentRequestWebservicePageStudent): 187 135 """ Request webservice view for the CollegePAY gateway … … 192 140 gateway_url = URL 193 141 194 class InterswitchPaymentRequestWebservicePageApplicant(142 class CustomInterswitchPaymentRequestWebservicePageApplicant( 195 143 InterswitchPaymentRequestWebservicePageApplicant): 196 144 """ Request webservice view for the CollegePAY gateway -
main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch/tests.py
r11271 r11638 152 152 self.assertTrue( 153 153 'zope.mgr - ' 154 'kofacustom.skeleton.interswitch.browser. InterswitchPaymentRequestWebservicePageStudent - '154 'kofacustom.skeleton.interswitch.browser.CustomInterswitchPaymentRequestWebservicePageStudent - ' 155 155 'X1000000 - successful schoolfee payment: p3547789850240\n' 156 156 in logcontent)
Note: See TracChangeset for help on using the changeset viewer.