fetching account spinner
This commit is contained in:
parent
0e518f78d5
commit
c607831fae
4 changed files with 17 additions and 10 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -117,4 +117,3 @@ cordova/ios/splash/
|
||||||
cordova/ios/icons/
|
cordova/ios/icons/
|
||||||
cordova/project/
|
cordova/project/
|
||||||
|
|
||||||
package.json
|
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,20 @@ angular.module('copayApp.controllers').controller('bitpayCardIntroController', f
|
||||||
email: data.stateParams.email,
|
email: data.stateParams.email,
|
||||||
otp: data.stateParams.otp
|
otp: data.stateParams.otp
|
||||||
};
|
};
|
||||||
var pairingReason = gettextCatalog.getString('add your BitPay Visa<sup>®</sup> card(s)');
|
|
||||||
|
var pairingReason = gettextCatalog.getString('BitPay Visa card');
|
||||||
|
|
||||||
bitpayService.pair(pairData, pairingReason, function(err, paired, apiContext) {
|
bitpayService.pair(pairData, pairingReason, function(err, paired, apiContext) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
popupService.showAlert(gettextCatalog.getString('Error pairing Bitpay Account'), err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (paired) {
|
if (paired) {
|
||||||
bitpayCardService.fetchBitpayDebitCards(apiContext, function(err, data) {
|
bitpayCardService.fetchBitpayDebitCards(apiContext, function(err, data) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
popupService.showAlert(gettextCatalog.getString('Error fetching Debit Cards'), err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Set flag for nextStep
|
// Set flag for nextStep
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'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 root = {};
|
||||||
|
|
||||||
var NETWORK = 'livenet';
|
var NETWORK = 'livenet';
|
||||||
|
|
@ -62,20 +62,23 @@ angular.module('copayApp.services').factory('bitpayService', function($log, $htt
|
||||||
};
|
};
|
||||||
appIdentityService.getIdentity(root.getEnvironment().network, function(err, appIdentity) {
|
appIdentityService.getIdentity(root.getEnvironment().network, function(err, appIdentity) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
ongoingProcess.set('fetchingBitPayAccount', true);
|
||||||
$http(_postAuth('/api/v2/', json, appIdentity)).then(function(data) {
|
$http(_postAuth('/api/v2/', json, appIdentity)).then(function(data) {
|
||||||
|
ongoingProcess.set('fetchingBitPayAccount', false);
|
||||||
|
|
||||||
if (data && data.data.error) return cb(data.data.error);
|
if (data && data.data.error) return cb(data.data.error);
|
||||||
$log.info('BitPay service BitAuth create token: SUCCESS');
|
$log.info('BitPay service BitAuth create token: SUCCESS');
|
||||||
var title = gettextCatalog.getString('Add BitPay Account?');
|
var title = gettextCatalog.getString('Link BitPay Account?');
|
||||||
var msgDetail = 'Add this BitPay account ({{email}})?';
|
var msgDetail = 'Link BitPay account ({{email}})?';
|
||||||
if (pairingReason) {
|
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, {
|
var msg = gettextCatalog.getString(msgDetail, {
|
||||||
reason: pairingReason,
|
reason: pairingReason,
|
||||||
email: pairData.email
|
email: pairData.email
|
||||||
});
|
});
|
||||||
var ok = gettextCatalog.getString('Add Account');
|
var ok = gettextCatalog.getString('Confirm');
|
||||||
var cancel = gettextCatalog.getString('Go back');
|
var cancel = gettextCatalog.getString('Cancel');
|
||||||
popupService.showConfirm(title, msg, ok, cancel, function(res) {
|
popupService.showConfirm(title, msg, ok, cancel, function(res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
var acctData = {
|
var acctData = {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
|
||||||
'sending2faCode': gettext('Sending 2FA code...'),
|
'sending2faCode': gettext('Sending 2FA code...'),
|
||||||
'buyingBitcoin': gettext('Buying Bitcoin...'),
|
'buyingBitcoin': gettext('Buying Bitcoin...'),
|
||||||
'sellingBitcoin': gettext('Selling Bitcoin...'),
|
'sellingBitcoin': gettext('Selling Bitcoin...'),
|
||||||
|
'fetchingBitPayAccount': gettext('Fetching BitPay Account...'),
|
||||||
'updatingGiftCards': 'Updating Gift Cards...',
|
'updatingGiftCards': 'Updating Gift Cards...',
|
||||||
'updatingGiftCard': 'Updating Gift Card...',
|
'updatingGiftCard': 'Updating Gift Card...',
|
||||||
'cancelingGiftCard': 'Canceling Gift Card...',
|
'cancelingGiftCard': 'Canceling Gift Card...',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue