Index: /main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/browser.py
===================================================================
--- /main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/browser.py	(revision 9783)
+++ /main/waeup.fceokene/trunk/src/waeup/fceokene/interswitch/browser.py	(revision 9784)
@@ -19,11 +19,11 @@
 import grok
 from zope.component import getUtility
-from kofacustom.nigeria.interswitch.helpers import (
-    query_interswitch, write_payments_log)
-from waeup.kofa.browser.layout import KofaPage, UtilityView
+from kofacustom.nigeria.interswitch.browser import (
+    InterswitchPaymentRequestWebservicePageApplicant,
+    InterswitchPaymentRequestWebservicePageStudent
+    )
+from waeup.kofa.browser.layout import KofaPage
 from waeup.kofa.interfaces import IKofaUtils
 from waeup.kofa.utils.helpers import to_timezone
-from waeup.kofa.students.viewlets import ApprovePaymentActionButton as APABStudent
-from waeup.kofa.applicants.viewlets import ApprovePaymentActionButton as APABApplicant
 from waeup.fceokene.students.interfaces import ICustomStudentOnlinePayment
 from waeup.fceokene.applicants.interfaces import ICustomApplicantOnlinePayment
@@ -48,48 +48,4 @@
 #URL = '/test_paydirect/services/TransactionQueryWs.asmx'
 httplib.HTTPConnection.debuglevel = 0
-
-class InterswitchActionButtonStudent(APABStudent):
-    grok.order(1)
-    grok.context(ICustomStudentOnlinePayment)
-    grok.require('waeup.payStudent')
-    icon = 'actionicon_pay.png'
-    text = _('CollegePAY')
-    target = 'goto_interswitch'
-
-    @property
-    def target_url(self):
-        if self.context.p_state != 'unpaid':
-            return ''
-        return self.view.url(self.view.context, self.target)
-
-class InterswitchActionButtonApplicant(APABApplicant):
-    grok.order(1)
-    grok.context(ICustomApplicantOnlinePayment)
-    grok.require('waeup.payApplicant')
-    icon = 'actionicon_pay.png'
-    text = _('CollegePAY')
-    target = 'goto_interswitch'
-
-    @property
-    def target_url(self):
-        if self.context.p_state != 'unpaid':
-            return ''
-        return self.view.url(self.view.context, self.target)
-
-class InterswitchRequestWebserviceActionButtonStudent(APABStudent):
-    grok.order(2)
-    grok.context(ICustomStudentOnlinePayment)
-    grok.require('waeup.payStudent')
-    icon = 'actionicon_call.png'
-    text = _('Requery CollegePAY')
-    target = 'request_webservice'
-
-class InterswitchRequestWebserviceActionButtonApplicant(APABApplicant):
-    grok.order(2)
-    grok.context(ICustomApplicantOnlinePayment)
-    grok.require('waeup.payApplicant')
-    icon = 'actionicon_call.png'
-    text = _('Requery CollegePAY')
-    target = 'request_webservice'
 
 class InterswitchPageStudent(KofaPage):
@@ -256,59 +212,19 @@
 
 
-class InterswitchPaymentRequestWebservicePageStudent(UtilityView, grok.View):
+class InterswitchPaymentRequestWebservicePageStudent(
+    InterswitchPaymentRequestWebservicePageStudent):
     """ Request webservice view for the CollegePAY gateway
     """
     grok.context(ICustomStudentOnlinePayment)
-    grok.name('request_webservice')
-    grok.require('waeup.payStudent')
-
-    def update(self):
-        if self.context.p_state == 'paid':
-            self.flash(_('This ticket has already been paid.'))
-            return
-        student = self.context.student
-        success, msg, log = query_interswitch(
-            self.context, PRODUCT_ID, HOST, URL)
-        student.writeLogMessage(self, log)
-        if not success:
-            self.flash(msg)
-            return
-        write_payments_log(student.student_id, self.context)
-        success, msg, log = self.context.doAfterStudentPayment()
-        if log is not None:
-            student.writeLogMessage(self, log)
-        self.flash(msg)
-        return
-
-    def render(self):
-        self.redirect(self.url(self.context, '@@index'))
-        return
-
-class InterswitchPaymentRequestWebservicePageApplicant(UtilityView, grok.View):
+    product_id = PRODUCT_ID
+    gateway_host = HOST
+    gateway_url = URL
+
+class InterswitchPaymentRequestWebservicePageApplicant(
+    InterswitchPaymentRequestWebservicePageApplicant):
     """ Request webservice view for the CollegePAY gateway
     """
     grok.context(ICustomApplicantOnlinePayment)
-    grok.name('request_webservice')
-    grok.require('waeup.payApplicant')
-
-    def update(self):
-        if self.context.p_state == 'paid':
-            self.flash(_('This ticket has already been paid.'))
-            return
-        applicant = self.context.__parent__
-        success, msg, log = query_interswitch(
-            self.context, PRODUCT_ID, HOST, URL)
-        applicant.writeLogMessage(self, log)
-        if not success:
-            self.flash(msg)
-            return
-        write_payments_log(applicant.applicant_id, self.context)
-        success, msg, log = self.context.doAfterApplicantPayment()
-        if log is not None:
-            applicant.writeLogMessage(self, log)
-        self.flash(msg)
-        return
-
-    def render(self):
-        self.redirect(self.url(self.context, '@@index'))
-        return
+    product_id = PRODUCT_ID
+    gateway_host = HOST
+    gateway_url = URL
