Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/etranzact/browser.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/etranzact/browser.py	(revision 15772)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/etranzact/browser.py	(revision 15773)
@@ -22,7 +22,10 @@
 from kofacustom.nigeria.etranzact.studentsbrowser import (
     EtranzactPageStudent, EtranzactReceiveResponseStudent,
-    EtranzactRequestPaymentStatusPageStudent)
+    EtranzactRequestPaymentStatusPageStudent, webconnect_module_activated)
 from kofacustom.nigeria.etranzact.payoutletbrowser import (
-    EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant)
+    EtranzactEnterPinPageStudent, EtranzactEnterPinPageApplicant,
+    EtranzactQueryHistoryPageStudent, EtranzactQueryHistoryPageApplicant,
+    payoutlet_module_activated)
+from kofacustom.nigeria.etranzact.payoutletwebservice  import NigeriaPaymentDataWebservice
 
 # Temporarily we can use the test portal like in kofacustom.nigeria
@@ -35,4 +38,5 @@
 #SECRET_KEY =
 #TERMINAL_ID =
+GATEWAY_AMT = 500.0
 LOGO_URL = 'https://iuokada.waeup.org/static_custom/iou_logo.png'
 
@@ -44,4 +48,24 @@
     terminal_id = TERMINAL_ID
     logo_url = LOGO_URL
+    gateway_amt = GATEWAY_AMT
+
+    def update(self):
+        # Already now it becomes an Etranzact payment. We set the net amount
+        # and add the gateway amount.
+        if not webconnect_module_activated(
+            self.context.__parent__.__parent__.year, self.context):
+            return _("Etranzact payments deactivated.")
+        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'etranzact'
+        self.amount = "%.1f" % self.context.amount_auth
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+            return
+        return
 
 class CustomEtranzactReceiveResponseApplicant(EtranzactReceiveResponseApplicant):
@@ -66,4 +90,24 @@
     terminal_id = TERMINAL_ID
     logo_url = LOGO_URL
+    gateway_amt = GATEWAY_AMT
+
+    def update(self):
+        # Already now it becomes an Etranzact payment. We set the net amount
+        # and add the gateway amount.
+        if not webconnect_module_activated(
+            self.context.student.current_session, self.context):
+            return _("Etranzact payments deactivated.")
+        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'etranzact'
+        self.amount = "%.1f" % self.context.amount_auth
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+            return
+        return
 
 class CustomEtranzactReceiveResponseStudent(EtranzactReceiveResponseStudent):
@@ -81,4 +125,52 @@
     logo_url = LOGO_URL
 
+# Payoutlet customizations
+
+class CustomEtranzactEnterPinPageStudent(EtranzactEnterPinPageStudent):
+    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageStudent`
+    """
+    gateway_amt = GATEWAY_AMT
+
+    def update(self):
+        if not payoutlet_module_activated(
+            self.context.student.current_session, self.context):
+            return
+        super(EtranzactEnterPinPageStudent, self).update()
+        # Already now it becomes an Etranzact payment. We set the net amount
+        # and add the gateway amount.
+        provider_amt = 0.0
+        if self.context.p_category == 'registration':
+            provider_amt = 5000.0
+        if not self.context.r_company:
+            self.context.net_amt = self.context.amount_auth
+            self.context.amount_auth += self.gateway_amt
+            self.context.amount_auth += provider_amt
+            self.context.gateway_amt = self.gateway_amt
+            self.context.provider_amt = provider_amt
+            self.context.r_company = u'etranzact'
+        return
+
+class CustomEtranzactEnterPinPageApplicant(EtranzactEnterPinPageApplicant):
+    """Enter confirmation PIN and submit to `EtranzactQueryHistoryPageApplicant`
+    """
+    gateway_amt = GATEWAY_AMT
+
+    def update(self):
+        if not payoutlet_module_activated(
+            self.context.__parent__.__parent__.year, self.context):
+            return
+        super(EtranzactEnterPinPageStudent, self).update()
+        # Already now it becomes an Etranzact payment. We set the net amount
+        # and add the gateway amount.
+        provider_amt = 0.0
+        if not self.context.r_company:
+            self.context.net_amt = self.context.amount_auth
+            self.context.amount_auth += self.gateway_amt
+            self.context.amount_auth += provider_amt
+            self.context.gateway_amt = self.gateway_amt
+            self.context.provider_amt = provider_amt
+            self.context.r_company = u'etranzact'
+        return
+
 class CustomEtranzactQueryHistoryPageStudent(EtranzactQueryHistoryPageStudent):
     """ Query history of Etranzact payments
@@ -94,2 +186,13 @@
     host = HOST
     https = HTTPS
+
+class CustomPaymentDataWebservice(NigeriaPaymentDataWebservice):
+    """A simple webservice to publish payment and payer details on request from
+    accepted IP addresses without authentication.
+    """
+    #ACCEPTED_IP = ('195.219.3.181', '195.219.3.184')
+    ACCEPTED_IP = None
+
+    CATEGORY_MAPPING = {
+        'SCHOOLFEE': ('schoolfee',),
+         }
Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interfaces.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interfaces.py	(revision 15772)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interfaces.py	(revision 15773)
@@ -83,4 +83,10 @@
 
     # Additional fees in custom package add here
+
+    registration_fee = schema.Float(
+        title = _(u'Registration Fee'),
+        default = 0.0,
+        required = False,
+        )
 
     late_registration_fee = schema.Float(
Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/browser.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interswitch/browser.py	(revision 15772)
+++ /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 15772)
+++ /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
Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py	(revision 15772)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/utils.py	(revision 15773)
@@ -21,5 +21,4 @@
     ADMITTED, CLEARANCE, CLEARED, RETURNING, PAID, REGISTERED, VALIDATED)
 from kofacustom.nigeria.students.utils import NigeriaStudentsUtils
-from kofacustom.iuokada.interswitch.browser import GATEWAY_AMT
 from kofacustom.iuokada.interfaces import MessageFactory as _
 
@@ -123,7 +122,7 @@
                     amount = getattr(certificate, 'school_fee_2', 0.0)
                 if amount and category == 'schoolfee40':
-                    amount = 0.4*amount + 0.6*GATEWAY_AMT
+                    amount = 0.4*amount
                 elif amount and category == 'secondinstal':
-                    amount = 0.6*amount + 0.4*GATEWAY_AMT
+                    amount = 0.6*amount
         elif category == 'clearance':
             try:
Index: /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/utils/utils.py
===================================================================
--- /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/utils/utils.py	(revision 15772)
+++ /main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/utils/utils.py	(revision 15773)
@@ -29,5 +29,5 @@
         'schoolfee': 'Tuition Plus (total amount)',
         'schoolfee40': 'Tuition Plus (40% - 1st instalment)',
-        'secondinstal': 'Tuition Plus (60% - 2nd instalment))',
+        'secondinstal': 'Tuition Plus (60% - 2nd instalment)',
         'clearance': 'Acceptance Fee',
         'registration': 'Registration Fee',
