Merge pull request #5482 from matiu/card/spinner-link

fetching account spinner
This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-18 16:16:52 -03:00 committed by GitHub
commit ecbe35da11
4 changed files with 17 additions and 10 deletions

1
.gitignore vendored
View file

@ -117,4 +117,3 @@ cordova/ios/splash/
cordova/ios/icons/
cordova/project/
package.json

View file

@ -8,16 +8,20 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
email: data.stateParams.email,
otp: data.stateParams.otp
};
var pairingReason = gettextCatalog.getString('add your BitPay Visa<sup>&reg;</sup> card(s)');
var pairingReason = gettextCatalog.getString('BitPay Visa card');
bitpayService.pair(pairData, pairingReason, function(err, paired, apiContext) {
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);
popupService.showAlert(gettextCatalog.getString('Error pairing Bitpay Account'), err);
return;
}
if (paired) {
bitpayCardService.fetchBitpayDebitCards(apiContext, function(err, data) {
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);
popupService.showAlert(gettextCatalog.getString('Error fetching Debit Cards'), err);
return;
}
// Set flag for nextStep

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('bitpayService', function($log, $http, platformInfo, appIdentityService, bitauthService, storageService, gettextCatalog, popupService) {
angular.module('copayApp.services').factory('bitpayService', function($log, $http, platformInfo, appIdentityService, bitauthService, storageService, gettextCatalog, popupService, ongoingProcess) {
var root = {};
var NETWORK = 'livenet';
@ -62,20 +62,23 @@ angular.module('copayApp.services').factory('bitpayService', function($log, $htt
};
appIdentityService.getIdentity(root.getEnvironment().network, function(err, appIdentity) {
if (err) return cb(err);
ongoingProcess.set('fetchingBitPayAccount', true);
$http(_postAuth('/api/v2/', json, appIdentity)).then(function(data) {
ongoingProcess.set('fetchingBitPayAccount', false);
if (data && data.data.error) return cb(data.data.error);
$log.info('BitPay service BitAuth create token: SUCCESS');
var title = gettextCatalog.getString('Add BitPay Account?');
var msgDetail = 'Add this BitPay account ({{email}})?';
var title = gettextCatalog.getString('Link BitPay Account?');
var msgDetail = 'Link BitPay account ({{email}})?';
if (pairingReason) {
msgDetail = 'To {{reason}} you must first add your BitPay account.<br/><br/>{{email}}';
msgDetail = 'To add your {{reason}} please link your BitPay account {{email}}';
}
var msg = gettextCatalog.getString(msgDetail, {
reason: pairingReason,
email: pairData.email
});
var ok = gettextCatalog.getString('Add Account');
var cancel = gettextCatalog.getString('Go back');
var ok = gettextCatalog.getString('Confirm');
var cancel = gettextCatalog.getString('Cancel');
popupService.showConfirm(title, msg, ok, cancel, function(res) {
if (res) {
var acctData = {

View file

@ -40,6 +40,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
'sending2faCode': gettext('Sending 2FA code...'),
'buyingBitcoin': gettext('Buying Bitcoin...'),
'sellingBitcoin': gettext('Selling Bitcoin...'),
'fetchingBitPayAccount': gettext('Fetching BitPay Account...'),
'updatingGiftCards': 'Updating Gift Cards...',
'updatingGiftCard': 'Updating Gift Card...',
'cancelingGiftCard': 'Canceling Gift Card...',