Index: /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser.py
===================================================================
--- /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser.py	(revision 10173)
+++ /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser.py	(revision 10174)
@@ -74,5 +74,5 @@
     currency = CURRENCY
     product_id = PRODUCT_ID
-    mac = 'E6BA6CBBA9AF2871EE25C32C8D57C98895B9B001DC5B9CB2C463E2A9BDA44A3F1260C8A364F33789CDF74CB3EE7E6EF5D94F48D3AF7B727E75D97F07618DFA6D'
+    #mac = ''
 
     def interswitch_img_url(self):
@@ -112,5 +112,5 @@
         xmldict['institution_name'] = INSTITUTION_NAME
         self.pay_item_id = '000'
-        if self.context.p_category == 'schoolfee':
+        if self.context.p_category in ('schoolfee', 'schoolfee_1', 'schoolfee_2'):
             provider_amt = 3000.0
             xmldict['provider_amt'] = 100 * provider_amt
@@ -119,17 +119,23 @@
                 self.context.amount_auth - provider_amt -
                 GATEWAY_AMT)
+            if student.current_mode.endswith('_pt'):
+                xmldict['institution_acct'] = "0321100000000046"
+                xmldict['institution_bank_id'] = "89"
+            elif student.current_mode.endswith('_sw'):
+                xmldict['institution_acct'] = "2461770000021"
+                xmldict['institution_bank_id'] = "120"
 
-        hashargs = (
-            self.context.p_id +
-            PRODUCT_ID +
-            self.pay_item_id +
-            str(int(self.amount_auth)) +
-            self.site_redirect_url +
-            self.mac)
-        self.hashvalue = hashlib.sha512(hashargs).hexdigest()
+        #hashargs = (
+        #    self.context.p_id +
+        #    PRODUCT_ID +
+        #    self.pay_item_id +
+        #    str(int(self.amount_auth)) +
+        #    self.site_redirect_url +
+        #    self.mac)
+        #self.hashvalue = hashlib.sha512(hashargs).hexdigest()
 
         # Interswitch amount is not part of the xml data
 
