Index: /main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py	(revision 11845)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/etranzact/browser.py	(revision 11846)
@@ -370,14 +370,14 @@
         return ''
 
-class InterswitchActionButtonApplicant(InterswitchActionButtonApplicant):
-
-    @property
-    def target_url(self):
-        return ''
-
-class InterswitchRequestWebserviceActionButtonApplicant(
-    InterswitchRequestWebserviceActionButtonApplicant):
-
-    @property
-    def target_url(self):
-        return ''
+#class InterswitchActionButtonApplicant(InterswitchActionButtonApplicant):
+
+#    @property
+#    def target_url(self):
+#        return ''
+
+#class InterswitchRequestWebserviceActionButtonApplicant(
+#    InterswitchRequestWebserviceActionButtonApplicant):
+
+#    @property
+#    def target_url(self):
+#        return ''
Index: /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/__init__.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/__init__.py	(revision 11846)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/__init__.py	(revision 11846)
@@ -0,0 +1,1 @@
+# Make this a package.
Index: /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py	(revision 11846)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py	(revision 11846)
@@ -0,0 +1,115 @@
+## $Id: browser.py 11797 2014-09-19 16:00:43Z henrik $
+##
+## Copyright (C) 2012 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 httplib
+import hashlib
+import grok
+from zope.interface import Interface
+from zope.component import queryAdapter
+from kofacustom.nigeria.interswitch.browser import (
+    InterswitchPaymentRequestWebservicePageStudent,
+    InterswitchPaymentRequestWebservicePageApplicant,
+    InterswitchPageStudent, InterswitchPageApplicant,
+    )
+from waeup.aaue.students.interfaces import ICustomStudentOnlinePayment
+from waeup.aaue.applicants.interfaces import ICustomApplicantOnlinePayment
+from waeup.aaue.interfaces import MessageFactory as _
+
+PRODUCT_ID = '119'
+SITE_NAME = 'aaue.waeup.org'
+PROVIDER_ACCT = '1010764827'
+PROVIDER_BANK_ID = '117'
+PROVIDER_ITEM_NAME = 'BT Education'
+INSTITUTION_NAME = 'AAU Ekpoma'
+CURRENCY = '566'
+GATEWAY_AMT = 250.0
+#QUERY_URL = 'https://webpay.interswitchng.com/paydirect/services/TransactionQueryURL.aspx'
+#QUERY_URL = 'https://testwebpay.interswitchng.com/test_paydirect/services/TransactionQueryURL.aspx'
+
+POST_ACTION = 'https://webpay.interswitchng.com/paydirect/webpay/pay.aspx'
+#POST_ACTION = 'https://testwebpay.interswitchng.com/test_paydirect/webpay/pay.aspx'
+
+HOST = 'webpay.interswitchng.com'
+#HOST = 'testwebpay.interswitchng.com'
+
+URL = '/paydirect/services/TransactionQueryWs.asmx'
+#URL = '/test_paydirect/services/TransactionQueryWs.asmx'
+httplib.HTTPConnection.debuglevel = 0
+
+
+class CustomInterswitchPageApplicant(InterswitchPageApplicant):
+    """ View which sends a POST request to the Interswitch
+    CollegePAY payment gateway.
+    """
+    grok.context(ICustomApplicantOnlinePayment)
+    grok.template('applicant_goto_interswitch')
+    action = POST_ACTION
+    site_name = SITE_NAME
+    currency = CURRENCY
+    pay_item_id = '11900'
+    product_id = PRODUCT_ID
+    mac = 'E6BA6CBBA9AF2871EE25C32C8D57C98895B9B001DC5B9CB2C463E2A9BDA44A3F1260C8A364F33789CDF74CB3EE7E6EF5D94F48D3AF7B727E75D97F07618DFA6D'
+
+    def interswitch_img_url(self):
+        return interswitch_img_url(self)
+
+    def update(self):
+
+        super(CustomInterswitchPageApplicant, self).update()
+        xmldict = {}
+        provider_amt = 1000.0
+        xmldict['institution_acct'] = '1010835352'
+        xmldict['institution_bank_id'] = '117'
+        xmldict['detail_ref'] = self.context.p_id
+        xmldict['provider_amt'] = 100 * provider_amt
+        xmldict['provider_acct'] = PROVIDER_ACCT
+        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.p_category
+        xmldict['institution_name'] = INSTITUTION_NAME
+        # Interswitch amount is not part of the xml data
+        xmltext = """<payment_item_detail>
+<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
+<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
+<item_detail item_id="2" item_name="%(provider_item_name)s" item_amt="%(provider_amt)d" bank_id="%(provider_bank_id)s" acct_num="%(provider_acct)s" />
+</item_details>
+</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
+
+        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()
+
+        return
+
+
+class CustomInterswitchPaymentRequestWebservicePageApplicant(
+    InterswitchPaymentRequestWebservicePageApplicant):
+    """ Request webservice view for the CollegePAY gateway
+    """
+    grok.context(ICustomApplicantOnlinePayment)
+    product_id = PRODUCT_ID
+    gateway_host = HOST
+    gateway_url = URL
Index: /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser_templates/applicant_goto_interswitch.pt
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser_templates/applicant_goto_interswitch.pt	(revision 11846)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser_templates/applicant_goto_interswitch.pt	(revision 11846)
@@ -0,0 +1,79 @@
+<form i18n:domain="waeup.kwarapoly"
+  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">
+    <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="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" />
+  <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>
+  <br />
+  <input type="submit" class="btn btn-primary" tal:attributes="value view/submit_button"/>
+
+  <br /><br />
+
+  <img src="/static/img/interswitch_verve_mastercard.gif" />
+
+</form>
Index: /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser_templates/student_goto_interswitch.pt
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser_templates/student_goto_interswitch.pt	(revision 11846)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser_templates/student_goto_interswitch.pt	(revision 11846)
@@ -0,0 +1,79 @@
+<form i18n:domain="waeup.kwarapoly"
+  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">
+    <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/student/student_id">CUSTID</span>
+        </td>
+      </tr>
+      <tr>
+        <td i18n:translate="" class="fieldname">
+          Customer Name:</td>
+        <td>
+          <span tal:replace="view/student/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="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" />
+  <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/student/student_id" />
+  <input type="hidden" name="cust_name" tal:attributes="value view/student/display_fullname" />
+
+  <input type="hidden" name="payment_params" value="college_split" />
+  <span tal:replace="structure view/xml_data"></span>
+  <br />
+  <input type="submit" class="btn btn-primary" tal:attributes="value view/submit_button"/>
+
+  <br /><br />
+
+  <img src="/static/img/interswitch_verve_mastercard.gif" />
+
+</form>
Index: /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py	(revision 11846)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py	(revision 11846)
@@ -0,0 +1,97 @@
+## $Id: tests.py 11813 2014-09-24 06:36:19Z henrik $
+##
+## 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 datetime import datetime, date, timedelta
+from zope.component import createObject, 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.aaue.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 InterswitchTestsApplicants(ApplicantsFullSetup):
+    """Tests for the Interswitch payment gateway.
+    """
+
+    layer = FunctionalLayer
+
+    def setUp(self):
+        super(InterswitchTestsApplicants, self).setUp()
+        configuration = SessionConfiguration()
+        configuration.academic_session = datetime.now().year - 2
+        self.app['configuration'].addSessionConfiguration(configuration)
+        self.configuration = configuration
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.manage_path)
+        #IWorkflowState(self.student).setState('started')
+        super(InterswitchTestsApplicants, self).fill_correct_values()
+        self.browser.getControl(name="form.programme_type").value = ['regular']
+        self.applicantscontainer.application_fee = 1000.0
+        self.browser.getControl(name="form.nationality").value = ['NG']
+        self.browser.getControl(name="transition").value = ['start']
+        self.browser.getControl("Save").click()
+        self.browser.getControl("Add online").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
+        #ctrl = self.browser.getControl(name='val_id')
+        #value = ctrl.options[0]
+        #self.browser.getLink(value).click()
+        self.assertMatches('...Amount Authorized...',
+                           self.browser.contents)
+        self.assertMatches(
+            '...<span>1000.0</span>...',
+            self.browser.contents)
+        self.payment_url = self.browser.url
+
+
+    def test_interswitch_form(self):
+
+        # Manager can access InterswitchForm
+        self.browser.getLink("CollegePAY", index=0).click()
+        self.assertMatches('...Total Amount Authorized:...',
+                           self.browser.contents)
+        self.assertMatches(
+            '...<input type="hidden" name="amount" value="100000" />...',
+            self.browser.contents)
+
+    @external_test
+    def test_webservice(self):
+
+        self.browser.open(self.payment_url + '/request_webservice')
+        self.assertMatches('...Unsuccessful callback...',
+                          self.browser.contents)
+        # The payment is now in state failed
+        self.assertMatches('...<span>Failed</span>...',
+                          self.browser.contents)
Index: /main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
===================================================================
--- /main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py	(revision 11845)
+++ /main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py	(revision 11846)
@@ -25,4 +25,5 @@
 from waeup.kofa.students.workflow import PAID
 from waeup.kofa.students.browser import (
+    StartClearancePage,
     StudentBasePDFFormPage,
     CourseTicketAddFormPage,
@@ -43,4 +44,7 @@
     ICustomStudent)
 from waeup.aaue.interfaces import MessageFactory as _
+
+class CustomStartClearancePage(StartClearancePage):
+    with_ac = False
 
 class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
