Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/paydirectbrowser.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/paydirectbrowser.py	(revision 16554)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/paydirectbrowser.py	(revision 16555)
@@ -113,19 +113,18 @@
         self.ref_number = self.merchant_id + self.context.p_id[1:]
         # Create a PAYDirect Booking
-        if not self.context.r_company:
-            result_xml = create_paydirect_booking(
-                self.merchant_id, self.context, self.gateway_host,
-                self.gateway_url, True)
-            if result_xml.startswith('Connection error'):
-                IPayer(self.context).payer.writeLogMessage(self, result_xml)
-                return result_xml
-            doc=parseString(result_xml)
-            if not doc.getElementsByTagName('ResponseCode'):
-                IPayer(self.context).payer.writeLogMessage(self, 'invalid callback')
-                return _('Invalid callback from Interswitch')
-            rc = doc.getElementsByTagName('ResponseCode')[0].firstChild.data
-            IPayer(self.context).payer.writeLogMessage(self, 'response code: %s' % rc)
-            if rc not in ('100', '108'):
-                return 'Error response code from Interswitch: %s' % rc
+        result_xml = create_paydirect_booking(
+            self.merchant_id, self.context, self.gateway_host,
+            self.gateway_url, True)
+        if result_xml.startswith('Connection error'):
+            IPayer(self.context).payer.writeLogMessage(self, result_xml)
+            return result_xml
+        doc=parseString(result_xml)
+        if not doc.getElementsByTagName('ResponseCode'):
+            IPayer(self.context).payer.writeLogMessage(self, 'invalid callback')
+            return _('Invalid callback from Interswitch')
+        rc = doc.getElementsByTagName('ResponseCode')[0].firstChild.data
+        IPayer(self.context).payer.writeLogMessage(self, 'response code: %s' % rc)
+        if rc not in ('100', '108'):
+            return 'Error response code from Interswitch: %s' % rc
         return
 
@@ -134,9 +133,4 @@
             self.context.student.current_session, self.context):
             self.flash(_('Forbidden'), type='danger')
-            self.redirect(self.url(self.context, '@@index'))
-            return
-        error = self.init_update()
-        if error:
-            self.flash(error, type='danger')
             self.redirect(self.url(self.context, '@@index'))
             return
@@ -148,4 +142,9 @@
             self.context.gateway_amt = self.gateway_amt
             self.context.r_company = u'interswitch'
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+            return
         return
 
@@ -179,12 +178,4 @@
             self.redirect(self.url(self.context, '@@index'))
             return
-        error = self.init_update()
-        if error:
-            self.flash(error, type='danger')
-            self.redirect(self.url(self.context, '@@index'))
-        if self.context.__parent__.__parent__.expired \
-            and self.context.__parent__.__parent__.strict_deadline:
-            return _("Payment ticket can't be used. "
-                     "Application period has expired.")
         # Already now it becomes an Interswitch payment. We set the net amount
         # and add the gateway amount.
@@ -194,4 +185,12 @@
             self.context.gateway_amt = self.gateway_amt
             self.context.r_company = u'interswitch'
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+        if self.context.__parent__.__parent__.expired \
+            and self.context.__parent__.__parent__.strict_deadline:
+            return _("Payment ticket can't be used. "
+                     "Application period has expired.")
         return
 
