refactor bitpay card

This commit is contained in:
Matias Alejo Garcia 2017-01-27 17:54:41 -03:00
commit 19b3d9bb15
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
11 changed files with 242 additions and 261 deletions

View file

@ -1,19 +1,21 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesBitpayCardController',
function($scope, $state, $timeout, $ionicHistory, bitpayCardService, popupService, gettextCatalog) {
function($scope, $state, $timeout, $ionicHistory, bitpayCardService, popupService, gettextCatalog, $log) {
$scope.remove = function(card) {
var msg = gettextCatalog.getString('Are you sure you would like to remove your BitPay Card ({{lastFourDigits}}) from this device?', {
lastFourDigits: card.lastFourDigits
});
popupService.showConfirm(null, msg, null, null, function(res) {
if (res) remove(card);
$log.info('Removing bitpay card:' + card.eid)
if (res)
remove(card.eid);
});
};
var remove = function(card) {
bitpayCardService.remove(card, function(err) {
var remove = function(cardEid) {
bitpayCardService.remove(cardEid, function(err) {
if (err) {
return popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not remove card'));
}
@ -25,8 +27,9 @@ angular.module('copayApp.controllers').controller('preferencesBitpayCardControll
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
bitpayCardService.getBitpayDebitCards(function(err, data) {
bitpayCardService.getCards(function(err, data) {
if (err) return;
$scope.bitpayCards = data;
});
});