paypro: better error display on no unspent outputs.

This commit is contained in:
Christopher Jeffrey 2014-08-13 21:06:57 -04:00 committed by Manuel Araoz
parent 8e86826b68
commit ea7948f420
2 changed files with 17 additions and 1 deletions

View File

@ -430,13 +430,29 @@ angular.module('copayApp.controllers').controller('SendController',
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;
$rootScope.merchantError = true;
var lastAddr = scope.sendForm.address.$viewValue;
var unregister = scope.$watch('address', function() {
if (scope.sendForm.address.$viewValue !== lastAddr) {
delete $rootScope.merchantError;
scope.sendForm.amount.$setViewValue('');
scope.sendForm.amount.$render();
unregister();
if ($rootScope.$$phase !== '$apply' && $rootScope.$$phase !== '$digest') {
$rootScope.$apply();
}
}
});
}
notification.error('Error', err.message || 'Bad payment server.');
if ($rootScope.$$phase !== '$apply' && $rootScope.$$phase !== '$digest') {
$rootScope.$apply();
}

View File

@ -65,7 +65,7 @@
</label>
<div class="small-9 columns">
<input type="number" id="amount"
ng-disabled="loading || ($root.merchant && +$root.merchant.total > 0)"
ng-disabled="loading || ($root.merchant && +$root.merchant.total > 0) || $root.merchantError"
name="amount" placeholder="Amount" ng-model="amount"
min="0.00005400" max="10000000000" enough-amount required
autocomplete="off"