paypro: better error display on no unspent outputs.
This commit is contained in:
parent
8e86826b68
commit
ea7948f420
2 changed files with 17 additions and 1 deletions
|
|
@ -430,13 +430,29 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
scope.sendForm.address.$isValid = false;
|
scope.sendForm.address.$isValid = false;
|
||||||
|
|
||||||
if (err.amount) {
|
if (err.amount) {
|
||||||
scope.sendForm.amount.$setViewValue(+err.amount / config.unitToSatoshi);
|
scope.sendForm.amount.$setViewValue(+err.amount / config.unitToSatoshi);
|
||||||
scope.sendForm.amount.$render();
|
scope.sendForm.amount.$render();
|
||||||
scope.sendForm.amount.$isValid = false;
|
scope.sendForm.amount.$isValid = false;
|
||||||
scope.notEnoughAmount = true;
|
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.');
|
notification.error('Error', err.message || 'Bad payment server.');
|
||||||
|
|
||||||
if ($rootScope.$$phase !== '$apply' && $rootScope.$$phase !== '$digest') {
|
if ($rootScope.$$phase !== '$apply' && $rootScope.$$phase !== '$digest') {
|
||||||
$rootScope.$apply();
|
$rootScope.$apply();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
</label>
|
</label>
|
||||||
<div class="small-9 columns">
|
<div class="small-9 columns">
|
||||||
<input type="number" id="amount"
|
<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"
|
name="amount" placeholder="Amount" ng-model="amount"
|
||||||
min="0.00005400" max="10000000000" enough-amount required
|
min="0.00005400" max="10000000000" enough-amount required
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue