Clean UI. Adds amount parser for coinbaseService

This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-14 19:22:33 -03:00
commit 8d1d59cb3b
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
9 changed files with 85 additions and 46 deletions

View file

@ -36,14 +36,10 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct
$scope.$on("$ionicView.beforeEnter", function(event, data) {
coinbaseService.setCredentials();
amount = data.stateParams.amount;
currency = data.stateParams.currency;
[amount, currency, $scope.amountUnitStr] = coinbaseService.parseAmount(
data.stateParams.amount,
data.stateParams.currency);
if (amount < 1) {
showErrorAndBack('Amount must be at least 1.00 ' + currency);
return;
}
$scope.network = coinbaseService.getNetwork();
$scope.wallets = profileService.getWallets({
onlyComplete: true,
@ -60,6 +56,10 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController', funct
}
var accessToken = res.accessToken;
coinbaseService.buyPrice(accessToken, coinbaseService.getAvailableCurrency(), function(err, b) {
$scope.buyPrice = b.data || null;
});
$scope.paymentMethods = [];
$scope.selectedPaymentMethodId = { value : null };
coinbaseService.getPaymentMethods(accessToken, function(err, p) {