fix: deprecate cashInFeeCrypto
This commit is contained in:
parent
8daa2a0585
commit
d7a5f05437
6 changed files with 16 additions and 6 deletions
|
|
@ -35,7 +35,7 @@ function toObj (row) {
|
||||||
|
|
||||||
keys.forEach(key => {
|
keys.forEach(key => {
|
||||||
const objKey = _.camelCase(key)
|
const objKey = _.camelCase(key)
|
||||||
if (_.includes(key, ['crypto_atoms', 'fiat', 'cash_in_fee', 'cash_in_fee_crypto', 'commission_percentage', 'raw_ticker_price'])) {
|
if (_.includes(key, ['crypto_atoms', 'fiat', 'cash_in_fee', 'commission_percentage', 'raw_ticker_price'])) {
|
||||||
newObj[objKey] = new BN(row[key])
|
newObj[objKey] = new BN(row[key])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +102,7 @@ function diff (oldTx, newTx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensureRatchet (oldField, newField, fieldKey) {
|
function ensureRatchet (oldField, newField, fieldKey) {
|
||||||
const monotonic = ['cryptoAtoms', 'fiat', 'cashInFeeCrypto', 'send', 'sendConfirmed', 'operatorCompleted', 'timedout', 'txVersion', 'batched']
|
const monotonic = ['cryptoAtoms', 'fiat', 'send', 'sendConfirmed', 'operatorCompleted', 'timedout', 'txVersion', 'batched']
|
||||||
const free = ['sendPending', 'error', 'errorCode', 'customerId']
|
const free = ['sendPending', 'error', 'errorCode', 'customerId']
|
||||||
|
|
||||||
if (_.isNil(oldField)) return true
|
if (_.isNil(oldField)) return true
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ const typeDef = gql`
|
||||||
operatorCompleted: Boolean
|
operatorCompleted: Boolean
|
||||||
sendPending: Boolean
|
sendPending: Boolean
|
||||||
cashInFee: String
|
cashInFee: String
|
||||||
cashInFeeCrypto: String
|
|
||||||
minimumTx: Float
|
minimumTx: Float
|
||||||
customerId: ID
|
customerId: ID
|
||||||
isAnonymous: Boolean
|
isAnonymous: Boolean
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ const tx = {
|
||||||
operatorCompleted: false,
|
operatorCompleted: false,
|
||||||
sendPending: true,
|
sendPending: true,
|
||||||
cashInFee: new BN(2),
|
cashInFee: new BN(2),
|
||||||
cashInFeeCrypto: new BN(9500),
|
|
||||||
minimumTx: 5,
|
minimumTx: 5,
|
||||||
customerId: '47ac1184-8102-11e7-9079-8f13a7117867',
|
customerId: '47ac1184-8102-11e7-9079-8f13a7117867',
|
||||||
txVersion: 6,
|
txVersion: 6,
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ function getOpenBatchCryptoValue (cryptoCode) {
|
||||||
if (_.isNil(batch)) return Promise.resolve([])
|
if (_.isNil(batch)) return Promise.resolve([])
|
||||||
return db.any(`SELECT * FROM cash_in_txs WHERE batch_id=$1`, [batch.id])
|
return db.any(`SELECT * FROM cash_in_txs WHERE batch_id=$1`, [batch.id])
|
||||||
})
|
})
|
||||||
.then(txs => _.reduce((acc, tx) => acc.plus(tx.cash_in_fee_crypto).plus(tx.crypto_atoms), BN(0), txs))
|
.then(txs => _.reduce((acc, tx) => acc.plus(tx.crypto_atoms), BN(0), txs))
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ function massage (tx, pi) {
|
||||||
cryptoAtoms: new BN(r.cryptoAtoms),
|
cryptoAtoms: new BN(r.cryptoAtoms),
|
||||||
fiat: new BN(r.fiat),
|
fiat: new BN(r.fiat),
|
||||||
cashInFee: new BN(r.cashInFee),
|
cashInFee: new BN(r.cashInFee),
|
||||||
cashInFeeCrypto: new BN(r.cashInFeeCrypto),
|
|
||||||
commissionPercentage: new BN(r.commissionPercentage),
|
commissionPercentage: new BN(r.commissionPercentage),
|
||||||
rawTickerPrice: r.rawTickerPrice ? new BN(r.rawTickerPrice) : null,
|
rawTickerPrice: r.rawTickerPrice ? new BN(r.rawTickerPrice) : null,
|
||||||
minimumTx: new BN(r.minimumTx)
|
minimumTx: new BN(r.minimumTx)
|
||||||
|
|
|
||||||
13
migrations/1670425142650-deprecate-cash-in-fee-crypto.js
Normal file
13
migrations/1670425142650-deprecate-cash-in-fee-crypto.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
const db = require('./db')
|
||||||
|
|
||||||
|
exports.up = function (next) {
|
||||||
|
var sql = [
|
||||||
|
'ALTER TABLE cash_in_txs DROP COLUMN cash_in_fee_crypto'
|
||||||
|
]
|
||||||
|
|
||||||
|
db.multi(sql, next)
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.down = function (next) {
|
||||||
|
next()
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue