Ignore:
Timestamp:
6 Nov 2019, 07:25:16 (5 years ago)
Author:
Henrik Bettermann
Message:

Adjust to changes in nigeria package.

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

Legend:

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

    r15614 r15756  
    5959    currency = CURRENCY
    6060    product_id = PRODUCT_ID
    61     mac = MAC 
     61    mac = MAC
     62    gateway_amt = GATEWAY_AMT
    6263
    6364    def update(self):
     
    6768            self.redirect(self.url(self.context, '@@index'))
    6869            return
     70        # Already now it becomes an Interswitch payment. We set the net amount
     71        # and add the gateway amount.
     72        if not self.context.r_company:
     73            self.context.net_amt = self.context.amount_auth
     74            self.context.amount_auth += self.gateway_amt
     75            self.context.gateway_amt = self.gateway_amt
     76            self.context.r_company = u'interswitch'
    6977        student = self.student
    7078        xmldict = self.xmldict
     
    7785        xmldict['institution_acct'] = '00000000'
    7886        xmldict['institution_bank_id'] = '00'
    79         xmldict['institution_amt'] = '0.0'
    8087        provider_amt = 0.0
    8188        self.pay_item_id = '0000' # must be provided by Interswitch
     
    8390        xmldict['institution_item_name'] = self.context.category
    8491        xmldict['institution_name'] = INSTITUTION_NAME
    85         xmldict['institution_amt'] = 100 * (
    86             self.context.amount_auth - provider_amt - GATEWAY_AMT)
    87         # Interswitch amount is not part of the xml data
     92        xmldict['institution_amt'] = 100 * self.context.net_amt
     93        if not self.context.provider_amt:
     94            self.context.provider_amt = provider_amt
     95            self.context.amount_auth += provider_amt
    8896        if provider_amt == 0:
    8997            xmltext = """<payment_item_detail>
     
    101109        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
    102110        self.context.provider_amt = provider_amt
    103         self.context.gateway_amt = GATEWAY_AMT
    104 
     111        self.amount_auth = int(100 * self.context.amount_auth)
    105112        hashargs = (
    106113            self.context.p_id +
     
    124131    product_id = PRODUCT_ID
    125132    mac = MAC
     133    gateway_amt = GATEWAY_AMT
    126134
    127135    def update(self):
     
    131139            self.redirect(self.url(self.context, '@@index'))
    132140            return
     141        # Already now it becomes an Interswitch payment. We set the net amount
     142        # and add the gateway amount.
     143        if not self.context.r_company:
     144            self.context.net_amt = self.context.amount_auth
     145            self.context.amount_auth += self.gateway_amt
     146            self.context.gateway_amt = self.gateway_amt
     147            self.context.r_company = u'interswitch'
    133148        xmldict = {}
    134149        provider_amt = 400.0
     
    140155        xmldict['provider_bank_id'] = PROVIDER_BANK_ID
    141156        xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
    142         xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - GATEWAY_AMT)
    143157        xmldict['institution_item_name'] = self.context.category
    144158        xmldict['institution_name'] = INSTITUTION_NAME
    145         # Interswitch amount is not part of the xml data
     159        xmldict['institution_amt'] = 100 * self.context.net_amt
     160        if not self.context.provider_amt:
     161            self.context.provider_amt = provider_amt
     162            self.context.amount_auth += provider_amt
    146163        xmltext = """<payment_item_detail>
    147164<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
     
    151168</payment_item_detail>""" % xmldict
    152169        self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
    153         self.context.provider_amt = provider_amt
    154         self.context.gateway_amt = GATEWAY_AMT
    155 
     170        self.amount_auth = int(100 * self.context.amount_auth)
    156171        hashargs = (
    157172            self.context.p_id +
  • main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/interswitch/tests.py

    r15614 r15756  
    7070            '<span>40000.0</span>' in self.browser.contents)
    7171        self.payment_url = self.browser.url
    72         self.browser.getLink("CollegePAY", index=0).click()
     72        self.browser.getLink("Pay via Interswitch", index=0).click()
    7373        self.assertTrue('<input type="hidden" name="pay_item_id" value="0000" />' in
    7474                           self.browser.contents)
    7575        self.assertEqual(self.student.current_mode, 'ug_ft')
    7676        self.assertTrue(
    77             '<input type="hidden" name="amount" value="4000000" />' in
    78             self.browser.contents)
    79         self.assertTrue(
    80             'item_name="School Fee" item_amt="3985000" bank_id="00" acct_num="00000000"' in
     77            '<input type="hidden" name="amount" value="4015000" />' in
     78            self.browser.contents)
     79        self.assertTrue(
     80            'item_name="School Fee" item_amt="4000000" bank_id="00" acct_num="00000000"' in
    8181            self.browser.contents)
    8282
     
    8888        acc_payment.p_id = 'xyz'
    8989        acc_payment.pay_item_id = '123'
    90         acc_payment.amount_auth = 876.0
     90        acc_payment.amount_auth = 1000.0
    9191        self.student['payments']['xyz'] = acc_payment
    9292        self.browser.open(self.payments_path + '/xyz')
    93         self.browser.getLink("CollegePAY", index=0).click()
     93        self.browser.getLink("Pay via Interswitch", index=0).click()
    9494        self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...',
    9595                           self.browser.contents)
     
    9898        self.assertEqual(self.student.current_mode, 'ug_ft')
    9999        self.assertMatches(
    100             '...<input type="hidden" name="amount" value="87600" />...',
     100            '...<input type="hidden" name="amount" value="115000" />...',
    101101            self.browser.contents)
    102102        delta = timedelta(days=8)
    103103        acc_payment.creation_date -= delta
    104104        self.browser.open(self.payments_path + '/xyz')
    105         self.browser.getLink("CollegePAY", index=0).click()
     105        self.browser.getLink("Pay via Interswitch", index=0).click()
    106106        self.assertMatches(
    107107            '...This payment ticket is too old. Please create a new ticket...',
     
    110110        acc_payment.creation_date += delta
    111111        self.browser.open(self.payments_path + '/xyz')
    112         self.browser.getLink("CollegePAY", index=0).click()
     112        self.browser.getLink("Pay via Interswitch", index=0).click()
    113113        self.assertMatches('...Total Amount Authorized:...',
    114114                           self.browser.contents)
     
    229229    def test_interswitch_form(self):
    230230        # Manager can access InterswitchForm
    231         self.browser.getLink("CollegePAY", index=0).click()
     231        self.browser.getLink("Pay via Interswitch", index=0).click()
    232232        self.assertMatches('...Total Amount Authorized:...',
    233233                           self.browser.contents)
     
    238238        self.applicant.values()[0].creation_date -= delta
    239239        self.browser.open(self.payment_url)
    240         self.browser.getLink("CollegePAY", index=0).click()
     240        self.browser.getLink("Pay via Interswitch", index=0).click()
    241241        self.assertMatches(
    242242            '...This payment ticket is too old. Please create a new ticket...',
Note: See TracChangeset for help on using the changeset viewer.