Removes cards. Fix history. New method getInvoiceHistory

This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-07 15:51:15 -03:00
commit 63916402a3
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
7 changed files with 89 additions and 54 deletions

View file

@ -6,13 +6,13 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$scope.dateRange = 'last30Days';
$scope.network = bitpayCardService.getEnvironment();
var getFromCache = function() {
var getFromCache = function(cb) {
bitpayCardService.getBitpayDebitCardsHistory($scope.cardId, function(err, data) {
if (err || lodash.isEmpty(data)) return;
if (err || lodash.isEmpty(data)) return cb();
$scope.historyCached = true;
self.bitpayCardTransactionHistory = data.transactions;
self.bitpayCardCurrentBalance = data.balance;
$scope.$apply();
return cb();
});
};
@ -53,7 +53,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
return;
}
self.bitpayCardTransactionHistory = history.transactionList;
self.bitpayCardTransactionHistory = history.txs;
self.bitpayCardCurrentBalance = history.currentCardBalance;
var cacheHistory = {
@ -102,8 +102,9 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$state.go('tabs.home');
popupService.showAlert(null, msg);
} else {
getFromCache();
self.update();
getFromCache(function() {
self.update();
});
}
});