cash out works for btc

This commit is contained in:
Josh Harvey 2016-04-07 16:17:33 +01:00
parent e2d619c56d
commit e227716ad9
3 changed files with 5 additions and 4 deletions

View file

@ -329,7 +329,7 @@ function addPendingTx (client, session, incoming, currencyCode, cryptoCode, toAd
'currency_code', 'crypto_code', 'to_address', 'satoshis']
var sql = getInsertQuery('pending_transactions', fields, false)
var values = [session.fingerprint, session.id, incoming, currencyCode,
cryptoCode, toAddress, satoshis]
cryptoCode, toAddress, satoshis.toString()]
query(client, sql, values, function (err) {
cb(err)
})

View file

@ -132,6 +132,10 @@ function send (req, res) {
function cashOut (req, res) {
logger.info({tx: req.body, cmd: 'cashOut'})
var tx = req.body
tx.cryptoAtoms = new BigNumber(tx.cryptoAtoms)
tx.satoshis = tx.cryptoAtoms
plugins.cashOut(session(req), req.body, function (err, bitcoinAddress) {
if (err) logger.error(err)

View file

@ -30,7 +30,4 @@ alter table pending_transactions alter satoshis TYPE bigint;
alter table bills add crypto_code text default 'BTC';
alter table bills alter satoshis TYPE bigint;
- get cryptoCode from pending tx
- update cryptoCode for bills insert
- insert correct satoshis in pending tx -- actually this is supposed to be 0
- fix satoshi math in postgres module by moving to bignumber math