- Timestamp:
- 7 Dec 2012, 08:59:30 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.futminna/trunk/src/waeup/futminna/interswitch/browser.py
r9750 r9785 19 19 import grok 20 20 from zope.component import getUtility 21 from kofacustom.nigeria.interswitch.helpers import query_interswitch 22 from waeup.kofa.browser.layout import KofaPage, UtilityView 21 from kofacustom.nigeria.interswitch.browser import ( 22 InterswitchPaymentRequestWebservicePageStudent 23 ) 24 from waeup.kofa.browser.layout import KofaPage 23 25 from waeup.kofa.interfaces import RETURNING, CLEARED, IKofaUtils 24 26 from waeup.kofa.utils.helpers import to_timezone 25 from waeup.kofa.students.viewlets import ApprovePaymentActionButton as APABStudent26 27 from waeup.futminna.students.interfaces import ICustomStudentOnlinePayment 27 28 from waeup.futminna.interfaces import MessageFactory as _ … … 34 35 INSTITUTION_NAME = 'FUTMinna' 35 36 CURRENCY = '566' 37 GATEWAY_AMT = 300.0 36 38 #QUERY_URL = 'https://webpay.interswitchng.com/paydirect/services/TransactionQueryURL.aspx' 37 39 #QUERY_URL = 'https://testwebpay.interswitchng.com/test_paydirect/services/TransactionQueryURL.aspx' … … 44 46 #URL = '/test_paydirect/services/TransactionQueryWs.asmx' 45 47 httplib.HTTPConnection.debuglevel = 0 46 47 class InterswitchActionButtonStudent(APABStudent):48 grok.order(1)49 grok.context(ICustomStudentOnlinePayment)50 grok.require('waeup.payStudent')51 icon = 'actionicon_pay.png'52 text = _('CollegePAY')53 target = 'goto_interswitch'54 55 @property56 def target_url(self):57 if self.context.p_state != 'unpaid':58 return ''59 return self.view.url(self.view.context, self.target)60 61 class InterswitchRequestWebserviceActionButtonStudent(APABStudent):62 grok.order(2)63 grok.context(ICustomStudentOnlinePayment)64 grok.require('waeup.payStudent')65 icon = 'actionicon_call.png'66 text = _('Requery CollegePAY')67 target = 'request_webservice'68 48 69 49 class InterswitchPageStudent(KofaPage): … … 111 91 xmldict['provider_bank_id'] = PROVIDER_BANK_ID 112 92 xmldict['provider_item_name'] = PROVIDER_ITEM_NAME 113 provider_amt = 1500 93 provider_amt = 1500.0 114 94 xmldict['provider_amt'] = 100 * provider_amt 115 95 … … 124 104 if self.context.p_category == 'schoolfee': 125 105 xmldict['institution_amt'] = 100 * ( 126 self.context.amount_auth - provider_amt - 300)106 self.context.amount_auth - provider_amt - GATEWAY_AMT) 127 107 if self.context.student.current_mode in ('pg_ft'): 128 108 self.pay_item_id = "11703" … … 183 163 elif self.context.p_category == 'clearance': 184 164 xmldict['institution_amt'] = 100 * ( 185 self.context.amount_auth - 300)165 self.context.amount_auth - GATEWAY_AMT) 186 166 xmldict['institution_acct'] = "1750005063" 187 167 xmldict['institution_bank_id'] = '120' 188 168 self.pay_item_id = "11706" 169 provider_amt = 0.0 189 170 190 171 elif 'maintenance' in self.context.p_category: 191 172 xmldict['institution_amt'] = 100 * ( 192 self.context.amount_auth - 300)173 self.context.amount_auth - GATEWAY_AMT) 193 174 xmldict['institution_acct'] = "2018856637" 194 175 xmldict['institution_bank_id'] = '8' 195 176 self.pay_item_id = "11705" 177 provider_amt = 0.0 196 178 197 179 # Interswitch amount is not part of the xml data … … 220 202 221 203 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 204 self.context.provider_amt = provider_amt 205 self.context.gateway_amt = GATEWAY_AMT 222 206 return 223 207 224 class InterswitchPaymentRequestWebservicePageStudent(UtilityView, grok.View): 208 class InterswitchPaymentRequestWebservicePageStudent( 209 InterswitchPaymentRequestWebservicePageStudent): 225 210 """ Request webservice view for the CollegePAY gateway 226 211 """ 227 212 grok.context(ICustomStudentOnlinePayment) 228 grok.name('request_webservice') 229 grok.require('waeup.payStudent') 230 231 def update(self): 232 if self.context.p_state == 'paid': 233 self.flash(_('This ticket has already been paid.')) 234 return 235 student = self.context.student 236 success, msg, log = query_interswitch( 237 self.context, PRODUCT_ID, HOST, URL) 238 student.writeLogMessage(self, log) 239 if not success: 240 self.flash(msg) 241 return 242 success, msg, log = self.context.doAfterStudentPayment() 243 if log is not None: 244 student.writeLogMessage(self, log) 245 self.flash(msg) 246 return 247 248 def render(self): 249 self.redirect(self.url(self.context, '@@index')) 250 return 213 product_id = PRODUCT_ID 214 gateway_host = HOST 215 gateway_url = URL
Note: See TracChangeset for help on using the changeset viewer.