Changeset 9956


Ignore:
Timestamp:
15 Feb 2013, 11:49:44 (12 years ago)
Author:
Henrik Bettermann
Message:

Configure acceptance fee payment.

We must not use assertMatches in browser tests when comparing payment amounts and bank account numbers because we need exact comparisons.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/browser.py

    r9951 r9956  
    126126            xmldict['institution_acct'] = "1012044132"
    127127            xmldict['institution_bank_id'] = '117'
     128        elif self.context.p_category == 'clearance':
     129            fceokene_split_amt = 0.0
     130            provider_amt = 0.0
     131            self.pay_item_id = '8304'
     132            xmldict['institution_amt'] = 100 * (
     133                self.context.amount_auth - GATEWAY_AMT)
     134            xmldict['institution_acct'] = "2003670143"
     135            xmldict['institution_bank_id'] = '8'
     136
    128137        # Interswitch amount is not part of the xml data
    129 
    130138        if self.context.p_category == 'schoolfee':
    131139            xmltext = """<payment_item_detail>
     
    137145</payment_item_detail>""" % xmldict
    138146
    139         elif 'maintenance' in self.context.p_category:
     147        else:
    140148            xmltext = """<payment_item_detail>
    141149<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
  • main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/tests.py

    r9951 r9956  
    6363        self.assertMatches('...Amount Authorized...',
    6464                           self.browser.contents)
    65         self.assertMatches(
    66             '...<span>12495.0</span>...',
    67             self.browser.contents)
     65        self.assertTrue(
     66            '<span>12495.0</span>' in self.browser.contents)
    6867        self.payment_url = self.browser.url
    6968
     
    9392        self.assertMatches('...Total Amount Authorized:...',
    9493                           self.browser.contents)
    95         self.assertMatches(
    96             '...<input type="hidden" name="amount" value="1249500.0" />...',
    97             self.browser.contents)
    98         self.assertMatches(
    99             '...item_name="School Fee" item_amt="934800" bank_id="117" acct_num="1012044015"...',
    100             self.browser.contents)
    101         self.assertMatches(
    102             '...item_name="FCEOkene Split" item_amt="140000" bank_id="117" acct_num="1012044039"...',
    103             self.browser.contents)
    104         self.assertMatches(
    105             '...item_name="BT Education" item_amt="160000" bank_id="31" acct_num="0026781725"...',
    106             self.browser.contents)
     94        self.assertTrue(
     95            '<input type="hidden" name="amount" value="1249500.0" />'
     96            in self.browser.contents)
     97        self.assertTrue(
     98            'item_name="School Fee" item_amt="934500" bank_id="117" acct_num="1012044015"'
     99            in self.browser.contents)
     100        self.assertTrue(
     101            'item_name="FCEOkene Split" item_amt="140000" bank_id="117" acct_num="1012044039"'
     102            in self.browser.contents)
     103        self.assertTrue(
     104            'item_name="BT Education" item_amt="160000" bank_id="31" acct_num="0026781725"'
     105            in self.browser.contents)
    107106
    108107        # Let's do the same for maintenance fee payment
     
    138137        self.assertMatches('...Amount Authorized...',
    139138                           self.browser.contents)
    140         self.assertMatches(
    141             '...<span>4150.0</span>...',
    142             self.browser.contents)
     139        self.assertTrue(
     140            '<span>4150.0</span>' in self.browser.contents)
    143141        self.payment_url = self.browser.url
    144142        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
     
    155153        self.assertMatches('...Total Amount Authorized:...',
    156154                           self.browser.contents)
    157         self.assertMatches(
    158             '...<input type="hidden" name="amount" value="400000.0" />...',
     155        self.assertTrue(
     156            '<input type="hidden" name="amount" value="415000.0" />'
     157            in self.browser.contents)
     158        self.assertTrue(
     159            'item_name="Hostel Maintenance Fee" item_amt="400000" bank_id="117" acct_num="1012044132"'
     160            in self.browser.contents)
     161        # BT does nor charge a fee for maintenance fee
     162        self.assertFalse("BT Education" in self.browser.contents)
     163
     164        # Let's do the same for acceptance fee
     165
     166        self.browser.open(self.payments_path)
     167        self.browser.open(self.payments_path + '/addop')
     168        self.browser.getControl(
     169            name="form.p_category").value = ['clearance']
     170        self.browser.getControl("Create ticket").click()
     171        self.assertMatches('...ticket created...',
     172                           self.browser.contents)
     173        ctrl = self.browser.getControl(name='val_id')
     174        value = ctrl.options[2]
     175        self.browser.getLink(value).click()
     176        self.assertMatches('...Amount Authorized...',
     177                           self.browser.contents)
     178        self.assertTrue(
     179            '<span>3456.0</span>' in self.browser.contents)
     180        self.payment_url = self.browser.url
     181        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
     182        self.assertEqual(self.student['payments'][value].gateway_amt, 0.0)
     183        self.assertEqual(self.student['payments'][value].thirdparty_amt, 0.0)
     184        # Manager can access InterswitchForm
     185        self.browser.getLink("CollegePAY", index=0).click()
     186        # Split amounts have been set
     187        self.assertEqual(self.student['payments'][value].provider_amt, 0.0)
     188        self.assertEqual(self.student['payments'][value].gateway_amt, 150.0)
     189        self.assertEqual(self.student['payments'][value].thirdparty_amt, 0.0)
     190        # The total amount to be processed by Interswitch
     191        # has been reduced by the Interswitch fee of 150 Nairas
     192        self.assertMatches('...Total Amount Authorized:...',
     193                           self.browser.contents)
     194        self.assertTrue(
     195            '<input type="hidden" name="amount" value="345600.0" />' in
    159196            self.browser.contents)
    160         self.assertMatches(
    161             '...item_name="Hostel Maintenance Fee" item_amt="385000" bank_id="117" acct_num="1012044132"...',
    162             self.browser.contents)
     197        self.assertTrue(
     198            'item_name="Acceptance Fee" item_amt="330600" bank_id="8" acct_num="2003670143"'
     199            in self.browser.contents)
    163200        # BT does nor charge a fee for maintenance fee
    164201        self.assertFalse("BT Education" in self.browser.contents)
     
    289326        self.assertMatches('...Total Amount Authorized:...',
    290327                           self.browser.contents)
    291         self.assertMatches(
    292             '...<input type="hidden" name="amount" value="100000.0" />...',
    293             self.browser.contents)
     328        self.assertTrue(
     329            '<input type="hidden" name="amount" value="100000.0" />'
     330            in self.browser.contents)
    294331
    295332    @external_test
Note: See TracChangeset for help on using the changeset viewer.