Index: main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py	(revision 12730)
+++ main/waeup.aaue/trunk/src/waeup/aaue/interswitch/browser.py	(revision 12975)
@@ -21,4 +21,5 @@
 from zope.interface import Interface
 from zope.component import queryAdapter
+from waeup.kofa.interfaces import CLEARED
 from kofacustom.nigeria.interswitch.browser import (
     InterswitchPaymentRequestWebservicePageStudent,
@@ -68,5 +69,9 @@
     def update(self):
 
-        super(CustomInterswitchPageApplicant, self).update()
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+            return
         xmldict = {}
         provider_amt = 1000.0
@@ -116,9 +121,32 @@
 
     def update(self):
-        #self.flash('Payment method not yet configured.', type='danger')
-        #self.redirect(self.url(self.context, '@@index'))
-        #return
-        super(CustomInterswitchPageStudent, self).update()
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+            return
         student = self.student
+
+        # To guarantee that cleared students pay both acceptance fee
+        # and school fees, the page can only be accessed
+        # for school fee payments if acceptance/clearance fee has
+        # been successfully queried/paid beforehand. This
+        # requirement applies to students in state 'cleared' and
+        # entry_session greater than 2013 only.
+        if self.context.p_category == 'schoolfee' and \
+            student.state == CLEARED and \
+            student.entry_session > 2012:
+            acceptance_fee_paid = False
+            for ticket in student['payments'].values():
+                if ticket.p_state == 'paid' and \
+                    ticket.p_category == 'clearance':
+                    acceptance_fee_paid = True
+                    break
+            if not acceptance_fee_paid:
+                self.flash(
+                    _('Please pay acceptance fee first.'), type="danger")
+                self.redirect(self.url(self.context, '@@index'))
+                return
+
         xmldict = self.xmldict
         xmltext = ""
Index: main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py	(revision 12730)
+++ main/waeup.aaue/trunk/src/waeup/aaue/interswitch/tests.py	(revision 12975)
@@ -107,4 +107,5 @@
 
     def test_interswitch_form_school_fees(self):
+        self.student['studycourse'].entry_session = 2013
         self.app['configuration']['2004'].school_fee_1 = 51750.0
         # Manager can access InterswitchForm
@@ -128,4 +129,11 @@
         self.payment_url = self.browser.url
         self.browser.getLink("CollegePAY", index=0).click()
+        self.assertTrue(
+            'Please pay acceptance fee first' in self.browser.contents)
+        acc_payment = createObject('waeup.StudentOnlinePayment')
+        acc_payment.p_state = 'paid'
+        acc_payment.p_category = 'clearance'
+        self.student['payments']['xyz'] = acc_payment
+        self.browser.getLink("CollegePAY", index=0).click()
         self.assertMatches('...<input type="hidden" name="pay_item_id" value="105" />...',
                            self.browser.contents)
@@ -139,4 +147,5 @@
             '...item_name="School Fee" item_amt="4600000" bank_id="7" acct_num="1014847058"...',
             self.browser.contents)
+
 
     def test_interswitch_form_acceptance_fees(self):
