Changeset 15756


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
Files:
5 edited

Legend:

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

    r15615 r15756  
    2323    EtranzactPageStudent, EtranzactReceiveResponseStudent,
    2424    EtranzactRequestPaymentStatusPageStudent)
     25from kofacustom.nigeria.etranzact.payoutletbrowser import (
     26    EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant,
     27    EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant)
     28from kofacustom.nigeria.etranzact.payoutletwebservice  import NigeriaPaymentDataWebservice
    2529
    2630# Temporarily we can use the test portal like in kofacustom.nigeria
    2731
    2832from kofacustom.nigeria.etranzact.tests import (
    29     HOST, HTTPS, SECRET_KEY, TERMINAL_ID)
     33    HOST, HTTPS, SECRET_KEY, TERMINAL_ID, GATEWAY_AMT)
    3034
    3135#HOST =
     
    3337#SECRET_KEY =
    3438#TERMINAL_ID =
     39#GATEWAY_AMT =
    3540LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
    3641
     
    4247    terminal_id = TERMINAL_ID
    4348    logo_url = LOGO_URL
     49    gateway_amt = GATEWAY_AMT
     50
     51    def update(self):
     52        # Already now it becomes an Etranzact payment. We set the net amount
     53        # and add the gateway amount.
     54        if not self.context.r_company:
     55            self.context.net_amt = self.context.amount_auth
     56            self.context.amount_auth += self.gateway_amt
     57            self.context.gateway_amt = self.gateway_amt
     58            self.context.r_company = u'etranzact'
     59        self.amount = "%.1f" % self.context.amount_auth
     60        error = self.init_update()
     61        if error:
     62            self.flash(error, type='danger')
     63            self.redirect(self.url(self.context, '@@index'))
     64            return
     65        return
    4466
    4567class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant):
     
    6486    terminal_id = TERMINAL_ID
    6587    logo_url = LOGO_URL
     88    gateway_amt = GATEWAY_AMT
     89
     90    def update(self):
     91        # Already now it becomes an Etranzact payment. We set the net amount
     92        # and add the gateway amount.
     93        if not self.context.r_company:
     94            self.context.net_amt = self.context.amount_auth
     95            self.context.amount_auth += self.gateway_amt
     96            self.context.gateway_amt = self.gateway_amt
     97            self.context.r_company = u'etranzact'
     98        self.amount = "%.1f" % self.context.amount_auth
     99        error = self.init_update()
     100        if error:
     101            self.flash(error, type='danger')
     102            self.redirect(self.url(self.context, '@@index'))
     103            return
     104        return
    66105
    67106class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent):
     
    79118    logo_url = LOGO_URL
    80119
     120# Payoutlet customizations
    81121
     122class CustomEtranzactEnterPinPageStudent(EtranzactEnterPinPageStudent):
     123    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent`
     124    """
     125    gateway_amt = GATEWAY_AMT
    82126
     127class CustomEtranzactEnterPinPageApplicant(EtranzactEnterPinPageApplicant):
     128    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant`
     129    """
     130    gateway_amt = GATEWAY_AMT
     131
     132class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent):
     133    """ Query history of Etranzact payments
     134    """
     135    terminal_id = TERMINAL_ID
     136    host = HOST
     137    https = HTTPS
     138
     139class CustomEtranzactQueryHistoryPageApplicant(EtranzactQueryHistoryPageApplicant):
     140    """ Query history of Etranzact payments
     141    """
     142    terminal_id = TERMINAL_ID
     143    host = HOST
     144    https = HTTPS
     145
     146class CustomPaymentDataWebservice(NigeriaPaymentDataWebservice):
     147    """A simple webservice to publish payment and payer details on request from
     148    accepted IP addresses without authentication.
     149    """
     150    #ACCEPTED_IP = ('195.219.3.181', '195.219.3.184')
     151    ACCEPTED_IP = None
     152
     153    CATEGORY_MAPPING = {
     154        'SCHOOLFEE': ('schoolfee',),
     155         }
     156
  • 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...',
  • main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/remita/browser.py

    r15614 r15756  
    9191            return
    9292        self.orderId = self.context.p_id
    93         self.amount = str(self.context.amount_auth)
    9493        error = self.init_update()
    9594        if error:
     
    9796            self.redirect(self.url(self.context, '@@index'))
    9897            return
     98        # Already now it becomes a Remita payment. We set the net amount
     99        # and add the gateway amount.
     100        if not self.context.r_company:
     101            self.context.net_amt = self.context.amount_auth
     102            self.context.amount_auth += self.gateway_amt
     103            self.context.gateway_amt = self.gateway_amt
     104            self.context.r_company = u'remita'
     105        self.amount_auth = int(100 * self.context.amount_auth)
    99106        return
    100107
     
    150157            return
    151158        self.orderId = self.context.p_id
    152         self.amount = str(self.context.amount_auth)
    153159        error = self.init_update()
    154160        if error:
     
    156162            self.redirect(self.url(self.context, '@@index'))
    157163            return
     164        # Already now it becomes a Remita payment. We set the net amount
     165        # and add the gateway amount.
     166        if not self.context.r_company:
     167            self.context.net_amt = self.context.amount_auth
     168            self.context.amount_auth += self.gateway_amt
     169            self.context.gateway_amt = self.gateway_amt
     170            self.context.r_company = u'remita'
     171        self.amount_auth = int(100 * self.context.amount_auth)
    158172        return
  • main/kofacustom.skeleton/trunk/src/kofacustom/skeleton/students/tests/test_export.py

    r15673 r15756  
    103103        result = open(self.outfile, 'rb').read()
    104104        self.assertMatches(
    105             'ac,amount_auth,creation_date,gateway_amt,p_category,p_combi,p_current,'
     105            'ac,amount_auth,creation_date,gateway_amt,net_amt,'
     106            'p_category,p_combi,p_current,'
    106107            'p_id,p_item,p_level,p_session,p_state,payment_date,provider_amt,'
    107108            'r_amount_approved,r_card_num,r_code,r_company,r_desc,'
    108109            'r_pay_reference,thirdparty_amt,student_id,state,'
    109110            'current_session\r\n'
    110             '666,12.12,%s-04-01 13:12:01#,,schoolfee,[],1,my-id,p-item,'
     111            '666,12.12,%s-04-01 13:12:01#,,,schoolfee,[],1,my-id,p-item,'
    111112            '100,%s,paid,%s-04-01 14:12:01#,,12.12,'
    112113            '789,r-code,interswatch,,,,A111111,created,2012\r\n'
Note: See TracChangeset for help on using the changeset viewer.