Clean code

This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-05 18:10:57 -03:00
commit 420a063017
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
2 changed files with 3 additions and 8 deletions

View file

@ -98,7 +98,6 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
}; };
root.getOauthCodeUrl = function() { root.getOauthCodeUrl = function() {
// TODO CHANGE LIMIT BACK TO 1000 *************************************************
return credentials.HOST return credentials.HOST
+ '/oauth/authorize?response_type=code&client_id=' + '/oauth/authorize?response_type=code&client_id='
+ credentials.CLIENT_ID + credentials.CLIENT_ID
@ -106,7 +105,7 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
+ credentials.REDIRECT_URI + credentials.REDIRECT_URI
+ '&state=SECURE_RANDOM&scope=' + '&state=SECURE_RANDOM&scope='
+ credentials.SCOPE + credentials.SCOPE
+ '&meta[send_limit_amount]=1&meta[send_limit_currency]=USD&meta[send_limit_period]=day'; + '&meta[send_limit_amount]=1000&meta[send_limit_currency]=USD&meta[send_limit_period]=day';
}; };
root.getToken = function(code, cb) { root.getToken = function(code, cb) {
@ -486,7 +485,6 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
var accountId = data.accountId; var accountId = data.accountId;
storageService.getCoinbaseTxs(credentials.NETWORK, function(err, txs) { storageService.getCoinbaseTxs(credentials.NETWORK, function(err, txs) {
txs = txs ? JSON.parse(txs) : {}; txs = txs ? JSON.parse(txs) : {};
console.log('[coinbaseService.js:484] getCoinbaseTxs',err, txs); //TODO
coinbasePendingTransactions.data = lodash.isEmpty(txs) ? null : txs; coinbasePendingTransactions.data = lodash.isEmpty(txs) ? null : txs;
lodash.forEach(coinbasePendingTransactions.data, function(dataFromStorage, txId) { lodash.forEach(coinbasePendingTransactions.data, function(dataFromStorage, txId) {
@ -496,7 +494,6 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
(dataFromStorage.type == 'send' && dataFromStorage.status == 'completed')) (dataFromStorage.type == 'send' && dataFromStorage.status == 'completed'))
return; return;
root.getTransaction(accessToken, accountId, txId, function(err, tx) { root.getTransaction(accessToken, accountId, txId, function(err, tx) {
console.log('[coinbaseService.js:494] getTransaction to UPDATE from Coinbase',err, tx); //TODO
if (err || lodash.isEmpty(tx) || (tx.data && tx.data.error)) { if (err || lodash.isEmpty(tx) || (tx.data && tx.data.error)) {
_savePendingTransaction(dataFromStorage, { _savePendingTransaction(dataFromStorage, {
status: 'error', status: 'error',
@ -608,7 +605,7 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
var _sendToWallet = function(tx, accessToken, accountId, coinbasePendingTransactions) { var _sendToWallet = function(tx, accessToken, accountId, coinbasePendingTransactions) {
if (!tx) return; if (!tx) return;
var desc = 'To ' + appConfigService.nameCase + ' Wallet'; var desc = appConfigService.nameCase + ' Wallet';
var data = { var data = {
to: tx.toAddr, to: tx.toAddr,
amount: tx.amount.amount, amount: tx.amount.amount,
@ -616,7 +613,6 @@ angular.module('copayApp.services').factory('coinbaseService', function($http, $
description: desc description: desc
}; };
root.sendTo(accessToken, accountId, data, function(err, res) { root.sendTo(accessToken, accountId, data, function(err, res) {
console.log('[coinbaseService.js:591] SEND TO COPAY',err, res); //TODO
if (err) { if (err) {
_savePendingTransaction(tx, { _savePendingTransaction(tx, {
status: 'error', status: 'error',
@ -637,7 +633,6 @@ console.log('[coinbaseService.js:591] SEND TO COPAY',err, res); //TODO
return; return;
} }
root.getTransaction(accessToken, accountId, res.data.id, function(err, sendTx) { root.getTransaction(accessToken, accountId, res.data.id, function(err, sendTx) {
console.log('[coinbaseService.js:633] GET UPDATED TX', err, sendTx); //TODO
_savePendingTransaction(tx, { _savePendingTransaction(tx, {
remove: true remove: true
}, function(err) { }, function(err) {

View file

@ -105,7 +105,7 @@
<h2> <h2>
<span ng-show="tx.type == 'sell' && tx.status == 'completed'">Sold</span> <span ng-show="tx.type == 'sell' && tx.status == 'completed'">Sold</span>
<span ng-show="tx.type == 'buy' && tx.status == 'completed'">Bought</span> <span ng-show="tx.type == 'send' && tx.to && tx.status == 'completed'">Bought</span>
</h2> </h2>
<p> <p>
<span ng-if="tx.type == 'sell' || (tx.type == 'send' && tx.from)">-</span>{{tx.amount.amount.replace('-','')}} <span ng-if="tx.type == 'sell' || (tx.type == 'send' && tx.from)">-</span>{{tx.amount.amount.replace('-','')}}