mirror of https://github.com/BTCPrivate/copay.git
Adds support for EUR and GBP currencies
This commit is contained in:
parent
8b28e708bc
commit
e0eb06156e
|
@ -184,6 +184,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
$scope.cardId = data.stateParams.id;
|
$scope.cardId = data.stateParams.id;
|
||||||
|
$scope.currency = bitpayCardService.getAvailableCurrency();
|
||||||
|
|
||||||
if (!$scope.cardId) {
|
if (!$scope.cardId) {
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('topUpController', function($scope, $log, $state, $timeout, $ionicHistory, $ionicConfig, lodash, popupService, profileService, ongoingProcess, walletService, configService, platformInfo, bitpayService, bitpayCardService, payproService, bwcError, txFormatService, sendMaxService) {
|
angular.module('copayApp.controllers').controller('topUpController', function($scope, $log, $state, $timeout, $ionicHistory, $ionicConfig, $sce, lodash, popupService, profileService, ongoingProcess, walletService, configService, platformInfo, bitpayService, bitpayCardService, payproService, bwcError, txFormatService, sendMaxService) {
|
||||||
|
|
||||||
var amount;
|
var amount;
|
||||||
var currency;
|
var currency;
|
||||||
|
@ -91,7 +91,19 @@ angular.module('copayApp.controllers').controller('topUpController', function($s
|
||||||
}
|
}
|
||||||
$scope.onWalletSelect($scope.wallets[0]); // Default first wallet
|
$scope.onWalletSelect($scope.wallets[0]); // Default first wallet
|
||||||
|
|
||||||
bitpayCardService.getRates('USD', function(err, data) {
|
var currencyCode = bitpayCardService.getAvailableCurrency();
|
||||||
|
var code;
|
||||||
|
switch(currencyCode) {
|
||||||
|
case 'EUR':
|
||||||
|
code = '€';
|
||||||
|
break;
|
||||||
|
case 'GBP':
|
||||||
|
code = '£';
|
||||||
|
break;
|
||||||
|
default : code = '$';
|
||||||
|
};
|
||||||
|
$scope.htmlCurrencyCode = $sce.trustAsHtml(code);
|
||||||
|
bitpayCardService.getRates(currencyCode, function(err, data) {
|
||||||
if (err) $log.error(err);
|
if (err) $log.error(err);
|
||||||
$scope.rate = data.rate;
|
$scope.rate = data.rate;
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,6 +41,16 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
||||||
return history;
|
return history;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.getAvailableCurrency = function() {
|
||||||
|
var config = configService.getSync().wallet.settings;
|
||||||
|
// ONLY "USD", "EUR" and "GBP"
|
||||||
|
switch (config.alternativeIsoCode) {
|
||||||
|
case 'EUR': return 'EUR';
|
||||||
|
case 'GBP': return 'GBP';
|
||||||
|
default: return 'USD'
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
root.sync = function(apiContext, cb) {
|
root.sync = function(apiContext, cb) {
|
||||||
var json = {
|
var json = {
|
||||||
method: 'getDebitCards'
|
method: 'getDebitCards'
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<a class="button button-primary button-small m5t size-14"
|
<a class="button button-primary button-small m5t size-14"
|
||||||
style="padding: 0.5em 1em;"
|
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: currency})" no-low-fee>
|
||||||
<i class="icon ion-plus m10r" style="vertical-align: baseline;"></i>
|
<i class="icon ion-plus m10r" style="vertical-align: baseline;"></i>
|
||||||
{{'Add Funds'|translate}}
|
{{'Add Funds'|translate}}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
<div class="amount-label">
|
<div class="amount-label">
|
||||||
<div class="amount-final">{{amountUnitStr}}</div>
|
<div class="amount-final">{{amountUnitStr}}</div>
|
||||||
<div class="alternative">
|
<div class="alternative">
|
||||||
<span ng-if="rate">@ {{rate | currency:'$':2}} per BTC</span>
|
<span ng-if="rate">@
|
||||||
|
<span ng-bind-html="htmlCurrencyCode"></span>
|
||||||
|
{{rate | currency:' ':2}} per BTC</span>
|
||||||
<span ng-if="!rate">...</span>
|
<span ng-if="!rate">...</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue