Overview
This is an enhancement on top of existing Charges features to be able to apply different fees for different slabs of amount. For e.g. for loan amount of 5000 - 10,000 fee is 100, for 10,001 - 20,000 fee is 200, etc.
Ref : - FINERACT-43Getting issue details... STATUS
Design Approach
Existing implementation uses 2 configurations while calculating the applicable fee.
- Charge calculation : Specifies if the charge is Flat or % based on applicable amount
- Amount : In case of Flat this specifies an absolute value, in case of % based this specifies %age to be considered
Proposal is to allow Amount to be defined as a single value (as it is now) or as a slab based value and keep remaining calculations as is.
DB Changes
Add new column is_slab_based to m_charge table
Add new table m_charge_slabs with below definition
m_charge_slabs | |
id | BIGINT |
charge_id | BIGINT |
from_applicable_amount | DECIMAL |
to_applicable_amount | DECIMAL |
Charge_amount | DECIMAL |
API Changes
Existing ‘/charges’ shall take following additional parameters
A Boolean param isSlabBased
An array param slabs : [{
fromApplicableAmount: 0,
toApplicableAmount: -1,
chargeAmount: 1
}]
isSlabBased and amount (existing) shall be mutually exclusive.
chargeAmount within the slabs will be absolute value if Flat based calculation is chosen or it would mean %age to be applied on the applicable amount in case of %based calculations.
The create/update APIs would also make sure fromApplicableAmount and toApplicableAmount doesn’t have either overlaps or gaps.
Changes to Charge Calculations
The final applicable fee value is calculated as part of entity specific charge classes (LoanCharge.java, SavingsAccountCharge.java, ClientCharge.java and ShareAccountCharge.java). Each of these classes have a similar method by the name populateDerivedFields(). If slab based, applicable charge amount is retrieved from the slab definition and passed to the populateDerivedFields() method.
Points to Remember
Charge Slab details are not copied over to entity level charge details, only the calculated amount. The slab definition shall always be picked up from the Original Charge Definition. This leads to a few scenarios that potential users need to be aware of
- The Charge Value is calculated at the time at which the Charge is first applied to the entity (can be before approval or disbursal). The Organization slabs defined for the Charge Template at the time of application shall be used for calculating the effective charge value
- Any change in the entity amount triggers a recalculation of the Slab based Charge (during approval or disbursal). The recalculation shall consider the current Organizational slabs defined for the Charge template, i.e as far as the system is concerned, the charge has been applied on this day.
- If the loan amount is not changed during approval or disbursal, the originally calculated Charge amount does not change (even if the current Organizational slabs defined for the Charge template have changed)