refactor: use the common fixedFee field

This commit is contained in:
siiky 2022-10-10 16:05:28 +01:00 committed by Rafael
parent dc9ca619bd
commit e7ca33c8a4
6 changed files with 9 additions and 9 deletions

View file

@ -77,7 +77,7 @@ const GET_TRANSACTIONS = gql`
hasError: error
deviceId
fiat
cashInFee
fixedFee
fiatCode
cryptoAtoms
cryptoCode

View file

@ -5,10 +5,10 @@ import React, { useEffect, useRef, useCallback } from 'react'
import { backgroundColor, zircon, primaryColor } from 'src/styling/variables'
const transactionProfit = tx => {
const cashInFee = tx.cashInFee ? Number.parseFloat(tx.cashInFee) : 0
const fixedFee = tx.fixedFee ? Number.parseFloat(tx.fixedFee) : 0
const commission =
Number.parseFloat(tx.commissionPercentage) * Number.parseFloat(tx.fiat)
return commission + cashInFee
return commission + fixedFee
}
const mockPoint = (tx, offsetMs, profit) => {

View file

@ -36,7 +36,7 @@ const GET_DATA = gql`
transactions(excludeTestingCustomers: $excludeTestingCustomers) {
fiatCode
fiat
cashInFee
fixedFee
commissionPercentage
created
txClass

View file

@ -40,7 +40,7 @@ const GET_TRANSACTIONS = gql`
hasError: error
deviceId
fiat
cashInFee
fixedFee
fiatCode
cryptoAtoms
cryptoCode

View file

@ -133,9 +133,9 @@ const DetailsRow = ({ it: tx, timezone }) => {
const commission = BigNumber(tx.profit).toFixed(2, 1) // ROUND_DOWN
const commissionPercentage =
Number.parseFloat(tx.commissionPercentage, 2) * 100
const cashInFee = isCashIn ? Number.parseFloat(tx.cashInFee) : 0
const fixedFee = Number.parseFloat(tx.fixedFee) || 0
const fiat = BigNumber(tx.fiat)
.minus(cashInFee)
.minus(fixedFee)
.toFixed(2, 1) // ROUND_DOWN
const crypto = getCryptoAmount(tx)
const cryptoFee = tx.fee ? `${getCryptoFeeAmount(tx)} ${tx.fiatCode}` : 'N/A'
@ -350,7 +350,7 @@ const DetailsRow = ({ it: tx, timezone }) => {
</div>
<div>
<Label>Fixed fee</Label>
<div>{isCashIn ? `${cashInFee} ${tx.fiatCode}` : 'N/A'}</div>
<div>{`${fixedFee} ${tx.fiatCode}`}</div>
</div>
</div>
<div className={classes.secondRow}>

View file

@ -105,7 +105,7 @@ const GET_TRANSACTIONS = gql`
deviceId
fiat
fee
cashInFee
fixedFee
fiatCode
cryptoAtoms
cryptoCode