Changeset 11634


Ignore:
Timestamp:
13 May 2014, 09:58:50 (11 years ago)
Author:
Henrik Bettermann
Message:

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

Location:
main/waeup.kwarapoly/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kwarapoly/trunk/CHANGES.txt

    r11629 r11634  
    441.2dev (unreleased)
    55===================
     6
     7* Use base classes InterswitchPageApplicant and InterswitchPageStudent from
     8  kofacustom.nigeria.
    69
    710* More special payment fee categories added.
  • main/waeup.kwarapoly/trunk/src/waeup/kwarapoly/interswitch/browser.py

    r11629 r11634  
    2323from kofacustom.nigeria.interswitch.browser import (
    2424    InterswitchPaymentRequestWebservicePageStudent,
    25     InterswitchPaymentRequestWebservicePageApplicant
     25    InterswitchPaymentRequestWebservicePageApplicant,
     26    InterswitchPageStudent, InterswitchPageApplicant,
    2627    )
    27 from waeup.kofa.browser.layout import KofaPage, UtilityView
    28 from waeup.kofa.interfaces import IKofaUtils
    29 from waeup.kofa.utils.helpers import to_timezone
    3028from waeup.kwarapoly.students.interfaces import ICustomStudentOnlinePayment
    3129from waeup.kwarapoly.applicants.interfaces import ICustomApplicantOnlinePayment
     
    5351httplib.HTTPConnection.debuglevel = 0
    5452
    55 class InterswitchPageStudent(KofaPage):
     53class CustomInterswitchPageStudent(InterswitchPageStudent):
    5654    """ View which sends a POST request to the Interswitch
    5755    CollegePAY payment gateway.
    5856    """
    5957    grok.context(ICustomStudentOnlinePayment)
    60     grok.name('goto_interswitch')
    6158    grok.template('student_goto_interswitch')
    62     grok.require('waeup.payStudent')
    63     label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')
    64     submit_button = _('Submit')
    6559    action = POST_ACTION
    6660    site_name = SITE_NAME
     
    7367
    7468    def update(self):
    75         #if self.context.p_state != 'unpaid':
    76         if self.context.p_state == 'paid':
    77             self.flash(_("Payment ticket can't be re-send to CollegePAY."))
    78             self.redirect(self.url(self.context, '@@index'))
    79             return
    80 
    81         student = self.student = self.context.student
    82         certificate = getattr(student['studycourse'],'certificate',None)
    83         self.amount_auth = 100 * self.context.amount_auth
    84         xmldict = {}
    85         if certificate is not None:
    86             xmldict['department'] = certificate.__parent__.__parent__.code
    87             xmldict['faculty'] = certificate.__parent__.__parent__.__parent__.code
    88         else:
    89             xmldict['department'] = None
    90             xmldict['faculty'] = None
    91         self.category = getUtility(IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category]
    92         tz = getUtility(IKofaUtils).tzinfo
    93         self.local_date_time = to_timezone(
    94             self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")
    95         self.site_redirect_url = self.url(self.context, 'request_webservice')
     69        student, certificate, xmldict = super(
     70            CustomInterswitchPageStudent, self).update()
    9671        # Provider data
    9772        xmldict['detail_ref'] = self.context.p_id
     
    243218        return
    244219
    245 class InterswitchPageApplicant(KofaPage):
     220class CustomInterswitchPageApplicant(InterswitchPageApplicant):
    246221    """ View which sends a POST request to the Interswitch
    247222    CollegePAY payment gateway.
    248223    """
    249224    grok.context(ICustomApplicantOnlinePayment)
    250     grok.require('waeup.payApplicant')
    251225    grok.template('applicant_goto_interswitch')
    252     grok.name('goto_interswitch')
    253     label = _('Submit data to CollegePAY (Interswitch Payment Gateway)')
    254     submit_button = _('Submit')
    255226    action = POST_ACTION
    256227    site_name = SITE_NAME
     
    264235
    265236    def update(self):
    266         if self.context.p_state != 'unpaid':
    267             self.flash(_("Payment ticket can't be re-send to CollegePAY."))
    268             self.redirect(self.url(self.context, '@@index'))
    269             return
    270         if self.context.__parent__.__parent__.expired \
    271             and self.context.__parent__.__parent__.strict_deadline:
    272             self.flash(_("Payment ticket can't be send to CollegePAY. "
    273                          "Application period has expired."))
    274             self.redirect(self.url(self.context, '@@index'))
    275             return
    276         self.applicant = self.context.__parent__
    277         self.amount_auth = 100 * self.context.amount_auth
     237        super(CustomInterswitchPageApplicant, self).update()
    278238        xmldict = {}
    279         self.category = getUtility(
    280             IKofaUtils).PAYMENT_CATEGORIES[self.context.p_category]
    281         tz = getUtility(IKofaUtils).tzinfo
    282         self.local_date_time = to_timezone(
    283             self.context.creation_date, tz).strftime("%Y-%m-%d %H:%M:%S %Z")
    284         self.site_redirect_url = self.url(self.context, 'request_webservice')
    285239        provider_amt = 300.0
    286240        dalash_amt = 200.0
     
    416370        return
    417371
    418 class InterswitchPaymentRequestWebservicePageStudent(
     372class CustomInterswitchPaymentRequestWebservicePageStudent(
    419373    InterswitchPaymentRequestWebservicePageStudent):
    420374    """ Request webservice view for the CollegePAY gateway
     
    425379    gateway_url = URL
    426380
    427 class InterswitchPaymentRequestWebservicePageApplicant(
     381class CustomInterswitchPaymentRequestWebservicePageApplicant(
    428382    InterswitchPaymentRequestWebservicePageApplicant):
    429383    """ Request webservice view for the CollegePAY gateway
Note: See TracChangeset for help on using the changeset viewer.