Ignore:
Timestamp:
28 Jan 2022, 08:17:50 (3 years ago)
Author:
Henrik Bettermann
Message:

Rework the entire schoolfee determination and split payment algorithm.

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  
    3030from kofacustom.dspg.applicants.interfaces import ICustomApplicantOnlinePayment
    3131from kofacustom.dspg.interfaces import MessageFactory as _
    32 from kofacustom.dspg.students.utils import MICROSOFT_FEE
     32from kofacustom.dspg.students.utils import (
     33    MICROSOFT_FEE, DEVELOP_FEE, TECH_FEE)
    3334
    3435PRODUCT_ID = '7269' # must be provided by Interswitch
     
    140141        tech_fee = 0.0
    141142        microsoft_fee = 0.0
     143        develop_fee = 0.0
    142144        if self.context.p_category.startswith('schoolfee'):
    143145            self.pay_item_id = '102'
    144146            if self.context.p_item != 'Balance':
    145147                provider_amt = 2800.0
    146                 tech_fee = 1200.0
    147                 if student.state == RETURNING:
    148                     microsoft_fee = MICROSOFT_FEE
     148                tech_fee = TECH_FEE(student)
     149                develop_fee = DEVELOP_FEE(student)
     150                microsoft_fee = MICROSOFT_FEE(student)
    149151            if student.faccode == 'SPAT':
    150152                xmldict['institution_acct'] = '1556004203'
     
    236238        xmldict['provider_amt'] = 100 * provider_amt
    237239        xmldict['tech_fee'] = 100 * tech_fee
     240        xmldict['develop_fee'] = 100 * develop_fee
    238241        xmldict['microsoft_fee'] = 100 * microsoft_fee
    239242        xmldict['institution_item_name'] = self.context.category
    240243        xmldict['institution_name'] = INSTITUTION_NAME
    241244        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)
    243247
    244248        if provider_amt == 0:
     
    248252</item_details>
    249253</payment_item_detail>""" % xmldict
    250         elif tech_fee == 0:
     254        elif tech_fee == 0:   # implies develop_fee == 0
    251255            xmltext = """<payment_item_detail>
    252256<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    261265<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" />
    262266<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" />
    263268</item_details>
    264269</payment_item_detail>""" % xmldict
     
    269274<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" />
    270275<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" />
    272278</item_details>
    273279</payment_item_detail>""" % xmldict
     
    288294</item_details>
    289295</payment_item_detail>""" % xmldict
    290             elif tech_fee == 0:
     296            elif tech_fee == 0: # implies develop_fee == 0
    291297                xmltext = """<payment_item_detail>
    292298<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    296302</item_details>
    297303</payment_item_detail>""" % xmldict
    298             else:
     304            elif microsoft_fee == 0:
    299305                xmltext = """<payment_item_detail>
    300306<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     
    303309<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" />
    304310<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" />
    305323</item_details>
    306324</payment_item_detail>""" % xmldict
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/tests.py

    r16751 r16760  
    8686        self.assertMatches('...ticket created...',
    8787                           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)
    8990        self.payment_url = self.browser.url
    9091        self.browser.getLink("Pay via Interswitch", index=0).click()
     
    9293            in self.browser.contents)
    9394        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
    98108            self.browser.contents)
    99109        # ND FT Non-Deltan Fresh Student Acceptance Fee
     
    190200        self.browser.getControl("Create ticket").click()
    191201        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="1545000" 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="1030000" 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" />'
    198208            in self.browser.contents)
    199209        self.assertTrue('<item_detail item_id="3" item_name="WAEAC" item_amt="280000" bank_id="8" acct_num="2028964403" />'
    200210            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)
    203219
    204220    def test_interswitch_form_dep_sug_payments(self):
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/tests/test_utils.py

    r16562 r16760  
    110110        self.assertEqual(payment.p_level, 200)
    111111        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)
    113114
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py

    r16752 r16760  
    2424from kofacustom.dspg.interfaces import MessageFactory as _
    2525
    26 MICROSOFT_FEE = 0.0
    27 
    2826def local(student):
    2927    lga = getattr(student, 'lga')
     
    3129        return True
    3230    return False
     31
     32def MICROSOFT_FEE(student):
     33    if student.is_fresh:
     34        return 5950.0
     35    return 0.0
     36
     37def DEVELOP_FEE(student):
     38    if local(student) and student.faccode != 'SPAT':
     39        return 10000.0
     40    return 15000.0
     41
     42def TECH_FEE(student):
     43    if student.is_fresh:
     44        return 4250.0
     45    return 1200.0
    3346
    3447class CustomStudentsUtils(NigeriaStudentsUtils):
     
    213226                        300, 310, 320, 330, 600, 610, 620, 630):
    214227                        amount -= 7000
    215                     amount += MICROSOFT_FEE
    216228                elif student.is_postgrad and student.state == PAID:
    217229                    # Returning postgraduate students also pay for the
     
    228240                    else:
    229241                        amount = getattr(certificate, 'school_fee_4', 0.0)
     242            amount += MICROSOFT_FEE(student)
     243            amount += DEVELOP_FEE(student)
     244            amount += TECH_FEE(student)
    230245        elif category == 'clearance':
    231246            try:
Note: See TracChangeset for help on using the changeset viewer.