Merge pull request #6581 from cmgustavo/bug/coinbase-03
Purchase throught Coinbase: Force buyInfo request until get tran…
This commit is contained in:
commit
548c4e3465
1 changed files with 20 additions and 10 deletions
|
|
@ -209,21 +209,31 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _processBuyOrder = function() {
|
||||||
|
coinbaseService.getBuyOrder(accessToken, accountId, b.data.id, function (err, buyResp) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('buyingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var tx = buyResp.data ? buyResp.data.transaction : null;
|
||||||
|
if (tx && tx.id) {
|
||||||
|
processBuyTx(tx);
|
||||||
|
} else {
|
||||||
|
$timeout(function() {
|
||||||
|
_processBuyOrder();
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
var tx = b.data ? b.data.transaction : null;
|
var tx = b.data ? b.data.transaction : null;
|
||||||
if (tx) {
|
if (tx && tx.id) {
|
||||||
processBuyTx(tx);
|
processBuyTx(tx);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
coinbaseService.getBuyOrder(accessToken, accountId, b.data.id, function (err, buyResp) {
|
_processBuyOrder();
|
||||||
if (err) {
|
|
||||||
ongoingProcess.set('buyingBitcoin', false, statusChangeHandler);
|
|
||||||
showError(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var tx = buyResp.data ? buyResp.data.transaction : null;
|
|
||||||
processBuyTx(tx);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, 8000);
|
}, 8000);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue