Complete buying flow

This commit is contained in:
Gustavo Maximiliano Cortez 2016-12-19 11:50:49 -03:00
commit 612d706779
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
8 changed files with 398 additions and 117 deletions

View file

@ -52,7 +52,7 @@ angular.module('copayApp.controllers').controller('amountController', function($
if ($scope.isCoinbase) {
var currency = 'USD';
coinbaseService.init($scope.coinbaseAccessToken, function(err, data) {
coinbaseService.init(function(err, data) {
if ($scope.isCoinbase == 'buy') {
coinbaseService.buyPrice(data.accessToken, currency, function(err, b) {
$scope.coinbaseBuyPrice = b.data || null;
@ -394,11 +394,14 @@ angular.module('copayApp.controllers').controller('amountController', function($
popupService.showAlert(gettextCatalog.getString('Error'), 'No Payment Method Selected');
return;
}
var amountUSD = $scope.showAlternativeAmount ? _amount : $filter('formatFiatAmount')(toFiat(_amount));
var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount;
$state.transitionTo('tabs.buyandsell.coinbase.confirm', {
toAmount: (amount * unitToSatoshi).toFixed(0),
isCoinbase: $scope.isCoinbase,
coinbasePaymentMethodId: $scope.coinbaseSelectedPaymentMethod.id
coinbasePaymentMethodId: $scope.coinbaseSelectedPaymentMethod.id,
coinbaseAmount: amountUSD,
coinbaseAmountCurrency: 'USD'
});
} else {
var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount;