Ignore:
Timestamp:
30 Dec 2022, 09:25:50 (23 months ago)
Author:
Henrik Bettermann
Message:

Implement Paypal module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/applicants/browser.py

    r17228 r17254  
    2626    FriendlyDatetimeDisplayWidget)
    2727from waeup.kofa.applicants.pdf import PDFApplicationSlip
    28 from waeup.kofa.browser.layout import KofaEditFormPage, KofaPage, action
     28from waeup.kofa.browser.layout import KofaEditFormPage, KofaPage, action, NullValidator
    2929from waeup.kofa.applicants.browser import (
    3030    ApplicantRegistrationPage, ApplicantsContainerPage,
     
    214214    grok.require('waeup.payApplicant')
    215215   
     216    @action(_('Create ticket'), style='primary')
     217    def createTicket(self, **data):
     218        p_category = data['p_category']
     219        form = self.request.form
     220        p_option = form.get('form.p_option', None)
     221        balance_amount = data.get('balance_amount', None)
     222        applicants_utils = getUtility(IApplicantsUtils)
     223        error, payment = applicants_utils.setBalanceDetails(
     224            self.context, p_category, balance_amount)
     225        if error is not None:
     226            self.flash(error, type="danger")
     227            return
     228        if p_option:
     229            payment.p_option = p_option
     230            payment.p_currency = p_option
     231        self.context[payment.p_id] = payment
     232        self.flash(_('Payment ticket created.'))
     233        self.context.writeLogMessage(self,'added: %s' % payment.p_id)
     234        self.redirect(self.url(payment))
     235        return
     236
     237    @action(_('Cancel'), validator=NullValidator)
     238    def cancel(self, **data):
     239        self.redirect(self.url(self.context))
     240
    216241class CustomApplicantBaseDisplayFormPage(ApplicantBaseDisplayFormPage):
    217242
Note: See TracChangeset for help on using the changeset viewer.