Index: main/waeup.futminna/trunk/src/waeup/futminna/interswitch/browser.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/interswitch/browser.py	(revision 9277)
+++ main/waeup.futminna/trunk/src/waeup/futminna/interswitch/browser.py	(revision 9285)
@@ -24,5 +24,5 @@
 from waeup.kofa.browser.layout import KofaPage, UtilityView
 from waeup.kofa.accesscodes import create_accesscode
-from waeup.kofa.interfaces import RETURNING, IKofaUtils
+from waeup.kofa.interfaces import RETURNING, CLEARED, IKofaUtils
 from waeup.kofa.utils.helpers import to_timezone
 from waeup.kofa.students.viewlets import ApprovePaymentActionButton as APABStudent
@@ -33,8 +33,8 @@
 from waeup.futminna.interfaces import MessageFactory as _
 
-PRODUCT_ID = '57'
+PRODUCT_ID = '117'
 SITE_NAME = 'futminna-kofa.waeup.org'
-PROVIDER_ACCT = '1010764827'
-PROVIDER_BANK_ID = '117'
+PROVIDER_ACCT = '0061001000021095'
+PROVIDER_BANK_ID = '89'
 PROVIDER_ITEM_NAME = 'BT Education'
 INSTITUTION_NAME = 'FUTMinna'
@@ -136,36 +136,4 @@
         return self.view.url(self.view.context, self.target)
 
-class InterswitchActionButtonApplicant(APABApplicant):
-    grok.order(1)
-    grok.context(ICustomApplicantOnlinePayment)
-    grok.require('waeup.payApplicant')
-    icon = 'actionicon_pay.png'
-    text = _('CollegePAY')
-    target = 'goto_interswitch'
-
-    @property
-    def target_url(self):
-        if self.context.p_state != 'unpaid':
-            return ''
-        return self.view.url(self.view.context, self.target)
-
-# Deprecated
-#class InterswitchRequestCallbackActionButtonStudent(RCABStudent):
-#    grok.order(3)
-#    grok.context(ICustomStudentOnlinePayment)
-#    icon = 'actionicon_call.png'
-#    text = _('Request CollegePAY callback')
-
-#    def target_url(self):
-#        if self.context.p_state == 'paid':
-#            return ''
-#        site_redirect_url = self.view.url(self.view.context, 'isw_callback')
-#        args = {
-#            'transRef':self.context.p_id,
-#            'prodID':PRODUCT_ID,
-#            'redirectURL':site_redirect_url}
-#        return QUERY_URL + '?%s' % urllib.urlencode(args)
-
-# Alternative preferred solution
 class InterswitchRequestWebserviceActionButtonStudent(APABStudent):
     grok.order(2)
@@ -175,13 +143,4 @@
     text = _('Requery CollegePAY')
     target = 'request_webservice'
-
-class InterswitchRequestWebserviceActionButtonApplicant(APABApplicant):
-    grok.order(2)
-    grok.context(ICustomApplicantOnlinePayment)
-    grok.require('waeup.payApplicant')
-    icon = 'actionicon_call.png'
-    text = _('Requery CollegePAY')
-    target = 'request_webservice'
-
 
 class InterswitchPageStudent(KofaPage):
@@ -229,10 +188,7 @@
         xmldict['provider_bank_id'] = PROVIDER_BANK_ID
         xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
-        if student.current_mode.endswith('_ft') \
-            and student.state == RETURNING:
-            provider_amt = 600
-        else:
-            provider_amt = 1500
+        provider_amt = 1500
         xmldict['provider_amt'] = 100 * provider_amt
+
         # Institution data
         studycourse = student['studycourse']
@@ -241,5 +197,65 @@
         xmldict['institution_acct'] = '000000000000'
         xmldict['institution_bank_id'] = '00'
