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

Configure split payments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.