From 209ead5e32cf020ccc99f3d0151d0a4002f639c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Tue, 23 Aug 2022 15:27:09 +0100 Subject: [PATCH] fix: ciphertrace ui score color --- lib/cash-in/cash-in-tx.js | 3 ++- lib/cash-out/cash-out-tx.js | 2 +- .../src/pages/Transactions/DetailsCard.js | 10 +++++++--- .../src/pages/Transactions/Transactions.js | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/cash-in/cash-in-tx.js b/lib/cash-in/cash-in-tx.js index 728c4b86..9b01d8fc 100644 --- a/lib/cash-in/cash-in-tx.js +++ b/lib/cash-in/cash-in-tx.js @@ -113,7 +113,8 @@ function postProcess (r, pi, isBlacklisted, addressReuse, walletScore) { return Promise.resolve({ walletScore: walletScore.score, operatorCompleted: true, - error: 'Ciphertrace score is above defined threshold' + error: 'Ciphertrace score is above defined threshold', + errorCode: 'scoreThresholdReached' }) } diff --git a/lib/cash-out/cash-out-tx.js b/lib/cash-out/cash-out-tx.js index a89646a0..a918a454 100644 --- a/lib/cash-out/cash-out-tx.js +++ b/lib/cash-out/cash-out-tx.js @@ -134,7 +134,7 @@ function getWalletScore (tx, pi) { ? _.assign(tx, { walletScore: highestScore.score }) : _.assign(tx, { walletScore: highestScore.score, - error: 'Address score is above defined threshold', + error: 'Ciphertrace score is above defined threshold', errorCode: 'scoreThresholdReached', dispense: true }) diff --git a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js index 52af182c..2e1cfdd2 100644 --- a/new-lamassu-admin/src/pages/Transactions/DetailsCard.js +++ b/new-lamassu-admin/src/pages/Transactions/DetailsCard.js @@ -169,6 +169,10 @@ const DetailsRow = ({ it: tx, timezone }) => { FileSaver.saveAs(content, zipFilename) } + const hasCiphertraceError = tx => + !R.isNil(tx.errorCode) && + R.includes(tx.errorCode, ['scoreThresholdReached', 'ciphertraceError']) + const errorElements = ( <> @@ -187,10 +191,10 @@ const DetailsRow = ({ it: tx, timezone }) => { r={3.5} fill={ it < tx.walletScore - ? R.isNil(tx.hasError) + ? !hasCiphertraceError(tx) ? primaryColor : errorColor - : R.isNil(tx.hasError) + : !hasCiphertraceError(tx) ? subheaderColor : offErrorColor } @@ -203,7 +207,7 @@ const DetailsRow = ({ it: tx, timezone }) => { noMargin className={classNames({ [classes.bold]: true, - [classes.error]: !R.isNil(tx.hasError) + [classes.error]: hasCiphertraceError(tx) })}> {tx.walletScore}

diff --git a/new-lamassu-admin/src/pages/Transactions/Transactions.js b/new-lamassu-admin/src/pages/Transactions/Transactions.js index 7a8758da..54a95f27 100644 --- a/new-lamassu-admin/src/pages/Transactions/Transactions.js +++ b/new-lamassu-admin/src/pages/Transactions/Transactions.js @@ -101,6 +101,7 @@ const GET_TRANSACTIONS = gql` sendConfirmed dispense hasError: error + errorCode deviceId fiat cashInFee