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