little refactors
This commit is contained in:
parent
c474cca890
commit
879f16d521
3 changed files with 5 additions and 30 deletions
|
|
@ -58,9 +58,8 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
self.error = null;
|
self.error = null;
|
||||||
self.errorInfo = null;
|
self.errorInfo = null;
|
||||||
|
|
||||||
var currency_code = configService.getSync().amazon.testnet ? window.amazon_sandbox_currency_code : window.amazon_currency_code;
|
|
||||||
var dataSrc = {
|
var dataSrc = {
|
||||||
currency: currency_code,
|
currency: 'USD',
|
||||||
amount: $scope.fiat,
|
amount: $scope.fiat,
|
||||||
uuid: self.selectedWalletId
|
uuid: self.selectedWalletId
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, $ionicSideMenuDelegate, $httpBackend, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwcError, txFormatService, uxLanguage, glideraService, coinbaseService, amazonService, platformInfo, addressbookService, openURLService, ongoingProcess) {
|
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, $ionicScrollDelegate, $ionicPopup, $ionicSideMenuDelegate, $httpBackend, latestReleaseService, feeService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwcError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, openURLService, ongoingProcess) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var SOFT_CONFIRMATION_LIMIT = 12;
|
var SOFT_CONFIRMATION_LIMIT = 12;
|
||||||
|
|
@ -161,7 +161,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
|
|
||||||
self.initGlidera();
|
self.initGlidera();
|
||||||
self.initCoinbase();
|
self.initCoinbase();
|
||||||
self.initAmazon();
|
|
||||||
|
|
||||||
self.hideBalance();
|
self.hideBalance();
|
||||||
|
|
||||||
|
|
@ -1391,15 +1390,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
self.initAmazon = function() {
|
|
||||||
self.amazonEnabled = configService.getSync().amazon.enabled;
|
|
||||||
self.amazonTestnet = configService.getSync().amazon.testnet;
|
|
||||||
var network = self.amazonTestnet ? 'testnet' : 'livenet';
|
|
||||||
if (!self.amazonEnabled) return;
|
|
||||||
amazonService.setCredentials(network);
|
|
||||||
};
|
|
||||||
|
|
||||||
self.isInFocus = function(walletId) {
|
self.isInFocus = function(walletId) {
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
return fc && fc.credentials.walletId == walletId;
|
return fc && fc.credentials.walletId == walletId;
|
||||||
|
|
|
||||||
|
|
@ -5,30 +5,16 @@
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var file;
|
var file;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
file = fs.readFileSync('./amazon.json', 'utf8');
|
file = fs.readFileSync('./amazon.json', 'utf8');
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var json = JSON.parse(file);
|
var json = JSON.parse(file);
|
||||||
console.log('Amazon Partner ID: ' + json.production.partner_id);
|
|
||||||
|
|
||||||
var content = 'window.amazon_sandbox_access_key="' + json.sandbox.access_key + '";';
|
|
||||||
content = content + '\nwindow.amazon_sandbox_secret_key="' + json.sandbox.secret_key + '";';
|
|
||||||
content = content + '\nwindow.amazon_sandbox_partner_id="' + json.sandbox.partner_id + '";';
|
|
||||||
content = content + '\nwindow.amazon_sandbox_currency_code="' + json.sandbox.currency_code + '";';
|
|
||||||
content = content + '\nwindow.amazon_sandbox_region="' + json.sandbox.region + '";';
|
|
||||||
content = content + '\nwindow.amazon_sandbox_endpoint="' + json.sandbox.endpoint + '";';
|
|
||||||
content = content + '\nwindow.amazon_sandbox_bitpay_api_token="' + json.sandbox.bitpay_api_token + '";';
|
content = content + '\nwindow.amazon_sandbox_bitpay_api_token="' + json.sandbox.bitpay_api_token + '";';
|
||||||
content = content + '\nwindow.amazon_sandbox_bitpay_api_url="' + json.sandbox.bitpay_api_url + '";';
|
content = content + '\nwindow.amazon_sandbox_bitpay_api_url="' + json.sandbox.bitpay_api_url + '";';
|
||||||
content = content + '\nwindow.amazon_access_key="' + json.production.access_key + '";';
|
|
||||||
content = content + '\nwindow.amazon_secret_key="' + json.production.secret_key + '";';
|
|
||||||
content = content + '\nwindow.amazon_partner_id="' + json.production.partner_id + '";';
|
|
||||||
content = content + '\nwindow.amazon_currency_code="' + json.production.currency_code + '";';
|
|
||||||
content = content + '\nwindow.amazon_region="' + json.production.region + '";';
|
|
||||||
content = content + '\nwindow.amazon_endpoint="' + json.production.endpoint + '";';
|
|
||||||
content = content + '\nwindow.amazon_bitpay_api_token="' + json.production.bitpay_api_token + '";';
|
content = content + '\nwindow.amazon_bitpay_api_token="' + json.production.bitpay_api_token + '";';
|
||||||
content = content + '\nwindow.amazon_bitpay_api_url="' + json.production.bitpay_api_url + '";';
|
content = content + '\nwindow.amazon_bitpay_api_url="' + json.production.bitpay_api_url + '";';
|
||||||
fs.writeFileSync("./src/js/amazon.js", content);
|
fs.writeFileSync("./src/js/amazon.js", content);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue