Index: /main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch/tests.py
===================================================================
--- /main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch/tests.py	(revision 15055)
+++ /main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/interswitch/tests.py	(revision 15056)
@@ -61,8 +61,34 @@
         self.browser.getControl(name="form.p_category").value = ['schoolfee']
         self.browser.getControl("Create ticket").click()
+        self.assertTrue(
+            'Pay SIWES, Logbook and ICT fees first.' in self.browser.contents)
+
+        # Add required payments first.
+        payment = createObject('waeup.StudentOnlinePayment')
+        payment.p_state = 'paid'
+        payment.p_category = 'ict_entre'
+        payment.p_id = '123'
+        payment.p_session = 2004
+        self.student['payments']['123'] = payment
+        payment = createObject('waeup.StudentOnlinePayment')
+        payment.p_state = 'paid'
+        payment.p_category = 'logbook_combo'
+        payment.p_id = '123'
+        payment.p_session = 2004
+        self.student['payments']['234'] = payment
+        payment = createObject('waeup.StudentOnlinePayment')
+        payment.p_state = 'paid'
+        payment.p_category = 'siwess_combo'
+        payment.p_id = '123'
+        payment.p_session = 2004
+        self.student['payments']['345'] = payment
+
+        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.value = ctrl.options[3]
         self.browser.getLink(self.value).click()
         self.assertMatches('...Amount Authorized...',
@@ -88,5 +114,5 @@
                            self.browser.contents)
         ctrl = self.browser.getControl(name='val_id')
-        self.value = ctrl.options[1]
+        self.value = ctrl.options[4]
         self.browser.getLink(self.value).click()
         self.assertTrue(
Index: /main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py
===================================================================
--- /main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py	(revision 15055)
+++ /main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/utils.py	(revision 15056)
@@ -87,4 +87,17 @@
         return 'N/A'
 
+    def _requiredPaymentsMade(self, student, session):
+        if len(student['payments']):
+            num = 0
+            for ticket in student['payments'].values():
+                if ticket.p_state == 'paid' and \
+                    ticket.p_category in (
+                        'ict_entre', 'logbook_combo', 'siwess_combo') and \
+                    ticket.p_session == session:
+                    num += 1
+            if num == 3:
+                return True
+        return False
+
     def setPaymentDetails(self, category, student,
             previous_session, previous_level):
@@ -116,5 +129,12 @@
             return _(u'Session configuration object is not available.'), None
         # Determine fee.
+        # The following three fees are part of the school fee which must be
+        # paid before tuition fee.
+        if category in ('ict_entre', 'logbook_combo', 'siwess_combo') and \
+            student.state == RETURNING:
+            p_session, p_level = self.getReturningData(student)
         if category == 'schoolfee':
+            if not self._requiredPaymentsMade(student, p_session):
+                return _('Pay SIWES, Logbook and ICT fees first.'), None
             try:
                 certificate = student['studycourse'].certificate
