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/applicants
Files:
3 added
3 edited

Legend:

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

    r8196 r8247  
    1919"""
    2020import grok
     21from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    2122from waeup.kofa.applicants.interfaces import (
    2223    IApplicantRegisterUpdate, IApplicant, IApplicantEdit)
     
    2425    OnlinePaymentCallbackPage, ExportPDFPage,
    2526    ApplicantManageFormPage, ApplicantEditFormPage,
    26     ApplicantRegistrationPage, ApplicantAddFormPage)
     27    ApplicantRegistrationPage, ApplicantAddFormPage,
     28    OnlinePaymentDisplayFormPage, AcceptanceFeePaymentAddPage,
     29    OnlinePaymentBreadcrumb)
    2730from waeup.kofa.applicants.viewlets import RequestCallbackActionButton
    2831from waeup.kofa.applicants.pdf import PDFApplicationSlip
    2932from waeup.uniben.applicants.interfaces import (
    30     IPGApplicant, IUGApplicant, IPGApplicantEdit, IUGApplicantEdit)
     33    IPGApplicant, IUGApplicant, IPGApplicantEdit, IUGApplicantEdit,
     34    ICustomApplicantOnlinePayment)
    3135from waeup.uniben.interfaces import MessageFactory as _
    3236
    33 class CustomRequestCallbackActionButton(RequestCallbackActionButton):
    34     """ Do not display the base package callback button in custom pages.
     37#class RequestCallbackActionButton(RequestCallbackActionButton):
     38#    """ Do not display the base package callback button in custom pages.
     39#    """
     40#    @property
     41#    def target_url(self):
     42#        return ''
     43
     44#class CustomOnlinePaymentCallbackPage(OnlinePaymentCallbackPage):
     45#    """ Neutralize callback simulation view
     46#    """
     47#    def update(self):
     48#        return
     49
     50class CustomOnlinePaymentBreadcrumb(OnlinePaymentBreadcrumb):
     51    """A breadcrumb for payments.
    3552    """
    36     @property
    37     def target_url(self):
    38         return ''
    39 
    40 class CustomOnlinePaymentCallbackPage(OnlinePaymentCallbackPage):
    41     """ Neutralize callback simulation view
    42     """
    43     def update(self):
    44         return
     53    grok.context(ICustomApplicantOnlinePayment)
    4554
    4655class CustomPDFApplicationSlip(PDFApplicationSlip):
     
    107116        form_fields['reg_number'].for_display = True
    108117        return form_fields
     118
     119class CustomOnlinePaymentDisplayFormPage(OnlinePaymentDisplayFormPage):
     120    """ Page to view an online payment ticket
     121    """
     122    grok.context(ICustomApplicantOnlinePayment)
     123    form_fields = grok.AutoFields(ICustomApplicantOnlinePayment)
     124    form_fields[
     125        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     126    form_fields[
     127        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     128    grok.template('payment_view')
     129
     130    @property
     131    def transaction_code(self):
     132        tcode = self.context.p_id
     133        return tcode[len(tcode)-8:len(tcode)]
     134
     135class CustomAcceptanceFeePaymentAddPage(AcceptanceFeePaymentAddPage):
     136    """ Page to add an online payment ticket
     137    """
     138    factory = u'waeup.CustomApplicantOnlinePayment'
     139
     140    def _fillCustomFields(self, payment, session_config):
     141        payment.surcharge_1 = session_config.surcharge_1
     142        payment.surcharge_2 = session_config.surcharge_2
     143        payment.surcharge_3 = session_config.surcharge_3
     144        return payment
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py

    r8196 r8247  
    2424    AppCatCertificateSource, CertificateSource)
    2525from waeup.kofa.schoolgrades import ResultEntryField
    26 from waeup.kofa.interfaces import SimpleKofaVocabulary
     26from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
    2727from waeup.kofa.schema import FormattedDate
    2828from waeup.kofa.students.vocabularies import nats_vocab
     
    3030    lgas_vocab, high_qual, high_grade, exam_types)
    3131from waeup.uniben.interfaces import MessageFactory as _
    32 
     32from waeup.uniben.payments.interfaces import ICustomOnlinePayment
    3333
    3434class IUGApplicant(IApplicantBaseData):
     
    261261    respective form page.
    262262    """
     263class ICustomApplicantOnlinePayment(ICustomOnlinePayment):
     264    """An applicant payment via payment gateways.
     265
     266    """
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py

    r8101 r8247  
    1919"""
    2020
     21import sys
    2122import grok
     23from hurry.workflow.interfaces import IWorkflowInfo, InvalidTransitionError
    2224from waeup.kofa.applicants.utils import ApplicantsUtils
    2325from waeup.uniben.interfaces import MessageFactory as _
     26
     27
     28def actions_after_applicant_payment(applicant, view):
     29    wf_info = IWorkflowInfo(applicant)
     30    try:
     31        wf_info.fireTransition('pay')
     32    except InvalidTransitionError:
     33        view.flash('Error: %s' % sys.exc_info()[1])
     34        return
    2435
    2536class ApplicantsUtils(ApplicantsUtils):
Note: See TracChangeset for help on using the changeset viewer.