Index: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/browser_templates/goto_remita.pt
===================================================================
--- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/browser_templates/goto_remita.pt	(revision 14765)
+++ main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/browser_templates/goto_remita.pt	(revision 14765)
@@ -0,0 +1,63 @@
+<form i18n:domain="kofacustom.nigeria"
+  tal:attributes="action view/action" method="POST">
+
+  <p i18n:translate="">
+    Your payment details were sent to Remita and a retrieval reference
+    number (RRR) has been generated. Please click button below to make
+    your RRR payment.
+  </p>
+
+  <table class="form-table" i18n:domain="waeup.kofa">
+    <tbody>
+      <tr>
+        <td i18n:translate="" class="fieldname">
+          Total Amount Authorized:</td>
+        <td>
+          <span tal:replace="view/context/amount_auth">AMOUNT</span>
+        </td>
+      </tr>
+      <tr>
+        <td i18n:translate="" class="fieldname">
+          Order Id:</td>
+        <td>
+          <span tal:replace="view/context/p_id">ORDERID</span>
+        </td>
+      </tr>
+      <tr>
+        <td i18n:translate="" class="fieldname">
+          Remita Retrieval Reference:</td>
+        <td>
+          <span tal:replace="view/rrr">RRR</span>
+        </td>
+      </tr>
+      <tr>
+        <td i18n:translate="" class="fieldname">
+          Customer Name:</td>
+        <td>
+          <span tal:replace="view/customer/display_fullname">CUSTNAME</span>
+        </td>
+      </tr>
+      <tr>
+        <td i18n:translate="" class="fieldname">
+          Email Address:</td>
+        <td>
+          <span tal:replace="view/customer/email">EMAIL</span>
+        </td>
+      </tr>
+    </tbody>
+  </table>
+
+  <input name="merchantId" tal:attributes="value view/merchantId" type="hidden">
+  <input name="hash" tal:attributes="value view/hashvalue" type="hidden">
+  <input name="rrr" tal:attributes="value view/rrr" type="hidden">
+  <input name="responseurl" tal:attributes="value view/responseurl" type="hidden">
+
+  <br />
+
+  <input type="submit" class="btn btn-primary" tal:attributes="value view/submit_button"/>
+
+  <br /><br />
+
+  <img src="/static/img/remita-payment-logo-horizonal.png" />
+
+</form>
Index: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/browser_templates/student_goto_remita.pt
===================================================================
--- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/browser_templates/student_goto_remita.pt	(revision 14764)
+++ 	(revision )
@@ -1,63 +1,0 @@
-<form i18n:domain="kofacustom.nigeria"
-  tal:attributes="action view/action" method="POST">
-
-  <p i18n:translate="">
-    Your payment details were sent to Remita and a retrieval reference
-    number (RRR) has been generated. Please click button below to make
-    your RRR payment.
-  </p>
-
-  <table class="form-table" i18n:domain="waeup.kofa">
-    <tbody>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Total Amount Authorized:</td>
-        <td>
-          <span tal:replace="view/context/amount_auth">AMOUNT</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Order Id:</td>
-        <td>
-          <span tal:replace="view/context/p_id">ORDERID</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Remita Retrieval Reference:</td>
-        <td>
-          <span tal:replace="view/rrr">RRR</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Customer Name:</td>
-        <td>
-          <span tal:replace="view/student/display_fullname">CUSTNAME</span>
-        </td>
-      </tr>
-      <tr>
-        <td i18n:translate="" class="fieldname">
-          Email Address:</td>
-        <td>
-          <span tal:replace="view/student/email">EMAIL</span>
-        </td>
-      </tr>
-    </tbody>
-  </table>
-
-  <input name="merchantId" tal:attributes="value view/merchantId" type="hidden">
-  <input name="hash" tal:attributes="value view/hashvalue" type="hidden">
-  <input name="rrr" tal:attributes="value view/rrr" type="hidden">
-  <input name="responseurl" tal:attributes="value view/responseurl" type="hidden">
-
-  <br />
-
-  <input type="submit" class="btn btn-primary" tal:attributes="value view/submit_button"/>
-
-  <br /><br />
-
-  <img src="/static/img/remita-payment-logo-horizonal.png" />
-
-</form>
Index: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/studentsbrowser.py
===================================================================
--- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/studentsbrowser.py	(revision 14764)
+++ main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/studentsbrowser.py	(revision 14765)
@@ -27,11 +27,11 @@
 from waeup.kofa.students.interfaces import IStudentsUtils
 from waeup.kofa.students.browser import OnlinePaymentDisplayFormPage as OPDPStudent
-from waeup.kofa.applicants.browser import OnlinePaymentDisplayFormPage as OPDPApplicant
 from kofacustom.nigeria.remita.helpers import (
     get_JSON_POST_response, query_remita, write_payments_log)
 from kofacustom.nigeria.payments.interfaces import INigeriaOnlinePayment
 from kofacustom.nigeria.students.interfaces import INigeriaStudentOnlinePayment