-        xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - 150)
+        xmldict['institution_amt'] = 100 * (self.context.amount_auth - provider_amt - 300)
+
+        if self.context.student.current_mode in ('pg_ft'):
+            pay_item_id = "11703"
+        elif self.context.student.state == CLEARED and \
+            self.context.student.current_level == 100:
+            pay_item_id = "11700"
+        elif self.context.student.state == CLEARED and \
+            self.context.student.current_level == 200:
+            pay_item_id = "11701"
+        elif self.context.student.state == CLEARED and \
+            self.context.student.current_level == 300:
+            pay_item_id = "11702"
+        elif self.context.student.state == RETURNING and \
+            self.context.student.current_level in (100,110):
+            pay_item_id = "11701"
+        elif self.context.student.state == RETURNING and \
+            self.context.student.current_level in (200,210):
+            pay_item_id = "11702"
+        elif self.context.student.state == RETURNING and \
+            self.context.student.current_level in (300,310):
+            pay_item_id = "11703"
+        elif self.context.student.state == RETURNING and \
+            self.context.student.current_level in (400,410,500,510,600):
+            pay_item_id = "11704"
+        else:
+            pay_item_id = ""
+
+        if self.context.student.current_mode == 'jm_ft':
+            xmldict['institution_acct'] = "000000000000"
+            xmldict['institution_bank_id'] = '0'
+        elif self.context.student.current_mode == 'pg_ft':
+            xmldict['institution_acct'] = "2522040000134"
+            xmldict['institution_bank_id'] = '8'
+        elif self.context.student.state == CLEARED and \
+            self.context.student.current_level == 100:
+            xmldict['institution_acct'] = "0030001000017110"
+            xmldict['institution_bank_id'] = '89'
+        elif self.context.student.state == CLEARED and \
+            self.context.student.current_level == 200:
+            xmldict['institution_acct'] = "0591201005146"
+            xmldict['institution_bank_id'] = '101'
+        elif self.context.student.state == CLEARED and \
+            self.context.student.current_level == 300:
+            xmldict['institution_acct'] = "6013803345"
+            xmldict['institution_bank_id'] = '117'
+        elif self.context.student.state == RETURNING and \
+            self.context.student.current_level in (100,110):
+            xmldict['institution_acct'] = "0591201005146"
+            xmldict['institution_bank_id'] = '101'
+        elif self.context.student.current_level in (200,210):
+            xmldict['institution_acct'] = "6013803345"
+            xmldict['institution_bank_id'] = '117'
+        elif self.context.student.current_level in (300,310):
+            xmldict['institution_acct'] = "2522040000134"
+            xmldict['institution_bank_id'] = '8'
+        #Change of acct from UBA to GTBank
+        elif self.context.student.current_level in (400,410,500,510,600):
+            xmldict['institution_acct'] = "3713516838111"
+            xmldict['institution_bank_id'] = '10'
+
         xmldict['institution_item_name'] = self.context.p_category
         xmldict['institution_name'] = INSTITUTION_NAME
@@ -254,126 +270,4 @@
         return
 
