Changeset 14938
- Timestamp:
- 16 Jan 2018, 15:06:52 (7 years ago)
- Location:
- main/kofacustom.dspg/trunk/src/kofacustom/dspg
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/browser.py
r14921 r14938 202 202 # amount_auth is being ignored. However, the sum of all split payments 203 203 # must coincide with the amount_auth configured in students/utils.py 204 xmldict['amt1'] = 100 * (1000 - GATEWAY_AMT)204 xmldict['amt1'] = 100 * 1000 205 205 xmldict['amt2'] = 100 * 500 206 206 xmldict['amt3'] = 100 * 900 207 207 xmldict['amt4'] = 100 * 500 208 xmltext = """<payment_item_detail> 208 209 if student.faccode == 'SPAT': 210 xmltext = """<payment_item_detail> 211 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 212 <item_detail item_id="1" item_name="Students Welfare" item_amt="%(amt2)d" bank_id="11" acct_num="0037892949" /> 213 <item_detail item_id="2" item_name="Anti-Cult Book" item_amt="%(amt3)d" bank_id="11" acct_num="0037892949" /> 214 </item_details> 215 </payment_item_detail>""" % xmldict 216 else: 217 xmltext = """<payment_item_detail> 209 218 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 210 219 <item_detail item_id="1" item_name="SUG" item_amt="%(amt1)d" bank_id="11" acct_num="0038079930" /> 211 220 <item_detail item_id="2" item_name="Students Welfare" item_amt="%(amt2)d" bank_id="11" acct_num="0037892949" /> 212 221 <item_detail item_id="3" item_name="Anti-Cult Book" item_amt="%(amt3)d" bank_id="11" acct_num="0037892949" /> 213 <item_detail item_id="4" item_name="NADESSTU " item_amt="%(amt4)d" bank_id="11" acct_num="0036375968" /> 214 </item_details> 215 </payment_item_detail>""" % xmldict 216 222 <item_detail item_id="4" item_name="NADESSTU" item_amt="%(amt4)d" bank_id="11" acct_num="0036375968" /> 223 </item_details> 224 </payment_item_detail>""" % xmldict 217 225 self.xml_data = """<input type="hidden" name="xml_data" value='%s' />""" % xmltext 218 226 self.context.provider_amt = provider_amt 219 227 self.context.gateway_amt = GATEWAY_AMT 220 221 228 hashargs = ( 222 229 self.context.p_id + -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/tests.py
r14921 r14938 67 67 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 68 68 self.browser.getControl("Create ticket").click() 69 self.assertTrue('You have to pay NADESU/SA/SUG Dues first' 70 in self.browser.contents) 71 payment = createObject('waeup.StudentOnlinePayment') 72 payment.p_category = u'dep_sug' 73 payment.p_session = self.student.current_session 74 payment.p_id = u'anyid' 75 payment.p_state = u'paid' 76 self.student['payments']['anykey'] = payment 77 self.browser.open(self.payments_path + '/addop') 78 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 79 self.browser.getControl("Create ticket").click() 69 80 self.assertMatches('...ticket created...', 70 81 self.browser.contents) 71 82 ctrl = self.browser.getControl(name='val_id') 72 self.value = ctrl.options[ 0]83 self.value = ctrl.options[1] 73 84 self.browser.getLink(self.value).click() 74 85 self.assertTrue('<span>30000.0</span>' in self.browser.contents) … … 88 99 self.browser.getControl(name="form.p_category").value = ['clearance'] 89 100 self.browser.getControl("Create ticket").click() 90 self.assertMatches('...ticket created...', 91 self.browser.contents) 92 ctrl = self.browser.getControl(name='val_id') 93 self.value = ctrl.options[1] 94 self.browser.getLink(self.value).click() 95 self.assertMatches('...Amount Authorized...', 96 self.browser.contents) 97 self.assertMatches( 98 '...<span>12345.0</span>...', 99 self.browser.contents) 100 self.payment_url = self.browser.url 101 self.browser.getLink("CollegePAY", index=0).click() 102 self.assertTrue('<input type="hidden" name="pay_item_id" value="103" />' in 103 self.browser.contents) 101 self.assertTrue('ticket created' in self.browser.contents) 102 ctrl = self.browser.getControl(name='val_id') 103 self.value = ctrl.options[2] 104 self.browser.getLink(self.value).click() 105 self.assertTrue('Amount Authorized' in self.browser.contents) 106 self.assertTrue('<span>12345.0</span>' in self.browser.contents) 107 self.payment_url = self.browser.url 108 self.browser.getLink("CollegePAY", index=0).click() 109 self.assertTrue('<input type="hidden" name="pay_item_id" value="103" />' 110 in self.browser.contents) 104 111 self.assertTrue( 105 112 '<input type="hidden" name="amount" value="1234500" />' in … … 142 149 self.browser.contents) 143 150 144 def test_ interswitch_form_pt_payments(self):151 def test_pt_payments(self): 145 152 # Add SPAT certificate 146 153 certificate = createObject('waeup.Certificate') … … 165 172 self.certificate.study_mode = 'nd_ft' 166 173 self.certificate.school_fee_3 = 30000.0 174 # Add dep_sug ticket 175 self.browser.open(self.payments_path + '/addop') 176 self.browser.getControl(name="form.p_category").value = ['dep_sug'] 177 self.browser.getControl("Create ticket").click() 178 self.assertMatches('...ticket created...', self.browser.contents) 179 ctrl = self.browser.getControl(name='val_id') 180 dep_sug_pid = ctrl.options[0] 181 self.assertTrue(self.student['payments'][dep_sug_pid].amount_auth == 1650) 182 183 self.browser.getLink(dep_sug_pid).click() 184 self.browser.getLink("CollegePAY", index=0).click() 185 self.student['payments'][dep_sug_pid].p_state = 'paid' 186 self.assertTrue( 187 '<item_detail item_id="1" item_name="Students Welfare" ' 188 'item_amt="50000" bank_id="11" acct_num="0037892949" />' 189 in self.browser.contents) 190 # Add school fee ticket 167 191 self.browser.open(self.payments_path + '/addop') 168 192 self.browser.getControl(name="form.p_category").value = ['schoolfee'] … … 170 194 self.assertMatches('...ticket created...', self.browser.contents) 171 195 ctrl = self.browser.getControl(name='val_id') 172 self.value = ctrl.options[ 0]196 self.value = ctrl.options[1] 173 197 self.browser.getLink(self.value).click() 174 198 self.assertTrue('<span>30000.0</span>' in self.browser.contents) … … 194 218 self.value = ctrl.options[0] 195 219 self.browser.getLink(self.value).click() 196 self.assertTrue('<span> 2900.0</span>' in self.browser.contents)197 self.payment_url = self.browser.url 198 self.browser.getLink("CollegePAY", index=0).click() 199 self.assertTrue('<item_detail item_id="1" item_name="SUG" item_amt=" 75000" bank_id="11" acct_num="0038079930" />'220 self.assertTrue('<span>3150.0</span>' in self.browser.contents) 221 self.payment_url = self.browser.url 222 self.browser.getLink("CollegePAY", index=0).click() 223 self.assertTrue('<item_detail item_id="1" item_name="SUG" item_amt="100000" bank_id="11" acct_num="0038079930" />' 200 224 in self.browser.contents) 201 225 self.assertTrue('<item_detail item_id="2" item_name="Students Welfare" item_amt="50000" bank_id="11" acct_num="0037892949" />' … … 203 227 self.assertTrue('<item_detail item_id="3" item_name="Anti-Cult Book" item_amt="90000" bank_id="11" acct_num="0037892949" />' 204 228 in self.browser.contents) 205 self.assertTrue('<item_detail item_id="4" item_name="NADESSTU 229 self.assertTrue('<item_detail item_id="4" item_name="NADESSTU" item_amt="50000" bank_id="11" acct_num="0036375968" />' 206 230 in self.browser.contents) 207 231 -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py
r14921 r14938 36 36 # prefix 37 37 STUDENT_ID_PREFIX = u'P' 38 39 def _dep_sug_paymentMade(self, student, session): 40 if len(student['payments']): 41 for ticket in student['payments'].values(): 42 if ticket.p_state == 'paid' and \ 43 ticket.p_category == 'dep_sug' and \ 44 ticket.p_session == session: 45 return True 46 return False 38 47 39 48 def setPaymentDetails(self, category, student, … … 87 96 amount = getattr(certificate, 'school_fee_4', 0.0) 88 97 else: 98 # Students are only allowed to pay school fee 99 # if current session dep_sug payment has been made. 100 if not self._dep_sug_paymentMade(student, 101 student.current_session): 102 return _('You have to pay NADESU/SA/SUG Dues first.'), None 89 103 if student.state == CLEARED: 90 104 if local(student): … … 164 178 amount = 13000.0 165 179 elif category == 'dep_sug': 166 amount = 2900.0 180 amount = 3150.0 # includes GATEWAY_AMT 181 if student.faccode == 'SPAT': 182 amount = 1650.0 # includes GATEWAY_AMT 167 183 else: 168 184 fee_name = category + '_fee'
Note: See TracChangeset for help on using the changeset viewer.