Index: main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py	(revision 9154)
+++ main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py	(revision 9155)
@@ -51,70 +51,7 @@
         self.browser.open(self.payments_path + '/addop')
         self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
+        self.assertMatches('...Payment components not yet configured...',
                            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>40000.0</span>...',
-            self.browser.contents)
-        self.payment_url = self.browser.url
 
-
-#    def callback_url(self, payment_url, resp, apprAmt):
-#        return payment_url + (
-#            '/isw_callback?echo=' +
-#            '&resp=%s' +
-#            '&desc=Something went wrong' +
-#            '&txnRef=p1331792385335' +
-#            '&payRef=' + '&retRef=' +
-#            '&cardNum=0' +
-#            '&apprAmt=%s' +
-#            '&url=http://xyz') % (resp, apprAmt)
-
-    def test_interswitch_form(self):
-
-        # Manager can access InterswitchForm
-        self.browser.getLink("CollegePAY", index=0).click()
-        self.assertMatches('...Total Amount Authorized:...',
-                           self.browser.contents)
-        # The total amount to be processed by Interswitch
-        # has been reduced by the Interswitch fee of 150 Nairas
-        self.assertMatches(
-            '...<input type="hidden" name="amount" value="4000000.0" />...',
-            self.browser.contents)
-
-#    @external_test
-#    def test_callback(self):
-
-        # Manager can call callback manually
-#        self.browser.open(self.callback_url(self.payment_url, 'XX', '300'))
-#        self.assertMatches('...Unsuccessful callback: Something went wrong...',
-#                          self.browser.contents)
-#        self.assertMatches('...Failed...',
-#                           self.browser.contents)
-#        self.browser.open(self.payment_url + '/isw_callback')
-#        self.assertMatches('...Unsuccessful callback: Incomplete query string...',
-#                          self.browser.contents)
-#        self.assertMatches('...Failed...',
-#                           self.browser.contents)
-#        self.browser.open(self.callback_url(self.payment_url, '00', '300000'))
-#        self.assertMatches('...Wrong amount...',
-#                          self.browser.contents)
-#        self.browser.open(self.callback_url(self.payment_url, '00', '4000000'))
-#        self.assertMatches('...Valid callback received...',
-#                          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)
 
 class InterswitchTestsApplicants(ApplicantsFullSetup):
