Refactor sell

This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-12 23:53:23 -03:00
commit 4b6be720a7
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 4 additions and 6 deletions

View file

@ -173,13 +173,12 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController', func
return; return;
} }
if (!hasPrimary) $scope.selectedPaymentMethodId.value = $scope.paymentMethods[0].id; if (!hasPrimary) $scope.selectedPaymentMethodId.value = $scope.paymentMethods[0].id;
$scope.sellRequest({ quote: true }); $scope.sellRequest();
}); });
}); });
}); });
$scope.sellRequest = function(opts) { $scope.sellRequest = function() {
opts = opts || {};
ongoingProcess.set('connectingCoinbase', true); ongoingProcess.set('connectingCoinbase', true);
coinbaseService.init(function(err, res) { coinbaseService.init(function(err, res) {
if (err) { if (err) {
@ -193,8 +192,7 @@ angular.module('copayApp.controllers').controller('sellCoinbaseController', func
amount: amount, amount: amount,
currency: currency, currency: currency,
payment_method: $scope.selectedPaymentMethodId.value, payment_method: $scope.selectedPaymentMethodId.value,
commit: opts.commit, quote: true
quote: opts.quote
}; };
coinbaseService.sellRequest(accessToken, accountId, dataSrc, function(err, data) { coinbaseService.sellRequest(accessToken, accountId, dataSrc, function(err, data) {
ongoingProcess.set('connectingCoinbase', false); ongoingProcess.set('connectingCoinbase', false);

View file

@ -17,7 +17,7 @@
</div> </div>
<select ng-model="selectedPaymentMethodId.value" <select ng-model="selectedPaymentMethodId.value"
ng-options="item.id as item.name for item in paymentMethods" ng-options="item.id as item.name for item in paymentMethods"
ng-change="sellRequest({quote: true})"> ng-change="sellRequest()">
</select> </select>
</label> </label>