Merge pull request #6161 from cmgustavo/ref/bitpay-card-intl-01

Adds support for EUR and GBP currencies
This commit is contained in:
Gabriel Edgardo Bazán 2017-06-06 10:07:34 -03:00 committed by GitHub
commit 25ce2c41ac
5 changed files with 11 additions and 9 deletions

View File

@ -203,6 +203,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
self.balance = cards[0].balance;
self.currencySymbol = cards[0].currencySymbol;
self.updatedOn = cards[0].updatedOn;
self.currency = cards[0].currency;
}
self.update();
});

View File

@ -91,17 +91,17 @@ angular.module('copayApp.controllers').controller('topUpController', function($s
}
$scope.onWalletSelect($scope.wallets[0]); // Default first wallet
bitpayCardService.getRates('USD', function(err, data) {
if (err) $log.error(err);
$scope.rate = data.rate;
});
bitpayCardService.get({ cardId: cardId, noRefresh: true }, function(err, card) {
if (err) {
showErrorAndBack(null, err);
return;
}
$scope.cardInfo = card[0];
bitpayCardService.setCurrencySymbol($scope.cardInfo);
bitpayCardService.getRates($scope.cardInfo.currency, function(err, data) {
if (err) $log.error(err);
$scope.rate = data.rate;
});
});
});

View File

@ -1,13 +1,13 @@
'use strict';
angular.module('copayApp.services').factory('bitpayCardService', function($log, $rootScope, $filter, lodash, storageService, bitauthService, platformInfo, moment, appIdentityService, bitpayService, nextStepsService, configService, txFormatService, appConfigService) {
angular.module('copayApp.services').factory('bitpayCardService', function($log, $rootScope, $filter, lodash, storageService, bitauthService, platformInfo, moment, appIdentityService, bitpayService, nextStepsService, txFormatService, appConfigService) {
var root = {};
var _setError = function(msg, e) {
$log.error(msg);
var error = (e && e.data && e.data.error) ? e.data.error : msg;
return error;
};
};
var _processTransactions = function(invoices, history) {
invoices = invoices ||  [];

View File

@ -23,7 +23,7 @@
<a class="button button-primary button-small m5t size-14"
style="padding: 0.5em 1em;"
ui-sref="tabs.bitpayCard.amount({nextStep: 'tabs.bitpayCard.topup'})" no-low-fee>
ui-sref="tabs.bitpayCard.amount({nextStep: 'tabs.bitpayCard.topup', currency: bitpayCard.currency})" no-low-fee>
<i class="icon ion-plus m10r" style="vertical-align: baseline;"></i>
{{'Add Funds'|translate}}
</a>

View File

@ -19,7 +19,8 @@
<div class="amount-label">
<div class="amount-final">{{amountUnitStr}}</div>
<div class="alternative">
<span ng-if="rate">@ {{rate | currency:'$':2}} per BTC</span>
<span ng-if="rate">@
{{rate | currency:cardInfo.currencySymbol:2}} per BTC</span>
<span ng-if="!rate">...</span>
</div>
</div>