remove unused files

This commit is contained in:
Gabriel Bazán 2016-12-05 10:29:24 -03:00
commit cc990526fc
5 changed files with 0 additions and 628 deletions

View file

@ -1,148 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, $log, profileService, walletService, glideraService, bwcError, lodash, ongoingProcess, popupService, gettextCatalog) {
var wallet;
var self = this;
this.show2faCodeInput = null;
this.success = null;
$scope.network = glideraService.getEnvironment();
$scope.$on('Wallet/Changed', function(event, w) {
if (lodash.isEmpty(w)) {
$log.debug('No wallet provided');
return;
}
wallet = w;
$log.debug('Wallet changed: ' + w.name);
});
$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.email;
});
}
if (permissions.personal_info && opts.fullUpdate) {
glideraService.getPersonalInfo(accessToken, function(err, data) {
$scope.personalInfo = data;
});
}
};
this.getBuyPrice = function(token, price) {
var self = this;
if (!price || (price && !price.qty && !price.fiat)) {
this.buyPrice = null;
return;
}
this.gettingBuyPrice = true;
glideraService.buyPrice(token, price, function(err, buyPrice) {
self.gettingBuyPrice = false;
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get exchange information. Please, try again'));
return;
}
self.buyPrice = buyPrice;
});
};
this.get2faCode = function(token) {
var self = this;
ongoingProcess.set('Sending 2FA code...', true);
$timeout(function() {
glideraService.get2faCode(token, function(err, sent) {
ongoingProcess.set('Sending 2FA code...', false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send confirmation code to your phone'));
return;
}
self.show2faCodeInput = sent;
});
}, 100);
};
this.sendRequest = function(token, permissions, twoFaCode) {
var self = this;
ongoingProcess.set('Buying Bitcoin...', true);
$timeout(function() {
walletService.getAddress(wallet, false, function(err, walletAddr) {
if (err) {
ongoingProcess.set('Buying Bitcoin...', false);
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.cb(err, 'Could not create address'));
return;
}
var data = {
destinationAddress: walletAddr,
qty: self.buyPrice.qty,
priceUuid: self.buyPrice.priceUuid,
useCurrentPrice: false,
ip: null
};
glideraService.buy(token, twoFaCode, data, function(err, data) {
ongoingProcess.set('Buying Bitcoin...', false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
self.success = data;
$timeout(function() {
$scope.$digest();
});
});
});
}, 100);
};
$scope.$on("$ionicView.enter", function(event, data) {
$scope.token = null;
$scope.permissions = null;
$scope.email = null;
$scope.personalInfo = null;
$scope.txs = null;
$scope.status = null;
$scope.limits = null;
ongoingProcess.set('connectingGlidera', true);
glideraService.init($scope.token, function(err, glidera) {
ongoingProcess.set('connectingGlidera');
if (err || !glidera) {
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.token = glidera.token;
$scope.permissions = glidera.permissions;
$scope.update({
fullUpdate: true
});
});
$scope.wallets = profileService.getWallets({
network: $scope.network,
onlyComplete: true
});
});
});

View file

@ -1,219 +0,0 @@
'use strict';
angular.module('copayApp.controllers').controller('sellGlideraController',
function($scope, $timeout, $log, profileService, glideraService, bwcError, lodash, walletService, configService, ongoingProcess, popupService, gettextCatalog) {
var self = this;
this.data = {};
this.show2faCodeInput = null;
this.success = null;
var wallet;
$scope.network = glideraService.getEnvironment();
$scope.$on('Wallet/Changed', function(event, w) {
if (lodash.isEmpty(w)) {
$log.debug('No wallet provided');
return;
}
wallet = w;
$log.debug('Wallet changed: ' + w.name);
});
$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.email;
});
}
if (permissions.personal_info && opts.fullUpdate) {
glideraService.getPersonalInfo(accessToken, function(err, data) {
$scope.personalInfo = data;
});
}
};
this.getSellPrice = function(token, price) {
var self = this;
if (!price || (price && !price.qty && !price.fiat)) {
self.sellPrice = null;
return;
}
self.gettingSellPrice = true;
glideraService.sellPrice(token, price, function(err, sellPrice) {
self.gettingSellPrice = false;
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not get exchange information. Please, try again'));
return;
}
self.sellPrice = sellPrice;
});
};
this.get2faCode = function(token) {
var self = this;
ongoingProcess.set('Sending 2FA code...', true);
$timeout(function() {
glideraService.get2faCode(token, function(err, sent) {
ongoingProcess.set('Sending 2FA code...', false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send confirmation code to your phone'));
} else {
self.show2faCodeInput = sent;
}
});
}, 100);
};
this.createTx = function(token, permissions, twoFaCode) {
var self = this;
var outputs = [];
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
if (!wallet) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('No wallet selected'));
return;
}
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(token, 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((self.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': token
}
};
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: self.sellPrice.priceUuid,
useCurrentPrice: self.sellPrice.priceUuid ? false : true,
ip: null
};
ongoingProcess.set('Selling Bitcoin', true);
glideraService.sell(token, twoFaCode, data, function(err, data) {
ongoingProcess.clear();
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message || bwcError.msg(err));
return;
}
self.success = data;
$timeout(function() {
$scope.$digest();
});
});
});
});
});
});
});
});
};
$scope.$on("$ionicView.enter", function(event, data){
$scope.token = null;
$scope.permissions = null;
$scope.email = null;
$scope.personalInfo = null;
$scope.txs = null;
$scope.status = null;
$scope.limits = null;
ongoingProcess.set('connectingGlidera', true);
glideraService.init($scope.token, function(err, glidera) {
ongoingProcess.set('connectingGlidera');
if (err || !glidera) {
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
$scope.token = glidera.token;
$scope.permissions = glidera.permissions;
$scope.update({fullUpdate: true});
});
$scope.wallets = profileService.getWallets({
network: $scope.network,
n: 1,
onlyComplete: true
});
});
});

View file

