fix amazon"s next steps

This commit is contained in:
Matias Alejo Garcia 2017-01-31 08:21:18 -03:00
commit 54c8c64351
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
3 changed files with 33 additions and 31 deletions

View file

@ -3,19 +3,31 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
var root = {};
var credentials = {};
var setCredentials = function() {
/*
* Development: 'testnet'
* Production: 'livenet'
*/
//credentials.NETWORK = 'livenet';
credentials.NETWORK = 'testnet';
/*
* Development: 'testnet'
* Production: 'livenet'
*/
//credentials.NETWORK = 'livenet';
credentials.NETWORK = 'testnet';
if (credentials.NETWORK == 'testnet') {
credentials.BITPAY_API_URL = "https://test.bitpay.com";
} else {
credentials.BITPAY_API_URL = "https://bitpay.com";
};
if (credentials.NETWORK == 'testnet') {
credentials.BITPAY_API_URL = "https://test.bitpay.com";
} else {
credentials.BITPAY_API_URL = "https://bitpay.com";
};
var homeItem = {
name: 'amazon',
title: 'Amazon Gift Cards',
icon: 'icon-amazon',
sref: 'tabs.giftcards.amazon',
};
var nextStepItem = {
name: 'amazon',
title: 'Buy a gift card',
icon: 'icon-amazon',
sref: 'tabs.giftcards.amazon',
};
var _getBitPay = function(endpoint) {
@ -63,6 +75,9 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
inv = JSON.stringify(inv);
storageService.setAmazonGiftCards(network, inv, function(err) {
homeIntegrationsService.register(homeItem);
nextStepsService.unregister(nextStepItem.name);
return cb(err);
});
});
@ -139,28 +154,16 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
});
};
var register = function () {
var register = function() {
storageService.getAmazonGiftCards(root.getNetwork(), function(err, giftCards) {
if (giftCards) {
homeIntegrationsService.register({
name: 'amazon',
title: 'Amazon Gift Cards',
icon: 'icon-amazon',
sref: 'tabs.giftcards.amazon',
});
homeIntegrationsService.register(homeItem);
} else {
nextStepsService.register({
name: 'amazon',
title: 'Buy a gift card',
icon: 'icon-amazon',
sref: 'tabs.giftcards.amazon',
});
nextStepsService.register(nextStepItem);
}
});
};
setCredentials();
register();
return root;
});

View file

@ -603,7 +603,7 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
};
root.updatePendingTransactions = lodash.throttle(function() {
$log.debug('Updating pending transactions...');
$log.debug('Updating coinbase pending transactions...');
var pendingTransactions = {
data: {}
};

View file

@ -14,7 +14,7 @@
};
root.unregister = function(serviceName) {
console.log('[nextStepsService.js.16:serviceName:] UNR',serviceName); //TODO
$log.info('Removing NextSteps entry:' + serviceName);
var newS = lodash.filter(services, function(x) {
return x.name!=serviceName;
});
@ -25,7 +25,6 @@ console.log('[nextStepsService.js.16:serviceName:] UNR',serviceName); //TODO
while(newS.length)
services.push(newS.pop());
console.log('[nextStepsService.js.26:services:]',services); //TODO
};
root.get = function() {