Index: /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py
===================================================================
--- /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py	(revision 11641)
+++ /main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/interswitch/browser.py	(revision 11642)
@@ -22,4 +22,5 @@
 from waeup.kofa.browser.layout import UtilityView, KofaPage
 from waeup.kofa.browser.viewlets import ManageActionButton
+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
@@ -116,5 +117,5 @@
     def update(self):
         if self.context.p_state == 'paid':
-            self.flash(_('This ticket has already been paid.'), type='warning')
+            self.flash(_('This ticket has already been paid.'), type='danger')
             return
         applicant = self.context.__parent__
@@ -154,18 +155,16 @@
     xml_data = None
 
-    def update(self):
-        #if self.context.p_state != 'unpaid':
-        if self.context.p_state == 'paid':
-            self.flash(_("Payment ticket can't be re-send to CollegePAY."))
-            self.redirect(self.url(self.context, '@@index'))
-            return
-
-        student = self.student = self.context.student
+    def init_update(self):
+        if self.context.p_state == 'paid':
+            return _("Payment ticket can't be re-sent to CollegePAY.")
+        student = self.context.student
         certificate = getattr(student['studycourse'],'certificate',None)
         if certificate is None:
-            self.flash(_("Study course data are incomplete."))
-            self.redirect(self.url(self.context, '@@index'))
-            return
+            return _("Study course data are incomplete.")
         kofa_utils = getUtility(IKofaUtils)
+        student_utils = getUtility(IStudentsUtils)
+        if student_utils.samePaymentMade(student, self.context.p_category,
+            self.context.p_item, self.context.p_session):
+            return _("This type of payment has already been made.")
         self.amount_auth = 100 * self.context.amount_auth
         xmldict = {}
@@ -181,5 +180,14 @@
             self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")
         self.site_redirect_url = self.url(self.context, 'request_webservice')
-        return student, certificate, xmldict
+        self.student = student
+        self.xmldict = xmldict
+        return
+
+    def update(self):
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+        return
 
 class InterswitchPageApplicant(KofaPage):
@@ -201,15 +209,11 @@
     xml_data = None
 
-    def update(self):
+    def init_update(self):
         if self.context.p_state != 'unpaid':
-            self.flash(_("Payment ticket can't be re-send to CollegePAY."))
-            self.redirect(self.url(self.context, '@@index'))
-            return
+            return _("Payment ticket can't be re-sent to CollegePAY.")
         if self.context.__parent__.__parent__.expired \
             and self.context.__parent__.__parent__.strict_deadline:
-            self.flash(_("Payment ticket can't be send to CollegePAY. "
-                         "Application period has expired."))
-            self.redirect(self.url(self.context, '@@index'))
-            return
+            return _("Payment ticket can't be send to CollegePAY. "
+                     "Application period has expired.")
         self.applicant = self.context.__parent__
         self.amount_auth = 100 * self.context.amount_auth
@@ -220,2 +224,9 @@
         self.site_redirect_url = self.url(self.context, 'request_webservice')
         return
+
+    def update(self):
+        error = self.init_update()
+        if error:
+            self.flash(error, type='danger')
+            self.redirect(self.url(self.context, '@@index'))
+        return