-from kofacustom.nigeria.applicants.interfaces import INigeriaApplicantOnlinePayment
 from kofacustom.nigeria.interfaces import MessageFactory as _
+
+grok.templatedir('browser_templates')
 
 def module_activated(session):
@@ -123,5 +123,4 @@
             self.flash(_('Remita Retrieval Reference not found.'), type='danger')
             return
-
         # Remita sends a POST request which may contain more information
         # if a payment was not successful.
@@ -130,5 +129,4 @@
             self.flash('Transaction status message from Remita: %s'
                 % resp.get('status'), type='warning')
-
         success, msg, log = query_remita(
             self.context,
@@ -139,5 +137,4 @@
             self.https,
             False)
-
         student.writeLogMessage(self, log)
         if not success:
@@ -160,5 +157,5 @@
     grok.context(INigeriaStudentOnlinePayment)
     grok.name('verify_payment_status')
-    grok.require('waeup.payStudent')
+    grok.require('waeup.manageStudent')
 
     # Here we use Remita test portal data
@@ -180,5 +177,4 @@
             self.flash(_('Remita Retrieval Reference not found.'), type='danger')
             return
-
         # Remita sends a POST request which may contain more information
         # if a payment was not successful.
@@ -187,5 +183,4 @@
             self.flash('Transaction status message from Remita: %s'
                 % resp.get('status'), type='warning')
-
         success, msg, log = query_remita(
             self.context,
@@ -196,14 +191,9 @@
             self.https,
             True)
-
         student.writeLogMessage(self, log)
         if not success:
             self.flash(msg, type='danger')
             return
-        write_payments_log(student.student_id, self.context)
-        flashtype, msg, log = self.context.doAfterStudentPayment()
-        if log is not None:
-            student.writeLogMessage(self, log)
-        self.flash(msg, type=flashtype)
+        self.flash(msg)
         return
 
@@ -220,5 +210,5 @@
     grok.context(INigeriaOnlinePayment)
     grok.name('goto_remita')
-    grok.template('student_goto_remita')
+    grok.template('goto_remita')
     grok.require('waeup.payStudent')
     label = _('Pay via Remita')
@@ -255,15 +245,13 @@
         if time_delta.days > 7:
             return _("This payment ticket is too old. Please create a new ticket.")
-        student = self.context.student
-        certificate = getattr(student['studycourse'],'certificate',None)
+        certificate = getattr(self.context.student['studycourse'],'certificate',None)
         if certificate is None:
             return _("Study course data are incomplete.")
         kofa_utils = getUtility(IKofaUtils)
         student_utils = getUtility(IStudentsUtils)
-        if student_utils.samePaymentMade(student, self.context.p_category,
+        if student_utils.samePaymentMade(self.context.student, self.context.p_category,
             self.context.p_item, self.context.p_session):
             return _("This type of payment has already been made.")
         self.responseurl = self.url(self.context, 'request_payment_status')
-        self.student = student
         resp = get_JSON_POST_response(
             merchantId=self.merchantId,
@@ -276,6 +264,6 @@
             url=self.init_url,
             https=self.https,
-            fullname=self.student.display_fullname,
-            email=self.student.email,
+            fullname=self.context.student.display_fullname,
+            email=self.context.student.email,
             lineitems=self.lineitems)
         if resp.get('error'):
@@ -288,4 +276,5 @@
         hashargs = 	self.merchantId + self.rrr + self.api_key
         self.hashvalue = hashlib.sha512(hashargs).hexdigest()
+        self.customer = self.context.student
         return
 
Index: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/tests.py
===================================================================
--- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/tests.py	(revision 14764)
+++ main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/remita/tests.py	(revision 14765)
@@ -122,5 +122,5 @@
 
     # successful transaction
-    # (hopefully this transaction remain in the Remita database)
+    # (hopefully this transaction remains in the Remita database)
     orderId = '3456346346'
     rrr = u'280007640804'
@@ -185,5 +185,5 @@
     @external_test
     def test_remita_form(self):
-        # Manager can access InterswitchForm
+        # Manager can access Remita form
         self.browser.getLink("Pay via Remita").click()
         # The RRR has been retrieved
@@ -197,5 +197,5 @@
     @external_test
     def test_requery_verify_payment_status(self):
-        # Manager can access InterswitchForm
+        # Manager can access Remita form
         self.browser.getLink("Requery Remita Payment Status").click()
         self.assertTrue('Remita Retrieval Reference not found.'
@@ -216,4 +216,4 @@
         self.assertEqual(self.payment.r_code, '01')
         self.browser.getLink("Verify Remita Payment Status").click()
-        self.assertTrue('Successful payment' in self.browser.contents)
+        self.assertTrue('Successful callback received' in self.browser.contents)
         return
