Implementation
More widened way of adding and calculating commissions
In second version of commission calculator services we use new entitites
Let's introduce these new entities. As we know in Bill Master we have only P2pCommission domain. And P2pParam has sender and recipient P2pCommission.
We have 4 new entities
P2pCommissionGroup
P2pCommission
P2pCommissionPartGroup
P2pCommissionPart
As we know we diffirent commission for diffirent intervals
So, This entity is like a tariff and it can be many Commissions for any intervals.
Ex: We have a tariff that's named 0.5 % for [0; 5 mln] and 0.4 % for (5 mln; unlimited]
And we have to have two commissions 0.5 % and 0.4 %
if Amount of Operation is less than or equal to 5 mln soums commission is 0.5%
if Amount of Operation is more than 5 mln soums commission is 0.4%
P2pCommission is commission that is active between fromAmount and toAmount
As we see in P2pCommissionGroup commission can be active intervals
ex: We have commission 0.5 % and 2000 UZS for charity in range 5 mln and 10 mln
if we want to set unlimit for toAmount we have to set it as NULL
if we want to set 0 for fromAmount we have to set it as NULL or 0
And this commission should have PARTS.
ex: 0.5 % commission can be splitted into 2 parts 0.3 % for UZCARD and 0.2% for Bank income.
For this we have P2pCommissionPartGroup
P2pCommissionPartGroup is group of P2pCommissionParts
We read previously we have to split Commission into parts.
So we have set many parts as group and set this group to commission
P2pCommissionGroup:
name: 0.5 % commission
parts:
Part1: 0.3% for UZCARD
Part2: 0.2% for Bank income
Part is P2pCommissionPart
P2pCommissionPart is the smallest unit.
As we read we have to split commission into parts and this part is here.
P2pCommissionPart is main calculation part of commission Because we calculate commission based on Parts.
Imagine we have P2pCommission in range [5mln: 10mln] 0.5% (0.3% UZCARD, 0.2% Bank income) and 2000 UZS for charity.
and we should have 3 parts
Part1 - 2000 UZS charity
Part2 - 0.3% for UZCARD
Part2 - 0.2% for Bank income
As we see we calculate commission based on parts.
And it has Commission Multiplier type. Because it can be FIXED amount, PERCENT or BRV based.
Implementation requirements
Commission can be various for various intervals. ex: between 0 and 5 mln commission 0.5 %. And more than 5 mln 0.4 %
Commission can have parts. ex: this 0.5% commission split into 2 parts. First HUMO 0.3% and bank income 0.2%
So, Our P2Param has sender and recipient commission group for various commissions at various intervals.

And Commission has parts

In this version. P2pCommissionPart is for calculating commissionPart
Last updated