-class InterswitchPageApplicant(KofaPage):
-    """ View which sends a POST request to the Interswitch
-    CollegePAY payment gateway.
-    """
-    grok.context(ICustomApplicantOnlinePayment)
-    grok.require('waeup.payApplicant')
-    grok.template('applicant_goto_interswitch')
-    grok.name('goto_interswitch')
-    label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')
-    submit_button = _('Submit')
-    action = POST_ACTION
-    site_name = SITE_NAME
-    currency = CURRENCY
-    pay_item_id = '5703'
-    product_id = PRODUCT_ID
-
-    def update(self):
-        if self.context.p_state != 'unpaid':
-            self.flash(_("Payment ticket can't be re-send to CollegePAY."))
-            self.redirect(self.url(self.context, '@@index'))
-            return
-        if self.context.__parent__.__parent__.expired \
-            and self.context.__parent__.__parent__.strict_deadline:
-            self.flash(_("Payment ticket can't be send to CollegePAY. "
-                         "Application period has expired."))
-            self.redirect(self.url(self.context, '@@index'))
-            return
-        self.applicant = self.context.__parent__
-        self.amount_auth = 100 * self.context.amount_auth
-        xmldict = {}
-        self.category = payment_categories.getTermByToken(
-            self.context.p_category).title
-        tz = getUtility(IKofaUtils).tzinfo
-        self.local_date_time = to_timezone(
-            self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")
-        self.site_redirect_url = self.url(self.context, 'request_webservice')
-        if self.applicant.applicant_id.startswith('pg'):
-            provider_amt = 400
-            xmldict['institution_acct'] = '0031716030'
-            xmldict['institution_bank_id'] = '10'
-        else:
-            provider_amt = 250
-            xmldict['institution_acct'] = '6220032503'
-            xmldict['institution_bank_id'] = '51'
-        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 - 150)
-        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
-        return
-
-# Deprecated
-#class InterswitchPaymentCallbackPageStudent(UtilityView, grok.View):
-#    """ Callback view for the CollegePAY gateway
-#    """
-#    grok.context(ICustomStudentOnlinePayment)
-#    grok.name('isw_callback')
-#    grok.require('waeup.payStudent')
-
-    # This view is not yet working for offline querying transactions
-    # since the query string differs from the query string sent after
-    # posting transactions. This Interswitch bug must be removed first.
-    # Alternatively, we could use the webservice only and replace
-    # the RequestCallbackActionButton by a RequestWebserviceActionButton
-
-#    def update(self):
-#        if self.context.p_state == 'paid':
-#            self.flash(_('This ticket has already been paid.'))
-#            return
-#        student = self.context.student
-#        query = self.request.form
-#        write_log_message(self,'callback received: %s' % query)
-#        self.context.r_card_num = query.get('cardNum', None)
-#        self.context.r_code = query.get('resp', None)
-#        self.context.r_pay_reference  = query.get('payRef', None)
-#        self.context.r_amount_approved = float(query.get('apprAmt', '0.0')) / 100
-#        self.context.r_desc = query.get('desc', None)
-#        if self.context.r_code != '00':
-#            self.flash(_('Unsuccessful callback: ${a}',
-#                mapping = {'a': query.get('desc', _('Incomplete query string.'))}))
-#            write_log_message(self,'unsuccessful callback: %s' % self.context.p_id)
-#            self.context.p_state = 'failed'
-#            return
-#        if self.context.r_amount_approved != payment.amount_auth:
-#            self.flash(_('Wrong amount'))
-#            write_log_message(
-#                self,'successful but wrong amount: %s' % self.context.p_id)
-#            self.context.p_state = 'failed'
-#            return
-#        try:
-#            validation_list = get_SOAP_response(
-#                PRODUCT_ID, self.context.p_id).split(':')
-            # Validation does not make sense yet since the query string
-            # formats are conflicting. We are only printing the validation
-            # string, nothing else.
-#            print 'WARNING: Webservice validation is not yet implemented'
-#            print 'validation list: %s' % validation_list
-#        except:
-#            print 'Connection to webservice failed.'
-        # Add webservice validation here
-#        write_log_message(self,'valid callback: %s' % self.context.p_id)
-#        self.context.p_state = 'paid'
-#        self.context.payment_date = datetime.utcnow()
-#        actions_after_student_payment(student, self.context, self)
-#        return
-
-#    def render(self):
-#        self.redirect(self.url(self.context, '@@index'))
-#        return
-
-# Alternative solution, replaces InterswitchPaymentCallbackPage
 class InterswitchPaymentRequestWebservicePageStudent(UtilityView, grok.View):
     """ Request webservice view for the CollegePAY gateway
@@ -403,29 +297,2 @@
         self.redirect(self.url(self.context, '@@index'))
         return
-
-class InterswitchPaymentRequestWebservicePageApplicant(UtilityView, grok.View):
-    """ Request webservice view for the CollegePAY gateway
-    """
-    grok.context(ICustomApplicantOnlinePayment)
-    grok.name('request_webservice')
-    grok.require('waeup.payApplicant')
-
-    def update(self):
-        if self.context.p_state == 'paid':
-            self.flash(_('This ticket has already been paid.'))
-            return
-        applicant = self.context.__parent__
-        success, msg, log = query_interswitch(self.context)
-        applicant.writeLogMessage(self, log)
-        if not success:
-            self.flash(msg)
-            return
-        success, msg, log = self.context.doAfterApplicantPayment()
-        if log is not None:
-            applicant.writeLogMessage(self, log)
-        self.flash(msg)
-        return
-
-    def render(self):
-        self.redirect(self.url(self.context, '@@index'))
-        return
Index: main/waeup.futminna/trunk/src/waeup/futminna/interswitch/browser_templates/applicant_goto_interswitch.pt
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/interswitch/browser_templates/applicant_goto_interswitch.pt	(revision 9277)
+++ 	(revision )
@@ -1,76 +1,0 @@
-<form i18n:domain="waeup.custom"
-  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/p_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/p_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"/>
-
-</form>
Index: main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py	(revision 9277)
+++ main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py	(revision 9285)
@@ -51,36 +51,15 @@
         self.browser.open(self.payments_path + '/addop')
         self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Payment components not yet configured...',
+        self.assertMatches('...Payment ticket created...',
                            self.browser.contents)
-
-
-class InterswitchTestsApplicants(ApplicantsFullSetup):
-    """Tests for the Interswitch payment gateway.
-    """
-
-    layer = FunctionalLayer
-
-    def setUp(self):
-        super(InterswitchTestsApplicants, self).setUp()
-        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.applicantscontainer.application_fee = 1000.0
-        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()
+        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>...',
+            '...<span>131500.0</span>...',
             self.browser.contents)
         self.payment_url = self.browser.url
-
 
     def test_interswitch_form(self):
@@ -91,10 +70,9 @@
                            self.browser.contents)
         self.assertMatches(
-            '...<input type="hidden" name="amount" value="100000.0" />...',
+            '...<input type="hidden" name="amount" value="13150000.0" />...',
             self.browser.contents)
 
     @external_test
     def test_webservice(self):
-
         self.browser.open(self.payment_url + '/request_webservice')
         self.assertMatches('...Unsuccessful callback...',
