Ignore:
Timestamp:
13 May 2014, 10:37:46 (11 years ago)
Author:
Henrik Bettermann
Message:

Use base classes InterswitchPageApplicant? and InterswitchPageStudent? from kofacustom.nigeria.

Location:
main/waeup.aaua/trunk/src/waeup/aaua/interswitch
Files:
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaua/trunk/src/waeup/aaua/interswitch/browser.py

    r10952 r11637  
    2020import grok
    2121from zope.interface import Interface
    22 from zope.component import getUtility, queryAdapter
     22from zope.component import queryAdapter
    2323from kofacustom.nigeria.interswitch.browser import (
    24     InterswitchPaymentRequestWebservicePageStudent
     24    InterswitchPaymentRequestWebservicePageStudent,
     25    InterswitchPageStudent
    2526    )
    26 from waeup.kofa.browser.layout import KofaPage, UtilityView
    27 from waeup.kofa.interfaces import IKofaUtils
    28 from waeup.kofa.utils.helpers import to_timezone
    2927from waeup.aaua.students.interfaces import ICustomStudentOnlinePayment
    3028from waeup.aaua.applicants.interfaces import ICustomApplicantOnlinePayment
     
    6058    return static['interswitch_verve_mastercard.gif']()
    6159
    62 class InterswitchPageStudent(KofaPage):
     60class CustomInterswitchPageStudent(InterswitchPageStudent):
    6361    """ View which sends a POST request to the Interswitch
    6462    CollegePAY payment gateway.
    6563    """
    6664    grok.context(ICustomStudentOnlinePayment)
    67     grok.name('goto_interswitch')
    6865    grok.template('student_goto_interswitch')
    69     grok.require('waeup.payStudent')
    70     label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')
    71     submit_button = _('Submit')
    7266    action = POST_ACTION
    7367    site_name = SITE_NAME
     
    8074
    8175    def update(self):
    82         #if self.context.p_state != 'unpaid':
    83         if self.context.p_state == 'paid':
    84             self.flash(_("Payment ticket can't be re-send to CollegePAY."))
    85             self.redirect(self.url(self.context, '@@index'))
    86             return
    87 
    88         student = self.student = self.context.student
    89         certificate = getattr(student['studycourse'],'certificate',None)
    90         self.amount_auth = 100 * self.context.amount_auth
    91         xmldict = {}
    92         if certificate is not None:
    93             xmldict['department'] = certificate.__parent__.__parent__.code
    94             xmldict['faculty'] = certificate.__parent__.__parent__.__parent__.code
    95         else:
    96             xmldict['department'] = None
    97             xmldict['faculty'] = None
    98         self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category]
    99         tz = getUtility(IKofaUtils).tzinfo
    100         self.local_date_time = to_timezone(
    101             self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")
    102         self.site_redirect_url = self.url(self.context, 'request_webservice')
     76        student, certificate, xmldict = super(
     77            CustomInterswitchPageStudent, self).update()
    10378        # Provider data
    10479        xmldict['detail_ref'] = self.context.p_id
     
    157132        return
    158133
    159 class InterswitchPaymentRequestWebservicePageStudent(
     134class CustomInterswitchPaymentRequestWebservicePageStudent(
    160135    InterswitchPaymentRequestWebservicePageStudent):
    161136    """ Request webservice view for the CollegePAY gateway
Note: See TracChangeset for help on using the changeset viewer.