Changeset 7873
- Timestamp:
- 13 Mar 2012, 22:10:26 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r7868 r7873 1109 1109 return 1110 1110 1111 class InterswitchPage(KofaPage): 1112 """ View which sends a POST request to the Interswitch 1113 CollegePAY payment gateway. 1114 """ 1115 grok.context(IStudentOnlinePayment) 1116 grok.name('goto_interswitch') 1117 grok.template('goto_interswitch') 1118 grok.require('waeup.payStudent') 1119 1120 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)') 1121 submit_button = _('Submit') 1122 1123 # Uniben product data (to be removed later) 1124 product_id = '57' 1125 currency = '566' 1126 pay_item_id = '5700' 1127 1128 site_redirect_url = 'http://localhost?echo=' 1129 site_name = 'xyz.waeup.org' 1130 provider_amt = 1000 1131 provider_acct = '2345' 1132 provider_bank_id = '8' 1133 provider_item_name = 'Kofa Provider' 1134 institution_acct = '1234' 1135 institution_bank_id = '9' 1136 1137 def update(self): 1138 if self.context.p_state != 'unpaid': 1139 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 1140 self.redirect(self.url(self.context, '@@index')) 1141 return 1142 xmldict = {} 1143 student = self.context.getStudent() 1144 self.amount = (self.context.amount_auth + self.context.surcharge_1 + 1145 self.context.surcharge_2 + self.context.surcharge_3) 1146 self.txn_ref = xmldict['detail_ref'] = self.context.p_id 1147 self.cust_id = student.student_id 1148 self.cust_id_desc = self.context.p_item 1149 self.pay_item_name = xmldict['institution_item_name'] = self.context.p_category 1150 self.cust_name = student.display_fullname 1151 self.local_date_time = str(self.context.creation_date) 1152 self.certificate = getattr(student['studycourse'],'certificate',None) 1153 if self.certificate is not None: 1154 xmldict['department'] = self.certificate.__parent__.__parent__.code 1155 xmldict['faculty'] = self.certificate.__parent__.__parent__.__parent__.code 1156 else: 1157 xmldict['department'] = None 1158 xmldict['faculty'] = None 1159 xmldict['provider_amt'] = self.provider_amt 1160 xmldict['provider_acct'] = self.provider_acct 1161 xmldict['provider_bank_id'] = self.provider_bank_id 1162 xmldict['provider_item_name'] = self.provider_item_name 1163 xmldict['institution_amt'] = self.amount - self.provider_amt 1164 xmldict['institution_acct'] = self.institution_acct 1165 xmldict['institution_bank_id'] = self.institution_bank_id 1166 xmltext = """<payment_item_detail> 1167 <item_details detail_ref="%(detail_ref)s" college="institution" department="%(department)s" faculty="%(faculty)s"> 1168 <item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> 1169 <item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> 1170 </item_details> 1171 </payment_item_detail>""" % xmldict 1172 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 1173 return 1174 1111 1175 class ExportPDFPaymentSlipPage(UtilityView, grok.View): 1112 1176 """Deliver a PDF slip of the context. -
main/waeup.kofa/trunk/src/waeup/kofa/students/viewlets.py
r7833 r7873 322 322 return self.view.url(self.view.context, self.target) 323 323 324 class InterswitchActionButton(ManageActionButton): 325 grok.order(3) 326 grok.context(IStudentOnlinePayment) 327 grok.view(OnlinePaymentDisplayFormPage) 328 grok.require('waeup.payStudent') 329 icon = 'actionicon_pay.png' 330 text = _('CollegePAY') 331 target = 'goto_interswitch' 332 333 @property 334 def target_url(self): 335 if self.context.p_state != 'unpaid': 336 return '' 337 return self.view.url(self.view.context, self.target) 338 324 339 class AddBedTicketActionButton(ManageActionButton): 325 340 grok.order(1)
Note: See TracChangeset for help on using the changeset viewer.