WIP
This commit is contained in:
parent
d6ec60db55
commit
184d30209a
4 changed files with 74 additions and 29 deletions
|
|
@ -284,6 +284,7 @@ function insertTx(client, session, incoming, tx, satoshis, fiat, stage,
|
|||
'to_address',
|
||||
'satoshis',
|
||||
'currency_code',
|
||||
'crypto_code',
|
||||
'fiat',
|
||||
'tx_hash',
|
||||
'error'
|
||||
|
|
@ -298,6 +299,7 @@ function insertTx(client, session, incoming, tx, satoshis, fiat, stage,
|
|||
tx.toAddress,
|
||||
satoshis,
|
||||
tx.currencyCode,
|
||||
tx.cryptoCode,
|
||||
fiat,
|
||||
tx.txHash,
|
||||
tx.error
|
||||
|
|
@ -322,13 +324,13 @@ function refreshPendingTx(client, session, cb) {
|
|||
});
|
||||
}
|
||||
|
||||
function addPendingTx(client, session, incoming, currencyCode, toAddress,
|
||||
function addPendingTx(client, session, incoming, currencyCode, cryptoCode, toAddress,
|
||||
satoshis, cb) {
|
||||
var fields = ['device_fingerprint', 'session_id', 'incoming',
|
||||
'currency_code', 'to_address', 'satoshis'];
|
||||
'currency_code', 'crypto_code', 'to_address', 'satoshis'];
|
||||
var sql = getInsertQuery('pending_transactions', fields, false);
|
||||
var values = [session.fingerprint, session.id, incoming, currencyCode,
|
||||
toAddress, satoshis];
|
||||
cryptoCode, toAddress, satoshis];
|
||||
query(client, sql, values, function(err) {
|
||||
cb(err);
|
||||
});
|
||||
|
|
@ -402,14 +404,14 @@ function ensureNotFinal(client, session, cb) {
|
|||
}
|
||||
|
||||
exports.addOutgoingPending = function addOutgoingPending(session, currencyCode,
|
||||
toAddress, cb) {
|
||||
cryptoCode, toAddress, cb) {
|
||||
connect(function(cerr, client, done) {
|
||||
if (cerr) return cb(cerr);
|
||||
|
||||
async.series([
|
||||
async.apply(silentQuery, client, 'BEGIN', null),
|
||||
async.apply(ensureNotFinal, client, session),
|
||||
async.apply(addPendingTx, client, session, false, currencyCode, toAddress,
|
||||
async.apply(addPendingTx, client, session, false, currencyCode, cryptoCode, toAddress,
|
||||
0)
|
||||
], function(err) {
|
||||
if (err) {
|
||||
|
|
@ -442,7 +444,7 @@ exports.addInitialIncoming = function addInitialIncoming(session, tx, cb) {
|
|||
async.series([
|
||||
async.apply(silentQuery, client, 'BEGIN', null),
|
||||
async.apply(addPendingTx, client, session, true, tx.currencyCode,
|
||||
tx.toAddress, tx.satoshis),
|
||||
tx.cryptoCode, tx.toAddress, tx.satoshis),
|
||||
async.apply(insertIncoming, client, session, tx, tx.satoshis, tx.fiat,
|
||||
'initial_request', 'pending')
|
||||
], function(err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue