Adds exchange rates during the top-up of the BitPay card

This commit is contained in:
Gustavo Maximiliano Cortez 2016-12-08 16:35:25 -03:00
commit 938862bfe8
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
5 changed files with 43 additions and 1 deletions

View file

@ -229,6 +229,20 @@ angular.module('copayApp.controllers').controller('amountController', function($
return result.replace('x', '*');
};
$scope.getRates = function() {
bitpayCardService.getRates($scope.alternativeIsoCode, function(err, res) {
if (err) {
$log.warn(err);
return;
}
if ($scope.unitName == 'bits') {
$scope.exchangeRate = '1,000,000 bits ~ ' + res.rate + ' ' + $scope.alternativeIsoCode;
} else {
$scope.exchangeRate = '1 BTC ~ ' + res.rate + ' ' + $scope.alternativeIsoCode;
}
});
};
$scope.finish = function() {
var _amount = evaluate(format($scope.amount));