fix: add discount percentage to fiat profit calculation
This commit is contained in:
parent
99100bae8f
commit
ce92dc1d15
1 changed files with 4 additions and 1 deletions
|
|
@ -100,7 +100,10 @@ function simplifiedBatch (data) {
|
|||
const getCryptoAmount = it => coinUtils.toUnit(BN(it.cryptoAtoms), it.cryptoCode).toString()
|
||||
|
||||
const getProfit = it => {
|
||||
const getCommissionFee = it => BN(it.commissionPercentage).mul(BN(it.fiat))
|
||||
const discountValue = _.isNil(it.discount) ? BN(100) : BN(100).sub(it.discount)
|
||||
const discountPercentage = BN(discountValue).div(100)
|
||||
const commissionPercentage = BN(it.commissionPercentage).mul(discountPercentage)
|
||||
const getCommissionFee = it => BN(commissionPercentage).mul(BN(it.fiat))
|
||||
if (!it.cashInFee) return getCommissionFee(it)
|
||||
return getCommissionFee(it).add(BN(it.cashInFee))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue