Index: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interfaces.py
===================================================================
--- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interfaces.py	(revision 14334)
+++ main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interfaces.py	(revision 14336)
@@ -39,5 +39,5 @@
 
     clearance_fee = schema.Float(
-        title = _(u'Clearance Fee (ignored)'),
+        title = _(u'Acceptance Fee'),
         default = 0.0,
         required = False,
Index: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/browser.py
===================================================================
--- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/browser.py	(revision 14334)
+++ main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/browser.py	(revision 14336)
@@ -58,5 +58,5 @@
     currency = CURRENCY
     product_id = PRODUCT_ID
-    mac = ''
+    mac = '9309B5CBF1BFB09693C6F5F578046E3FCAB0A2538C3FE4221A6E63AFD348DE888E655F9C7E9F112151A702B6B09E6A7ACC5B3BF3C701F0C1B0D8EA6C1872AE94'
 
     def update(self):
@@ -74,8 +74,7 @@
         xmldict['provider_item_name'] = PROVIDER_ITEM_NAME
         # Institution data
-        xmldict['institution_acct'] = '00000000'
-        xmldict['institution_bank_id'] = '00'
-        xmldict['institution_amt'] = '0.0'
-        provider_amt = 0.0
+        xmldict['institution_acct'] = '1019684470'
+        xmldict['institution_bank_id'] = '7'
+        provider_amt = 500.0
         self.pay_item_id = '0000'
         xmldict['provider_amt'] = 100 * provider_amt
@@ -84,4 +83,8 @@
         xmldict['institution_amt'] = 100 * (
             self.context.amount_auth - provider_amt - GATEWAY_AMT)
+        if self.context.p_category == 'clearance':
+            self.pay_item_id = '102'
+        elif self.context.p_category == 'schoolfee':
+            self.pay_item_id = '103'
         # Interswitch amount is not part of the xml data
         if provider_amt == 0:
Index: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/tests.py
===================================================================
--- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/tests.py	(revision 14334)
+++ main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/interswitch/tests.py	(revision 14336)
@@ -68,9 +68,9 @@
                            self.browser.contents)
         self.assertMatches(
-            '...<span>40000.0</span>...',
+            '...<span>79500.0</span>...',
             self.browser.contents)
         self.payment_url = self.browser.url
         self.browser.getLink("CollegePAY", index=0).click()
-        self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...',
+        self.assertMatches('...<input type="hidden" name="pay_item_id" value="103" />...',
                            self.browser.contents)
         self.assertMatches('...Total Amount Authorized:...',
@@ -78,8 +78,8 @@
         self.assertEqual(self.student.current_mode, 'ug_ft')
         self.assertMatches(
-            '...<input type="hidden" name="amount" value="4000000" />...',
-            self.browser.contents)
-        self.assertMatches(
-            '...item_name="School Fee" item_amt="4000000" bank_id="00" acct_num="00000000"...',
+            '...<input type="hidden" name="amount" value="7950000" />...',
+            self.browser.contents)
+        self.assertMatches(
+            '...item_name="School Fee" item_amt="7950000" bank_id="7" acct_num="1019684470"...',
             self.browser.contents)
 
@@ -95,5 +95,5 @@
         self.browser.open(self.payments_path + '/xyz')
         self.browser.getLink("CollegePAY", index=0).click()
-        self.assertMatches('...<input type="hidden" name="pay_item_id" value="0000" />...',
+        self.assertMatches('...<input type="hidden" name="pay_item_id" value="102" />...',
                            self.browser.contents)
         self.assertMatches('...Total Amount Authorized:...',
Index: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_utils.py
===================================================================
--- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_utils.py	(revision 14336)
+++ main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_utils.py	(revision 14336)
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+from hurry.workflow.interfaces import IWorkflowState
+from zope.component import getUtility, createObject
+from waeup.kofa.testing import FunctionalTestCase
+from waeup.kofa.university.faculty import Faculty
+from waeup.kofa.university.department import Department
+from waeup.kofa.students.student import Student
+from waeup.kofa.students.interfaces import IStudentsUtils
+from waeup.kofa.students.tests.test_browser import StudentsFullSetup
+from kofacustom.coewarri.testing import FunctionalLayer
+
+class StudentsUtilsTests(StudentsFullSetup):
+
+    layer = FunctionalLayer
+
+    def test_set_payment_details(self):
+        self.student['studycourse'].certificate.study_mode = 'ug_ft'
+        self.student.nationality = u'NG'
+        self.student.lga = 'ebonyi_ukaba'
+        self.student['studycourse'].current_session = 2016
+        self.student['studycourse'].entry_session = 2016
+        utils = getUtility(IStudentsUtils)
+
+        configuration = createObject('waeup.SessionConfiguration')
+        configuration.academic_session = 2016
+        self.app['configuration'].addSessionConfiguration(configuration)
+        self.app['configuration']['2016'].clearance_fee = 10234.0
+
+        error, payment = utils.setPaymentDetails('schoolfee', self.student)
+        self.assertEqual(payment, None)
+        self.assertEqual(error, u'Amount could not be determined.')
+        IWorkflowState(self.student).setState('cleared')
+        error, payment = utils.setPaymentDetails('schoolfee',self.student)
+        self.assertEqual(payment.p_level, 100)
+        self.assertEqual(payment.p_session, 2016)
+        self.assertEqual(payment.amount_auth, 79500.0)
+        self.assertEqual(payment.p_item, u'CERT1')
+        self.assertEqual(error, None)
+
+        error, payment = utils.setPaymentDetails('clearance',self.student)
+        self.assertEqual(payment.amount_auth, 15234.0)
+        self.assertEqual(payment.p_item, u'CERT1')
+
+        self.student.lga = 'delta_burutu'
+        error, payment = utils.setPaymentDetails('schoolfee',self.student)
+        self.assertEqual(payment.amount_auth, 69500.0)
+        error, payment = utils.setPaymentDetails('clearance',self.student)
+        self.assertEqual(payment.amount_auth, 10234.0)
+        return
Index: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/utils.py
===================================================================
--- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/utils.py	(revision 14334)
+++ main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/utils.py	(revision 14336)
@@ -18,8 +18,10 @@
 from time import time
 from zope.component import createObject, getUtility
+from waeup.kofa.fees import FeeTable
 from waeup.kofa.interfaces import (IKofaUtils,
     ADMITTED, CLEARED, RETURNING, PAID, REGISTERED, VALIDATED)
 from kofacustom.nigeria.students.utils import NigeriaStudentsUtils
 from kofacustom.coewarri.interfaces import MessageFactory as _
+from kofacustom.coewarri.interswitch.browser import GATEWAY_AMT
 
 
@@ -31,4 +33,27 @@
         return 'non-local'
 
+PAYMENT_LEVELS = (100, 110, 200, 210, 300, 310, 400, 410, 500, 999)
+
+FEES_PARAMS = (
+        ('local', 'non-local'),
+        ('nce_ft', 'nce_pt', 'ug_ft'),
+        PAYMENT_LEVELS
+    )
+
+FEES_VALUES = (
+      ( # 100      110      200      210      300      310      400      410     500  999
+        (42000.0, 42000.0, 20600.0, 20600.0, 18100.0, 18100.0,     0.0,     0.0, 0.0, 0.0), # nce_ft
+        (55200.0, 55200.0, 42200.0, 42200.0, 44700.0, 44700.0, 42200.0, 42200.0, 0.0, 0.0), # nce_pt
+        (69200.0, 69200.0, 63100.0, 63100.0, 63100.0, 63100.0, 62100.0, 62100.0, 0.0, 0.0), # ug_ft
+      ), # local
+      ( #
+        (54600.0, 54600.0, 22600.0, 22600.0, 20100.0, 20100.0,     0.0,     0.0, 0.0, 0.0), # nce_ft
+        (55200.0, 55200.0, 42200.0, 42200.0, 44700.0, 44700.0, 42200.0, 42200.0, 0.0, 0.0), # nce_pt
+        (79200.0, 79200.0, 63100.0, 63100.0, 63100.0, 63100.0, 62100.0, 62100.0, 0.0, 0.0), # ug_ft
+      ), # non-local
+    )
+
+SCHOOL_FEES = FeeTable(FEES_PARAMS, FEES_VALUES)
+
 class CustomStudentsUtils(NigeriaStudentsUtils):
     """A collection of customized methods.
@@ -37,5 +62,5 @@
 
     def setPaymentDetails(self, category, student,
-            previous_session, previous_level):
+            previous_session=None, previous_level=None):
         """Create a payment ticket and set the payment data of a
         student for the payment category specified.
@@ -43,22 +68,7 @@
         p_item = u''
         amount = 0.0
-        if previous_session:
-            if previous_session < student['studycourse'].entry_session:
-                return _('The previous session must not fall below '
-                         'your entry session.'), None
-            if category == 'schoolfee':
-                # School fee is always paid for the following session
-                if previous_session > student['studycourse'].current_session:
-                    return _('This is not a previous session.'), None
-            else:
-                if previous_session > student['studycourse'].current_session - 1:
-                    return _('This is not a previous session.'), None
-            p_session = previous_session
-            p_level = previous_level
-            p_current = False
-        else:
-            p_session = student['studycourse'].current_session
-            p_level = student['studycourse'].current_level
-            p_current = True
+        p_session = student['studycourse'].current_session
+        p_level = student['studycourse'].current_level
+        p_current = True
         academic_session = self._getSessionConfiguration(p_session)
         if academic_session == None:
@@ -71,38 +81,20 @@
             except (AttributeError, TypeError):
                 return _('Study course data are incomplete.'), None
-            if previous_session:
-                # Students can pay for previous sessions in all
-                # workflow states.  Fresh students are excluded by the
-                # update method of the PreviousPaymentAddFormPage.
-                if previous_level == 100:
-                    amount = getattr(certificate, 'school_fee_1', 0.0)
-                else:
-                    amount = getattr(certificate, 'school_fee_2', 0.0)
-            else:
-                if student.state == CLEARED:
-                    amount = getattr(certificate, 'school_fee_1', 0.0)
-                elif student.state == RETURNING:
-                    # In case of returning school fee payment the
-                    # payment session and level contain the values of
-                    # the session the student has paid for. Payment
-                    # session is always next session.
-                    p_session, p_level = self.getReturningData(student)
-                    academic_session = self._getSessionConfiguration(p_session)
-                    if academic_session == None:
-                        return _(
-                            u'Session configuration object is not available.'
-                            ), None
-                    amount = getattr(certificate, 'school_fee_2', 0.0)
-                elif student.is_postgrad and student.state == PAID:
-                    # Returning postgraduate students also pay for the
-                    # next session but their level always remains the
-                    # same.
-                    p_session += 1
-                    academic_session = self._getSessionConfiguration(p_session)
-                    if academic_session == None:
-                        return _(
-                            u'Session configuration object is not available.'
-                            ), None
-                    amount = getattr(certificate, 'school_fee_2', 0.0)
+            if student.state == RETURNING:
+                # Override p_session and p_level
+                p_session, p_level = self.getReturningData(student)
+                academic_session = self._getSessionConfiguration(p_session)
+                if academic_session == None:
+                    return _(u'Session configuration object '
+                              'is not available.'), None
+            if student.state in (RETURNING, CLEARED):
+                if p_level in PAYMENT_LEVELS:
+                    amount = SCHOOL_FEES.get_fee(
+                        (
+                         local_nonlocal(student),
+                         student.current_mode,
+                         p_level)
+                        )
+                    amount += GATEWAY_AMT
         elif category == 'clearance':
             try:
@@ -111,4 +103,6 @@
                 return _('Study course data are incomplete.'), None
             amount = academic_session.clearance_fee
+            if local_nonlocal(student) == 'non-local':
+                amount += 5000.0
         elif category == 'bed_allocation':
             p_item = self.getAccommodationDetails(student)['bt']
Index: main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/utils/utils.py
===================================================================
--- main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/utils/utils.py	(revision 14334)
+++ main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/utils/utils.py	(revision 14336)
@@ -34,38 +34,11 @@
 
     STUDY_MODES_DICT = {
-        'ume_ft': 'UME Full Time',
         'ug_ft': 'Undergraduate Full Time',
-        'ug_pt': 'Undergraduate Part Time',
-        'dp_pt': 'Diploma Part Time',
-        'ct_ft': 'Certificate Full Time',
-        'dp_ft': 'Diploma Full Time',
-        'de_ft': 'Direct Entry Full Time',
-        'de_pt': 'Direct Entry Part Time',
-        'nd_ft': 'National Diploma Full Time',
-        'nd_pt': 'National Diploma Part Time',
-        'hnd_ft': 'Higher National Diploma Full Time',
-        'hnd_pt': 'Higher National Diploma Part Time',
         'pg_ft': 'Postgraduate Full Time',
         'pg_pt': 'Postgraduate Part Time',
-        'pgd_ft': 'Postgraduate Diploma Full Time',
-        'pgd_pt': 'Postgraduate Diploma Part Time',
-        'special_pg_pt': 'Special Postgraduate Part Time',
         'nce_ft': 'NCE Full Time',
         'nce_pt': 'NCE Part Time',
-        'ug_sw': 'Undergraduate Sandwich',
         'nce_sw': 'NCE Sandwich',
-        'jm_ft': 'Joint Matriculation Full Time',
-        'ph_ft': 'Post Higher Education Full Time',
-        'transfer_pt': 'Transfer Part Time',
-        'transfer_ft': 'Transfer Full Time',
-        'ct_pt': 'Certificate Part Time',
-        'rmd_ft': 'Remedial with deficiencies',
-        'rm_ft': 'Remedial',
-        'transfer': 'Transfer',
         'prence': 'Pre-NCE',
-        'prend': 'Pre-ND',
-        'pce': 'PCE',
-        'pd_ft': 'Professional Diploma in Education',
-        'found': 'Foundation',
         'no': 'no application',
         }
