Ignore:
Timestamp:
6 Nov 2017, 08:11:13 (7 years ago)
Author:
Henrik Bettermann
Message:

All certificates in SPAT are part time thus any payments coming from those certificates (Application, Acceptance, school fees etc) 40% should be split to keystone account.

Location:
main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/browser.py

    r14879 r14889  
    135135            self.pay_item_id = '102'
    136136            provider_amt = 2800.0
    137             if self.student.current_mode.endswith('pt') or \
    138                 self.student.current_mode.endswith('we'):
    139                 xmldict['institution_acct'] = '1012808851 '
     137            if student.faccode == 'SPAT':
     138                xmldict['institution_acct'] = '1012808851'
    140139                xmldict['institution_bank_id'] = '117'
    141             elif self.student.current_mode in ('nd_ft', 'hnd_ft'):
     140            elif student.current_mode in ('nd_ft', 'hnd_ft'):
    142141                xmldict['institution_acct'] = '0026235493'
    143142                xmldict['institution_bank_id'] = '31'
     
    145144            self.pay_item_id = '103'
    146145            provider_amt = 500.0
    147             if self.student.current_mode.endswith('pt') or \
    148                 self.student.current_mode.endswith('we'):
    149                 xmldict['institution_acct'] = '1012808851 '
     146            if student.faccode == 'SPAT':
     147                xmldict['institution_acct'] = '1012808851'
    150148                xmldict['institution_bank_id'] = '117'
    151             elif self.student.current_mode == 'nd_ft':
     149            elif student.current_mode == 'nd_ft':
    152150                xmldict['institution_acct'] = '2004402644'
    153151                xmldict['institution_bank_id'] = '8'
     
    160158        xmldict['institution_item_name'] = self.context.category
    161159        xmldict['institution_name'] = INSTITUTION_NAME
    162         xmldict['institution_amt'] = 100 * (
     160        xmldict['institution_amt'] = institution_amt = 100 * (
    163161            self.context.amount_auth - provider_amt - GATEWAY_AMT)
    164         # Interswitch amount is not part of the xml data
    165162        if provider_amt == 0:
    166163            xmltext = """<payment_item_detail>
     
    176173</item_details>
    177174</payment_item_detail>""" % xmldict
     175
     176        # isouaba: All certificates in SPAT are part time thus any payments
     177        # coming from those certificates (Application, Acceptance, school fees
     178        # etc) 40% should be split to keystone account.
     179        if student.faccode == 'SPAT':
     180            xmldict['institution_amt_2'] = 0.4 * institution_amt
     181            xmldict['institution_amt_1'] = 0.6 * institution_amt
     182            if provider_amt == 0:
     183                xmltext = """<payment_item_detail>
     184<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     185<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" />
     186<item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="123" acct_num="1002883141" />
     187</item_details>
     188</payment_item_detail>""" % xmldict
     189            else:
     190                xmltext = """<payment_item_detail>
     191<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
     192<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" />
     193<item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="123" acct_num="1002883141" />
     194<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" />
     195</item_details>
     196</payment_item_detail>""" % xmldict
     197
    178198        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
    179199        self.context.provider_amt = provider_amt
     
    234254        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
    235255        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
    236         xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - gateway_amt)
     256        xmldict['institution_amt'] = institution_amt = 100 * (
     257            self.context.amount_auth - provider_amt - gateway_amt)
    237258        xmldict['institution_item_name'] = self.context.category
    238259        xmldict['institution_name'] = INSTITUTION_NAME
    239         # Interswitch amount is not part of the xml data
    240260        xmltext = """<payment_item_detail>
    241261<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
     
    244264</item_details>
    245265</payment_item_detail>""" % xmldict
     266
     267        # isouaba: All certificates in SPAT are part time thus any payments
     268        # coming from those certificates (Application, Acceptance, school fees
     269        # etc) 40% should be split to keystone account.
     270        if self.applicant.__parent__.application_category in (
     271            'ndpt', 'hndpt', 'ndwe', 'hndwe'):
     272            xmldict['institution_amt_2'] = 0.4 * institution_amt
     273            xmldict['institution_amt_1'] = 0.6 * institution_amt
     274            xmltext = """<payment_item_detail>
     275<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
     276<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" />
     277<item_detail item_id="2" item_name="%(institution_item_name)s 2" item_amt="%(institution_amt_2)d" bank_id="123" acct_num="1002883141" />
     278<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" />
     279</item_details>
     280</payment_item_detail>""" % xmldict
     281
    246282        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
    247283        self.context.provider_amt = provider_amt
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/interswitch/tests.py

    r14875 r14889  
    2424from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
    2525from waeup.kofa.configuration import SessionConfiguration
     26from waeup.kofa.university.faculty import Faculty
     27from waeup.kofa.university.department import Department
    2628from kofacustom.dspg.testing import FunctionalLayer
    2729
     
    7072        self.value = ctrl.options[0]
    7173        self.browser.getLink(self.value).click()
    72         self.assertMatches('...Amount Authorized...',
    73                            self.browser.contents)
    74         self.assertMatches(
    75             '...<span>30000.0</span>...',
    76             self.browser.contents)
     74        self.assertTrue('<span>30000.0</span>'  in self.browser.contents)
    7775        self.payment_url = self.browser.url
    7876        self.browser.getLink("CollegePAY", index=0).click()
     
    143141        self.assertMatches('...Total Amount Authorized:...',
    144142                           self.browser.contents)
     143
     144    def test_interswitch_form_pt_payments(self):
     145        # Add SPAT certificate
     146        certificate = createObject('waeup.Certificate')
     147        certificate.code = u'CERT2'
     148        certificate.application_category = 'basic' # can be anything
     149        certificate.start_level = 100
     150        certificate.end_level = 500
     151        certificate.study_mode = u'ug_ft' # can be anything
     152        self.app['faculties']['SPAT'] = Faculty(code=u'SPAT')
     153        self.app['faculties']['SPAT']['dep2'] = Department(code=u'dep2')
     154        department = self.app['faculties']['SPAT']['dep2']
     155        self.app['faculties']['SPAT']['dep2'].certificates.addCertificate(
     156            certificate)
     157        certificate.school_fee_3 = 30000.0
     158        self.student['studycourse'].certificate = certificate
     159        # Manager can access InterswitchForm
     160        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     161        self.browser.open(self.payments_path)
     162        IWorkflowState(self.student).setState('cleared')
     163        self.student.nationality = u'NG'
     164        # ND PT Non-Deltan Fresh Student School Fee
     165        self.certificate.study_mode = 'nd_ft'
     166        self.certificate.school_fee_3 = 30000.0
     167        self.browser.open(self.payments_path + '/addop')
     168        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     169        self.browser.getControl("Create ticket").click()
     170        self.assertMatches('...ticket created...', self.browser.contents)
     171        ctrl = self.browser.getControl(name='val_id')
     172        self.value = ctrl.options[0]
     173        self.browser.getLink(self.value).click()
     174        self.assertTrue('<span>30000.0</span>'  in self.browser.contents)
     175        self.payment_url = self.browser.url
     176        self.browser.getLink("CollegePAY", index=0).click()
     177        self.assertTrue('<item_detail item_id="1" item_name="School Fee 1" item_amt="1617000" bank_id="117" acct_num="1012808851" />'
     178            in self.browser.contents)
     179        self.assertTrue('<item_detail item_id="2" item_name="School Fee 2" item_amt="1078000" bank_id="123" acct_num="1002883141" />'
     180            in self.browser.contents)
     181        self.assertTrue('<item_detail item_id="3" item_name="BT Education" item_amt="280000" bank_id="8" acct_num="2028964403" />'
     182            in self.browser.contents)
    145183
    146184    @external_test
     
    243281        self.browser.getControl(name="transition").value = ['start']
    244282        self.browser.getControl("Save").click()
     283
     284
     285    def test_interswitch_form(self):
    245286        self.browser.getControl("Add online").click()
    246287        self.assertMatches('...passport photo before making payment...',
     
    263304        self.assertMatches('...Amount Authorized...',
    264305                           self.browser.contents)
    265         self.assertMatches(
    266             '...<span>1000.0</span>...',
    267             self.browser.contents)
    268         self.payment_url = self.browser.url
    269 
    270 
    271     def test_interswitch_form(self):
    272         # Manager can access InterswitchForm
    273         self.browser.getLink("CollegePAY", index=0).click()
    274         self.assertMatches('...Total Amount Authorized:...',
    275                            self.browser.contents)
    276         self.assertMatches(
    277             '...<input type="hidden" name="amount" value="100000" />...',
    278             self.browser.contents)
     306        self.assertTrue('span>1000.0</span>' in self.browser.contents)
     307        self.payment_url = self.browser.url
     308        self.browser.getLink("CollegePAY", index=0).click()
     309        self.assertTrue('<input type="hidden" name="amount" value="100000" />'
     310            in self.browser.contents)
    279311        delta = timedelta(days=8)
    280312        self.applicant.values()[0].creation_date -= delta
     
    284316            '...This payment ticket is too old. Please create a new ticket...',
    285317            self.browser.contents)
     318        # ND PT Application Fee
     319        self.applicantscontainer.application_category = 'ndpt'
     320        self.certificate.application_category = 'ndpt'
     321        self.browser.open(self.manage_path)
     322        self.browser.getControl("Add online").click()
     323        self.browser.getLink("CollegePAY", index=0).click()
     324        self.assertTrue('<item_detail item_id="1" item_name="Application 1" item_amt="15000" bank_id="117" acct_num="1015220292" />'
     325            in self.browser.contents)
     326        self.assertTrue('<item_detail item_id="2" item_name="Application 2" item_amt="10000" bank_id="123" acct_num="1002883141" />'
     327            in self.browser.contents)
     328        self.assertTrue('<item_detail item_id="3" item_name="BT Education" item_amt="50000" bank_id="8" acct_num="2028964403" />'
     329            in self.browser.contents)
    286330
    287331    @external_test
Note: See TracChangeset for help on using the changeset viewer.