Changeset 16760 for main/kofacustom.dspg
- Timestamp:
- 28 Jan 2022, 08:17:50 (3 years ago)
- Location:
- main/kofacustom.dspg/trunk/src/kofacustom/dspg
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/browser.py
r16753 r16760 30 30 from kofacustom.dspg.applicants.interfaces import ICustomApplicantOnlinePayment 31 31 from kofacustom.dspg.interfaces import MessageFactory as _ 32 from kofacustom.dspg.students.utils import MICROSOFT_FEE 32 from kofacustom.dspg.students.utils import ( 33 MICROSOFT_FEE, DEVELOP_FEE, TECH_FEE) 33 34 34 35 PRODUCT_ID = '7269' # must be provided by Interswitch … … 140 141 tech_fee = 0.0 141 142 microsoft_fee = 0.0 143 develop_fee = 0.0 142 144 if self.context.p_category.startswith('schoolfee'): 143 145 self.pay_item_id = '102' 144 146 if self.context.p_item != 'Balance': 145 147 provider_amt = 2800.0 146 tech_fee = 1200.0147 if student.state == RETURNING:148 microsoft_fee = MICROSOFT_FEE148 tech_fee = TECH_FEE(student) 149 develop_fee = DEVELOP_FEE(student) 150 microsoft_fee = MICROSOFT_FEE(student) 149 151 if student.faccode == 'SPAT': 150 152 xmldict['institution_acct'] = '1556004203' … … 236 238 xmldict['provider_amt'] = 100 * provider_amt 237 239 xmldict['tech_fee'] = 100 * tech_fee 240 xmldict['develop_fee'] = 100 * develop_fee 238 241 xmldict['microsoft_fee'] = 100 * microsoft_fee 239 242 xmldict['institution_item_name'] = self.context.category 240 243 xmldict['institution_name'] = INSTITUTION_NAME 241 244 xmldict['institution_amt'] = institution_amt = 100 * ( 242 self.context.amount_auth - provider_amt - tech_fee - microsoft_fee - GATEWAY_AMT) 245 self.context.amount_auth - provider_amt - tech_fee - 246 develop_fee - microsoft_fee - GATEWAY_AMT) 243 247 244 248 if provider_amt == 0: … … 248 252 </item_details> 249 253 </payment_item_detail>""" % xmldict 250 elif tech_fee == 0: 254 elif tech_fee == 0: # implies develop_fee == 0 251 255 xmltext = """<payment_item_detail> 252 256 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> … … 261 265 <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" /> 262 266 <item_detail item_id="3" item_name="Technology Fee" item_amt="%(tech_fee)d" bank_id="10" acct_num="0032256360" /> 267 <item_detail item_id="4" item_name="Developmental Levy" item_amt="%(develop_fee)d" bank_id="51" acct_num="1012963301" /> 263 268 </item_details> 264 269 </payment_item_detail>""" % xmldict … … 269 274 <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" /> 270 275 <item_detail item_id="3" item_name="Technology Fee" item_amt="%(tech_fee)d" bank_id="10" acct_num="0032256360" /> 271 <item_detail item_id="4" item_name="Microsoft Academy Fee" item_amt="%(microsoft_fee)d" bank_id="8" acct_num="2011810360" /> 276 <item_detail item_id="4" item_name="Developmental Levy" item_amt="%(develop_fee)d" bank_id="51" acct_num="1012963301" /> 277 <item_detail item_id="5" item_name="Microsoft Academy Fee" item_amt="%(microsoft_fee)d" bank_id="117" acct_num="4011256518" /> 272 278 </item_details> 273 279 </payment_item_detail>""" % xmldict … … 288 294 </item_details> 289 295 </payment_item_detail>""" % xmldict 290 elif tech_fee == 0: 296 elif tech_fee == 0: # implies develop_fee == 0 291 297 xmltext = """<payment_item_detail> 292 298 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> … … 296 302 </item_details> 297 303 </payment_item_detail>""" % xmldict 298 el se:304 elif microsoft_fee == 0: 299 305 xmltext = """<payment_item_detail> 300 306 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> … … 303 309 <item_detail item_id="3" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> 304 310 <item_detail item_id="4" item_name="Technology Fee" item_amt="%(tech_fee)d" bank_id="10" acct_num="0032256360" /> 311 <item_detail item_id="5" item_name="Developmental Levy" item_amt="%(develop_fee)d" bank_id="51" acct_num="1012963301" /> 312 </item_details> 313 </payment_item_detail>""" % xmldict 314 else: 315 xmltext = """<payment_item_detail> 316 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s"> 317 <item_detail item_id="1" item_name="%(institution_item_name)s 1" item_amt="%(institution_amt_1)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" /> 318 <item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="8" acct_num="2034761924" /> 319 <item_detail item_id="3" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" /> 320 <item_detail item_id="4" item_name="Technology Fee" item_amt="%(tech_fee)d" bank_id="10" acct_num="0032256360" /> 321 <item_detail item_id="5" item_name="Developmental Levy" item_amt="%(develop_fee)d" bank_id="51" acct_num="1012963301" /> 322 <item_detail item_id="6" item_name="Microsoft Academy Fee" item_amt="%(microsoft_fee)d" bank_id="117" acct_num="4011256518" /> 305 323 </item_details> 306 324 </payment_item_detail>""" % xmldict -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/tests.py
r16751 r16760 86 86 self.assertMatches('...ticket created...', 87 87 self.browser.contents) 88 self.assertTrue('<span>30000.0</span>' in self.browser.contents) 88 # 30000 + 4250 + 15000 + 5950.0 = 55200 89 self.assertTrue('<span>55200.0</span>' in self.browser.contents) 89 90 self.payment_url = self.browser.url 90 91 self.browser.getLink("Pay via Interswitch", index=0).click() … … 92 93 in self.browser.contents) 93 94 self.assertTrue( 94 '<input type="hidden" name="amount" value="3000000" />' in 95 self.browser.contents) 96 self.assertTrue( 97 'item_name="School Fee" item_amt="2575000" bank_id="8" acct_num="2004145840"' in 95 '<input type="hidden" name="amount" value="5520000" />' in 96 self.browser.contents) 97 self.assertTrue( 98 'item_name="School Fee" item_amt="2695000" bank_id="8" acct_num="2004145840"' in 99 self.browser.contents) 100 self.assertTrue( 101 'item_name="Technology Fee" item_amt="425000" bank_id="10" acct_num="0032256360"' in 102 self.browser.contents) 103 self.assertTrue( 104 'item_name="Developmental Levy" item_amt="1500000" bank_id="51" acct_num="1012963301"' in 105 self.browser.contents) 106 self.assertTrue( 107 'item_name="Microsoft Academy Fee" item_amt="595000" bank_id="117" acct_num="4011256518"' in 98 108 self.browser.contents) 99 109 # ND FT Non-Deltan Fresh Student Acceptance Fee … … 190 200 self.browser.getControl("Create ticket").click() 191 201 self.assertMatches('...ticket created...', self.browser.contents) 192 self.assertTrue('<span> 30000.0</span>'in self.browser.contents)193 self.payment_url = self.browser.url 194 self.browser.getLink("Pay via Interswitch", index=0).click() 195 self.assertTrue('<item_detail item_id="1" item_name="School Fee 1" item_amt="1 545000" bank_id="388" acct_num="1556004203" />'196 in self.browser.contents) 197 self.assertTrue('<item_detail item_id="2" item_name="School Fee 2" item_amt="10 30000" bank_id="8" acct_num="2034761924" />'202 self.assertTrue('<span>55200.0</span>' in self.browser.contents) 203 self.payment_url = self.browser.url 204 self.browser.getLink("Pay via Interswitch", index=0).click() 205 self.assertTrue('<item_detail item_id="1" item_name="School Fee 1" item_amt="1617000" bank_id="388" acct_num="1556004203" />' 206 in self.browser.contents) 207 self.assertTrue('<item_detail item_id="2" item_name="School Fee 2" item_amt="1078000" bank_id="8" acct_num="2034761924" />' 198 208 in self.browser.contents) 199 209 self.assertTrue('<item_detail item_id="3" item_name="WAEAC" item_amt="280000" bank_id="8" acct_num="2028964403" />' 200 210 in self.browser.contents) 201 self.assertTrue('<item_detail item_id="4" item_name="Technology Fee" item_amt="120000" bank_id="10" acct_num="0032256360" />' 202 in self.browser.contents) 211 self.assertTrue('<item_detail item_id="4" item_name="Technology Fee" item_amt="425000" bank_id="10" acct_num="0032256360" />' 212 in self.browser.contents) 213 self.assertTrue( 214 '<item_detail item_id="5" item_name="Developmental Levy" item_amt="1500000" bank_id="51" acct_num="1012963301"' in 215 self.browser.contents) 216 self.assertTrue( 217 '<item_detail item_id="6" item_name="Microsoft Academy Fee" item_amt="595000" bank_id="117" acct_num="4011256518"' in 218 self.browser.contents) 203 219 204 220 def test_interswitch_form_dep_sug_payments(self): -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_utils.py
r16562 r16760 110 110 self.assertEqual(payment.p_level, 200) 111 111 self.assertEqual(payment.p_session, 2005) 112 self.assertEqual(payment.amount_auth, 9999.0) # now includes Microsoft Fee 112 # 9999 + 5950 + 15000 4250 113 self.assertEqual(payment.amount_auth, 35199.0) 113 114 -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py
r16752 r16760 24 24 from kofacustom.dspg.interfaces import MessageFactory as _ 25 25 26 MICROSOFT_FEE = 0.027 28 26 def local(student): 29 27 lga = getattr(student, 'lga') … … 31 29 return True 32 30 return False 31 32 def MICROSOFT_FEE(student): 33 if student.is_fresh: 34 return 5950.0 35 return 0.0 36 37 def DEVELOP_FEE(student): 38 if local(student) and student.faccode != 'SPAT': 39 return 10000.0 40 return 15000.0 41 42 def TECH_FEE(student): 43 if student.is_fresh: 44 return 4250.0 45 return 1200.0 33 46 34 47 class CustomStudentsUtils(NigeriaStudentsUtils): … … 213 226 300, 310, 320, 330, 600, 610, 620, 630): 214 227 amount -= 7000 215 amount += MICROSOFT_FEE216 228 elif student.is_postgrad and student.state == PAID: 217 229 # Returning postgraduate students also pay for the … … 228 240 else: 229 241 amount = getattr(certificate, 'school_fee_4', 0.0) 242 amount += MICROSOFT_FEE(student) 243 amount += DEVELOP_FEE(student) 244 amount += TECH_FEE(student) 230 245 elif category == 'clearance': 231 246 try:
Note: See TracChangeset for help on using the changeset viewer.