diff --git a/lib/cash-in/cash-in-tx.js b/lib/cash-in/cash-in-tx.js index d97398da..b426d3ed 100644 --- a/lib/cash-in/cash-in-tx.js +++ b/lib/cash-in/cash-in-tx.js @@ -41,6 +41,8 @@ function post (machineTx, pi) { walletScore = fetchedWalletScore + console.log(fetchedWalletScore) + if (_.some(it => it.address === updatedTx.toAddress)(blacklistItems)) { blacklisted = true notifier.notifyIfActive('compliance', 'blacklistNotify', r.tx, false) @@ -109,6 +111,7 @@ function postProcess (r, pi, isBlacklisted, addressReuse, walletScore) { } if (!_.isNil(walletScore) && !walletScore.isValid) { + console.log('aaaaaaaa') return Promise.resolve({ walletScore: walletScore.score, operatorCompleted: true, diff --git a/lib/constants.js b/lib/constants.js index 7b7c16e7..1efcf1d7 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -21,6 +21,8 @@ const MANUAL = 'manual' const CASH_OUT_DISPENSE_READY = 'cash_out_dispense_ready' const CONFIRMATION_CODE = 'sms_code' +const WALLET_SCORE_THRESHOLD = 9 + module.exports = { anonymousCustomer, CASSETTE_MAX_CAPACITY, @@ -34,5 +36,6 @@ module.exports = { CASH_OUT_DISPENSE_READY, CONFIRMATION_CODE, CASH_OUT_MINIMUM_AMOUNT_OF_CASSETTES, - CASH_OUT_MAXIMUM_AMOUNT_OF_CASSETTES + CASH_OUT_MAXIMUM_AMOUNT_OF_CASSETTES, + WALLET_SCORE_THRESHOLD } diff --git a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js index 99a4460d..74668b09 100644 --- a/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js +++ b/lib/plugins/wallet-scoring/ciphertrace/ciphertrace.js @@ -16,25 +16,22 @@ function getClient(account) { const apiVersion = ctv1.slice(-2) const authHeader = { - "Authorization": account + "Authorization": account.authorizationValue } return { apiVersion, authHeader } } function rateWallet(account, cryptoCode, address) { const client = getClient(account) - console.log('client', client) if (!_.includes(_.toUpper(cryptoCode), SUPPORTED_COINS) || _.isNil(client)) return Promise.resolve(null) const { apiVersion, authHeader } = client - const score = Math.floor(Math.random() * (10 - 1 + 1)) + 1 - const threshold = _.isNil(account.scoreThreshold) ? WALLET_SCORE_THRESHOLD : account.scoreThreshold - return Promise.resolve({ address, score, isValid: score < threshold }) + const threshold = _.isNil(account) ? WALLET_SCORE_THRESHOLD : account.scoreThreshold - // return axios.get(`https://rest.ciphertrace.com/aml/${apiVersion}/${_.toLower(cryptoCode)}/risk?address=${address}`, { - // headers: authHeader - // }) - // .then(res => ({ address, score: res.risk, isValid: res.risk <= SCORE_THRESHOLD })) + return axios.get(`https://rest.ciphertrace.com/aml/${apiVersion}/${_.toLower(cryptoCode)}/risk?address=${address}`, { + headers: authHeader + }) + .then(res => ({ address, score: res.data.risk, isValid: res.data.risk < threshold })) } function isValidWalletScore(account, score) {