Index: main/waeup.futminna/trunk/src/waeup/futminna/students/interfaces.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/students/interfaces.py	(revision 9154)
+++ main/waeup.futminna/trunk/src/waeup/futminna/students/interfaces.py	(revision 9155)
@@ -71,4 +71,10 @@
     """
 
+    p_current = schema.Bool(
+        title = _(u'Current Session Payment'),
+        default = True,
+        required = False,
+        )
+
     p_level = schema.Int(
         title = _(u'Payment Level'),
Index: main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py	(revision 9154)
+++ main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py	(revision 9155)
@@ -70,114 +70,4 @@
     layer = FunctionalLayer
 
-    def test_manage_payments(self):
-        # Add missing configuration data
-        self.app['configuration']['2004'].gown_fee = 150.0
-        self.app['configuration']['2004'].transfer_fee = 90.0
-        #self.app['configuration']['2004'].clearance_fee = 120.0
-        self.app['configuration']['2004'].booking_fee = 150.0
-        self.app['configuration']['2004'].maint_fee = 180.0
-
-        # Managers can add online payment tickets
-        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
-        self.browser.open(self.payments_path)
-        self.browser.getControl("Add online payment ticket").click()
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Amount could not be determined...',
-                           self.browser.contents)
-        IWorkflowState(self.student).setState('cleared')
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl("Create ticket").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)
-        # Managers can open payment slip
-        self.browser.getLink("Download payment slip").click()
-        self.assertEqual(self.browser.headers['Status'], '200 Ok')
-        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
-        # Set ticket paid
-        ticket = self.student['payments'].items()[0][1]
-        ticket.p_state = 'paid'
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...This type of payment has already been made...',
-                           self.browser.contents)
-        # Remove all payments so that we can add a school fee payment again
-        keys = [i for i in self.student['payments'].keys()]
-        for payment in keys:
-            del self.student['payments'][payment]
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['gown']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['transfer']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(
-            name="form.p_category").value = ['bed_allocation']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(
-            name="form.p_category").value = ['hostel_maintenance']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['clearance']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...ticket created...',
-                           self.browser.contents)
-        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)
-        # In state returning we can add a new school fee ticket since
-        # p_session and p_level is different
-        IWorkflowState(self.student).setState('returning')
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['schoolfee']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Session configuration object is not...',
-                           self.browser.contents)
-        # Uups, we forgot to add a session configuration for next session
-        configuration = createObject('waeup.SessionConfiguration')
-        configuration.academic_session = 2005
-        self.app['configuration'].addSessionConfiguration(configuration)
-        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)
-        # In state admitted school fee can't be determined
-        IWorkflowState(self.student).setState('admitted')
-        self.browser.open(self.payments_path + '/addop')
-        self.browser.getControl(name="form.p_category").value = ['schoolfee']
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Amount could not be determined...',
-                           self.browser.contents)
-
-        # If the session configuration doesn't exist an error message will
-        # be shown. No other requirement is being checked.
-        del self.app['configuration']['2004']
-        self.browser.open(self.payments_path)
-        self.browser.getControl("Add online payment ticket").click()
-        self.browser.getControl("Create ticket").click()
-        self.assertMatches('...Session configuration object is not...',
-                           self.browser.contents)
-
     def test_get_returning_data(self):
         # Student is in level 100, session 2004 with verdict A
@@ -189,77 +79,2 @@
         self.assertEqual(utils.getReturningData(self.student),(2005, 100))
         return
-
-    def test_set_payment_details(self):
-        self.app['configuration']['2004'].gown_fee = 150.0
-        self.app['configuration']['2004'].transfer_fee = 90.0
-        self.app['configuration']['2004'].booking_fee = 150.0
-        self.app['configuration']['2004'].maint_fee = 180.0
-        utils = getUtility(IStudentsUtils)
-
-        configuration = createObject('waeup.SessionConfiguration')
-        configuration.academic_session = 2005
-        self.app['configuration'].addSessionConfiguration(configuration)
-
-        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, 2004)
-        self.assertEqual(payment.amount_auth, 40000.0)
-        self.assertEqual(payment.p_item, u'CERT1')
-        self.assertEqual(error, None)
-
-        # Add penalty fee ...
-        # ... for cleared
-        self.app['configuration']['2004'].penalty_ug = 99.0
-        # ... for returning
-        self.app['configuration']['2005'].penalty_ug = 88.0
-        error, payment = utils.setPaymentDetails('schoolfee',self.student)
-        self.assertEqual(payment.amount_auth, 40099.0)
-
-        IWorkflowState(self.student).setState('returning')
-        error, payment = utils.setPaymentDetails('schoolfee',self.student)
-        self.assertEqual(payment.p_level, 200)
-        self.assertEqual(payment.p_session, 2005)
-        self.assertEqual(payment.amount_auth, 20088.0)
-        self.assertEqual(payment.p_item, u'CERT1')
-        self.assertEqual(error, None)
-
-        error, payment = utils.setPaymentDetails('clearance',self.student)
-        self.assertEqual(payment.p_level, 100)
-        self.assertEqual(payment.p_session, 2004)
-        self.assertEqual(payment.amount_auth, 34250.0)
-        self.assertEqual(payment.p_item, u'CERT1')
-        self.assertEqual(error, None)
-
-        error, payment = utils.setPaymentDetails('gown',self.student)
-        self.assertEqual(payment.p_level, 100)
-        self.assertEqual(payment.p_session, 2004)
-        self.assertEqual(payment.amount_auth, 150.0)
-        self.assertEqual(payment.p_item, u'')
-        self.assertEqual(error, None)
-
-        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
-        self.assertEqual(payment.p_level, 100)
-        self.assertEqual(payment.p_session, 2004)
-        self.assertEqual(payment.amount_auth, 180.0)
-        self.assertEqual(payment.p_item, u'')
-        self.assertEqual(error, None)
-
-        error, payment = utils.setPaymentDetails('bed_allocation',self.student)
-        self.assertEqual(payment.p_level, 100)
-        self.assertEqual(payment.p_session, 2004)
-        self.assertEqual(payment.amount_auth, 150.0)
-        self.assertEqual(payment.p_item, u'')
-        self.assertEqual(error, None)
-
-        error, payment = utils.setPaymentDetails('transfer',self.student)
-        self.assertEqual(payment.p_level, 100)
-        self.assertEqual(payment.p_session, 2004)
-        self.assertEqual(payment.amount_auth, 90.0)
-        self.assertEqual(payment.p_item, u'')
-        self.assertEqual(error, None)
-        return
Index: main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py
===================================================================
--- main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py	(revision 9154)
+++ main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py	(revision 9155)
@@ -48,92 +48,12 @@
         return new_session, new_level
 
-    def setPaymentDetails(self, category, student):
+    def setPaymentDetails(self, category, student,
+            previous_session=None, previous_level=None):
         """Create Payment object and set the payment data of a student for
         the payment category specified.
 
         """
-        details = {}
-        p_item = u''
-        amount = 0.0
-        error = u''
-        p_session = student['studycourse'].current_session
-        p_level = student['studycourse'].current_level
-        session = str(p_session)
-        try:
-            academic_session = grok.getSite()['configuration'][session]
-        except KeyError:
-            return _(u'Session configuration object is not available.'), None
-        # Determine fee.
-        if category == 'transfer':
-            amount = academic_session.transfer_fee
-        elif category == 'gown':
-            amount = academic_session.gown_fee
-        elif category == 'bed_allocation':
-            amount = academic_session.booking_fee
-        elif category == 'hostel_maintenance':
-            amount = academic_session.maint_fee
-        elif category == 'clearance':
-            try:
-                p_item = student['studycourse'].certificate.code
-            except (AttributeError, TypeError):
-                return _('Study course data are incomplete.'), None
-            if p_item in ('BEDCET', 'BIOEDCET', 'CHMEDCET', 'ISEDCET',
-                'MTHEDCET', 'PHYEDCET', 'ITECET', 'AGREDCET', 'HEEDCET'):
-                amount = 17250.0
-            else:
-                amount = 34250.0
-        elif category == 'schoolfee':
-            try:
-                certificate = student['studycourse'].certificate
-                p_item = certificate.code
-            except (AttributeError, TypeError):
-                return _('Study course data are incomplete.'), None
-            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.
-                p_session, p_level = self.getReturningData(student)
-                amount = getattr(certificate, 'school_fee_2', 0.0)
-                try:
-                    academic_session = grok.getSite()[
-                        'configuration'][str(p_session)]
-                except KeyError:
-                    return _(u'Session configuration object is not available.'), None
-            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
-                amount = getattr(certificate, 'school_fee_2', 0.0)
-                try:
-                    academic_session = grok.getSite()[
-                        'configuration'][str(p_session)]
-                except KeyError:
-                    return _(u'Session configuration object is not available.'), None
-        if amount in (0.0, None):
-            return _(u'Amount could not be determined.'), None
-        # Add session specific penalty fee.
-        if category == 'schoolfee' and student.is_postgrad:
-            amount += academic_session.penalty_pg
-        elif category == 'schoolfee':
-            amount += academic_session.penalty_ug
-        # Create ticket.
-        for key in student['payments'].keys():
-            ticket = student['payments'][key]
-            if ticket.p_state == 'paid' and\
-               ticket.p_category == category and \
-               ticket.p_item == p_item and \
-               ticket.p_session == p_session:
-                  return _('This type of payment has already been made.'), None
-        payment = createObject(u'waeup.StudentOnlinePayment')
-        timestamp = ("%d" % int(time()*10000))[1:]
-        payment.p_id = "p%s" % timestamp
-        payment.p_category = category
-        payment.p_item = p_item
-        payment.p_session = p_session
-        payment.p_level = p_level
-        payment.amount_auth = amount
-        return None, payment
+        return _(u'Payment components not yet configured.'), None
+
 
     # FUTMinna prefix