@ -1,123 +0,0 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-title>Buy</ion-nav-title>
</ion-nav-bar>
<ion-content>
<div class="box-notification warning" ng-show="network == 'testnet'">
Testnet wallets only work with Glidera Sandbox Accounts
</div>
<div class="box-notification notice" ng-show="limits && !buy.show2faCodeInput && !buy.success">
<span class="text-light">Daily buy limit</span>:
{{limits.dailyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}})
<br>
<span class="text-light">Monthly buy limit</span>:
{{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}})
</div>
<div class="box-notification warning" ng-show="limits.transactDisabledPendingFirstTransaction && !buy.success">
<span class="text-warning">
This operation was disabled because you have a pending first transaction
</span>
</div>
<div ng-show="!buy.show2faCodeInput && !buy.success">
<form name="buyPriceForm" ng-if="token"
ng-submit="buy.get2faCode(token)" novalidate>
<div class="list card">
<label class="item item-input item-stacked-label">
<span class="input-label">Amount in {{showAlternative ? 'USD' : 'BTC'}}</span>
<input ng-show="!showAlternative"
type="number"
id="qty" ignore-mouse-wheel
name="qty"
ng-attr-placeholder="{{'Amount'}}"
ng-minlength="0.00000001"
ng-maxlength="10000000000"
ng-model="qty"
autocomplete="off"
ng-change="buy.getBuyPrice(token, {'qty': qty})">
<input ng-show="showAlternative"
type="number"
id="fiat" ignore-mouse-wheel
name="fiat"
ng-attr-placeholder="{{'Amount'}}"
ng-model="fiat"
autocomplete="off"
ng-change="buy.getBuyPrice(token, {'fiat': fiat})">
<a ng-show="!showAlternative"
class="postfix"
on-tap="showAlternative = true; qty = null; buy.buyPrice = null">BTC</a>
<a ng-show="showAlternative"
class="postfix"
on-tap="showAlternative = false; fiat = null; buy.buyPrice = null">USD</a>
</label>
</div>
<wallets ng-if="wallets[0]" wallets="wallets"></wallets>
<div class="text-center text-gray size-12 m20v" ng-show="!buy.gettingBuyPrice && buy.buyPrice.qty">
Buy
<span ng-show="qty">{{buy.buyPrice.subtotal|currency:'':2}} {{buy.buyPrice.currency}} in Bitcoin</span>
<span ng-show="fiat">{{buy.buyPrice.qty}} BTC</span>
at {{buy.buyPrice.price}} {{buy.buyPrice.currency}}/BTC
</div>
<div class="text-center text-gray size-12 m20b" ng-show="!buy.gettingBuyPrice && !buy.buyPrice.qty">
(Enter the amount to get the exchange rate)
</div>
<div class="text-center text-gray size-12 m20b" ng-show="buy.gettingBuyPrice">
...
</div>
<button class="button button-standard button-primary"
type="submit"
ng-disabled="limits.transactDisabledPendingFirstTransaction || !buy.buyPrice.qty || buy.loading">
Continue
</button>
</form>
</div>
<div ng-show="buy.show2faCodeInput && !buy.success">
<div class="m10t text-center">
{{buy.buyPrice.subtotal|currency:'':2}} {{buy.buyPrice.currency}} &rarr; {{buy.buyPrice.qty}} BTC
<p class="m20t">
A SMS containing a confirmation code was sent to your phone. <br>
Please, enter the code below
</p>
<form name="buyForm"
ng-submit="buy.sendRequest(token, permissions, twoFaCode)" novalidate>
<div class="list card">
<label class="item item-input">
<input type="number" ng-model="twoFaCode" placeholder="2FA Code" required ignore-mouse-wheel>
</label>
</div>
<button class="button button-standard button-primary"
type="submit" ng-disabled="buyForm.$invalid || buy.loading">
Buy
</button>
</form>
<p class="m10t size-12 text-gray padding">
Fiat will be immediately withdrawn from your bank account. The bitcoins will be purchased and deposited to your wallet in 2-4 business days.
</p>
</div>
</div>
<div class="text-center padding" ng-show="buy.success">
<h1>Purchase initiated</h1>
<p class="text-gray">
A transfer has been initiated from your bank account. Your bitcoins should arrive to your wallet in 2-4 business days.
</p>
<button class="button button-standard button-primary" ui-sref="tabs.buyandsell.glidera">OK</button>
</div>
</ion-content>
</ion-view>

View file

@ -87,20 +87,6 @@
Sell Bitcoin Sell Bitcoin
<i class="icon bp-arrow-right"></i> <i class="icon bp-arrow-right"></i>
</a> </a>
<a ng-show="status.userCanBuy"
class="item item-icon-right"
href ui-sref="tabs.buyandsell.glidera.buy">
<img src="img/buy-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-buy">
Buy Bitcoin OLD
<i class="icon bp-arrow-right"></i>
</a>
<a class="item item-icon-right"
ng-show="status.userCanSell"
href ui-sref="tabs.buyandsell.glidera.sell">
<img src="img/sell-bitcoin.svg" alt="buy bitcoin" width="45" class="item-img-sell">
Sell Bitcoin OLD
<i class="icon bp-arrow-right"></i>
</a>
</div> </div>
<div class="list card" ng-show="permissions && permissions.transaction_history && txs.length > 0"> <div class="list card" ng-show="permissions && permissions.transaction_history && txs.length > 0">

View file

