commit
ad4d5ea7ae
18 changed files with 1104 additions and 606 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService, glideraService) {
|
angular.module('copayApp.controllers').controller('amountController', function($scope, $filter, $timeout, $ionicScrollDelegate, $ionicHistory, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, profileService, bitcore, amazonService) {
|
||||||
var unitToSatoshi;
|
var unitToSatoshi;
|
||||||
var satToUnit;
|
var satToUnit;
|
||||||
var unitDecimals;
|
var unitDecimals;
|
||||||
|
|
@ -14,9 +14,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
// Glidera parameters
|
|
||||||
$scope.isGlidera = data.stateParams.isGlidera;
|
|
||||||
$scope.glideraAccessToken = data.stateParams.glideraAccessToken;
|
|
||||||
|
|
||||||
// Go to...
|
// Go to...
|
||||||
$scope.nextStep = data.stateParams.nextStep;
|
$scope.nextStep = data.stateParams.nextStep;
|
||||||
|
|
@ -30,26 +27,17 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
$scope.toAddress = data.stateParams.toAddress;
|
$scope.toAddress = data.stateParams.toAddress;
|
||||||
$scope.toName = data.stateParams.toName;
|
$scope.toName = data.stateParams.toName;
|
||||||
$scope.toEmail = data.stateParams.toEmail;
|
$scope.toEmail = data.stateParams.toEmail;
|
||||||
$scope.showAlternativeAmount = !!$scope.cardId || !!$scope.isGlidera || !!$scope.nextStep;
|
$scope.showAlternativeAmount = !!$scope.cardId || !!$scope.nextStep;
|
||||||
$scope.toColor = data.stateParams.toColor;
|
$scope.toColor = data.stateParams.toColor;
|
||||||
$scope.showSendMax = false;
|
$scope.showSendMax = false;
|
||||||
|
|
||||||
$scope.customAmount = data.stateParams.customAmount;
|
$scope.customAmount = data.stateParams.customAmount;
|
||||||
|
|
||||||
if (!$scope.cardId && !$scope.isGlidera && !$scope.nextStep && !data.stateParams.toAddress) {
|
if (!$scope.cardId && !$scope.nextStep && !data.stateParams.toAddress) {
|
||||||
$log.error('Bad params at amount')
|
$log.error('Bad params at amount')
|
||||||
throw ('bad params');
|
throw ('bad params');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($scope.isGlidera) {
|
|
||||||
glideraService.getLimits($scope.glideraAccessToken, function(err, limits) {
|
|
||||||
$scope.limits = limits;
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.$apply();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var reNr = /^[1234567890\.]$/;
|
var reNr = /^[1234567890\.]$/;
|
||||||
var reOp = /^[\*\+\-\/]$/;
|
var reOp = /^[\*\+\-\/]$/;
|
||||||
|
|
||||||
|
|
@ -293,13 +281,6 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
} else if ($scope.isGlidera) {
|
|
||||||
var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount;
|
|
||||||
$state.transitionTo('tabs.buyandsell.glidera.confirm', {
|
|
||||||
toAmount: (amount * unitToSatoshi).toFixed(0),
|
|
||||||
isGlidera: $scope.isGlidera,
|
|
||||||
glideraAccessToken: $scope.glideraAccessToken
|
|
||||||
});
|
|
||||||
} else if ($scope.nextStep) {
|
} else if ($scope.nextStep) {
|
||||||
$state.transitionTo($scope.nextStep, {
|
$state.transitionTo($scope.nextStep, {
|
||||||
amount: _amount,
|
amount: _amount,
|
||||||
|
|
|
||||||
165
src/js/controllers/buyGlidera.js
Normal file
165
src/js/controllers/buyGlidera.js
Normal file
|
|
@ -0,0 +1,165 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('buyGlideraController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, glideraService, popupService, profileService, ongoingProcess, walletService, platformInfo) {
|
||||||
|
|
||||||
|
var amount;
|
||||||
|
var currency;
|
||||||
|
|
||||||
|
$scope.isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
|
var showErrorAndBack = function(err) {
|
||||||
|
$scope.sendStatus = '';
|
||||||
|
$log.error(err);
|
||||||
|
err = err.errors ? err.errors[0].message : err || '';
|
||||||
|
popupService.showAlert('Error', err, function() {
|
||||||
|
$ionicHistory.goBack();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var showError = function(err) {
|
||||||
|
$scope.sendStatus = '';
|
||||||
|
$log.error(err);
|
||||||
|
err = err.errors ? err.errors[0].message : err;
|
||||||
|
popupService.showAlert('Error', err);
|
||||||
|
};
|
||||||
|
|
||||||
|
var statusChangeHandler = function (processName, showName, isOn) {
|
||||||
|
$log.debug('statusChangeHandler: ', processName, showName, isOn);
|
||||||
|
if ( processName == 'buyingBitcoin' && !isOn) {
|
||||||
|
$scope.sendStatus = 'success';
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
}, 100);
|
||||||
|
} else if (showName) {
|
||||||
|
$scope.sendStatus = showName;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
|
$scope.isFiat = data.stateParams.currency ? true : false;
|
||||||
|
var parsedAmount = glideraService.parseAmount(
|
||||||
|
data.stateParams.amount,
|
||||||
|
data.stateParams.currency);
|
||||||
|
|
||||||
|
amount = parsedAmount.amount;
|
||||||
|
currency = parsedAmount.currency;
|
||||||
|
$scope.amountUnitStr = parsedAmount.amountUnitStr;
|
||||||
|
|
||||||
|
$scope.network = glideraService.getNetwork();
|
||||||
|
$scope.wallets = profileService.getWallets({
|
||||||
|
onlyComplete: true,
|
||||||
|
network: $scope.network
|
||||||
|
});
|
||||||
|
$scope.wallet = $scope.wallets[0]; // Default first wallet
|
||||||
|
|
||||||
|
ongoingProcess.set('connectingGlidera', true);
|
||||||
|
glideraService.init(function(err, data) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('connectingGlidera', false);
|
||||||
|
showErrorAndBack(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.token = data.token;
|
||||||
|
var price = {};
|
||||||
|
if ($scope.isFiat) {
|
||||||
|
price['fiat'] = amount;
|
||||||
|
} else {
|
||||||
|
price['qty'] = amount;
|
||||||
|
}
|
||||||
|
glideraService.buyPrice($scope.token, price, function(err, buy) {
|
||||||
|
ongoingProcess.set('connectingGlidera', false);
|
||||||
|
if (err) {
|
||||||
|
showErrorAndBack(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.buyInfo = buy;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var ask2FaCode = function(mode, cb) {
|
||||||
|
if (mode != 'NONE') {
|
||||||
|
// SHOW PROMPT
|
||||||
|
var title = 'Please, enter the code below';
|
||||||
|
var message;
|
||||||
|
if (mode == 'PIN') {
|
||||||
|
message = 'You have enabled PIN based two-factor authentication.';
|
||||||
|
} else if (mode == 'AUTHENTICATOR') {
|
||||||
|
message = 'Use an authenticator app (Authy or Google Authenticator).';
|
||||||
|
} else {
|
||||||
|
message = 'A SMS containing a confirmation code was sent to your phone.';
|
||||||
|
}
|
||||||
|
popupService.showPrompt(title, message, null, function(twoFaCode) {
|
||||||
|
if (typeof twoFaCode == 'undefined') return cb();
|
||||||
|
return cb(twoFaCode);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return cb();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.buyConfirm = function() {
|
||||||
|
var message = 'Buy bitcoin for ' + amount + ' ' + currency;
|
||||||
|
var okText = 'Confirm';
|
||||||
|
var cancelText = 'Cancel';
|
||||||
|
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
|
||||||
|
if (!ok) return;
|
||||||
|
ongoingProcess.set('buyingBitcoin', true, statusChangeHandler);
|
||||||
|
glideraService.get2faCode($scope.token, function(err, tfa) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('buyingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ask2FaCode(tfa.mode, function(twoFaCode) {
|
||||||
|
if (tfa.mode != 'NONE' && lodash.isEmpty(twoFaCode)) {
|
||||||
|
ongoingProcess.set('buyingBitcoin', false, statusChangeHandler);
|
||||||
|
showError('No code entered');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
walletService.getAddress($scope.wallet, false, function(err, walletAddr) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('buyingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var data = {
|
||||||
|
destinationAddress: walletAddr,
|
||||||
|
qty: $scope.buyInfo.qty,
|
||||||
|
priceUuid: $scope.buyInfo.priceUuid,
|
||||||
|
useCurrentPrice: false,
|
||||||
|
ip: null
|
||||||
|
};
|
||||||
|
glideraService.buy($scope.token, twoFaCode, data, function(err, data) {
|
||||||
|
ongoingProcess.set('buyingBitcoin', false, statusChangeHandler);
|
||||||
|
if (err) return showError(err);
|
||||||
|
$log.info(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.showWalletSelector = function() {
|
||||||
|
$scope.walletSelectorTitle = 'Receive in';
|
||||||
|
$scope.showWallets = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.onWalletSelect = function(wallet) {
|
||||||
|
$scope.wallet = wallet;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.goBackHome = function() {
|
||||||
|
$scope.sendStatus = '';
|
||||||
|
$ionicHistory.nextViewOptions({
|
||||||
|
disableAnimate: true,
|
||||||
|
historyRoot: true
|
||||||
|
});
|
||||||
|
$ionicHistory.clearHistory();
|
||||||
|
$state.go('tabs.home').then(function() {
|
||||||
|
$state.transitionTo('tabs.buyandsell.glidera');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, glideraService, bwcError, bitpayCardService) {
|
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, bwcError, bitpayCardService) {
|
||||||
var cachedTxp = {};
|
var cachedTxp = {};
|
||||||
var toAmount;
|
var toAmount;
|
||||||
var isChromeApp = platformInfo.isChromeApp;
|
var isChromeApp = platformInfo.isChromeApp;
|
||||||
|
|
@ -11,10 +11,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
|
|
||||||
// Glidera parameters
|
|
||||||
$scope.isGlidera = data.stateParams.isGlidera;
|
|
||||||
$scope.glideraAccessToken = data.stateParams.glideraAccessToken;
|
|
||||||
|
|
||||||
toAmount = data.stateParams.toAmount;
|
toAmount = data.stateParams.toAmount;
|
||||||
cachedSendMax = {};
|
cachedSendMax = {};
|
||||||
$scope.useSendMax = data.stateParams.useSendMax == 'true' ? true : false;
|
$scope.useSendMax = data.stateParams.useSendMax == 'true' ? true : false;
|
||||||
|
|
@ -39,8 +35,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
var config = configService.getSync().wallet;
|
var config = configService.getSync().wallet;
|
||||||
var feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
|
var feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
|
||||||
$scope.feeLevel = feeService.feeOpts[feeLevel];
|
$scope.feeLevel = feeService.feeOpts[feeLevel];
|
||||||
if ($scope.isGlidera) $scope.network = glideraService.getEnvironment();
|
$scope.network = (new bitcore.Address($scope.toAddress)).network.name;
|
||||||
else $scope.network = (new bitcore.Address($scope.toAddress)).network.name;
|
|
||||||
resetValues();
|
resetValues();
|
||||||
setwallets();
|
setwallets();
|
||||||
applyButtonText();
|
applyButtonText();
|
||||||
|
|
@ -49,7 +44,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
function applyButtonText(multisig) {
|
function applyButtonText(multisig) {
|
||||||
$scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' ';
|
$scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' ';
|
||||||
|
|
||||||
if ($scope.isGlidera || $scope.cardId) {
|
if ($scope.cardId) {
|
||||||
$scope.buttonText += gettextCatalog.getString('to complete');
|
$scope.buttonText += gettextCatalog.getString('to complete');
|
||||||
} else if ($scope.paypro) {
|
} else if ($scope.paypro) {
|
||||||
$scope.buttonText += gettextCatalog.getString('to pay');
|
$scope.buttonText += gettextCatalog.getString('to pay');
|
||||||
|
|
@ -75,11 +70,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($scope.isGlidera == 'buy') {
|
|
||||||
initConfirm();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filteredWallets = [];
|
var filteredWallets = [];
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var enoughFunds = false;
|
var enoughFunds = false;
|
||||||
|
|
@ -161,8 +151,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
$scope.alternativeAmountStr = v;
|
$scope.alternativeAmountStr = v;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ($scope.isGlidera == 'buy') $scope.getBuyPrice();
|
|
||||||
if ($scope.isGlidera == 'sell') $scope.getSellPrice();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function resetValues() {
|
function resetValues() {
|
||||||
|
|
@ -271,7 +259,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.showWalletSelector = function() {
|
$scope.showWalletSelector = function() {
|
||||||
$scope.walletSelectorTitle = $scope.isGlidera == 'buy' ? 'Receive in' : $scope.isGlidera == 'sell' ? 'Sell From' : gettextCatalog.getString('Send from');
|
$scope.walletSelectorTitle = gettextCatalog.getString('Send from');
|
||||||
if (!$scope.useSendMax && ($scope.insufficientFunds || $scope.noMatchingWallet)) return;
|
if (!$scope.useSendMax && ($scope.insufficientFunds || $scope.noMatchingWallet)) return;
|
||||||
$scope.showWallets = true;
|
$scope.showWallets = true;
|
||||||
};
|
};
|
||||||
|
|
@ -350,7 +338,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
$scope.wallet = wallet;
|
$scope.wallet = wallet;
|
||||||
$scope.fee = $scope.txp = null;
|
$scope.fee = $scope.txp = null;
|
||||||
|
|
||||||
if ($scope.isGlidera) return;
|
|
||||||
if (stop) {
|
if (stop) {
|
||||||
$timeout.cancel(stop);
|
$timeout.cancel(stop);
|
||||||
stop = null;
|
stop = null;
|
||||||
|
|
@ -476,47 +463,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($scope.isGlidera) {
|
|
||||||
$scope.get2faCode(function(err, sent) {
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send confirmation code to your phone'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (sent) {
|
|
||||||
var title = gettextCatalog.getString("Please, enter the code below");
|
|
||||||
var message = gettextCatalog.getString("A SMS containing a confirmation code was sent to your phone.");
|
|
||||||
popupService.showPrompt(title, message, null, function(twoFaCode) {
|
|
||||||
if (typeof twoFaCode == 'undefined') return;
|
|
||||||
if ($scope.isGlidera == 'buy') {
|
|
||||||
$scope.buyRequest(wallet, twoFaCode, function(err, data) {
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.sendStatus = 'success';
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.$digest();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if ($scope.isGlidera == 'sell') {
|
|
||||||
$scope.sellRequest(wallet, twoFaCode, function(err, data) {
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.sendStatus = 'success';
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.$digest();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ongoingProcess.set('creatingTx', true, onSendStatusChange);
|
ongoingProcess.set('creatingTx', true, onSendStatusChange);
|
||||||
createTx(wallet, false, function(err, txp) {
|
createTx(wallet, false, function(err, txp) {
|
||||||
ongoingProcess.set('creatingTx', false, onSendStatusChange);
|
ongoingProcess.set('creatingTx', false, onSendStatusChange);
|
||||||
|
|
@ -587,7 +533,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
$scope.onSuccessConfirm = function() {
|
$scope.onSuccessConfirm = function() {
|
||||||
var previousView = $ionicHistory.viewHistory().backView && $ionicHistory.viewHistory().backView.stateName;
|
var previousView = $ionicHistory.viewHistory().backView && $ionicHistory.viewHistory().backView.stateName;
|
||||||
var fromBitPayCard = previousView.match(/tabs.bitpayCard/) ? true : false;
|
var fromBitPayCard = previousView.match(/tabs.bitpayCard/) ? true : false;
|
||||||
var fromGlidera = previousView.match(/tabs.buyandsell.glidera/) ? true : false;
|
|
||||||
|
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
disableAnimate: true
|
disableAnimate: true
|
||||||
|
|
@ -601,15 +546,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
id: $stateParams.cardId
|
id: $stateParams.cardId
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
} else if (fromGlidera) {
|
|
||||||
$ionicHistory.nextViewOptions({
|
|
||||||
disableAnimate: true,
|
|
||||||
historyRoot: true
|
|
||||||
});
|
|
||||||
$ionicHistory.clearHistory();
|
|
||||||
$state.go('tabs.home').then(function() {
|
|
||||||
$state.transitionTo('tabs.buyandsell.glidera');
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
disableAnimate: true,
|
disableAnimate: true,
|
||||||
|
|
@ -622,162 +558,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.get2faCode = function(cb) {
|
|
||||||
ongoingProcess.set('sending2faCode', true);
|
|
||||||
$timeout(function() {
|
|
||||||
glideraService.get2faCode($scope.glideraAccessToken, function(err, sent) {
|
|
||||||
ongoingProcess.set('sending2faCode', false);
|
|
||||||
return cb(err, sent);
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.buyRequest = function(wallet, twoFaCode, cb) {
|
|
||||||
ongoingProcess.set('buyingBitcoin', true);
|
|
||||||
$timeout(function() {
|
|
||||||
walletService.getAddress(wallet, false, function(err, walletAddr) {
|
|
||||||
if (err) {
|
|
||||||
ongoingProcess.set('buyingBitcoin', false);
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.cb(err, 'Could not create address'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var data = {
|
|
||||||
destinationAddress: walletAddr,
|
|
||||||
qty: $scope.buyPrice.qty,
|
|
||||||
priceUuid: $scope.buyPrice.priceUuid,
|
|
||||||
useCurrentPrice: false,
|
|
||||||
ip: null
|
|
||||||
};
|
|
||||||
glideraService.buy($scope.glideraAccessToken, twoFaCode, data, function(err, data) {
|
|
||||||
ongoingProcess.set('buyingBitcoin', false);
|
|
||||||
return cb(err, data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.sellRequest = function(wallet, twoFaCode, cb) {
|
|
||||||
var outputs = [];
|
|
||||||
var config = configService.getSync();
|
|
||||||
var configWallet = config.wallet;
|
|
||||||
var walletSettings = configWallet.settings;
|
|
||||||
|
|
||||||
ongoingProcess.set('creatingTx', true);
|
|
||||||
walletService.getAddress(wallet, null, function(err, refundAddress) {
|
|
||||||
if (!refundAddress) {
|
|
||||||
ongoingProcess.clear();
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, 'Could not create address'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
glideraService.getSellAddress($scope.glideraAccessToken, function(err, sellAddress) {
|
|
||||||
if (!sellAddress || err) {
|
|
||||||
ongoingProcess.clear();
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get the destination bitcoin address'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var amount = parseInt(($scope.sellPrice.qty * 100000000).toFixed(0));
|
|
||||||
var comment = 'Glidera transaction';
|
|
||||||
|
|
||||||
outputs.push({
|
|
||||||
'toAddress': sellAddress,
|
|
||||||
'amount': amount,
|
|
||||||
'message': comment
|
|
||||||
});
|
|
||||||
|
|
||||||
var txp = {
|
|
||||||
toAddress: sellAddress,
|
|
||||||
amount: amount,
|
|
||||||
outputs: outputs,
|
|
||||||
message: comment,
|
|
||||||
payProUrl: null,
|
|
||||||
excludeUnconfirmedUtxos: configWallet.spendUnconfirmed ? false : true,
|
|
||||||
feeLevel: walletSettings.feeLevel || 'normal',
|
|
||||||
customData: {
|
|
||||||
'glideraToken': $scope.glideraAccessToken
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
walletService.createTx(wallet, txp, function(err, createdTxp) {
|
|
||||||
ongoingProcess.clear();
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
walletService.prepare(wallet, function(err, password) {
|
|
||||||
if (err) {
|
|
||||||
ongoingProcess.clear();
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ongoingProcess.set('signingTx', true);
|
|
||||||
walletService.publishTx(wallet, createdTxp, function(err, publishedTxp) {
|
|
||||||
if (err) {
|
|
||||||
ongoingProcess.clear();
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
walletService.signTx(wallet, publishedTxp, password, function(err, signedTxp) {
|
|
||||||
if (err) {
|
|
||||||
ongoingProcess.clear();
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
|
|
||||||
walletService.removeTx(wallet, signedTxp, function(err) {
|
|
||||||
if (err) $log.debug(err);
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var rawTx = signedTxp.raw;
|
|
||||||
var data = {
|
|
||||||
refundAddress: refundAddress,
|
|
||||||
signedTransaction: rawTx,
|
|
||||||
priceUuid: $scope.sellPrice.priceUuid,
|
|
||||||
useCurrentPrice: $scope.sellPrice.priceUuid ? false : true,
|
|
||||||
ip: null
|
|
||||||
};
|
|
||||||
ongoingProcess.set('sellingBitcoin', true);
|
|
||||||
glideraService.sell($scope.glideraAccessToken, twoFaCode, data, function(err, data) {
|
|
||||||
ongoingProcess.clear();
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
return cb(err, data)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.getBuyPrice = function() {
|
|
||||||
var satToBtc = 1 / 100000000;
|
|
||||||
var price = {};
|
|
||||||
price.qty = (toAmount * satToBtc).toFixed(8);
|
|
||||||
glideraService.buyPrice($scope.glideraAccessToken, price, function(err, buyPrice) {
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), 'Could not get exchange information. Please, try again');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.buyPrice = buyPrice;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.getSellPrice = function() {
|
|
||||||
var satToBtc = 1 / 100000000;
|
|
||||||
var price = {};
|
|
||||||
price.qty = (toAmount * satToBtc).toFixed(8);
|
|
||||||
|
|
||||||
glideraService.sellPrice($scope.glideraAccessToken, price, function(err, sellPrice) {
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), 'Could not get exchange information. Please, try again');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.sellPrice = sellPrice;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function publishAndSign(wallet, txp, onSendStatusChange) {
|
function publishAndSign(wallet, txp, onSendStatusChange) {
|
||||||
|
|
||||||
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
|
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
|
||||||
|
|
|
||||||
|
|
@ -1,72 +1,30 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('glideraController',
|
angular.module('copayApp.controllers').controller('glideraController',
|
||||||
function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, externalLinkService, popupService, gettextCatalog) {
|
function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, externalLinkService, popupService, lodash) {
|
||||||
|
|
||||||
$scope.network = glideraService.getEnvironment();
|
|
||||||
|
|
||||||
$scope.openExternalLink = function(url) {
|
$scope.openExternalLink = function(url) {
|
||||||
externalLinkService.open(url);
|
externalLinkService.open(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
var initGlidera = function(accessToken) {
|
var init = function() {
|
||||||
$scope.token = accessToken;
|
glideraService.init(function(err, data) {
|
||||||
$scope.permissions = null;
|
if (err || lodash.isEmpty(data)) return;
|
||||||
$scope.email = null;
|
|
||||||
$scope.personalInfo = null;
|
|
||||||
$scope.txs = null;
|
|
||||||
$scope.status = null;
|
|
||||||
$scope.limits = null;
|
|
||||||
|
|
||||||
$scope.connectingGlidera = true;
|
$scope.account['token'] = data.token;
|
||||||
ongoingProcess.set('connectingGlidera', true);
|
$scope.account['status'] = data.status;
|
||||||
glideraService.init($scope.token, function(err, glidera) {
|
$scope.account['txs'] = data.txs;
|
||||||
ongoingProcess.set('connectingGlidera');
|
|
||||||
$scope.connectingGlidera = false;
|
$timeout(function() {
|
||||||
if (err || !glidera) {
|
$scope.$digest();
|
||||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
$scope.update();
|
||||||
return;
|
|
||||||
}
|
|
||||||
$scope.token = glidera.token;
|
|
||||||
$scope.permissions = glidera.permissions;
|
|
||||||
$scope.update({
|
|
||||||
fullUpdate: true
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.update = function(opts) {
|
$scope.update = function(opts) {
|
||||||
if (!$scope.token || !$scope.permissions) return;
|
$log.debug('Updating Glidera...');
|
||||||
$log.debug('Updating Glidera Account...');
|
glideraService.updateStatus($scope.account);
|
||||||
var accessToken = $scope.token;
|
|
||||||
var permissions = $scope.permissions;
|
|
||||||
|
|
||||||
opts = opts || {};
|
|
||||||
|
|
||||||
glideraService.getStatus(accessToken, function(err, data) {
|
|
||||||
$scope.status = data;
|
|
||||||
});
|
|
||||||
|
|
||||||
glideraService.getLimits(accessToken, function(err, limits) {
|
|
||||||
$scope.limits = limits;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (permissions.transaction_history) {
|
|
||||||
glideraService.getTransactions(accessToken, function(err, data) {
|
|
||||||
$scope.txs = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permissions.view_email_address && opts.fullUpdate) {
|
|
||||||
glideraService.getEmail(accessToken, function(err, data) {
|
|
||||||
$scope.email = data.email;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (permissions.personal_info && opts.fullUpdate) {
|
|
||||||
glideraService.getPersonalInfo(accessToken, function(err, data) {
|
|
||||||
$scope.personalInfo = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.getAuthenticateUrl = function() {
|
$scope.getAuthenticateUrl = function() {
|
||||||
|
|
@ -75,29 +33,24 @@ angular.module('copayApp.controllers').controller('glideraController',
|
||||||
|
|
||||||
$scope.submitOauthCode = function(code) {
|
$scope.submitOauthCode = function(code) {
|
||||||
ongoingProcess.set('connectingGlidera', true);
|
ongoingProcess.set('connectingGlidera', true);
|
||||||
$timeout(function() {
|
glideraService.authorize(code, function(err, data) {
|
||||||
glideraService.getToken(code, function(err, data) {
|
ongoingProcess.set('connectingGlidera', false);
|
||||||
ongoingProcess.set('connectingGlidera', false);
|
if (err) {
|
||||||
if (err) {
|
popupService.showAlert('Authorisation error', err);
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
return;
|
||||||
} else if (data && data.access_token) {
|
}
|
||||||
storageService.setGlideraToken($scope.network, data.access_token, function() {
|
$scope.account['token'] = data.token;
|
||||||
initGlidera(data.access_token);
|
$scope.account['status'] = data.status;
|
||||||
$timeout(function() {
|
init();
|
||||||
$scope.$apply();
|
});
|
||||||
}, 100);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.openTxModal = function(token, tx) {
|
$scope.openTxModal = function(tx) {
|
||||||
$scope.tx = tx;
|
$scope.tx = tx;
|
||||||
|
|
||||||
glideraService.getTransaction(token, tx.transactionUuid, function(err, tx) {
|
glideraService.getTransaction($scope.account.token, tx.transactionUuid, function(err, tx) {
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get transactions'));
|
popupService.showAlert('Error getting transaction', 'Could not get transactions');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.tx = tx;
|
$scope.tx = tx;
|
||||||
|
|
@ -127,28 +80,27 @@ angular.module('copayApp.controllers').controller('glideraController',
|
||||||
$scope.openSupportWindow = function() {
|
$scope.openSupportWindow = function() {
|
||||||
var url = glideraService.getSupportUrl();
|
var url = glideraService.getSupportUrl();
|
||||||
var optIn = true;
|
var optIn = true;
|
||||||
var title = gettextCatalog.getString('Glidera Support');
|
var title = 'Glidera Support';
|
||||||
var message = gettextCatalog.getString('You can email glidera at support@glidera.io for direct support, or you can contact Glidera on Twitter.');
|
var message = 'You can email glidera at support@glidera.io for direct support, or you can contact Glidera on Twitter.';
|
||||||
var okText = gettextCatalog.getString('Tweet @GlideraInc');
|
var okText = 'Tweet @GlideraInc';
|
||||||
var cancelText = gettextCatalog.getString('Go Back');
|
var cancelText = 'Go Back';
|
||||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.retry = function() {
|
|
||||||
$scope.connectingGlidera = true;
|
|
||||||
$scope.update({'fullUpdate': true});
|
|
||||||
$timeout(function(){
|
|
||||||
$scope.connectingGlidera = false;
|
|
||||||
}, 300);
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.toggleOauthForm = function() {
|
$scope.toggleOauthForm = function() {
|
||||||
$scope.showOauthForm = !$scope.showOauthForm;
|
$scope.showOauthForm = !$scope.showOauthForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
|
$scope.network = glideraService.getNetwork();
|
||||||
|
$scope.currency = glideraService.getCurrency();
|
||||||
$scope.showOauthForm = false;
|
$scope.showOauthForm = false;
|
||||||
initGlidera();
|
$scope.account = {};
|
||||||
|
if (data.stateParams && data.stateParams.code) {
|
||||||
|
$scope.submitOauthCode(data.stateParams.code);
|
||||||
|
} else {
|
||||||
|
init();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
'use strict';
|
|
||||||
angular.module('copayApp.controllers').controller('glideraUriController',
|
|
||||||
function($scope, $log, $stateParams, $timeout, glideraService, storageService, $state, ongoingProcess, popupService, gettextCatalog) {
|
|
||||||
|
|
||||||
var submitOauthCode = function(code) {
|
|
||||||
$log.debug('Glidera Oauth Code:' + code);
|
|
||||||
$scope.network = glideraService.getEnvironment();
|
|
||||||
ongoingProcess.set('connectingGlidera', true);
|
|
||||||
$timeout(function() {
|
|
||||||
glideraService.getToken(code, function(err, data) {
|
|
||||||
ongoingProcess.set('connectingGlidera', false);
|
|
||||||
if (err) {
|
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
|
||||||
} else if (data && data.access_token) {
|
|
||||||
storageService.setGlideraToken($scope.network, data.access_token, function() {
|
|
||||||
$timeout(function() {
|
|
||||||
$state.go('tabs.buyandsell.glidera');
|
|
||||||
$scope.$apply();
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.$on("$ionicView.enter", function(event, data){
|
|
||||||
if ($stateParams.url) {
|
|
||||||
var match = $stateParams.url.match(/code=(.+)/);
|
|
||||||
if (match && match[1]) {
|
|
||||||
submitOauthCode(match[1]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$log.error('Bad state: ' + JSON.stringify($stateParams));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
@ -1,46 +1,12 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesGlideraController',
|
angular.module('copayApp.controllers').controller('preferencesGlideraController',
|
||||||
function($scope, $log, $timeout, $state, $ionicHistory, ongoingProcess, glideraService, popupService, gettextCatalog) {
|
function($scope, $timeout, $state, $ionicHistory, glideraService, popupService) {
|
||||||
|
|
||||||
$scope.update = function(opts) {
|
|
||||||
if (!$scope.token || !$scope.permissions) return;
|
|
||||||
$log.debug('Updating Glidera Account...');
|
|
||||||
var accessToken = $scope.token;
|
|
||||||
var permissions = $scope.permissions;
|
|
||||||
|
|
||||||
opts = opts || {};
|
|
||||||
|
|
||||||
glideraService.getStatus(accessToken, function(err, data) {
|
|
||||||
$scope.status = data;
|
|
||||||
});
|
|
||||||
|
|
||||||
glideraService.getLimits(accessToken, function(err, limits) {
|
|
||||||
$scope.limits = limits;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (permissions.transaction_history) {
|
|
||||||
glideraService.getTransactions(accessToken, function(err, data) {
|
|
||||||
$scope.txs = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (permissions.view_email_address && opts.fullUpdate) {
|
|
||||||
glideraService.getEmail(accessToken, function(err, data) {
|
|
||||||
$scope.email = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (permissions.personal_info && opts.fullUpdate) {
|
|
||||||
glideraService.getPersonalInfo(accessToken, function(err, data) {
|
|
||||||
$scope.personalInfo = data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.revokeToken = function() {
|
$scope.revokeToken = function() {
|
||||||
popupService.showConfirm('Glidera', 'Are you sure you would like to log out of your Glidera account?', null, null, function(res) {
|
popupService.showConfirm('Glidera', 'Are you sure you would like to log out of your Glidera account?', null, null, function(res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
glideraService.removeToken(function() {
|
glideraService.remove(function() {
|
||||||
$ionicHistory.clearHistory();
|
$ionicHistory.clearHistory();
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$state.go('tabs.home');
|
$state.go('tabs.home');
|
||||||
|
|
@ -50,21 +16,20 @@ angular.module('copayApp.controllers').controller('preferencesGlideraController'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.$on("$ionicView.enter", function(event, data){
|
$scope.$on("$ionicView.afterEnter", function(event, data){
|
||||||
$scope.network = glideraService.getEnvironment();
|
glideraService.updateStatus($scope.account);
|
||||||
|
});
|
||||||
|
|
||||||
ongoingProcess.set('connectingGlidera', true);
|
$scope.$on("$ionicView.beforeEnter", function(event, data){
|
||||||
glideraService.init($scope.token, function(err, glidera) {
|
$scope.account = {};
|
||||||
ongoingProcess.set('connectingGlidera');
|
glideraService.init(function(err, glidera) {
|
||||||
if (err || !glidera) {
|
if (err || !glidera) {
|
||||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
if (err) popupService.showAlert('Error connecting Glidera', err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$scope.token = glidera.token;
|
$scope.account['token'] = glidera.token;
|
||||||
$scope.permissions = glidera.permissions;
|
$scope.account['permissions'] = glidera.permissions;
|
||||||
$scope.update({
|
$scope.account['status'] = glidera.status;
|
||||||
fullUpdate: true
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
233
src/js/controllers/sellGlidera.js
Normal file
233
src/js/controllers/sellGlidera.js
Normal file
|
|
@ -0,0 +1,233 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('sellGlideraController', function($scope, $log, $state, $timeout, $ionicHistory, lodash, glideraService, popupService, profileService, ongoingProcess, walletService, configService, platformInfo) {
|
||||||
|
|
||||||
|
var amount;
|
||||||
|
var currency;
|
||||||
|
|
||||||
|
$scope.isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
|
var showErrorAndBack = function(err) {
|
||||||
|
$scope.sendStatus = '';
|
||||||
|
$log.error(err);
|
||||||
|
err = err.errors ? err.errors[0].message : err;
|
||||||
|
popupService.showAlert('Error', err, function() {
|
||||||
|
$ionicHistory.goBack();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var showError = function(err) {
|
||||||
|
$scope.sendStatus = '';
|
||||||
|
$log.error(err);
|
||||||
|
err = err.errors ? err.errors[0].message : err;
|
||||||
|
popupService.showAlert('Error', err);
|
||||||
|
};
|
||||||
|
|
||||||
|
var statusChangeHandler = function (processName, showName, isOn) {
|
||||||
|
$log.debug('statusChangeHandler: ', processName, showName, isOn);
|
||||||
|
if ( processName == 'sellingBitcoin' && !isOn) {
|
||||||
|
$scope.sendStatus = 'success';
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$digest();
|
||||||
|
}, 100);
|
||||||
|
} else if (showName) {
|
||||||
|
$scope.sendStatus = showName;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
|
$scope.isFiat = data.stateParams.currency ? true : false;
|
||||||
|
var parsedAmount = glideraService.parseAmount(
|
||||||
|
data.stateParams.amount,
|
||||||
|
data.stateParams.currency);
|
||||||
|
|
||||||
|
amount = parsedAmount.amount;
|
||||||
|
currency = parsedAmount.currency;
|
||||||
|
$scope.amountUnitStr = parsedAmount.amountUnitStr;
|
||||||
|
|
||||||
|
$scope.network = glideraService.getNetwork();
|
||||||
|
$scope.wallets = profileService.getWallets({
|
||||||
|
m: 1, // Only 1-signature wallet
|
||||||
|
onlyComplete: true,
|
||||||
|
network: $scope.network
|
||||||
|
});
|
||||||
|
$scope.wallet = $scope.wallets[0]; // Default first wallet
|
||||||
|
|
||||||
|
ongoingProcess.set('connectingGlidera', true);
|
||||||
|
glideraService.init(function(err, data) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('connectingGlidera', false);
|
||||||
|
showErrorAndBack(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.token = data.token;
|
||||||
|
var price = {};
|
||||||
|
if ($scope.isFiat) {
|
||||||
|
price['fiat'] = amount;
|
||||||
|
} else {
|
||||||
|
price['qty'] = amount;
|
||||||
|
}
|
||||||
|
glideraService.sellPrice($scope.token, price, function(err, sell) {
|
||||||
|
ongoingProcess.set('connectingGlidera', false);
|
||||||
|
if (err) {
|
||||||
|
showErrorAndBack(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.sellInfo = sell;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
var ask2FaCode = function(mode, cb) {
|
||||||
|
if (mode != 'NONE') {
|
||||||
|
// SHOW PROMPT
|
||||||
|
var title = 'Please, enter the code below';
|
||||||
|
var message;
|
||||||
|
if (mode == 'PIN') {
|
||||||
|
message = 'You have enabled PIN based two-factor authentication.';
|
||||||
|
} else if (mode == 'AUTHENTICATOR') {
|
||||||
|
message = 'Use an authenticator app (Authy or Google Authenticator).';
|
||||||
|
} else {
|
||||||
|
message = 'A SMS containing a confirmation code was sent to your phone.';
|
||||||
|
}
|
||||||
|
popupService.showPrompt(title, message, null, function(twoFaCode) {
|
||||||
|
if (typeof twoFaCode == 'undefined') return cb();
|
||||||
|
return cb(twoFaCode);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return cb();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.sellConfirm = function() {
|
||||||
|
var message = 'Sell bitcoin for ' + amount + ' ' + currency;
|
||||||
|
var okText = 'Confirm';
|
||||||
|
var cancelText = 'Cancel';
|
||||||
|
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
|
||||||
|
if (!ok) return;
|
||||||
|
ongoingProcess.set('sellingBitcoin', true, statusChangeHandler);
|
||||||
|
glideraService.get2faCode($scope.token, function(err, tfa) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ask2FaCode(tfa.mode, function(twoFaCode) {
|
||||||
|
if (tfa.mode != 'NONE' && lodash.isEmpty(twoFaCode)) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError('No code entered');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var outputs = [];
|
||||||
|
var config = configService.getSync();
|
||||||
|
var configWallet = config.wallet;
|
||||||
|
var walletSettings = configWallet.settings;
|
||||||
|
|
||||||
|
walletService.getAddress($scope.wallet, null, function(err, refundAddress) {
|
||||||
|
if (!refundAddress) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError('Could not create address');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
glideraService.getSellAddress($scope.token, function(err, sellAddress) {
|
||||||
|
if (!sellAddress || err) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var amount = parseInt(($scope.sellInfo.qty * 100000000).toFixed(0));
|
||||||
|
var comment = 'Glidera transaction';
|
||||||
|
|
||||||
|
outputs.push({
|
||||||
|
'toAddress': sellAddress,
|
||||||
|
'amount': amount,
|
||||||
|
'message': comment
|
||||||
|
});
|
||||||
|
|
||||||
|
var txp = {
|
||||||
|
toAddress: sellAddress,
|
||||||
|
amount: amount,
|
||||||
|
outputs: outputs,
|
||||||
|
message: comment,
|
||||||
|
payProUrl: null,
|
||||||
|
excludeUnconfirmedUtxos: configWallet.spendUnconfirmed ? false : true,
|
||||||
|
feeLevel: walletSettings.feeLevel || 'normal',
|
||||||
|
customData: {
|
||||||
|
'glideraToken': $scope.token
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
walletService.createTx($scope.wallet, txp, function(err, createdTxp) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
walletService.prepare($scope.wallet, function(err, password) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
walletService.publishTx($scope.wallet, createdTxp, function(err, publishedTxp) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
walletService.signTx($scope.wallet, publishedTxp, password, function(err, signedTxp) {
|
||||||
|
if (err) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
showError(err);
|
||||||
|
walletService.removeTx($scope.wallet, signedTxp, function(err) {
|
||||||
|
if (err) $log.debug(err);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var rawTx = signedTxp.raw;
|
||||||
|
var data = {
|
||||||
|
refundAddress: refundAddress,
|
||||||
|
signedTransaction: rawTx,
|
||||||
|
priceUuid: $scope.sellInfo.priceUuid,
|
||||||
|
useCurrentPrice: $scope.sellInfo.priceUuid ? false : true,
|
||||||
|
ip: null
|
||||||
|
};
|
||||||
|
glideraService.sell($scope.token, twoFaCode, data, function(err, data) {
|
||||||
|
ongoingProcess.set('sellingBitcoin', false, statusChangeHandler);
|
||||||
|
if (err) return showError(err);
|
||||||
|
$log.info(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.showWalletSelector = function() {
|
||||||
|
$scope.walletSelectorTitle = 'Sell From';
|
||||||
|
$scope.showWallets = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.onWalletSelect = function(wallet) {
|
||||||
|
$scope.wallet = wallet;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.goBackHome = function() {
|
||||||
|
$scope.sendStatus = '';
|
||||||
|
$ionicHistory.nextViewOptions({
|
||||||
|
disableAnimate: true,
|
||||||
|
historyRoot: true
|
||||||
|
});
|
||||||
|
$ionicHistory.clearHistory();
|
||||||
|
$state.go('tabs.home').then(function() {
|
||||||
|
$state.transitionTo('tabs.buyandsell.glidera');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|
@ -140,11 +140,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
url: '/uri-payment/:url',
|
url: '/uri-payment/:url',
|
||||||
templateUrl: 'views/paymentUri.html'
|
templateUrl: 'views/paymentUri.html'
|
||||||
})
|
})
|
||||||
.state('uriglidera', {
|
|
||||||
url: '/uri-glidera/:url',
|
|
||||||
controller: 'glideraUriController',
|
|
||||||
templateUrl: 'views/glideraUri.html'
|
|
||||||
})
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
@ -883,7 +878,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
.state('tabs.buyandsell.glidera', {
|
.state('tabs.buyandsell.glidera', {
|
||||||
url: '/glidera',
|
url: '/glidera/:code',
|
||||||
views: {
|
views: {
|
||||||
'tab-home@tabs': {
|
'tab-home@tabs': {
|
||||||
controller: 'glideraController',
|
controller: 'glideraController',
|
||||||
|
|
@ -893,7 +888,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('tabs.buyandsell.glidera.amount', {
|
.state('tabs.buyandsell.glidera.amount', {
|
||||||
url: '/amount/:isGlidera/:glideraAccessToken',
|
url: '/amount/:nextStep/:currency',
|
||||||
views: {
|
views: {
|
||||||
'tab-home@tabs': {
|
'tab-home@tabs': {
|
||||||
controller: 'amountController',
|
controller: 'amountController',
|
||||||
|
|
@ -901,12 +896,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('tabs.buyandsell.glidera.confirm', {
|
.state('tabs.buyandsell.glidera.buy', {
|
||||||
url: '/confirm/:toAmount/:isGlidera/:glideraAccessToken',
|
url: '/buy/:amount/:currency',
|
||||||
views: {
|
views: {
|
||||||
'tab-home@tabs': {
|
'tab-home@tabs': {
|
||||||
controller: 'confirmController',
|
controller: 'buyGlideraController',
|
||||||
templateUrl: 'views/confirm.html'
|
templateUrl: 'views/buyGlidera.html'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.state('tabs.buyandsell.glidera.sell', {
|
||||||
|
url: '/sell/:amount/:currency',
|
||||||
|
views: {
|
||||||
|
'tab-home@tabs': {
|
||||||
|
controller: 'sellGlideraController',
|
||||||
|
templateUrl: 'views/sellGlidera.html'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('glideraService', function($http, $log, $window, platformInfo, storageService, buyAndSellService) {
|
angular.module('copayApp.services').factory('glideraService', function($http, $log, $window, $filter, platformInfo, storageService, buyAndSellService, lodash, configService, txFormatService) {
|
||||||
var root = {};
|
var root = {};
|
||||||
var credentials = {};
|
var credentials = {};
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
|
@ -45,10 +45,38 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
root.getEnvironment = function() {
|
root.getNetwork = function() {
|
||||||
return credentials.NETWORK;
|
return credentials.NETWORK;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.getCurrency = function() {
|
||||||
|
return 'USD';
|
||||||
|
};
|
||||||
|
|
||||||
|
root.parseAmount = function(amount, currency) {
|
||||||
|
var config = configService.getSync().wallet.settings;
|
||||||
|
var satToBtc = 1 / 100000000;
|
||||||
|
var unitToSatoshi = config.unitToSatoshi;
|
||||||
|
var amountUnitStr;
|
||||||
|
|
||||||
|
// IF 'USD'
|
||||||
|
if (currency) {
|
||||||
|
amountUnitStr = $filter('formatFiatAmount')(amount) + ' ' + currency;
|
||||||
|
} else {
|
||||||
|
var amountSat = parseInt((amount * unitToSatoshi).toFixed(0));
|
||||||
|
amountUnitStr = txFormatService.formatAmountStr(amountSat);
|
||||||
|
// convert unit to BTC
|
||||||
|
amount = (amountSat * satToBtc).toFixed(8);
|
||||||
|
currency = 'BTC';
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
amount: amount,
|
||||||
|
currency: currency,
|
||||||
|
amountUnitStr: amountUnitStr
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
root.getSignupUrl = function() {
|
root.getSignupUrl = function() {
|
||||||
return credentials.HOST + '/register';
|
return credentials.HOST + '/register';
|
||||||
}
|
}
|
||||||
|
|
@ -61,10 +89,14 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return credentials.HOST + '/oauth2/auth?response_type=code&client_id=' + credentials.CLIENT_ID + '&redirect_uri=' + credentials.REDIRECT_URI;
|
return credentials.HOST + '/oauth2/auth?response_type=code&client_id=' + credentials.CLIENT_ID + '&redirect_uri=' + credentials.REDIRECT_URI;
|
||||||
};
|
};
|
||||||
|
|
||||||
root.removeToken = function(cb) {
|
root.remove = function(cb) {
|
||||||
storageService.removeGlideraToken(credentials.NETWORK, function() {
|
storageService.removeGlideraToken(credentials.NETWORK, function() {
|
||||||
buyAndSellService.updateLink('glidera', false);
|
storageService.removeGlideraPermissions(credentials.NETWORK, function() {
|
||||||
return cb();
|
storageService.removeGlideraStatus(credentials.NETWORK, function() {
|
||||||
|
buyAndSellService.updateLink('glidera', false);
|
||||||
|
return cb();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -87,15 +119,39 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
|
|
||||||
$http(req).then(function(data) {
|
$http(req).then(function(data) {
|
||||||
$log.info('Glidera Authorization Access Token: SUCCESS');
|
$log.info('Glidera Authorization Access Token: SUCCESS');
|
||||||
// Show pending task from the UI
|
|
||||||
storageService.setNextStep('BuyAndSell', 'true', function(err) {});
|
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Authorization Access Token: ERROR ' + data.statusText);
|
$log.error('Glidera Authorization Access Token: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Authorization Access Token: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.authorize = function(code, cb) {
|
||||||
|
root.getToken(code, function(err, data) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
if (data && !data.access_token) return cb('No access token');
|
||||||
|
var accessToken = data.access_token;
|
||||||
|
root.getAccessTokenPermissions(accessToken, function(err, p) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
root.getStatus(accessToken, function(err, status) {
|
||||||
|
if (err) $log.error(err);
|
||||||
|
storageService.setGlideraToken(credentials.NETWORK, accessToken, function() {
|
||||||
|
storageService.setGlideraPermissions(credentials.NETWORK, JSON.stringify(p), function() {
|
||||||
|
storageService.setGlideraStatus(credentials.NETWORK, JSON.stringify(status), function() {
|
||||||
|
return cb(null, {
|
||||||
|
token: accessToken,
|
||||||
|
permissions: p,
|
||||||
|
status: status
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var _get = function(endpoint, token) {
|
var _get = function(endpoint, token) {
|
||||||
return {
|
return {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|
@ -115,7 +171,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Access Token Permissions: ERROR ' + data.statusText);
|
$log.error('Glidera Access Token Permissions: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Access Token Permissions: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -126,7 +183,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Get Email: ERROR ' + data.statusText);
|
$log.error('Glidera Get Email: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Get Email: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -137,7 +195,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Get Personal Info: ERROR ' + data.statusText);
|
$log.error('Glidera Get Personal Info: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Get Personal Info: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -148,7 +207,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera User Status: ERROR ' + data.statusText);
|
$log.error('Glidera User Status: ERROR ' + data.statusText);
|
||||||
return cb('Glidera User Status: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -159,7 +219,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Transaction Limits: ERROR ' + data.statusText);
|
$log.error('Glidera Transaction Limits: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Transaction Limits: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -170,7 +231,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data.transactions);
|
return cb(null, data.data.transactions);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Transactions: ERROR ' + data.statusText);
|
$log.error('Glidera Transactions: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Transactions: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -182,7 +244,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Transaction: ERROR ' + data.statusText);
|
$log.error('Glidera Transaction: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Transaction: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -193,23 +256,20 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data.sellAddress);
|
return cb(null, data.data.sellAddress);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Create Sell Address: ERROR ' + data.statusText);
|
$log.error('Glidera Create Sell Address: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Create Sell Address: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
root.get2faCode = function(token, cb) {
|
root.get2faCode = function(token, cb) {
|
||||||
if (!token) {
|
if (!token) return cb('Invalid Token');
|
||||||
$log.error('Glidera Sent 2FA code by SMS: ERROR Invalid Token');
|
|
||||||
return cb('Invalid Token');
|
|
||||||
}
|
|
||||||
|
|
||||||
$http(_get('/authentication/get2faCode', token)).then(function(data) {
|
$http(_get('/authentication/get2faCode', token)).then(function(data) {
|
||||||
|
$log.info('Glidera 2FA code: SUCCESS');
|
||||||
$log.info('Glidera Sent 2FA code by SMS: SUCCESS');
|
return cb(null, data.data);
|
||||||
return cb(null, data.status == 200 ? true : false);
|
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Sent 2FA code by SMS: ERROR ' + data.statusText);
|
$log.error('Glidera 2FA code: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Sent 2FA code by SMS: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -221,7 +281,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Authorization': 'Bearer ' + token,
|
'Authorization': 'Bearer ' + token,
|
||||||
'2FA_CODE': twoFaCode
|
'X-2FA-CODE': twoFaCode
|
||||||
},
|
},
|
||||||
data: data
|
data: data
|
||||||
};
|
};
|
||||||
|
|
@ -237,7 +297,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Sell Price: ERROR ' + data.statusText);
|
$log.error('Glidera Sell Price: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Sell Price: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -254,7 +315,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Sell Request: ERROR ' + data.statusText);
|
$log.error('Glidera Sell Request: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Sell Request: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -268,7 +330,8 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Buy Price: ERROR ' + data.statusText);
|
$log.error('Glidera Buy Price: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Buy Price: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -285,44 +348,84 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$log.error('Glidera Buy Request: ERROR ' + data.statusText);
|
$log.error('Glidera Buy Request: ERROR ' + data.statusText);
|
||||||
return cb('Glidera Buy Request: ERROR ' + data.statusText);
|
var message = data.data && data.data.message ? data.data.message : data.statusText;
|
||||||
|
return cb(message);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
root.init = function(accessToken, cb) {
|
root.init = function(cb) {
|
||||||
$log.debug('Init Glidera...');
|
if (lodash.isEmpty(credentials.CLIENT_ID)) {
|
||||||
|
return cb('Glidera is Disabled');
|
||||||
var glidera = {
|
|
||||||
token: null,
|
|
||||||
permissions: null
|
|
||||||
}
|
}
|
||||||
|
$log.debug('Trying to initialise Glidera...');
|
||||||
|
|
||||||
var getToken = function(cb) {
|
storageService.getGlideraToken(credentials.NETWORK, function(err, accessToken) {
|
||||||
if (accessToken) {
|
if (err || lodash.isEmpty(accessToken)) return cb();
|
||||||
cb(null, accessToken);
|
|
||||||
} else {
|
storageService.getGlideraPermissions(credentials.NETWORK, function(err, permissions) {
|
||||||
storageService.getGlideraToken(credentials.NETWORK, cb);
|
if (lodash.isString(permissions)) permissions = JSON.parse(permissions);
|
||||||
}
|
storageService.getGlideraStatus(credentials.NETWORK, function(err, status) {
|
||||||
};
|
if (lodash.isString(status)) status = JSON.parse(status);
|
||||||
|
storageService.getGlideraTxs(credentials.NETWORK, function(err, txs) {
|
||||||
getToken(function(err, accessToken) {
|
if (lodash.isString(txs)) txs = JSON.parse(txs);
|
||||||
if (err || !accessToken) return cb();
|
buyAndSellService.updateLink('glidera', true);
|
||||||
else {
|
return cb(null, {
|
||||||
buyAndSellService.updateLink('glidera', true);
|
token: accessToken,
|
||||||
|
permissions: permissions,
|
||||||
root.getAccessTokenPermissions(accessToken, function(err, p) {
|
status: status,
|
||||||
if (err) {
|
txs: txs
|
||||||
return cb(err);
|
});
|
||||||
} else {
|
});
|
||||||
glidera.token = accessToken;
|
|
||||||
glidera.permissions = p;
|
|
||||||
return cb(null, glidera);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.updateStatus = function(data) {
|
||||||
|
storageService.getGlideraToken(credentials.NETWORK, function(err, accessToken) {
|
||||||
|
if (err) return;
|
||||||
|
root.getAccessTokenPermissions(accessToken, function(err, permissions) {
|
||||||
|
if (err) return;
|
||||||
|
storageService.setGlideraPermissions(credentials.NETWORK, JSON.stringify(permissions), function() {});
|
||||||
|
data.permissions = permissions;
|
||||||
|
|
||||||
|
data.price = {};
|
||||||
|
root.buyPrice(accessToken, {qty: 1}, function(err, buy) {
|
||||||
|
data.price['buy'] = buy.price;
|
||||||
|
});
|
||||||
|
root.sellPrice(accessToken, {qty: 1}, function(err, sell) {
|
||||||
|
data.price['sell'] = sell.price;
|
||||||
|
});
|
||||||
|
|
||||||
|
root.getStatus(accessToken, function(err, status) {
|
||||||
|
data.status = status;
|
||||||
|
storageService.setGlideraStatus(credentials.NETWORK, JSON.stringify(status), function() {});
|
||||||
|
});
|
||||||
|
|
||||||
|
root.getLimits(accessToken, function(err, limits) {
|
||||||
|
data.limits = limits;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (permissions.transaction_history) {
|
||||||
|
root.getTransactions(accessToken, function(err, txs) {
|
||||||
|
storageService.setGlideraTxs(credentials.NETWORK, JSON.stringify(txs), function() {});
|
||||||
|
data.txs = txs;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (permissions.view_email_address) {
|
||||||
|
root.getEmail(accessToken, function(err, email) {
|
||||||
|
data.email = email;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (permissions.personal_info) {
|
||||||
|
root.getPersonalInfo(accessToken, function(err, info) {
|
||||||
|
data.personalInfo = info;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var register = function() {
|
var register = function() {
|
||||||
if (isWindowsPhoneApp) return;
|
if (isWindowsPhoneApp) return;
|
||||||
|
|
|
||||||
|
|
@ -122,9 +122,23 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
goToAmountPage(data);
|
goToAmountPage(data);
|
||||||
}
|
}
|
||||||
} else if (data && data.indexOf(appConfigService.name + '://glidera') === 0) {
|
} else if (data && data.indexOf(appConfigService.name + '://glidera') === 0) {
|
||||||
return $state.go('uriglidera', {
|
var code = getParameterByName('code', data);
|
||||||
url: data
|
$ionicHistory.nextViewOptions({
|
||||||
|
disableAnimate: true
|
||||||
});
|
});
|
||||||
|
$state.go('tabs.home', {}, {
|
||||||
|
'reload': true,
|
||||||
|
'notify': $state.current.name == 'tabs.home' ? false : true
|
||||||
|
}).then(function() {
|
||||||
|
$ionicHistory.nextViewOptions({
|
||||||
|
disableAnimate: true
|
||||||
|
});
|
||||||
|
$state.transitionTo('tabs.buyandsell.glidera', {
|
||||||
|
code: code
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
|
||||||
} else if (data && data.indexOf(appConfigService.name + '://coinbase') === 0) {
|
} else if (data && data.indexOf(appConfigService.name + '://coinbase') === 0) {
|
||||||
var code = getParameterByName('code', data);
|
var code = getParameterByName('code', data);
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,42 @@ angular.module('copayApp.services')
|
||||||
storage.remove('glideraToken-' + network, cb);
|
storage.remove('glideraToken-' + network, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.setGlideraPermissions = function(network, p, cb) {
|
||||||
|
storage.set('glideraPermissions-' + network, p, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.getGlideraPermissions = function(network, cb) {
|
||||||
|
storage.get('glideraPermissions-' + network, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.removeGlideraPermissions = function(network, cb) {
|
||||||
|
storage.remove('glideraPermissions-' + network, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.setGlideraStatus = function(network, status, cb) {
|
||||||
|
storage.set('glideraStatus-' + network, status, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.getGlideraStatus = function(network, cb) {
|
||||||
|
storage.get('glideraStatus-' + network, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.removeGlideraStatus = function(network, cb) {
|
||||||
|
storage.remove('glideraStatus-' + network, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.setGlideraTxs = function(network, txs, cb) {
|
||||||
|
storage.set('glideraTxs-' + network, txs, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.getGlideraTxs = function(network, cb) {
|
||||||
|
storage.get('glideraTxs-' + network, cb);
|
||||||
|
};
|
||||||
|
|
||||||
|
root.removeGlideraTxs = function(network, cb) {
|
||||||
|
storage.remove('glideraTxs-' + network, cb);
|
||||||
|
};
|
||||||
|
|
||||||
root.setCoinbaseRefreshToken = function(network, token, cb) {
|
root.setCoinbaseRefreshToken = function(network, token, cb) {
|
||||||
storage.set('coinbaseRefreshToken-' + network, token, cb);
|
storage.set('coinbaseRefreshToken-' + network, token, cb);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,136 @@
|
||||||
#glidera {
|
#glidera {
|
||||||
|
$item-lateral-padding: 20px;
|
||||||
|
$item-vertical-padding: 10px;
|
||||||
|
$item-border-color: #EFEFEF;
|
||||||
|
$item-label-color: #6C6C6E;
|
||||||
|
@extend .deflash-blue;
|
||||||
|
|
||||||
|
.spinner svg {
|
||||||
|
stroke: #0067c8;
|
||||||
|
fill: #0067c8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-bottom-for-cta {
|
||||||
|
bottom: 92px;
|
||||||
|
}
|
||||||
|
.head {
|
||||||
|
padding: 30px $item-lateral-padding 4rem;
|
||||||
|
border-top: 0;
|
||||||
|
|
||||||
|
.sending-label {
|
||||||
|
display: flex;
|
||||||
|
font-size: 18px;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
|
||||||
|
img {
|
||||||
|
margin-right: 1rem;
|
||||||
|
height: 35px;
|
||||||
|
width: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.amount-label{
|
||||||
|
line-height: 30px;
|
||||||
|
.amount{
|
||||||
|
font-size: 38px;
|
||||||
|
margin-bottom: .5rem;
|
||||||
|
|
||||||
|
> .unit {
|
||||||
|
font-family: "Roboto-Light";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.alternative {
|
||||||
|
font-size: 16px;
|
||||||
|
font-family: "Roboto-Light";
|
||||||
|
color: #9B9B9B;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
border-color: $item-border-color;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
.badge {
|
||||||
|
border-radius: 0;
|
||||||
|
padding: .5rem;
|
||||||
|
}
|
||||||
|
.item {
|
||||||
|
color: #4A4A4A;
|
||||||
|
padding-top: $item-vertical-padding;
|
||||||
|
padding-bottom: $item-vertical-padding;
|
||||||
|
padding-left: $item-lateral-padding;
|
||||||
|
|
||||||
|
&:not(.item-icon-right) {
|
||||||
|
padding-right: $item-lateral-padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 14px;
|
||||||
|
color: $item-label-color;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.capitalized {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wallet .big-icon-svg > .bg {
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
padding: 2px;
|
||||||
|
box-shadow: none;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total-amount {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.single-line {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-top: 17px;
|
||||||
|
padding-bottom: 17px;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
margin: 0;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.item-divider {
|
||||||
|
padding-top: 1.2rem;
|
||||||
|
color: $item-label-color;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.wallet {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: .2rem 0;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
|
||||||
|
~ .bp-arrow-right {
|
||||||
|
top: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
> i {
|
||||||
|
padding: 0;
|
||||||
|
position: static;
|
||||||
|
|
||||||
|
> img {
|
||||||
|
height: 24px;
|
||||||
|
width: 24px;
|
||||||
|
padding: 2px;
|
||||||
|
margin-right: .7rem;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.glidera-lead {
|
.glidera-lead {
|
||||||
margin: 2rem 1rem;
|
margin: 2rem 1rem;
|
||||||
color: $dark-gray;
|
color: $dark-gray;
|
||||||
|
|
|
||||||
103
www/views/buyGlidera.html
Normal file
103
www/views/buyGlidera.html
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
<ion-view id="glidera" hide-tabs>
|
||||||
|
<ion-nav-bar class="bar-royal">
|
||||||
|
<ion-nav-back-button>
|
||||||
|
</ion-nav-back-button>
|
||||||
|
<ion-nav-title>Buy bitcoin</ion-nav-title>
|
||||||
|
</ion-nav-bar>
|
||||||
|
|
||||||
|
<ion-content class="add-bottom-for-cta">
|
||||||
|
<!-- BUY -->
|
||||||
|
<div class="list" ng-if="buyInfo">
|
||||||
|
|
||||||
|
<div class="item head">
|
||||||
|
<div class="sending-label">
|
||||||
|
<img src="img/buy-bitcoin.svg" alt="buy bitcoin" width="35" class="item-img-buy">
|
||||||
|
<span>Buying</span>
|
||||||
|
</div>
|
||||||
|
<div class="amount-label">
|
||||||
|
<div class="amount">{{amountUnitStr}}</div>
|
||||||
|
<div class="alternative">
|
||||||
|
<span ng-show="!isFiat">{{buyInfo.subtotal}} {{buyInfo.currency}}</span>
|
||||||
|
<span ng-show="isFiat">{{buyInfo.qty}} BTC</span>
|
||||||
|
@ ${{buyInfo.price}} per BTC
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info">
|
||||||
|
|
||||||
|
<div class="item item-icon-right" ng-click="showWalletSelector()">
|
||||||
|
<div class="label">Receive in</div>
|
||||||
|
<div class="wallet">
|
||||||
|
<i class="icon big-icon-svg">
|
||||||
|
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg">
|
||||||
|
</i>
|
||||||
|
{{wallet ? wallet.name : '...'}}
|
||||||
|
</div>
|
||||||
|
<i class="icon bp-arrow-right"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item item-divider">
|
||||||
|
Transaction details
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
Expires
|
||||||
|
<span class="item-note">
|
||||||
|
{{buyInfo.expires | amCalendar}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
Fees
|
||||||
|
<span class="item-note">
|
||||||
|
{{buyInfo.fees}} {{buyInfo.currency}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
Total to pay
|
||||||
|
<span class="item-note total-amount">
|
||||||
|
{{buyInfo.total}} {{buyInfo.currency}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ion-content>
|
||||||
|
|
||||||
|
<click-to-accept
|
||||||
|
ng-disabled="!buyInfo || !wallet"
|
||||||
|
ng-click="buyConfirm()"
|
||||||
|
ng-if="!isCordova && buyInfo"
|
||||||
|
click-send-status="sendStatus"
|
||||||
|
has-wallet-chosen="wallet"
|
||||||
|
insufficient-funds="false"
|
||||||
|
no-matching-wallet="!buyInfo">
|
||||||
|
Confirm purchase
|
||||||
|
</click-to-accept>
|
||||||
|
<slide-to-accept
|
||||||
|
ng-disabled="!buyInfo || !wallet"
|
||||||
|
ng-if="isCordova && buyInfo"
|
||||||
|
slide-on-confirm="buyConfirm()"
|
||||||
|
slide-send-status="sendStatus"
|
||||||
|
has-wallet-chosen="wallet"
|
||||||
|
insufficient-funds="false"
|
||||||
|
no-matching-wallet="!buyInfo">
|
||||||
|
Slide to buy
|
||||||
|
</slide-to-accept>
|
||||||
|
<slide-to-accept-success
|
||||||
|
slide-success-show="sendStatus === 'success'"
|
||||||
|
slide-success-on-confirm="goBackHome()"
|
||||||
|
slide-success-hide-on-confirm="true">
|
||||||
|
<span>Bought</span>
|
||||||
|
<div class="m10 size-14">
|
||||||
|
A transfer has been initiated from your bank account. Your bitcoins should arrive to your wallet in 2-4 business day
|
||||||
|
</div>
|
||||||
|
</slide-to-accept-success>
|
||||||
|
|
||||||
|
<wallet-selector
|
||||||
|
wallet-selector-title="walletSelectorTitle"
|
||||||
|
wallet-selector-wallets="wallets"
|
||||||
|
wallet-selector-selected-wallet="wallet"
|
||||||
|
wallet-selector-show="showWallets"
|
||||||
|
wallet-selector-on-select="onWalletSelect">
|
||||||
|
</wallet-selector>
|
||||||
|
</ion-view>
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<div ng-repeat="service in services">
|
<div ng-repeat="service in services">
|
||||||
<div class="item item-icon-right" ui-sref="{{service.sref}}">
|
<div class="item item-icon-right" ui-sref="{{service.sref}}">
|
||||||
<img ng-src="{{service.logo}}" width="90">
|
<img ng-src="{{service.logo}}" width="90">
|
||||||
<span class="item-note" translate>{{service.location}}</span>
|
<span class="item-note">{{service.location}}</span>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,8 @@
|
||||||
<div class="item head">
|
<div class="item head">
|
||||||
<div class="sending-label">
|
<div class="sending-label">
|
||||||
<img src="img/icon-tx-sent-outline.svg">
|
<img src="img/icon-tx-sent-outline.svg">
|
||||||
<span translate ng-if="!useSendMax && !isGlidera">Sending</span>
|
<span translate ng-if="!useSendMax">Sending</span>
|
||||||
<span translate ng-if="useSendMax">Sending maximum amount</span>
|
<span translate ng-if="useSendMax">Sending maximum amount</span>
|
||||||
<span ng-if="isGlidera == 'buy'">Buying</span>
|
|
||||||
<span ng-if="isGlidera == 'sell'">Selling</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="amount-label">
|
<div class="amount-label">
|
||||||
<div class="amount">{{displayAmount || '...'}} <span class="unit">{{displayUnit}}</span></div>
|
<div class="amount">{{displayAmount || '...'}} <span class="unit">{{displayUnit}}</span></div>
|
||||||
|
|
@ -31,16 +29,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<span class="label" ng-if="!isGlidera" translate>To</span>
|
<span class="label" translate>To</span>
|
||||||
<span class="label" ng-if="isGlidera == 'buy'">From</span>
|
|
||||||
<span class="label" ng-if="isGlidera == 'sell'">To</span>
|
|
||||||
<span class="payment-proposal-to">
|
<span class="payment-proposal-to">
|
||||||
<img ng-if="!cardId && !isGiftCard && !isGlidera" src="img/icon-bitcoin-small.svg">
|
<img ng-if="!cardId && !isGiftCard" src="img/icon-bitcoin-small.svg">
|
||||||
<img ng-if="cardId" src="img/icon-card.svg" width="34">
|
<img ng-if="cardId" src="img/icon-card.svg" width="34">
|
||||||
<i ng-if="isGiftCard" class="icon big-icon-svg">
|
<i ng-if="isGiftCard" class="icon big-icon-svg">
|
||||||
<div class="bg icon-amazon"></div>
|
<div class="bg icon-amazon"></div>
|
||||||
</i>
|
</i>
|
||||||
<img ng-if="isGlidera" src="img/glidera-logo.png" width="90"/>
|
|
||||||
|
|
||||||
<div copy-to-clipboard="toAddress" ng-if="!paypro" class="ellipsis">
|
<div copy-to-clipboard="toAddress" ng-if="!paypro" class="ellipsis">
|
||||||
<contact ng-if="!toName" address="{{toAddress}}"></contact>
|
<contact ng-if="!toName" address="{{toAddress}}"></contact>
|
||||||
|
|
@ -58,9 +53,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<a class="item item-icon-right" ng-hide="!useSendMax && (insufficientFunds || noMatchingWallet)" ng-click="showWalletSelector()">
|
<a class="item item-icon-right" ng-hide="!useSendMax && (insufficientFunds || noMatchingWallet)" ng-click="showWalletSelector()">
|
||||||
<span class="label" ng-if="!isGlidera" translate>From</span>
|
<span class="label" translate>From</span>
|
||||||
<span class="label" ng-if="isGlidera == 'buy'">To</span>
|
|
||||||
<span class="label" ng-if="isGlidera == 'sell'">From</span>
|
|
||||||
<div class="wallet" ng-if="wallet">
|
<div class="wallet" ng-if="wallet">
|
||||||
<i class="icon big-icon-svg">
|
<i class="icon big-icon-svg">
|
||||||
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/>
|
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg"/>
|
||||||
|
|
@ -75,47 +68,19 @@
|
||||||
</div>
|
</div>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a class="item single-line item-icon-right" ng-if="!insufficientFunds && !noMatchingWallet && !isGlidera" ng-click="showDescriptionPopup()">
|
<a class="item single-line item-icon-right" ng-if="!insufficientFunds && !noMatchingWallet" ng-click="showDescriptionPopup()">
|
||||||
<span class="label" translate>Add Memo</span>
|
<span class="label" translate>Add Memo</span>
|
||||||
<span class="item-note m10l">
|
<span class="item-note m10l">
|
||||||
{{description}}
|
{{description}}
|
||||||
</span>
|
</span>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="item single-line" ng-if="!insufficientFunds && !noMatchingWallet && !isGlidera">
|
<div class="item single-line" ng-if="!insufficientFunds && !noMatchingWallet">
|
||||||
<span class="label">{{'Fee' | translate}}: {{feeLevel | translate}}</span>
|
<span class="label">{{'Fee' | translate}}: {{feeLevel | translate}}</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{fee || '...'}}
|
{{fee || '...'}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item" ng-show="isGlidera == 'buy'">
|
|
||||||
<span class="label">Information</span>
|
|
||||||
<div class="glidera-explanation">
|
|
||||||
<div class="glidera-description" ng-show="buyPrice.qty">
|
|
||||||
Buy {{buyPrice.subtotal|currency:'':2}} {{buyPrice.currency}} in Bitcoin at {{buyPrice.price}} {{buyPrice.currency}}/BTC
|
|
||||||
</div>
|
|
||||||
<div class="glidera-description">
|
|
||||||
Fiat will be immediately withdrawn from your bank account.
|
|
||||||
</div>
|
|
||||||
<div class="glidera-description">
|
|
||||||
The bitcoins will be purchased and deposited to "{{wallet.name || '...' }}" wallet in 2-4 business days.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="item" ng-show="isGlidera == 'sell'">
|
|
||||||
<span class="label">Information</span>
|
|
||||||
<div class="glidera-explanation">
|
|
||||||
<div class="glidera-description" ng-show="sellPrice.qty">
|
|
||||||
Sell {{sellPrice.subtotal|currency:'':2}} {{sellPrice.currency}} in Bitcoin at {{sellPrice.price|currency:'':2}} {{sellPrice.currency}}/BTC
|
|
||||||
</div>
|
|
||||||
<div class="glidera-description">
|
|
||||||
Fiat will be deposited in your bank account in 4-6 business days.
|
|
||||||
</div>
|
|
||||||
<div class="glidera-description">
|
|
||||||
Bitcoins will be immediately sent from your "{{wallet.name || '...' }}" wallet to Glidera.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="text-center" ng-show="noMatchingWallet">
|
<div class="text-center" ng-show="noMatchingWallet">
|
||||||
<span class="badge badge-energized" translate>No wallets available</span>
|
<span class="badge badge-energized" translate>No wallets available</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -150,10 +115,6 @@
|
||||||
<span ng-show="wallet.m == 1 && (wallet.canSign() || wallet.isPrivKeyExternal())" translate>Payment Sent</span>
|
<span ng-show="wallet.m == 1 && (wallet.canSign() || wallet.isPrivKeyExternal())" translate>Payment Sent</span>
|
||||||
<span ng-show="wallet.m > 1 && (wallet.canSign() || wallet.isPrivKeyExternal())" translate>Proposal Created</span>
|
<span ng-show="wallet.m > 1 && (wallet.canSign() || wallet.isPrivKeyExternal())" translate>Proposal Created</span>
|
||||||
<span ng-show="!wallet.canSign() && !wallet.isPrivKeyExternal()" translate>Transaction created</span>
|
<span ng-show="!wallet.canSign() && !wallet.isPrivKeyExternal()" translate>Transaction created</span>
|
||||||
<div ng-show="isGlidera" class="glidera-success">
|
|
||||||
<span ng-show="isGlidera == 'buy'">A transfer has been initiated from your bank account. Your bitcoins should arrive to your wallet in 2-4 business day</span>
|
|
||||||
<span ng-show="isGlidera == 'sell'">A transfer has been initiated to your bank account. Should arrive in 4-6 business days</span>
|
|
||||||
</div>
|
|
||||||
</slide-to-accept-success>
|
</slide-to-accept-success>
|
||||||
|
|
||||||
<wallet-selector
|
<wallet-selector
|
||||||
|
|
|
||||||
|
|
@ -4,30 +4,25 @@
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
<ion-nav-title>Glidera</ion-nav-title>
|
<ion-nav-title>Glidera</ion-nav-title>
|
||||||
<ion-nav-buttons side="secondary">
|
<ion-nav-buttons side="secondary">
|
||||||
<button class="button button-clear button-small ng-hide" ng-show="!token && !connectingGlidera" ng-click="toggleOauthForm()">
|
<button class="button button-clear button-small ng-hide" ng-show="!account.token" ng-click="toggleOauthForm()">
|
||||||
<span ng-hide="showOauthForm" translate>Enter Code</span>
|
<span ng-hide="showOauthForm">Enter Code</span>
|
||||||
<span ng-show="showOauthForm" translate>Restart</span>
|
<span ng-show="showOauthForm">Restart</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="button button-clear button-small ng-hide" ng-show="token && !connectingGlidera && status && !status.userCanTransact" ng-click="retry()" translate>
|
<button class="button button-clear button-small ng-hide" ng-show="account.token && account.status &&
|
||||||
|
!account.status.userCanTransact" ng-click="update()">
|
||||||
Refresh
|
Refresh
|
||||||
</button>
|
</button>
|
||||||
</ion-nav-buttons>
|
</ion-nav-buttons>
|
||||||
<ion-content scroll="false" class="ng-hide" ng-show="!token && !connectingGlidera">
|
<ion-content scroll="false" class="ng-hide" ng-show="!account.token">
|
||||||
<div class="box-notification error m0" ng-show="!network">
|
|
||||||
The Glidera integration is currently disabled.
|
|
||||||
</div>
|
|
||||||
<div class="box-notification warning m0" ng-show="network == 'testnet'">
|
|
||||||
Testnet wallets only work with Glidera Sandbox Accounts.
|
|
||||||
</div>
|
|
||||||
<div class="integration-onboarding">
|
<div class="integration-onboarding">
|
||||||
<div class="integration-onboarding-logo">
|
<div class="integration-onboarding-logo">
|
||||||
<img src="img/glidera-logo.png">
|
<img src="img/glidera-logo.png">
|
||||||
</div>
|
</div>
|
||||||
<div class="integration-onboarding-description" ng-hide="showOauthForm" translate>Glidera's exchange service is available in the United States, and can take 1-2 weeks to buy or sell bitcoin.</div>
|
<div class="integration-onboarding-description" ng-hide="showOauthForm">Glidera's exchange service is available in the United States, and can take 1-2 weeks to buy or sell bitcoin.</div>
|
||||||
<div class="integration-onboarding-description" ng-show="showOauthForm" translate>If you have trouble, contact Glidera support for direct assistance.</div>
|
<div class="integration-onboarding-description" ng-show="showOauthForm">If you have trouble, contact Glidera support for direct assistance.</div>
|
||||||
<div class="integration-onboarding-cta" ng-show="!showOauthForm">
|
<div class="integration-onboarding-cta" ng-show="!showOauthForm">
|
||||||
<button class="button button-standard button-primary" ng-click="openAuthenticateWindow()" translate>Connect to Glidera</button>
|
<button class="button button-standard button-primary" ng-click="openAuthenticateWindow()">Connect to Glidera</button>
|
||||||
<button type="button" class="button button-standard button-secondary" ng-click="openSupportWindow()" translate>Glidera Support →</button>
|
<button type="button" class="button button-standard button-secondary" ng-click="openSupportWindow()">Glidera Support →</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-show="showOauthForm" class="integration-onboarding-oauthform">
|
<div ng-show="showOauthForm" class="integration-onboarding-oauthform">
|
||||||
|
|
@ -43,54 +38,60 @@
|
||||||
<input
|
<input
|
||||||
class="button button-standard button-primary"
|
class="button button-standard button-primary"
|
||||||
type="submit" value="Connect Glidera Account" ng-disabled="oauthCodeForm.$invalid">
|
type="submit" value="Connect Glidera Account" ng-disabled="oauthCodeForm.$invalid">
|
||||||
<button type="button" class="button button-standard button-secondary" ng-click="openSupportWindow()" translate>Glidera Support →</button>
|
<button type="button" class="button button-standard button-secondary" ng-click="openSupportWindow()">Glidera Support →</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<ion-content scroll="false" class="ng-hide" ng-show="token && !connectingGlidera && status && !status.userCanTransact">
|
<ion-content scroll="false" class="ng-hide" ng-show="account.token && account.status && !account.status.userCanTransact">
|
||||||
<div class="integration-onboarding">
|
<div class="integration-onboarding">
|
||||||
<div class="integration-onboarding-logo">
|
<div class="integration-onboarding-logo">
|
||||||
<img src="img/glidera-logo.png">
|
<img src="img/glidera-logo.png">
|
||||||
</div>
|
</div>
|
||||||
<div class="integration-onboarding-description" translate>Please complete your account verification on Glidera's website. If you have trouble, contact Glidera's support for direct assistance.</div>
|
<div class="integration-onboarding-description">Please complete your account verification on Glidera's website. If you have trouble, contact Glidera's support for direct assistance.</div>
|
||||||
<div class="integration-onboarding-cta">
|
<div class="integration-onboarding-cta">
|
||||||
<button class="button button-standard button-primary" ng-click="openLoginWindow()" translate>Complete Glidera Setup</button>
|
<button class="button button-standard button-primary" ng-click="openLoginWindow()">Complete Glidera Setup</button>
|
||||||
<button type="button" class="button button-standard button-secondary" ng-click="openSupportWindow()" translate>Glidera Support →</button>
|
<button type="button" class="button button-standard button-secondary" ng-click="openSupportWindow()">Glidera Support →</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<ion-content class="ng-hide" ng-show="token && !connectingGlidera && status && status.userCanTransact">
|
<ion-content class="ng-hide" ng-show="account.token && account.status && account.status.userCanTransact">
|
||||||
<div class="text-center m20v">
|
<div class="text-center m20v">
|
||||||
<img src="img/glidera-logo.png" width="170">
|
<img src="img/glidera-logo.png" width="170" ng-click="update()">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="list card"
|
<div class="list card">
|
||||||
ng-show="status && status.userCanTransact">
|
<a ng-show="account.status.userCanBuy"
|
||||||
<a ng-show="status.userCanBuy"
|
|
||||||
class="item item-icon-right"
|
class="item item-icon-right"
|
||||||
href ui-sref="tabs.buyandsell.glidera.amount({isGlidera: 'buy', glideraAccessToken: token})">
|
href ui-sref="tabs.buyandsell.glidera.amount({nextStep: 'tabs.buyandsell.glidera.buy', currency: currency})">
|
||||||
<img src="img/buy-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-buy">
|
<img src="img/buy-bitcoin.svg" alt="buy bitcoin" width="25" class="item-img-buy">
|
||||||
Buy Bitcoin
|
Buy Bitcoin
|
||||||
|
<span class="item-note" ng-show="account.price.buy">
|
||||||
|
${{account.price.buy}}/BTC
|
||||||
|
</span>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a class="item item-icon-right"
|
<a class="item item-icon-right"
|
||||||
ng-show="status.userCanSell"
|
ng-show="account.status.userCanSell"
|
||||||
href ui-sref="tabs.buyandsell.glidera.amount({isGlidera: 'sell', glideraAccessToken: token})">
|
href ui-sref="tabs.buyandsell.glidera.amount({nextStep: 'tabs.buyandsell.glidera.sell', currency: currency})">
|
||||||
<img src="img/sell-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-sell">
|
<img src="img/sell-bitcoin.svg" alt="buy bitcoin" width="25" class="item-img-sell">
|
||||||
Sell Bitcoin
|
Sell Bitcoin
|
||||||
|
<span class="item-note" ng-show="account.price.sell">
|
||||||
|
${{account.price.sell}}/BTC
|
||||||
|
</span>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="list card" ng-show="permissions && permissions.transaction_history && txs.length > 0">
|
<div class="list card">
|
||||||
<div class="item item-heading">
|
<div class="item item-heading">
|
||||||
Activity
|
Activity
|
||||||
</div>
|
</div>
|
||||||
<a ng-repeat="tx in txs"
|
<a ng-repeat="tx in account.txs"
|
||||||
ng-click="openTxModal(token, tx)"
|
ng-click="openTxModal(tx)"
|
||||||
|
ng-show="account.txs && account.txs.length > 0"
|
||||||
class="item">
|
class="item">
|
||||||
|
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
|
|
|
||||||
|
|
@ -8,55 +8,55 @@
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<div ng-if="token">
|
<div ng-if="account.token">
|
||||||
<div class="item item-divider">
|
<div class="item item-divider">
|
||||||
Permissions
|
Permissions
|
||||||
</div>
|
</div>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Email</span>
|
<span>Email</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{permissions.view_email_address}}
|
{{account.permissions.view_email_address}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Personal Information</span>
|
<span>Personal Information</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{permissions.personal_info}}
|
{{account.permissions.personal_info}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Buy/Sell</span>
|
<span>Buy/Sell</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{permissions.transact}}
|
{{account.permissions.transact}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Transaction History</span>
|
<span>Transaction History</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{permissions.transaction_history}}
|
{{account.permissions.transaction_history}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="permissions.view_email_address">
|
<div ng-if="account.permissions.view_email_address">
|
||||||
<div class="item item-divider">
|
<div class="item item-divider">
|
||||||
Email
|
Email
|
||||||
</div>
|
</div>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Email</span>
|
<span>Email</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{email.email}}
|
{{account.email.email}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Active</span>
|
<span>Active</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{email.userEmailIsSetup}}
|
{{account.email.userEmailIsSetup}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-if="permissions.personal_info">
|
<div ng-if="account.permissions.personal_info">
|
||||||
<div class="item item-divider">
|
<div class="item item-divider">
|
||||||
Personal Information
|
Personal Information
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -64,73 +64,73 @@
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>First Name</span>
|
<span>First Name</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.firstName}}
|
{{account.personalInfo.firstName}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Middle Name</span>
|
<span>Middle Name</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.middleName}}
|
{{account.personalInfo.middleName}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Last Name</span>
|
<span>Last Name</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.lastName}}
|
{{account.personalInfo.lastName}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Birth Date</span>
|
<span>Birth Date</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.birthDate}}
|
{{account.personalInfo.birthDate}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Address 1</span>
|
<span>Address 1</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.address1}}
|
{{account.personalInfo.address1}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Address 2</span>
|
<span>Address 2</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.address2}}
|
{{account.personalInfo.address2}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>City</span>
|
<span>City</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.city}}
|
{{account.personalInfo.city}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>State</span>
|
<span>State</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.state}}
|
{{account.personalInfo.state}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>ZIP Code</span>
|
<span>ZIP Code</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.zipCode}}
|
{{account.personalInfo.zipCode}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Country</span>
|
<span>Country</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.countryCode}}
|
{{account.personalInfo.countryCode}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Occupation</span>
|
<span>Occupation</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.occupation}}
|
{{account.personalInfo.occupation}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Basic Information State</span>
|
<span>Basic Information State</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{personalInfo.basicInfoState}}
|
{{account.personalInfo.basicInfoState}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -143,56 +143,56 @@
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Buy/Sell</span>
|
<span>Buy/Sell</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.userCanTransact}}
|
{{account.status.userCanTransact}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Buy</span>
|
<span>Buy</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.userCanBuy}}
|
{{account.status.userCanBuy}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Sell</span>
|
<span>Sell</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.userCanSell}}
|
{{account.status.userCanSell}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Email Is Setup</span>
|
<span>Email Is Setup</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.userEmailIsSetup}}
|
{{account.status.userEmailIsSetup}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Phone Is Setup</span>
|
<span>Phone Is Setup</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.userPhoneIsSetup}}
|
{{account.status.userPhoneIsSetup}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Bank Account Is Setup</span>
|
<span>Bank Account Is Setup</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.userBankAccountIsSetup}}
|
{{account.status.userBankAccountIsSetup}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Personal Information State</span>
|
<span>Personal Information State</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.personalInfoState}}
|
{{account.status.personalInfoState}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Bank Account State</span>
|
<span>Bank Account State</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.bankAccountState}}
|
{{account.status.bankAccountState}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Country</span>
|
<span>Country</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{status.country}}
|
{{account.status.country}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -205,55 +205,55 @@
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Daily Buy</span>
|
<span>Daily Buy</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.dailyBuy|currency:'':2}} {{limits.currency}}
|
{{account.limits.dailyBuy|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Daily Sell</span>
|
<span>Daily Sell</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.dailySell|currency:'':2}} {{limits.currency}}
|
{{account.limits.dailySell|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Monthly Buy</span>
|
<span>Monthly Buy</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
|
{{account.limits.monthlyBuy|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Monthly Sell</span>
|
<span>Monthly Sell</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.monthlySell|currency:'':2}} {{limits.currency}}
|
{{account.limits.monthlySell|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Daily Buy Remaining</span>
|
<span>Daily Buy Remaining</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}}
|
{{account.limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Daily Sell Remaining</span>
|
<span>Daily Sell Remaining</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.dailySellRemaining|currency:'':2}} {{limits.currency}}
|
{{account.limits.dailySellRemaining|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Monthly Buy Remaining</span>
|
<span>Monthly Buy Remaining</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}}
|
{{account.limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Monthly Sell Remaining</span>
|
<span>Monthly Sell Remaining</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.monthlySellRemaining|currency:'':2}} {{limits.currency}}
|
{{account.limits.monthlySellRemaining|currency:'':2}} {{limits.currency}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="item">
|
<li class="item">
|
||||||
<span>Buy/Sell Disabled (pending first transaction)</span>
|
<span>Buy/Sell Disabled (pending first transaction)</span>
|
||||||
<span class="item-note">
|
<span class="item-note">
|
||||||
{{limits.transactDisabledPendingFirstTransaction}}
|
{{account.limits.transactDisabledPendingFirstTransaction}}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
104
www/views/sellGlidera.html
Normal file
104
www/views/sellGlidera.html
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
<ion-view id="glidera" hide-tabs>
|
||||||
|
<ion-nav-bar class="bar-royal">
|
||||||
|
<ion-nav-back-button>
|
||||||
|
</ion-nav-back-button>
|
||||||
|
<ion-nav-title>Sell bitcoin</ion-nav-title>
|
||||||
|
</ion-nav-bar>
|
||||||
|
|
||||||
|
<ion-content class="add-bottom-for-cta">
|
||||||
|
<!-- SELL -->
|
||||||
|
<div class="list" ng-if="sellInfo">
|
||||||
|
|
||||||
|
<div class="item head">
|
||||||
|
<div class="sending-label">
|
||||||
|
<img src="img/sell-bitcoin.svg" alt="sell bitcoin" width="35" class="item-img-sell">
|
||||||
|
<span>Selling</span>
|
||||||
|
</div>
|
||||||
|
<div class="amount-label">
|
||||||
|
<div class="amount">{{amountUnitStr}}</div>
|
||||||
|
<div class="alternative">
|
||||||
|
<span ng-show="!isFiat">{{sellInfo.subtotal}} {{sellInfo.currency}}</span>
|
||||||
|
<span ng-show="isFiat">{{sellInfo.qty}} BTC</span>
|
||||||
|
@ ${{sellInfo.price}} per BTC
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="info">
|
||||||
|
|
||||||
|
<div class="item item-icon-right" ng-click="showWalletSelector()">
|
||||||
|
<div class="label">From</div>
|
||||||
|
<div class="wallet">
|
||||||
|
<i class="icon big-icon-svg">
|
||||||
|
<img src="img/icon-wallet.svg" ng-style="{'background-color': wallet.color}" class="bg">
|
||||||
|
</i>
|
||||||
|
{{wallet ? wallet.name : '...'}}
|
||||||
|
</div>
|
||||||
|
<i class="icon bp-arrow-right"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="item item-divider">
|
||||||
|
Transaction details
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
Expires
|
||||||
|
<span class="item-note">
|
||||||
|
{{sellInfo.expires | amCalendar}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
Fees
|
||||||
|
<span class="item-note">
|
||||||
|
{{sellInfo.fees}} {{sellInfo.currency}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
Total to receive
|
||||||
|
<span class="item-note total-amount">
|
||||||
|
{{sellInfo.total}} {{sellInfo.currency}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ion-content>
|
||||||
|
|
||||||
|
<click-to-accept
|
||||||
|
ng-disabled="!sellInfo || !wallet"
|
||||||
|
ng-click="sellConfirm()"
|
||||||
|
ng-if="!isCordova && sellInfo"
|
||||||
|
click-send-status="sendStatus"
|
||||||
|
has-wallet-chosen="wallet"
|
||||||
|
insufficient-funds="false"
|
||||||
|
no-matching-wallet="!sellInfo">
|
||||||
|
Confirm sale
|
||||||
|
</click-to-accept>
|
||||||
|
<slide-to-accept
|
||||||
|
ng-disabled="!sellInfo || !wallet"
|
||||||
|
ng-if="isCordova && sellInfo"
|
||||||
|
slide-on-confirm="sellConfirm()"
|
||||||
|
slide-send-status="sendStatus"
|
||||||
|
has-wallet-chosen="wallet"
|
||||||
|
insufficient-funds="false"
|
||||||
|
no-matching-wallet="!sellInfo">
|
||||||
|
Slide to sell
|
||||||
|
</slide-to-accept>
|
||||||
|
<slide-to-accept-success
|
||||||
|
slide-success-show="sendStatus === 'success'"
|
||||||
|
slide-success-on-confirm="goBackHome()"
|
||||||
|
slide-success-hide-on-confirm="true">
|
||||||
|
<span>Funds sent to Glidera Account</span>
|
||||||
|
<div class="m10 size-14">
|
||||||
|
The transaction is not yet confirmed, and will show as "Pending" in your Activity. The bitcoin sale will be
|
||||||
|
completed automatically once it is confirmed by Glidera.
|
||||||
|
</div>
|
||||||
|
</slide-to-accept-success>
|
||||||
|
|
||||||
|
<wallet-selector
|
||||||
|
wallet-selector-title="walletSelectorTitle"
|
||||||
|
wallet-selector-wallets="wallets"
|
||||||
|
wallet-selector-selected-wallet="wallet"
|
||||||
|
wallet-selector-show="showWallets"
|
||||||
|
wallet-selector-on-select="onWalletSelect">
|
||||||
|
</wallet-selector>
|
||||||
|
</ion-view>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue