refactor bitpay card
This commit is contained in:
parent
5b1cbe0ab9
commit
19b3d9bb15
11 changed files with 242 additions and 261 deletions
|
|
@ -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;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue