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 hasError: error
deviceId deviceId
fiat fiat
cashInFee fixedFee
fiatCode fiatCode
cryptoAtoms cryptoAtoms
cryptoCode cryptoCode

View file

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

View file

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

View file

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

View file

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

View file

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