Index: /main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py	(revision 12565)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py	(revision 12566)
@@ -47,4 +47,5 @@
         'pgpt': ['Postgraduate Part-Time Programmes', 'PG'],
         'pgnew': ['New Postgraduate Programmes', 'NEWPG'],
+        'pgnewtwo': ['New Postgraduate Programmes (#2)', 'NEWPG'],
         'pgext': ['Postgraduate Programmes (extended application)', 'PG']
         }
Index: /main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py	(revision 12565)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/interswitch/tests.py	(revision 12566)
@@ -202,4 +202,16 @@
             'item_name="BT Education"' in self.browser.contents)
 
+        # Create hostel application ticket
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['hostel_application']
+        self.browser.getControl("Create ticket").click()
+        ctrl = self.browser.getControl(name='val_id')
+        value = ctrl.options[3]
+        self.browser.getLink(value).click()
+        self.assertMatches(
+            '...<span>1000.0</span>...',
+            self.browser.contents)
+        self.student['payments'][value].approve()
+
         # Create temp maint fee ticket
         self.browser.open(self.payments_path + '/addop')
@@ -207,5 +219,5 @@
         self.browser.getControl("Create ticket").click()
         ctrl = self.browser.getControl(name='val_id')
-        value = ctrl.options[3]
+        value = ctrl.options[4]
         self.browser.getLink(value).click()
         self.assertMatches(
@@ -224,5 +236,5 @@
             self.browser.contents)
         self.assertMatches(
-            '...<item_detail item_id="1" item_name="Hostel Maintenance Fee" item_amt="800000" bank_id="17" acct_num="0009598925" />...',
+            '...<item_detail item_id="1" item_name="Hostel Maintenance Fee" item_amt="800000" bank_id="129" acct_num="0014419432" />...',
             self.browser.contents)
         self.assertFalse(
@@ -269,5 +281,5 @@
         self.browser.getControl("Create ticket").click()
         ctrl = self.browser.getControl(name='val_id')
-        value = ctrl.options[4]
+        value = ctrl.options[5]
         self.browser.getLink(value).click()
         self.assertMatches(
Index: /main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 12565)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 12566)
@@ -249,4 +249,17 @@
             name="form.p_category").value = ['tempmaint_1']
         self.browser.getControl("Create ticket").click()
+        self.assertMatches('...You have not yet paid the hostel application fee...',
+                           self.browser.contents)
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(name="form.p_category").value = ['hostel_application']
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
+        ha_ticket = self.student['payments'].values()[2]
+        ha_ticket.approve()
+        self.browser.open(self.payments_path + '/addop')
+        self.browser.getControl(
+            name="form.p_category").value = ['tempmaint_1']
+        self.browser.getControl("Create ticket").click()
         self.assertMatches('...ticket created...',
                            self.browser.contents)
@@ -579,19 +592,30 @@
         self.assertEqual(error, None)
 
-        error, payment = utils.setPaymentDetails('hostel_maintenance',
+        #error, payment = utils.setPaymentDetails('hostel_maintenance',
+        #    self.student, None, None)
+        #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, None, None)
+        #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_application',
             self.student, None, None)
         self.assertEqual(payment.p_level, 100)
         self.assertEqual(payment.p_session, 2004)
-        self.assertEqual(payment.amount_auth, 180.0)
+        self.assertEqual(payment.amount_auth, 1000.0)
         self.assertEqual(payment.p_item, u'')
         self.assertEqual(error, None)
 
-        error, payment = utils.setPaymentDetails('bed_allocation',
-            self.student, None, None)
-        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)
+        payment.approve()
+        self.student['payments'][payment.p_id] = payment
 
         error, payment = utils.setPaymentDetails('tempmaint_1',
Index: /main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 12565)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 12566)
@@ -53,4 +53,13 @@
                 if ticket.p_state == 'paid' and \
                     ticket.p_category == 'schoolfee' and \
+                    ticket.p_session == session:
+                    return True
+        return False
+
+    def _hostelApplicationPaymentMade(self, student, session):
+        if len(student['payments']):
+            for ticket in student['payments'].values():
+                if ticket.p_state == 'paid' and \
+                    ticket.p_category == 'hostel_application' and \
                     ticket.p_session == session:
                     return True
@@ -93,14 +102,21 @@
         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 == 'tempmaint_1':
-            amount = 8150.0
-        elif category == 'tempmaint_2':
-            amount = 12650.0
-        elif category == 'tempmaint_3':
-            amount = 9650.0
+        #elif category == 'bed_allocation':
+        #    amount = academic_session.booking_fee
+        #elif category == 'hostel_maintenance':
+        #    amount = academic_session.maint_fee
+        elif category == 'hostel_application':
+            amount = 1000.0
+        elif category.startswith('tempmaint'):
+            if not self._hostelApplicationPaymentMade(
+                student, student.current_session):
+                return _(
+                    'You have not yet paid the hostel application fee.'), None
+            if category == 'tempmaint_1':
+                amount = 8150.0
+            elif category == 'tempmaint_2':
+                amount = 12650.0
+            elif category == 'tempmaint_3':
+                amount = 9650.0
         elif category == 'clearance':
             p_item = student.certcode
@@ -196,10 +212,9 @@
         elif category == 'schoolfee':
             amount += academic_session.penalty_ug
-        # XXX: Obsolete in 2013
         if category.startswith('tempmaint'):
             p_item = getUtility(IKofaUtils).PAYMENT_CATEGORIES[category]
             p_item = unicode(p_item)
             # Now we change the category because tempmaint payments
-            # will be obsolete in 2013
+            # will be obsolete when Uniben returns to Kofa bed allocation.
             category = 'hostel_maintenance'
         # Create ticket.
Index: /main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py	(revision 12565)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/utils/utils.py	(revision 12566)
@@ -35,4 +35,5 @@
         'cest': 'Part-Time, Diploma, Certificate',
         'pg_new': 'Supplementary PG Application',
+        'pg_new2': 'Supplementary PG Application (#2)',
         'dp_ft': 'Diploma Full-Time Programmes',
         'pg': 'Postgraduate',
@@ -55,5 +56,6 @@
         'schoolfee': 'School Fee',
         'clearance': 'Acceptance Fee',
-        'bed_allocation': 'Bed Allocation Fee',
+        #'bed_allocation': 'Bed Allocation Fee',
+        'hostel_application': 'Hostel Application Fee',
         'hostel_maintenance': 'Hostel Maintenance Fee',
         'tempmaint_1': 'Hall 1-4 M/F Ekehuan',
@@ -70,4 +72,5 @@
         'schoolfee': 'School Fee',
         'clearance': 'Acceptance Fee',
+        'hostel_application': 'Hostel Application Fee',
         'tempmaint_1': 'Hall 1-4 M/F Ekehuan Maintenance Fee',
         'tempmaint_2': 'Hall 5 M/F Maintenance Fee',
