Fix buying if operation is not completed inmediatly (#4110)

This commit is contained in:
Gustavo Maximiliano Cortez 2016-04-21 17:20:10 -03:00 committed by Matias Alejo Garcia
commit 5886b22f07
2 changed files with 5 additions and 5 deletions

View file

@ -151,10 +151,10 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
self.error = {errors: [{ message: 'Could not create address' }]};
return;
}
coinbaseService.savePendingTransaction(updatedTx.data, {toAddr: addr}, function(err) {
updatedTx.data['toAddr'] = addr;
coinbaseService.savePendingTransaction(updatedTx.data, {}, function(err) {
self.loading = null;
if (err) $log.debug(err);
updatedTx.data['toAddr'] = addr;
if (updatedTx.data.status == 'completed') {
self.sendToCopay(token, account, updatedTx.data);
} else {

View file

@ -1390,8 +1390,8 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
}
});
} else if (tx.data.type == 'buy' && tx.data.status == 'pending' && tx.data.buy) {
self.buyPending(tx.data);
} else if (tx.data.type == 'buy' && tx.data.status == 'completed' && tx.data.buy) {
self.sendToCopay(dataFromStorage);
} else {
coinbaseService.savePendingTransaction(dataFromStorage, {}, function(err) {
if (err) $log.debug(err);
@ -1435,7 +1435,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
};
self.buyPending = function(tx) {
self.sendToCopay = function(tx) {
if (!tx) return;
var data = {
to: tx.toAddr,