Changeset 8420 for main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
- Timestamp:
- 11 May 2012, 14:18:47 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r8404 r8420 32 32 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 33 33 from waeup.kofa.accesscodes import ( 34 invalidate_accesscode, get_access_code , create_accesscode)34 invalidate_accesscode, get_access_code) 35 35 from waeup.kofa.accesscodes.workflow import USED 36 36 from waeup.kofa.browser import ( … … 1130 1130 'b':self.context.p_id}) 1131 1131 1132 class OnlinePayment CallbackPage(UtilityView, grok.View):1132 class OnlinePaymentApprovePage(UtilityView, grok.View): 1133 1133 """ Callback view 1134 1134 """ 1135 1135 grok.context(IStudentOnlinePayment) 1136 grok.name('simulate_callback') 1137 grok.require('waeup.payStudent') 1138 1139 # This update method simulates a valid callback und must be 1140 # neutralized in the customization package. 1136 grok.name('approve') 1137 grok.require('waeup.managePortal') 1138 1141 1139 def update(self): 1142 if self.context.p_state == 'paid': 1143 self.flash(_('This ticket has already been paid.')) 1144 return 1145 student = self.context.getStudent() 1146 write_log_message(self,'valid callback: %s' % self.context.p_id) 1147 self.context.r_amount_approved = self.context.amount_auth 1148 self.context.r_code = u'00' 1149 self.context.p_state = 'paid' 1150 self.context.payment_date = datetime.utcnow() 1151 if self.context.p_category == 'clearance': 1152 # Create CLR access code 1153 pin, error = create_accesscode( 1154 'CLR',0,self.context.amount_auth,student.student_id) 1155 if error: 1156 self.flash(_('Valid callback received. ${a}', 1157 mapping = {'a':error})) 1158 return 1159 self.context.ac = pin 1160 elif self.context.p_category == 'schoolfee': 1161 # Create SFE access code 1162 pin, error = create_accesscode( 1163 'SFE',0,self.context.amount_auth,student.student_id) 1164 if error: 1165 self.flash(_('Valid callback received. ${a}', 1166 mapping = {'a':error})) 1167 return 1168 self.context.ac = pin 1169 elif self.context.p_category == 'bed_allocation': 1170 # Create HOS access code 1171 pin, error = create_accesscode( 1172 'HOS',0,self.context.amount_auth,student.student_id) 1173 if error: 1174 self.flash(_('Valid callback received. ${a}', 1175 mapping = {'a':error})) 1176 return 1177 self.context.ac = pin 1178 self.flash(_('Valid callback received.')) 1140 success, msg = self.context.approveStudentPayment() 1141 if success: 1142 write_log_message(self,'valid callback: %s' % self.context.p_id) 1143 self.flash(msg) 1179 1144 return 1180 1145 … … 1182 1147 self.redirect(self.url(self.context, '@@index')) 1183 1148 return 1149 1150 class OnlinePaymentFakeApprovePage(OnlinePaymentApprovePage): 1151 """ Approval view for students. 1152 1153 This view is used for browser tests only and 1154 must be neutralized in custom pages! 1155 """ 1156 1157 grok.name('fake_approve') 1158 grok.require('waeup.payStudent') 1184 1159 1185 1160 class ExportPDFPaymentSlipPage(UtilityView, grok.View):
Note: See TracChangeset for help on using the changeset viewer.