Purchase throught from Coinbase: Force buyInfo request until get transaction id

This commit is contained in:
Gustavo Maximiliano Cortez 2017-08-16 11:12:56 -03:00
commit 23cc08574e
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF

View file

@ -209,12 +209,7 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct
}); });
}; };
$timeout(function() { var _getBuyOrder = function() {
var tx = b.data ? b.data.transaction : null;
if (tx) {
processBuyTx(tx);
}
else {
coinbaseService.getBuyOrder(accessToken, accountId, b.data.id, function (err, buyResp) { coinbaseService.getBuyOrder(accessToken, accountId, b.data.id, function (err, buyResp) {
if (err) { if (err) {
ongoingProcess.set('buyingBitcoin', false, statusChangeHandler); ongoingProcess.set('buyingBitcoin', false, statusChangeHandler);
@ -222,9 +217,24 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct
return; return;
} }
var tx = buyResp.data ? buyResp.data.transaction : null; var tx = buyResp.data ? buyResp.data.transaction : null;
if (tx && tx.id) {
processBuyTx(tx); processBuyTx(tx);
} else {
$timeout(function() {
_getBuyOrder();
}, 5000);
}
}); });
} }
$timeout(function() {
var tx = b.data ? b.data.transaction : null;
if (tx && tx.id) {
processBuyTx(tx);
}
else {
_getBuyOrder();
}
}, 8000); }, 8000);
}); });
}); });