Top up a debit card is limited to 10000 usd
This commit is contained in:
parent
f75b43f21e
commit
acb4d3d354
1 changed files with 19 additions and 5 deletions
|
|
@ -50,6 +50,22 @@ angular.module('copayApp.controllers').controller('topUpController', function($s
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var checkDailyLimit = function() {
|
||||||
|
if (currency == 'USD' && amount > 10000) {
|
||||||
|
showErrorAndBack('Top up is limited to USD 10,000 per day');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bitpayCardService.getRates('USD', function(err, data) {
|
||||||
|
if (err) $log.error(err);
|
||||||
|
$scope.rate = data.rate;
|
||||||
|
if (currency == 'BTC' && (amount * data.rate) > 10000) {
|
||||||
|
showErrorAndBack('Top up is limited to USD 10,000 per day');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
cardId = data.stateParams.id;
|
cardId = data.stateParams.id;
|
||||||
sendMax = data.stateParams.useSendMax;
|
sendMax = data.stateParams.useSendMax;
|
||||||
|
|
@ -81,11 +97,6 @@ angular.module('copayApp.controllers').controller('topUpController', function($s
|
||||||
}
|
}
|
||||||
$scope.onWalletSelect($scope.wallets[0]); // Default first wallet
|
$scope.onWalletSelect($scope.wallets[0]); // Default first wallet
|
||||||
|
|
||||||
bitpayCardService.getRates('USD', function(err, data) {
|
|
||||||
if (err) $log.error(err);
|
|
||||||
$scope.rate = data.rate;
|
|
||||||
});
|
|
||||||
|
|
||||||
bitpayCardService.get({ cardId: cardId, noRefresh: true }, function(err, card) {
|
bitpayCardService.get({ cardId: cardId, noRefresh: true }, function(err, card) {
|
||||||
if (err) {
|
if (err) {
|
||||||
showErrorAndBack(err);
|
showErrorAndBack(err);
|
||||||
|
|
@ -207,11 +218,14 @@ angular.module('copayApp.controllers').controller('topUpController', function($s
|
||||||
|
|
||||||
amount = parsedAmount.amount;
|
amount = parsedAmount.amount;
|
||||||
currency = parsedAmount.currency;
|
currency = parsedAmount.currency;
|
||||||
|
checkDailyLimit();
|
||||||
$scope.amountUnitStr = parsedAmount.amountUnitStr;
|
$scope.amountUnitStr = parsedAmount.amountUnitStr;
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
checkDailyLimit();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue