Ignore:
Timestamp:
16 Dec 2022, 13:40:09 (2 years ago)
Author:
Henrik Bettermann
Message:

Configure split payments.

Location:
main/kofacustom.lpng/trunk/src/kofacustom/lpng
Files:
2 edited

Legend:

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

    r17225 r17228  
    227227    form_fields = grok.AutoFields(INigeriaApplicantOnlinePayment).omit('ac',
    228228        'provider_amt', 'gateway_amt', 'thirdparty_amt',
    229         'p_item', 'display_item', 'p_session')
     229        'p_item', 'display_item', 'p_session', 'p_split_data')
    230230    form_fields[
    231231        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     
    238238    # use IApplicantOnlinePayment alternativly
    239239    form_fields = grok.AutoFields(INigeriaApplicantOnlinePayment).omit(
    240         'p_item', 'p_option', 'p_combi', 'display_item', 'p_session')
     240        'p_item', 'p_option', 'p_combi', 'display_item', 'p_session',
     241        'thirdparty_amt', 'p_split_data')
    241242    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    242243    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
  • main/kofacustom.lpng/trunk/src/kofacustom/lpng/interswitch/browser.py

    r17224 r17228  
    2828    InterswitchPageApplicant,)
    2929from kofacustom.nigeria.interswitch.webcheckoutbrowser import (
     30    webcheckout_module_activated,
    3031    WebCheckoutPageStudent,
    3132    WebCheckoutPageApplicant,
     
    258259    pay_item_id = 'Default_Payable_MX76823'
    259260    merchant_code = 'MX76823'
    260     gateway_amt = 0.0
     261    gateway_share = 0.015
     262    provider_share = 0.05
     263
     264    @property
     265    def split_accounts(self):
     266        sa = [
     267            {"alias":"bigtentfdn","percentage":"95","description":"Donation","isPrimary":"true"},
     268            {"alias":"waeac","percentage":"5","description":"Tech Fee"},
     269            ]
     270        return str(sa)
     271
     272    def update(self):
     273        if not webcheckout_module_activated(
     274            self.context.__parent__.__parent__.year, self.context):
     275            self.flash(_('Forbidden'), type='danger')
     276            self.redirect(self.url(self.context, '@@index'))
     277            return
     278        error = self.init_update()
     279        if error:
     280            self.flash(error, type='danger')
     281            self.redirect(self.url(self.context, '@@index'))
     282        # Already now it becomes an Interswitch payment. We set the net amount
     283        # and add the gateway amount. Fees will be added so that the foundation
     284        # receives the whole subscription.
     285        if not self.context.r_company:
     286            self.context.net_amt = self.context.amount_auth
     287            self.context.amount_auth = round(self.context.net_amt/(1-self.gateway_share)/(1-self.provider_share), 2)
     288            self.context.gateway_amt = round(self.context.amount_auth *  self.gateway_share, 2)
     289            self.context.provider_amt = round((self.context.amount_auth-self.context.gateway_amt) * self.provider_share, 2)
     290            self.context.r_company = u'interswitch'
     291        self.amount_auth = int(100 * self.context.amount_auth)
     292        return
    261293
    262294class CustomWebCheckoutConfirmTransactionStudent(WebCheckoutConfirmTransactionStudent):
Note: See TracChangeset for help on using the changeset viewer.