Ignore:
Timestamp:
23 Apr 2012, 14:06:39 (13 years ago)
Author:
Henrik Bettermann
Message:

Implement acceptance fee payments via Interswitch (part 2)

File:
1 edited

Legend:

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

    r8247 r8259  
    1919from zope.formlib.textwidgets import BytesDisplayWidget
    2020from zope.component import getUtility
     21from zope.i18n import translate
    2122from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2223from waeup.kofa.interfaces import IExtFileStore
     
    2930    StudentBaseEditFormPage, StudentPersonalEditFormPage,
    3031    OnlinePaymentDisplayFormPage, OnlinePaymentAddFormPage,
    31     OnlinePaymentBreadcrumb)
    32 from waeup.kofa.students.viewlets import RequestCallbackActionButton
     32    OnlinePaymentBreadcrumb, ExportPDFPaymentSlipPage)
     33from waeup.kofa.students.viewlets import (
     34    RequestCallbackActionButton, PaymentReceiptActionButton)
    3335from waeup.uniben.students.interfaces import (
    3436    ICustomStudentBase, ICustomStudent, ICustomStudentPersonal,
     
    3840from waeup.uniben.interfaces import MessageFactory as _
    3941
     42#class RequestCallbackActionButton(RequestCallbackActionButton):
     43#    """ Display the base package callback button in custom pages.
     44#    """
     45#    grok.context(ICustomStudentOnlinePayment)
     46
     47#class CustomOnlinePaymentCallbackPage(OnlinePaymentCallbackPage):
     48#    """ Activate callback simulation view
     49#    """
     50#    grok.context(ICustomStudentOnlinePayment)
     51
    4052class CustomOnlinePaymentBreadcrumb(OnlinePaymentBreadcrumb):
    4153    """A breadcrumb for payments.
     
    4355    grok.context(ICustomStudentOnlinePayment)
    4456
    45 class RequestCallbackActionButton(RequestCallbackActionButton):
    46     """ Do not display the base package callback button in custom pages.
    47     """
    48     @property
    49     def target_url(self):
    50         return ''
    51 
    52 class CustomOnlinePaymentCallbackPage(OnlinePaymentCallbackPage):
    53     """ Neutralize callback simulation view
    54     """
    55     def update(self):
    56         return
     57class PaymentReceiptActionButton(PaymentReceiptActionButton):
     58    grok.order(4)
     59    grok.context(ICustomStudentOnlinePayment)
    5760
    5861class CustomStudentBaseManageFormPage(StudentBaseManageFormPage):
     
    182185        payment.surcharge_3 = pay_details['surcharge_3']
    183186        return payment
     187
     188class CustomExportPDFPaymentSlipPage(ExportPDFPaymentSlipPage):
     189    """Deliver a PDF slip of the context.
     190    """
     191    grok.context(ICustomStudentOnlinePayment)
     192    form_fields = grok.AutoFields(ICustomStudentOnlinePayment)
     193    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     194    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     195
     196    @property
     197    def note(self):
     198        tcode = self.context.p_id
     199        tcode = tcode[len(tcode)-8:len(tcode)]
     200        amount = self.context.amount_auth
     201        note = translate(_(
     202            u"""<br /><br /><br />
     203The tranzaction code for eTranzact payments is <strong>${a}</strong>.""",
     204            mapping = {'a':tcode}))
     205        return note
Note: See TracChangeset for help on using the changeset viewer.