Index: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/browser.py
===================================================================
--- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/browser.py	(revision 15728)
+++ main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/browser.py	(revision 15773)
@@ -61,4 +61,5 @@
     product_id = PRODUCT_ID
     mac = MAC  
+    gateway_amt = GATEWAY_AMT
 
     def update(self):
@@ -68,4 +69,11 @@
             self.redirect(self.url(self.context, '@@index'))
             return
+        # Already now it becomes an Interswitch payment. We set the net amount
+        # and add the gateway amount.
+        if not self.context.r_company:
+            self.context.net_amt = self.context.amount_auth
+            self.context.amount_auth += self.gateway_amt
+            self.context.gateway_amt = self.gateway_amt
+            self.context.r_company = u'interswitch'
         student = self.student
         xmldict = self.xmldict
@@ -75,8 +83,7 @@
         xmldict['provider_bank_id'] = PROVIDER_BANK_ID
         xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
-        provider_amt = 0.0
         xmldict['institution_acct'] = ''
         xmldict['institution_bank_id'] = ''
-        provider_amt = 5000.0
+        provider_amt = 0.0
         self.pay_item_id = ''
         # Institution data
@@ -103,7 +110,8 @@
         xmldict['institution_item_name'] = self.context.category
         xmldict['institution_name'] = INSTITUTION_NAME
-        xmldict['institution_amt'] = 100 * (
-            self.context.amount_auth - provider_amt - GATEWAY_AMT)
-        # Interswitch amount is not part of the xml data
+        xmldict['institution_amt'] = 100 * self.context.net_amt
+        if not self.context.provider_amt:
+            self.context.provider_amt = provider_amt
+            self.context.amount_auth += provider_amt
         if provider_amt == 0:
             xmltext = """<payment_item_detail>
@@ -120,7 +128,5 @@
 </payment_item_detail>""" % xmldict
         self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
-        self.context.provider_amt = provider_amt
-        self.context.gateway_amt = GATEWAY_AMT
-
+        self.amount_auth = int(100 * self.context.amount_auth)
         hashargs = (
             self.context.p_id +
@@ -144,4 +150,5 @@
     product_id = PRODUCT_ID
     mac = MAC
+    gateway_amt = GATEWAY_AMT
 
     def update(self):
@@ -151,6 +158,14 @@
             self.redirect(self.url(self.context, '@@index'))
             return
+        # Already now it becomes an Interswitch payment. We set the net amount
+        # and add the gateway amount.
+        if not self.context.r_company:
+            self.context.net_amt = self.context.amount_auth
+            self.context.amount_auth += self.gateway_amt
+            self.context.gateway_amt = self.gateway_amt
+            self.context.r_company = u'interswitch'
+        self.amount_auth = int(100 * self.context.amount_auth)
         xmldict = {}
-        provider_amt = 400.0
+        provider_amt = 0.0
         xmldict['institution_acct'] = '0040484781'
         xmldict['institution_bank_id'] = '31'
@@ -160,8 +175,10 @@
         xmldict['provider_bank_id'] = PROVIDER_BANK_ID
         xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
-        xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - GATEWAY_AMT)
         xmldict['institution_item_name'] = self.context.category
         xmldict['institution_name'] = INSTITUTION_NAME
-        # Interswitch amount is not part of the xml data
+        xmldict['institution_amt'] = 100 * self.context.net_amt
+        if not self.context.provider_amt:
+            self.context.provider_amt = provider_amt
+            self.context.amount_auth += provider_amt
         xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
@@ -171,7 +188,5 @@
 </payment_item_detail>""" % xmldict
         self.xml_data = """<input type="hidden" name="xml_data" value='%s'  />""" % xmltext
-        self.context.provider_amt = provider_amt
-        self.context.gateway_amt = GATEWAY_AMT
-
+        self.amount_auth = int(100 * self.context.amount_auth)
         hashargs = (
             self.context.p_id +
Index: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/tests.py
===================================================================
--- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/tests.py	(revision 15728)
+++ main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/tests.py	(revision 15773)
@@ -75,9 +75,13 @@
                            self.browser.contents)
         self.assertEqual(self.student.current_mode, 'ug_ft')
-        self.assertTrue(
-            '<input type="hidden" name="amount" value="4000000" />' in
-            self.browser.contents)
-        self.assertTrue(
-            'item_name="Tuition Plus (total amount)" item_amt="3475000" bank_id="117" acct_num="1011005811"' in
+        # 250 gateway charge have been added
+        payment = self.student['payments'][self.value]
+        self.assertEqual(payment.amount_auth, 40250)
+        self.assertEqual(payment.net_amt, 40000)
+        self.assertTrue(
+            '<input type="hidden" name="amount" value="4025000" />' in
+            self.browser.contents)
+        self.assertTrue(
+            'item_name="Tuition Plus (total amount)" item_amt="4000000" bank_id="117" acct_num="1011005811"' in
             self.browser.contents)
 
@@ -86,19 +90,22 @@
         acc_payment = createObject('waeup.StudentOnlinePayment')
         acc_payment.p_state = 'unpaid'
-        acc_payment.p_category = 'clearance'
+        acc_payment.p_category = 'registration'
         acc_payment.p_id = 'xyz'
         acc_payment.pay_item_id = '123'
-        acc_payment.amount_auth = 876.0
+        acc_payment.amount_auth = 1000.0
         self.student['payments']['xyz'] = acc_payment
         self.browser.open(self.payments_path + '/xyz')
         self.browser.getLink("Pay via Interswitch", index=0).click()
-        self.assertMatches('...<input type="hidden" name="pay_item_id" value="102" />...',
+        self.assertTrue('<input type="hidden" name="pay_item_id" value="102" />' in
                            self.browser.contents)
         self.assertMatches('...Total Amount Authorized:...',
                            self.browser.contents)
         self.assertEqual(self.student.current_mode, 'ug_ft')
-        self.assertMatches(
-            '...<input type="hidden" name="amount" value="87600" />...',
-            self.browser.contents)
+        # 5000 provider charge and 250 gateway charge have been added
+        self.assertTrue(
+            '<input type="hidden" name="amount" value="625000" />' in
+            self.browser.contents)
+        self.assertEqual(acc_payment.amount_auth, 6250)
+        self.assertEqual(acc_payment.net_amt, 1000)
         delta = timedelta(days=8)
         acc_payment.creation_date -= delta
