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.cardId = data.stateParams.id;
|
||||
$scope.currency = bitpayCardService.getAvailableCurrency();
|
||||
|
||||
if (!$scope.cardId) {
|
||||
$ionicHistory.nextViewOptions({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'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 currency;
|
||||
|
@ -91,7 +91,19 @@ angular.module('copayApp.controllers').controller('topUpController', function($s
|
|||
}
|
||||
$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);
|
||||
$scope.rate = data.rate;
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
|||
$log.error(msg);
|
||||
var error = (e && e.data && e.data.error) ? e.data.error : msg;
|
||||
return error;
|
||||
};
|
||||
};
|
||||
|
||||
var _processTransactions = function(invoices, history) {
|
||||
invoices = invoices || [];
|
||||
|
@ -41,6 +41,16 @@ angular.module('copayApp.services').factory('bitpayCardService', function($log,
|
|||
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) {
|
||||
var json = {
|
||||
method: 'getDebitCards'
|
||||
|
|
|
@ -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: currency})" no-low-fee>
|
||||
<i class="icon ion-plus m10r" style="vertical-align: baseline;"></i>
|
||||
{{'Add Funds'|translate}}
|
||||
</a>
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
<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">@
|
||||
<span ng-bind-html="htmlCurrencyCode"></span>
|
||||
{{rate | currency:' ':2}} per BTC</span>
|
||||
<span ng-if="!rate">...</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue