From e227716ad94ce12270b956f31cf1d5aecbc4cf23 Mon Sep 17 00:00:00 2001 From: Josh Harvey Date: Thu, 7 Apr 2016 16:17:33 +0100 Subject: [PATCH] cash out works for btc --- lib/postgresql_interface.js | 2 +- lib/routes.js | 4 ++++ todo.txt | 3 --- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/postgresql_interface.js b/lib/postgresql_interface.js index e27f6487..7a089448 100644 --- a/lib/postgresql_interface.js +++ b/lib/postgresql_interface.js @@ -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) }) diff --git a/lib/routes.js b/lib/routes.js index ad298f9a..74213fc8 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -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) diff --git a/todo.txt b/todo.txt index f2fa57a4..82026517 100644 --- a/todo.txt +++ b/todo.txt @@ -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