Index: /main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py
===================================================================
--- /main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py	(revision 9430)
+++ /main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py	(revision 9431)
@@ -116,4 +116,19 @@
         self.browser.getControl(name="form.p_category").value = ['hostel_maintenance']
         self.browser.getControl("Create ticket").click()
+        self.assertMatches('...You have not yet booked accommodation...',
+                           self.browser.contents)
+        # Students have to book bed first
+        self.browser.open(self.acco_path)
+        IWorkflowState(self.student).setState('admitted')
+        self.browser.getLink("Book accommodation").click()
+        self.assertFalse('Activation Code:' in self.browser.contents)
+        self.browser.getControl("Create bed ticket").click()
+        # Bed is randomly selected but, since there is only
+        # one bed for this student, we know that ...
+        self.assertMatches('...Hall 1, Block A, Room 101, Bed A...',
+                           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)
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 9430)
+++ /main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py	(revision 9431)
@@ -28,4 +28,5 @@
 from waeup.kofa.university.department import Department
 from waeup.kofa.students.tests.test_browser import StudentsFullSetup
+from waeup.kofa.students.accommodation import BedTicket
 from waeup.kofa.testing import FunctionalTestCase
 from waeup.kofa.interfaces import (
@@ -87,4 +88,15 @@
         self.app['faculties']['SSE']['dep1'].certificates.addCertificate(
             self.certificate2)
+        # Create EET faculty with certificate
+        self.app['faculties']['EET'] = Faculty(code='EET')
+        self.app['faculties']['EET']['dep1'] = Department(code='dep1')
+        self.certificate3 = createObject('waeup.Certificate')
+        self.certificate3.code = u'CERT3'
+        self.certificate3.application_category = 'basic'
+        self.certificate3.study_mode = 'ug_ft'
+        self.certificate3.start_level = 100
+        self.certificate3.end_level = 300
+        self.app['faculties']['EET']['dep1'].certificates.addCertificate(
+            self.certificate3)
         # Set study course attributes of test student
         self.student['studycourse'].certificate = self.certificate2
@@ -160,23 +172,32 @@
 
         error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
+        self.assertEqual(error, 'You have not yet booked accommodation.')
+        bedticket = BedTicket()
+        bedticket.booking_session = 2004
+        bedticket.bed_type = u'any bed type'
+        bedticket.bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
+        bedticket.bed_coordinates = u'My bed coordinates'
+        self.student['accommodation'].addBedTicket(bedticket)
+        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, 10000.0)
-        self.assertEqual(payment.p_item, u'sse_male_fr')
-        self.assertEqual(error, None)
-
-        self.student['studycourse'].certificate = self.certificate
-        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, 10000.0)
-        self.assertEqual(payment.p_item, u'regular_male_fr')
-        self.assertEqual(error, None)
-
-        error, payment = utils.setPaymentDetails('block_h_maintenance',self.student)
+        self.assertEqual(payment.p_item, u'My bed coordinates')
+        self.assertEqual(error, None)
+
+        self.student['studycourse'].certificate = self.certificate3
+        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, 12000.0)
+        self.assertEqual(payment.p_item, u'My bed coordinates')
+        self.assertEqual(error, None)
+
+        bedticket.bed.bed_id = u'block-h_anything'
+        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, 15000.0)
-        self.assertEqual(payment.p_item, u'regular_male_fr')
+        self.assertEqual(payment.p_item, u'My bed coordinates')
         self.assertEqual(error, None)
 
Index: /main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py
===================================================================
--- /main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py	(revision 9430)
+++ /main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py	(revision 9431)
@@ -116,21 +116,20 @@
                 amount = 20000.0
         elif category == 'hostel_maintenance':
+            current_session = student['studycourse'].current_session
+            bedticket = student['accommodation'].get(str(current_session), None)
+            if bedticket:
+                p_item = bedticket.bed_coordinates
+            else:
+                return _(u'You have not yet booked accommodation.'), None
             acc_details = self.getAccommodationDetails(student)
-            if student['studycourse'].current_session != acc_details[
-                'booking_session']:
+            if current_session != acc_details['booking_session']:
                 return _(u'Current session does not match accommodation session.'), None
-            if student.current_level  in ('100','200','300','400','500') and \
+            if bedticket.bed.bed_id.startswith('block-h'):
+                amount = 15000.0
+            elif student.current_level  in (100,200,300,400,500) and \
                 student.faccode in ('EET','SET','AAT','ICT','EMT'):
                 amount = 12000.0
             else:
                 amount = 10000.0
-            p_item = acc_details['bt']
-        elif category == 'block_h_maintenance':
-            acc_details = self.getAccommodationDetails(student)
-            if student['studycourse'].current_session != acc_details[
-                'booking_session']:
-                return _(u'Current session does not match accommodation session.'), None
-            amount = 15000.0
-            p_item = acc_details['bt']
         elif category == 'bed_allocation':
             p_item = self.getAccommodationDetails(student)['bt']
Index: /main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py
===================================================================
--- /main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py	(revision 9430)
+++ /main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py	(revision 9431)
@@ -36,6 +36,5 @@
         'schoolfee': 'School Fee',
         'clearance': 'Acceptance Fee',
-        #'hostel_maintenance': 'Regular Hostel Maintenance Fee',
-        #'block_h_maintenance': 'Block H Maintenance Fee',
+        'hostel_maintenance': 'Hostel Maintenance Fee',
         'application': 'Application Fee'
         }