-        if self.context.p_category == 'schoolfee':
+        if self.context.p_category in ('schoolfee', 'schoolfee_1', 'schoolfee_2'):
             xmltext = """<payment_item_detail>
 <item_details detail_ref="%(detail_ref)s" college="%(institution_name)s" department="%(department)s" faculty="%(faculty)s">
Index: in/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser_templates/applicant_goto_interswitch.pt
===================================================================
--- /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser_templates/applicant_goto_interswitch.pt	(revision 10173)
+++ 	(revision )
@@ -1,80 +1,0 @@
-<form i18n:domain="waeup.aaua"
-  tal:attributes="action view/action" method="POST">
-
-  <p i18n:translate="">
-    These data will be submitted to the CollegePAY payment gateway,
-    please check:
-  </p>
-
-  <table class="form-table" i18n:domain="waeup.kofa">
-    <thead>
-    </thead>
-    <tbody>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Total Amount Authorized:</td>
-        <td>
-          <span tal:replace="view/context/amount_auth">AMOUNT</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Transaction Reference:</td>
-        <td>
-          <span tal:replace="view/context/p_id">TXNREF</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Customer Id:</td>
-        <td>
-          <span tal:replace="view/applicant/applicant_id">CUSTID</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Customer Name:</td>
-        <td>
-          <span tal:replace="view/applicant/display_fullname">CUSTNAME</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Payment Item:</td>
-        <td>
-          <span tal:replace="view/context/display_item">PAYMENTITEM</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Payment Category:</td>
-        <td>
-          <span tal:replace="view/category">PAYMENTCATEGORY</span>
-        </td>
-      </tr>
-    </tbody>
-  </table>
-
-  <input type="hidden" name="product_id" tal:attributes="value view/product_id" />
-  <input type="hidden" name="currency" tal:attributes="value view/currency" />
-  <input type="hidden" name="pay_item_id" tal:attributes="value view/pay_item_id" />
-  <input type="hidden" name="site_redirect_url" tal:attributes="value view/site_redirect_url" />
-  <input type="hidden" name="site_name" tal:attributes="value view/site_name" />
-  <input type="hidden" name="local_date_time" tal:attributes="value view/local_date_time" />
-  <input type="hidden" name="amount" tal:attributes="value view/amount_auth" />
-  <input type="hidden" name="txn_ref" tal:attributes="value view/context/p_id" />
-  <input type="hidden" name="pay_item_name" tal:attributes="value view/context/display_item" />
-  <input type="hidden" name="cust_id_desc" tal:attributes="value view/category" />
-  <input type="hidden" name="cust_id" tal:attributes="value view/applicant/applicant_id" />
-  <input type="hidden" name="cust_name" tal:attributes="value view/applicant/display_fullname" />
-
-  <input type="hidden" name="payment_params" value="college_split" />
-  <span tal:replace="structure view/xml_data"></span>
-
-  <input type="submit" class="btn" tal:attributes="value view/submit_button"/>
-
-  <br /><br />
-
-  <img tal:attributes="src view/interswitch_img_url" />
-
-</form>
Index: /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser_templates/student_goto_interswitch.pt
===================================================================
--- /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser_templates/student_goto_interswitch.pt	(revision 10173)
+++ /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser_templates/student_goto_interswitch.pt	(revision 10174)
@@ -59,5 +59,4 @@
   <input type="hidden" name="currency" tal:attributes="value view/currency" />
   <input type="hidden" name="pay_item_id" tal:attributes="value view/pay_item_id" />
-  <input type="hidden" name="hash" tal:attributes="value view/hashvalue" />
   <input type="hidden" name="site_redirect_url" tal:attributes="value view/site_redirect_url" />
   <input type="hidden" name="site_name" tal:attributes="value view/site_name" />
Index: /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/tests.py
===================================================================
--- /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/tests.py	(revision 10174)
+++ /main/waeup.aaua/trunk/src/waeup/aaua/interswitch/tests.py	(revision 10174)
@@ -0,0 +1,109 @@
+## $Id$
+##
+## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+import os
+from zope.component import getUtility
+from zope.catalog.interfaces import ICatalog
+from hurry.workflow.interfaces import IWorkflowState
+from waeup.kofa.students.tests.test_browser import StudentsFullSetup
+from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup
+from waeup.kofa.configuration import SessionConfiguration
+from waeup.aaua.testing import FunctionalLayer
+
+# Also run tests that send requests to external servers?
+#   If you enable this, please make sure the external services
+#   do exist really and are not bothered by being spammed by a test programme.
+EXTERNAL_TESTS = False
+
+def external_test(func):
+    if not EXTERNAL_TESTS:
+        myself = __file__
+        if myself.endswith('.pyc'):
+            myself = myself[:-2]
+        print "WARNING: external tests are skipped!"
+        print "WARNING: edit %s to enable them." % myself
+        return
+    return func
+
+
+class InterswitchTestsStudents(StudentsFullSetup):
+    """Tests for the Interswitch payment gateway.
+    """
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(InterswitchTestsStudents, self).setUp()
+        self.certificate.school_fee_1 = 10000.0
+        self.certificate.school_fee_2 = 20000.0
+        self.certificate.study_mode = 'ug_pt'
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.payments_path)
+        IWorkflowState(self.student).setState('cleared')
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['schoolfee']
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
+        ctrl = self.browser.getControl(name='val_id')
+        self.value = ctrl.options[0]
+        self.browser.getLink(self.value).click()
+        self.assertMatches('...Amount Authorized...',
+                           self.browser.contents)
+        self.assertTrue(
+            '<span>10000.0</span>' in self.browser.contents)
+        self.payment_url = self.browser.url
+
+    def test_interswitch_form(self):
+
+        self.assertEqual(self.student['payments'][self.value].provider_amt, 0.0)
+        self.assertEqual(self.student['payments'][self.value].gateway_amt, 0.0)
+        self.assertEqual(self.student['payments'][self.value].thirdparty_amt, 0.0)
+        # Manager can access InterswitchForm for the created school fee ticket
+        self.browser.getLink("CollegePAY", index=0).click()
+        # Split amounts have been set
+        self.assertEqual(self.student['payments'][self.value].provider_amt, 3000.0)
+        self.assertEqual(self.student['payments'][self.value].gateway_amt, 150.0)
+        self.assertEqual(self.student['payments'][self.value].thirdparty_amt, 0.0)
+        self.assertMatches('...Total Amount Authorized:...',
+                           self.browser.contents)
+        self.assertTrue(
+            '<input type="hidden" name="amount" value="1000000.0" />'
+            in self.browser.contents)
+        self.assertTrue(
+            'item_name="School Fee" item_amt="685000" bank_id="89" acct_num="0321100000000046"'
+            in self.browser.contents)
+        self.assertTrue(
+            'item_name="BT Education" item_amt="300000" bank_id="117" acct_num="6012015294"'
+            in self.browser.contents)
+
+        self.certificate.study_mode = 'ug_sw'
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['schoolfee']
+        self.browser.getControl("Create ticket").click()
+        ctrl = self.browser.getControl(name='val_id')
+        self.value = ctrl.options[1]
+        self.browser.getLink(self.value).click()
+        self.assertTrue(
+            '<span>10000.0</span>' in self.browser.contents)
+        self.browser.getLink("CollegePAY", index=0).click()
+        self.assertTrue(
+            '<input type="hidden" name="amount" value="1000000.0" />'
+            in self.browser.contents)
+        self.assertTrue(
+            'item_name="School Fee" item_amt="685000" bank_id="120" acct_num="2461770000021"'
+            in self.browser.contents)
