Check min max on shapeshift flow
This commit is contained in:
parent
caafec4625
commit
5b6f48e6a2
3 changed files with 5 additions and 13 deletions
|
|
@ -20,7 +20,6 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
||||||
vm.lastUsedPopularList = [];
|
vm.lastUsedPopularList = [];
|
||||||
vm.maxAmount = 0;
|
vm.maxAmount = 0;
|
||||||
vm.minAmount = 0;
|
vm.minAmount = 0;
|
||||||
vm.shapeshiftOrderId = '';
|
|
||||||
vm.thirdParty = false;
|
vm.thirdParty = false;
|
||||||
vm.unit = '';
|
vm.unit = '';
|
||||||
|
|
||||||
|
|
@ -95,14 +94,9 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
||||||
vm.thirdParty.data['minAmount'] = vm.minAmount = parseFloat(data.minimum);
|
vm.thirdParty.data['minAmount'] = vm.minAmount = parseFloat(data.minimum);
|
||||||
vm.thirdParty.data['maxAmount'] = vm.maxAmount = parseFloat(data.maxLimit);
|
vm.thirdParty.data['maxAmount'] = vm.maxAmount = parseFloat(data.maxLimit);
|
||||||
});
|
});
|
||||||
|
|
||||||
// if (vm.thirdParty.data['shapeshiftOrderId'] && data.stateParams.shapeshiftOrderId.length > 0) {
|
|
||||||
// vm.shapeshiftOrderId = vm.thirdParty.data['shapeshiftOrderId'];
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// vm.shapeshiftOrderId = data.stateParams.thirdPartyOrderId;
|
|
||||||
|
|
||||||
vm.isRequestingSpecificAmount = !data.stateParams.fromWalletId;
|
vm.isRequestingSpecificAmount = !data.stateParams.fromWalletId;
|
||||||
|
|
||||||
|
|
@ -371,8 +365,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
||||||
vm.alternativeAmount = txFormatService.formatAmount(amountInSatoshis, true);
|
vm.alternativeAmount = txFormatService.formatAmount(amountInSatoshis, true);
|
||||||
vm.allowSend = lodash.isNumber(a)
|
vm.allowSend = lodash.isNumber(a)
|
||||||
&& a > 0
|
&& a > 0
|
||||||
&& (!vm.shapeshiftOrderId
|
&& (a >= vm.minAmount && a <= vm.maxAmount)
|
||||||
|| (a >= vm.minAmount && a <= vm.maxAmount))
|
|
||||||
&& !vm.fundsAreInsufficient;
|
&& !vm.fundsAreInsufficient;
|
||||||
} else {
|
} else {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
@ -392,8 +385,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
||||||
vm.alternativeAmount = $filter('formatFiatAmount')(toFiat(result));
|
vm.alternativeAmount = $filter('formatFiatAmount')(toFiat(result));
|
||||||
vm.allowSend = lodash.isNumber(result)
|
vm.allowSend = lodash.isNumber(result)
|
||||||
&& result > 0
|
&& result > 0
|
||||||
&& (!vm.shapeshiftOrderId
|
&& (result >= vm.minAmount && result <= vm.maxAmount)
|
||||||
|| (result >= vm.minAmount && result <= vm.maxAmount))
|
|
||||||
&& !vm.fundsAreInsufficient;
|
&& !vm.fundsAreInsufficient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -404,7 +396,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
||||||
if (vm.fundsAreInsufficient) {
|
if (vm.fundsAreInsufficient) {
|
||||||
vm.errorMessage = gettextCatalog.getString('Not enough available funds');
|
vm.errorMessage = gettextCatalog.getString('Not enough available funds');
|
||||||
|
|
||||||
} else if (amountInCrypto && vm.shapeshiftOrderId) {
|
} else if (amountInCrypto && vm.thirdParty && vm.thirdParty.id === 'shapeshift') {
|
||||||
if (amountInCrypto < vm.minAmount) {
|
if (amountInCrypto < vm.minAmount) {
|
||||||
vm.errorMessage = gettextCatalog.getString('Amount is below minimum');
|
vm.errorMessage = gettextCatalog.getString('Amount is below minimum');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.approve = function() {
|
vm.approve = function() {
|
||||||
if (vm.thirdParty.id === 'shapeshift') {
|
if (vm.thirdParty.id === 'shapeshift')
|
||||||
shapeshiftService.shiftIt();
|
|
||||||
return;
|
return;
|
||||||
if (!tx || !vm.originWallet) return;
|
if (!tx || !vm.originWallet) return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleThirdPartyIfShapeshift() {
|
function handleThirdPartyIfShapeshift() {
|
||||||
|
console.log($scope.thirdParty, $scope.coin);
|
||||||
if ($scope.thirdParty.id === 'shapeshift' && $scope.type === 'destination') { // Shapeshift wants to know the
|
if ($scope.thirdParty.id === 'shapeshift' && $scope.type === 'destination') { // Shapeshift wants to know the
|
||||||
$scope.coin = profileService.getWallet(fromWalletId).coin;
|
$scope.coin = profileService.getWallet(fromWalletId).coin;
|
||||||
if ($scope.coin === 'bch') {
|
if ($scope.coin === 'bch') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue