Changeset 7879
- Timestamp:
- 14 Mar 2012, 09:41:09 (13 years ago)
- Location:
- main/waeup.custom/trunk/src/waeup/custom/students
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.custom/trunk/src/waeup/custom/students/browser.py
r7822 r7879 21 21 FriendlyDateWidget, FriendlyDateDisplayWidget 22 22 ) 23 from waeup.custom.students.interfaces import ( 24 IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit 25 ) 23 from waeup.kofa.browser.layout import KofaPage 24 from waeup.kofa.students.interfaces import IStudentOnlinePayment 26 25 from waeup.kofa.students.browser import ( 27 26 StudentPersonalDisplayFormPage, StudentPersonalManageFormPage, … … 29 28 StudentClearanceDisplayFormPage 30 29 ) 30 from waeup.kofa.students.viewlets import RequestCallbackActionButton 31 from waeup.custom.students.interfaces import ( 32 IStudent, IStudentPersonal, IStudentClearance, IStudentClearanceEdit 33 ) 34 from waeup.custom.interfaces import MessageFactory as _ 31 35 32 36 class StudentPersonalDisplayFormPage(StudentPersonalDisplayFormPage): … … 65 69 form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year') 66 70 71 class InterswitchActionButton(RequestCallbackActionButton): 72 grok.order(2) 73 icon = 'actionicon_pay.png' 74 text = _('CollegePAY') 75 target = 'goto_interswitch' 67 76 77 class RequestCallbackActionButton(RequestCallbackActionButton): 78 grok.order(3) 79 icon = 'actionicon_call.png' 80 text = _('Request CollegePAY callback') 81 target = 'callback' 82 83 class InterswitchPage(KofaPage): 84 """ View which sends a POST request to the Interswitch 85 CollegePAY payment gateway. 86 """ 87 grok.context(IStudentOnlinePayment) 88 grok.name('goto_interswitch') 89 grok.template('goto_interswitch') 90 grok.require('waeup.payStudent') 91 92 label = _('Submit data to CollegePAY (Interswitch Payment Gateway)') 93 submit_button = _('Submit') 94 95 # Uniben product data (to be removed later) 96 product_id = '57' 97 currency = '566' 98 pay_item_id = '5700' 99 100 action = 'https://testwebpay.interswitchng.com/test_paydirect/webpay/pay.aspx' 101 site_redirect_url = 'http://localhost?echo=' 102 site_name = 'xyz.waeup.org' 103 provider_acct = '2345' 104 provider_bank_id = '8' 105 provider_item_name = 'Kofa Provider Fee' 106 institution_acct = '1234' 107 institution_bank_id = '9' 108 institution_name = 'Sample University' 109 110 def update(self): 111 if self.context.p_state != 'unpaid': 112 self.flash(_("Payment ticket can't be re-send to CollegePAY.")) 113 self.redirect(self.url(self.context, '@@index')) 114 return 115 xmldict = {} 116 self.student = self.context.getStudent() 117 self.amount = (self.context.amount_auth + self.context.surcharge_1 + 118 self.context.surcharge_2 + self.context.surcharge_3) 119 self.local_date_time = str(self.context.creation_date) 120 certificate = getattr(self.student['studycourse'],'certificate',None) 121 if certificate is not None: 122 xmldict['department'] = certificate.__parent__.__parent__.code 123 xmldict['faculty'] = certificate.__parent__.__parent__.__parent__.code 124 else: 125 xmldict['department'] = None 126 xmldict['faculty'] = None 127 xmldict['detail_ref'] = self.context.p_id 128 xmldict['provider_amt'] = self.context.surcharge_1 129 xmldict['provider_acct'] = self.provider_acct 130 xmldict['provider_bank_id'] = self.provider_bank_id 131 xmldict['provider_item_name'] = self.provider_item_name 132 xmldict['institution_amt'] = self.amount 133 xmldict['institution_acct'] = self.institution_acct 134 xmldict['institution_bank_id'] = self.institution_bank_id 135 xmldict['institution_item_name'] = self.context.p_category 136 xmldict['institution_name'] = self.institution_name 137 xmltext = """<payment_item_detail> 138 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 139 <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" /> 140 <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" /> 141 </item_details> 142 </payment_item_detail>""" % xmldict 143 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 144 return -
main/waeup.custom/trunk/src/waeup/custom/students/tests.py
r7822 r7879 128 128 #payment_url = self.browser.url 129 129 #self.browser.open(payment_url) 130 self.browser.getLink("Request callback").click()130 self.browser.getLink("Request CollegePAY callback").click() 131 131 self.assertMatches('...Valid callback received...', 132 132 self.browser.contents) -
main/waeup.custom/trunk/src/waeup/custom/students/utils.py
r7845 r7879 20 20 from waeup.kofa.students.utils import StudentsUtils 21 21 from waeup.kofa.students.interfaces import IStudentsUtils 22 from waeup.custom.interfaces import MessageFactory as _ 22 23 23 24 def get_school_fee(student, surcharge): … … 67 68 academic_session = grok.getSite()['configuration'][session] 68 69 except KeyError: 69 d['error'] = u'Session configuration object is not available.'70 d['error'] = _(u'Session configuration object is not available.') 70 71 return d 71 72 if category == 'transfer': … … 88 89 d['p_session'] += 1 89 90 if d['amount'] == 0: 90 d['error'] = u'Amount could not be determined.'91 d['error'] = _(u'Amount could not be determined.') 91 92 return d 92 93
Note: See TracChangeset for help on using the changeset viewer.