Skip to content

Commit

Permalink
fetching account spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
matiu committed Jan 18, 2017
1 parent 0e518f7 commit c607831
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,3 @@ cordova/ios/splash/
cordova/ios/icons/
cordova/project/

package.json
10 changes: 7 additions & 3 deletions src/js/controllers/bitpayCardIntro.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions src/js/services/bitpayService.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 = {
Expand Down
1 change: 1 addition & 0 deletions src/js/services/onGoingProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -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...',
Expand Down

0 comments on commit c607831

Please sign in to comment.