paypro: even better notification when user has insufficient funds.

This commit is contained in:
Christopher Jeffrey 2014-08-13 20:51:33 -04:00 committed by Manuel Araoz
commit 8e86826b68
2 changed files with 18 additions and 3 deletions

View file

@ -425,12 +425,17 @@ angular.module('copayApp.controllers').controller('SendController',
if (merchantData && available < +merchantData.total) {
err = new Error('No unspent outputs available.');
scope.notEnoughAmount = true;
scope.sendForm.amount.$isValid = false;
err.amount = merchantData.total;
}
if (err) {
scope.sendForm.address.$isValid = false;
if (err.amount) {
scope.sendForm.amount.$setViewValue(+err.amount / config.unitToSatoshi);
scope.sendForm.amount.$render();
scope.sendForm.amount.$isValid = false;
scope.notEnoughAmount = true;
}
notification.error('Error', err.message || 'Bad payment server.');
if ($rootScope.$$phase !== '$apply' && $rootScope.$$phase !== '$digest') {
$rootScope.$apply();