@ -1,124 +0,0 @@
<ion-view>
<ion-nav-bar class="bar-royal">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-title>Sell</ion-nav-title>
</ion-nav-bar>
<ion-content>
<div class="box-notification warning" ng-show="network == 'testnet'">
Testnet wallets only work with Glidera Sandbox Accounts
</div>
<div class="box-notification notice" ng-show="limits && !sell.show2faCodeInput && !sell.success">
<span class="text-light">Daily sell limit</span>:
{{limits.dailySell|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailySellRemaining|currency:'':2}} {{limits.currency}})
<br>
<span class="text-light">Monthly sell limit</span>:
{{limits.monthlySell|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlySellRemaining|currency:'':2}} {{limits.currency}})
</div>
<div class="box-notification m20b" ng-show="limits.transactDisabledPendingFirstTransaction">
<span class="text-warning">
This operation was disabled because you have a pending first transaction
</span>
</div>
<div ng-show="!sell.show2faCodeInput && !sell.success">
<form name="sellPriceForm" ng-if="token"
ng-submit="sell.get2faCode(token)" novalidate>
<div class="list card">
<label class="item item-input item-stacked-label">
<span class="input-label"><span>Amount in</span> {{showAlternative ? 'USD' : 'BTC'}}</span>
<input ng-show="!showAlternative"
type="number"
id="qty" ignore-mouse-wheel
name="qty"
ng-attr-placeholder="{{'Amount'}}"
ng-minlength="0.00000001"
ng-maxlength="10000000000"
ng-model="qty"
autocomplete="off"
ng-change="sell.getSellPrice(token, {'qty': qty})">
<input ng-show="showAlternative"
type="number"
id="fiat" ignore-mouse-wheel
name="fiat"
ng-attr-placeholder="{{'Amount'}}"
ng-model="fiat"
autocomplete="off"
ng-change="sell.getSellPrice(token, {'fiat': fiat})">
<a ng-show="!showAlternative"
class="postfix"
on-tap="showAlternative = true; qty = null; sell.sellPrice = null">BTC</a>
<a ng-show="showAlternative"
class="postfix"
on-tap="showAlternative = false; fiat = null; sell.sellPrice = null">USD</a>
</label>
</div>
<wallets ng-if="wallets[0]" wallets="wallets"></wallets>
<div class="text-center text-gray size-12 m20v" ng-show="!sell.gettingSellPrice && sell.sellPrice.qty">
Sell
<span ng-show="qty">{{sell.sellPrice.subtotal|currency:'':2}} {{sell.sellPrice.currency}} in Bitcoin</span>
<span ng-show="fiat">{{sell.sellPrice.qty}} BTC</span>
at {{sell.sellPrice.price|currency:'':2}} {{sell.sellPrice.currency}}/BTC
</div>
<div class="text-center text-gray size-12 m20b" ng-show="!sell.gettingSellPrice && !sell.sellPrice.qty">
(Enter the amount to get the exchange rate)
</div>
<div class="text-center text-gray size-12 m20b" ng-show="sell.gettingSellPrice">
...
</div>
<button class="button button-standard button-primary"
type="submit"
ng-disabled="limits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty">
Continue
</button>
</form>
</div>
<div ng-show="sell.show2faCodeInput && !sell.success">
<div class="m10t text-center">
{{sell.sellPrice.qty}} BTC &rarr; {{sell.sellPrice.subtotal|currency:'':2}} {{sell.sellPrice.currency}}
<p class="m20t">
A SMS containing a confirmation code was sent to your phone. <br>
Please, enter the code below
</p>
<form name="sellForm"
ng-submit="sell.createTx(token, permissions, twoFaCode)" novalidate>
<div class="list card">
<label class="item item-input">
<input type="number" ng-model="twoFaCode" placeholder="2FA Code" required ignore-mouse-wheel>
</label>
</div>
<button class="button button-standard button-primary"
type="submit"
ng-disabled="sellForm.$invalid ">
Sell
</button>
</form>
<p class="m10t size-12 text-gray padding">
Bitcoins will be immediately sent from your wallet to Glidera. Fiat will be deposited in your bank account in 4-6 business days.
</p>
</div>
</div>
<div class="text-center padding" ng-show="sell.success">
<h1>Sale initiated</h1>
<p class="text-gray">
A transfer has been initiated to your bank account and should arrive in 4-6 business days.
</p>
<button class="button button-standard button-primary" ui-sref="tabs.buyandsell.glidera">OK</button>
</div>
</ion-content>
</ion-view>