Index: /main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser.py	(revision 9781)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/interswitch/browser.py	(revision 9782)
@@ -21,4 +21,8 @@
 from kofacustom.nigeria.interswitch.helpers import (
     query_interswitch, write_payments_log)
+from kofacustom.nigeria.interswitch.browser import (
+    InterswitchPaymentRequestWebservicePageApplicant,
+    InterswitchPaymentRequestWebservicePageStudent
+    )
 from waeup.kofa.browser.layout import KofaPage, UtilityView
 from waeup.kofa.interfaces import IKofaUtils
@@ -48,66 +52,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)
-
-# Deprecated
-#class InterswitchRequestCallbackActionButtonStudent(RCABStudent):
-#    grok.order(3)
-#    grok.context(ICustomStudentOnlinePayment)
-#    icon = 'actionicon_call.png'
-#    text = _('Request CollegePAY callback')
-
-#    def target_url(self):
-#        if self.context.p_state == 'paid':
-#            return ''
-#        site_redirect_url = self.view.url(self.view.context, 'isw_callback')
-#        args = {
-#            'transRef':self.context.p_id,
-#            'prodID':PRODUCT_ID,
-#            'redirectURL':site_redirect_url}
-#        return QUERY_URL + '?%s' % urllib.urlencode(args)
-
-# Alternative preferred solution
-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):
@@ -296,119 +238,19 @@
         return
 
-# Deprecated
-#class InterswitchPaymentCallbackPageStudent(UtilityView, grok.View):
-#    """ Callback view for the CollegePAY gateway
-#    """
-#    grok.context(ICustomStudentOnlinePayment)
-#    grok.name('isw_callback')
-#    grok.require('waeup.payStudent')
-
-    # This view is not yet working for offline querying transactions
-    # since the query string differs from the query string sent after
-    # posting transactions. This Interswitch bug must be removed first.
-    # Alternatively, we could use the webservice only and replace
-    # the RequestCallbackActionButton by a RequestWebserviceActionButton
-
-#    def update(self):
-#        if self.context.p_state == 'paid':
-#            self.flash(_('This ticket has already been paid.'))
-#            return
-#        student = self.context.student
-#        query = self.request.form
-#        write_log_message(self,'callback received: %s' % query)
-#        self.context.r_card_num = query.get('cardNum', None)
-#        self.context.r_code = query.get('resp', None)
-#        self.context.r_pay_reference  = query.get('payRef', None)
-#        self.context.r_amount_approved = float(query.get('apprAmt', '0.0')) / 100
-#        self.context.r_desc = query.get('desc', None)
-#        if self.context.r_code != '00':
-#            self.flash(_('Unsuccessful callback: ${a}',
-#                mapping = {'a': query.get('desc', _('Incomplete query string.'))}))
-#            write_log_message(self,'unsuccessful callback: %s' % self.context.p_id)
-#            self.context.p_state = 'failed'
-#            return
-#        if self.context.r_amount_approved != payment.amount_auth:
-#            self.flash(_('Wrong amount'))
-#            write_log_message(
-#                self,'successful but wrong amount: %s' % self.context.p_id)
-#            self.context.p_state = 'failed'
-#            return
-#        try:
-#            validation_list = get_SOAP_response(
-#                PRODUCT_ID, self.context.p_id).split(':')
-            # Validation does not make sense yet since the query string
-            # formats are conflicting. We are only printing the validation
-            # string, nothing else.
-#            print 'WARNING: Webservice validation is not yet implemented'
-#            print 'validation list: %s' % validation_list
-#        except:
-#            print 'Connection to webservice failed.'
-        # Add webservice validation here
-#        write_log_message(self,'valid callback: %s' % self.context.p_id)
-#        self.context.p_state = 'paid'
-#        self.context.payment_date = datetime.utcnow()
-#        actions_after_student_payment(student, self.context, self)
-#        return
-
-#    def render(self):
-#        self.redirect(self.url(self.context, '@@index'))
-#        return
-
-# Alternative solution, replaces InterswitchPaymentCallbackPage
-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
Index: /main/waeup.uniben/trunk/src/waeup/uniben/payments/interfaces.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/payments/interfaces.py	(revision 9781)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/payments/interfaces.py	(revision 9782)
@@ -25,10 +25,2 @@
 
     """
-
-    #amount_auth = schema.Float(
-    #    title = _(u'Amount Authorized'),
-    #    default = 0.0,
-    #    required = False,
-    #    readonly = False,
-    #    )
-
