Ignore:
Timestamp:
22 Apr 2012, 12:56:07 (13 years ago)
Author:
Henrik Bettermann
Message:

Reorganize payment customizatiom. Tests will follow.

Let also applicants pay via eTranzact. Show transaction code on display view (slip view will follow).

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r8204 r8247  
    1919from zope.formlib.textwidgets import BytesDisplayWidget
    2020from zope.component import getUtility
     21from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2122from waeup.kofa.interfaces import IExtFileStore
     23from waeup.kofa.browser.layout import action
    2224from waeup.kofa.students.browser import (
    2325    StudentPersonalDisplayFormPage,
     
    2527    StudentClearanceDisplayFormPage, OnlinePaymentCallbackPage,
    2628    ExportPDFClearanceSlipPage, StudentBaseManageFormPage,
    27     StudentBaseEditFormPage, StudentPersonalEditFormPage)
     29    StudentBaseEditFormPage, StudentPersonalEditFormPage,
     30    OnlinePaymentDisplayFormPage, OnlinePaymentAddFormPage,
     31    OnlinePaymentBreadcrumb)
    2832from waeup.kofa.students.viewlets import RequestCallbackActionButton
    2933from waeup.uniben.students.interfaces import (
    3034    ICustomStudentBase, ICustomStudent, ICustomStudentPersonal,
    3135    ICustomUGStudentClearance,ICustomPGStudentClearance,
     36    ICustomStudentOnlinePayment,
    3237    )
    3338from waeup.uniben.interfaces import MessageFactory as _
    3439
    35 class CustomRequestCallbackActionButton(RequestCallbackActionButton):
     40class CustomOnlinePaymentBreadcrumb(OnlinePaymentBreadcrumb):
     41    """A breadcrumb for payments.
     42    """
     43    grok.context(ICustomStudentOnlinePayment)
     44
     45class RequestCallbackActionButton(RequestCallbackActionButton):
    3646    """ Do not display the base package callback button in custom pages.
    3747    """
     
    144154        return False
    145155
     156class CustomOnlinePaymentDisplayFormPage(OnlinePaymentDisplayFormPage):
     157    """ Page to view an online payment ticket
     158    """
     159    grok.context(ICustomStudentOnlinePayment)
     160    form_fields = grok.AutoFields(ICustomStudentOnlinePayment)
     161    form_fields[
     162        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     163    form_fields[
     164        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     165    grok.template('payment_view')
     166
     167    @property
     168    def transaction_code(self):
     169        tcode = self.context.p_id
     170        return tcode[len(tcode)-8:len(tcode)]
     171
     172class CustomOnlinePaymentAddFormPage(OnlinePaymentAddFormPage):
     173    """ Page to add an online payment ticket
     174    """
     175    form_fields = grok.AutoFields(ICustomStudentOnlinePayment).select(
     176        'p_category')
     177    factory = u'waeup.CustomStudentOnlinePayment'
     178
     179    def _fillCustomFields(self, payment, pay_details):
     180        payment.surcharge_1 = pay_details['surcharge_1']
     181        payment.surcharge_2 = pay_details['surcharge_2']
     182        payment.surcharge_3 = pay_details['surcharge_3']
     183        return payment
  • main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py

    r8204 r8247  
    1818from zope import schema
    1919from waeup.kofa.schema import TextLineChoice
    20 from waeup.kofa.interfaces import SimpleKofaVocabulary
     20from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
    2121from waeup.kofa.schema import FormattedDate
    2222from waeup.kofa.schoolgrades import ResultEntryField
     
    3131    lgas_vocab, high_qual, high_grade, exam_types)
    3232from waeup.uniben.interfaces import MessageFactory as _
     33from waeup.uniben.payments.interfaces import ICustomOnlinePayment
    3334
    3435class ICustomStudentBase(IStudentBase):
     
    339340
    340341    """
     342
     343class ICustomStudentOnlinePayment(ICustomOnlinePayment):
     344    """A student payment via payment gateways.
     345
     346    """
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r8204 r8247  
    2020from waeup.kofa.students.utils import StudentsUtils
    2121from waeup.kofa.students.interfaces import IStudentsUtils
     22from waeup.kofa.accesscodes import create_accesscode
    2223from waeup.uniben.interfaces import MessageFactory as _
    2324
     
    4142    else:
    4243        return 0.0
     44
     45def actions_after_student_payment(student, payment, view):
     46    if payment.p_category == 'clearance':
     47        # Create CLR access code
     48        pin, error = create_accesscode('CLR',0,student.student_id)
     49        if error:
     50            view.flash(_('Valid callback received. ${a}',
     51                mapping = {'a':error}))
     52            return
     53        payment.ac = pin
     54    elif payment.p_category == 'schoolfee':
     55        # Create SFE access code
     56        pin, error = create_accesscode('SFE',0,student.student_id)
     57        if error:
     58            view.flash(_('Valid callback received. ${a}',
     59                mapping = {'a':error}))
     60            return
     61        payment.ac = pin
     62    elif payment.p_category == 'bed_allocation':
     63        # Create HOS access code
     64        pin, error = create_accesscode('HOS',0,student.student_id)
     65        if error:
     66            view.flash(_('Valid callback received. ${a}',
     67                mapping = {'a':error}))
     68            return
     69        payment.ac = pin
     70    view.flash(_('Valid callback received.'))
     71    return
    4372
    4473class CustomStudentsUtils(StudentsUtils):
Note: See TracChangeset for help on using the changeset viewer.