Index: /main/waeup.custom/trunk/src/waeup/custom/applicants/__init__.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/applicants/__init__.py	(revision 6902)
+++ /main/waeup.custom/trunk/src/waeup/custom/applicants/__init__.py	(revision 6902)
@@ -0,0 +1,1 @@
+# Make this a package.
Index: /main/waeup.custom/trunk/src/waeup/custom/students/__init__.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/students/__init__.py	(revision 6902)
+++ /main/waeup.custom/trunk/src/waeup/custom/students/__init__.py	(revision 6902)
@@ -0,0 +1,1 @@
+# Make this a package.
Index: /main/waeup.custom/trunk/src/waeup/custom/students/browser.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/students/browser.py	(revision 6902)
+++ /main/waeup.custom/trunk/src/waeup/custom/students/browser.py	(revision 6902)
@@ -0,0 +1,32 @@
+import grok
+from time import time
+from zope.component import createObject
+from waeup.sirp.students.browser import OnlinePaymentAddFormPage
+from waeup.custom.students.utils import getPaymentDetails
+
+class OnlinePaymentAddFormPage(OnlinePaymentAddFormPage):
+    """ Page to add an online payment ticket
+    """
+
+    @grok.action('Create ticket')
+    def createTicket(self, **data):
+        payment = createObject(u'waeup.StudentOnlinePayment')
+        self.applyData(payment, **data)
+        timestamp = "%d" % int(time()*1000)
+        #order_id = "%s%s" % (student_id[1:],timestamp)
+        payment.p_id = "p%s" % timestamp
+        (payment.amount_auth,
+            payment.p_item, payment.p_session,
+            payment.surcharge_1,
+            payment.surcharge_2,
+            payment.surcharge_3)  = getPaymentDetails(
+            data['p_category'],self.context.__parent__)
+        import pdb; pdb.set_trace()
+        if payment.amount_auth == 0:
+            self.flash('Payment amount could not be determined.')
+            self.redirect(self.url(self.context, u'@@manage'))
+            return
+        self.context[payment.p_id] = payment
+        self.flash('Payment ticket created.')
+        self.redirect(self.url(self.context, u'@@manage'))
+        return
Index: /main/waeup.custom/trunk/src/waeup/custom/students/tests.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/students/tests.py	(revision 6902)
+++ /main/waeup.custom/trunk/src/waeup/custom/students/tests.py	(revision 6902)
@@ -0,0 +1,30 @@
+from waeup.sirp.testing import FunctionalLayer
+from waeup.sirp.students.tests.test_browser import StudentsFullSetup
+
+class StudentUITests(StudentsFullSetup):
+    # Tests for customized student class views and pages
+
+    layer = FunctionalLayer
+
+    def test_manage_payments(self):
+        # Managers can add online payment tickets
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.payments_student_path)
+        self.browser.getLink("Manage").click()
+        self.browser.getControl("Add online payment ticket").click()
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...amount could not be determined...',
+                           self.browser.contents)
+        self.browser.open(self.manage_student_path)
+        self.browser.getControl(name="transition").value = ['admit']
+        self.browser.getControl("Save").click()
+        self.browser.getControl(name="transition").value = ['start_clearance']
+        self.browser.getControl("Save").click()
+        self.browser.getControl(name="transition").value = ['request_clearance']
+        self.browser.getControl("Save").click()
+        self.browser.getControl(name="transition").value = ['clear']
+        self.browser.getControl("Save").click()
+        self.browser.open(self.payments_student_path + '/addop')
+        self.browser.getControl("Create ticket").click()
+        self.assertMatches('...ticket created...',
+                           self.browser.contents)
Index: /main/waeup.custom/trunk/src/waeup/custom/students/utils.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/students/utils.py	(revision 6902)
+++ /main/waeup.custom/trunk/src/waeup/custom/students/utils.py	(revision 6902)
@@ -0,0 +1,61 @@
+from waeup.sirp.students.vocabularies import academic_sessions_vocab
+
+def getPaymentDetails(category, student):
+    p_session = student['studycourse'].current_session
+    surcharge_1 = surcharge_2 = surcharge_3 = 0
+    p_item = u''
+    if category == 'transfer':
+        amount = 500
+    elif category == 'gown':
+        amount = 500
+    elif category == 'hostel_maintenance':
+        amount = 300
+    elif category == 'schoolfee':
+        surcharge_1 = 1500 # BT amount
+        surcharge_2 = 300 # Interswitch amount
+        try:
+            amount = getSchoolFee(student, surcharge_1 + surcharge_2)
+            code = student['studycourse'].certificate.code
+        except AttributeError:
+            return 0, None, None, 0, 0, 0
+        #session_string = academic_sessions_vocab.by_value[p_session + 1].title
+        p_item = code
+        p_session += 1
+    return amount, p_item, p_session, surcharge_1, surcharge_2, surcharge_3
+
+def getSchoolFee(student, surcharge):
+    study_mode = student['studycourse'].certificate.study_mode
+    entry_mode = student.entry_mode
+    state = student.state
+    #lga = student.lga
+    lga = 'nothing'
+    current_level = student['studycourse'].current_level
+    CLEARED = 'cleared'
+
+    if study_mode.endswith('_ft'):
+        # fresh remedial
+        if current_level == 0 and state == CLEARED:
+            if entry_mode == 'rmd_ft':
+                return 80200 - surcharge
+            else:
+                return 74200 - surcharge
+        # fresh
+        elif state == CLEARED:
+            if study_mode == 'jm_ft':
+                return 72700 - surcharge
+            elif lga == 'foreigner':
+                return 131500 - surcharge
+            else:
+                return 41500 - surcharge
+        # returning
+        elif state == 'returning':
+            if study_mode == 'jm_ft':
+                return 32500 - surcharge
+            elif lga == 'foreigner':
+                return 109500 - surcharge
+            else:
+                return 19500 - surcharge
+        else:
+            return 0
+    else:
+        return 0
Index: /main/waeup.custom/trunk/src/waeup/custom/university/__init__.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/university/__init__.py	(revision 6902)
+++ /main/waeup.custom/trunk/src/waeup/custom/university/__init__.py	(revision 6902)
@@ -0,0 +1,1 @@
+# Make this a package.
Index: /main/waeup.custom/trunk/src/waeup/custom/utils/__init__.py
===================================================================
--- /main/waeup.custom/trunk/src/waeup/custom/utils/__init__.py	(revision 6902)
+++ /main/waeup.custom/trunk/src/waeup/custom/utils/__init__.py	(revision 6902)
@@ -0,0 +1,1 @@
+# Make this a package.
