Skip to content

Commit

Permalink
Merge pull request #263 from xenohunter/master
Browse files Browse the repository at this point in the history
USD gateway and small fixes
  • Loading branch information
Phil Filippak authored Jun 20, 2017
2 parents c64a72c + 216e50a commit 9dd92ef
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 35 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "waves-lite-client",
"version": "0.4.25",
"version": "0.4.26",
"dependencies": {
"angular": "~1.6.0",
"angular-route": "~1.6.0",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "waves-lite-client",
"version": "0.4.25",
"version": "0.4.26",
"description": "A lite client for the Waves platform",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "waves-lite-client",
"version": "0.4.25",
"version": "0.4.26",
"description": "A lite client for the Waves platform",
"license": "Apache-2.0",
"main": "main.js"
Expand Down
39 changes: 36 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ <h2 class="sectionHeader">DEPOSIT: EUR</h2>
</p>
<p class="dialog-text textCenter">
In order to get verified follow the link:<br/>
<a href="{{deposit.eur.verificationLink}}" target="_blank">{{deposit.eur.verificationLink}}</a>
<a href="{{deposit.fiat.verificationLink}}" target="_blank">{{deposit.fiat.verificationLink}}</a>
</p>
<br/>
<p class="dialog-text textCenter">
Expand All @@ -571,8 +571,41 @@ <h2 class="sectionHeader">DEPOSIT: EUR</h2>
tooltipster
tooltip-theme="tooltipster-theme1"
ngclipboard
data-clipboard-text="{{deposit.eur.email}}"
ngclipboard-success="clipboardOk()">{{deposit.eur.email}}</span>
data-clipboard-text="{{deposit.fiat.email}}"
ngclipboard-success="clipboardOk()">{{deposit.fiat.email}}</span>
<br/>
with your Waves wallet address as the subject
</p>
</div>
</div>

<div class="noDisp" ng-controller="walletDepositController as deposit">
<div id="deposit-usd-dialog" waves-dialog ok-button-caption="CLOSE" cancel-button-visible="false">
<h2 class="sectionHeader">DEPOSIT: USD</h2>
<p class="dialog-text textCenter">VERIFICATION</p>
<p class="dialog-text textCenter">
In order to deposit USD directly from your bank<br/>
account through wire transfer you MUST get verified<br/>
by our partner <a href="https://www.idnow.eu/" target="_blank">IDNow.eu</a>
</p>
<p class="dialog-text textCenter">
<a href="https://wavesplatform.userecho.com/topics/1304-list-of-accepted-countries-and-documents-for-verification/" target="_blank">List of eligible countries and IDs</a>
</p>
<p class="dialog-text textCenter">
In order to get verified follow the link:<br/>
<a href="{{deposit.fiat.verificationLink}}" target="_blank">{{deposit.fiat.verificationLink}}</a>
</p>
<br/>
<p class="dialog-text textCenter">
In case the link doesn't work for you,<br/>
please just send an email to<br/>
<span class="email"
title="Copy this address to the clipboard"
tooltipster
tooltip-theme="tooltipster-theme1"
ngclipboard
data-clipboard-text="{{deposit.fiat.email}}"
ngclipboard-success="clipboardOk()">{{deposit.fiat.email}}</span>
<br/>
with your Waves wallet address as the subject
</p>
Expand Down
19 changes: 14 additions & 5 deletions src/js/wallet/deposit.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

var DEFAULT_ERROR_MESSAGE = 'Connection is lost';

function WavesWalletDepositController ($scope, events, coinomatService, dialogService, notificationService,
applicationContext, bitcoinUriService) {
function WavesWalletDepositController($scope, events, coinomatService, dialogService,
notificationService, applicationContext, bitcoinUriService,
utilsService) {
var ctrl = this;

ctrl.btc = {
Expand All @@ -14,7 +15,7 @@
minimumAmount: 0.01
};

ctrl.eur = {
ctrl.fiat = {
verificationLink: 'https://go.idnow.de/coinomat/userdata/' + applicationContext.account.address,
email: '[email protected]'
};
Expand All @@ -34,10 +35,13 @@
ctrl.assetBalance = eventData.assetBalance;
ctrl.currency = ctrl.assetBalance.currency.displayName;

if (ctrl.assetBalance.currency === Currency.BTC) {
if (ctrl.assetBalance.currency === Currency.BTC && !utilsService.isTestnet()) {
// Show the BTC deposit popup only on mainnet
depositBTC();
} else if (ctrl.assetBalance.currency === Currency.EUR) {
depositEUR();
} else if (ctrl.assetBalance.currency === Currency.USD) {
depositUSD();
} else {
$scope.home.featureUnderDevelopment();
}
Expand Down Expand Up @@ -66,10 +70,15 @@
function depositEUR() {
dialogService.open('#deposit-eur-dialog');
}

function depositUSD() {
dialogService.open('#deposit-usd-dialog');
}
}

WavesWalletDepositController.$inject = ['$scope', 'wallet.events', 'coinomatService', 'dialogService',
'notificationService', 'applicationContext', 'bitcoinUriService'];
'notificationService', 'applicationContext', 'bitcoinUriService',
'utilsService'];

angular
.module('app.wallet')
Expand Down
13 changes: 11 additions & 2 deletions src/js/wallet/deposit.controller.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('Wallet.Deposit.Controller', function() {
var $rootScope, $q, scope, timeout, events, dialogService, controller, coinomatService, notificationService,
var $rootScope, $q, scope, timeout, events, dialogService, controller,
coinomatService, notificationService, utilsService,
applicationContext = {
account: {
address: '3N9UuGeWuDt9NfWbC5oEACHyRoeEMApXAeq',
Expand All @@ -12,6 +13,7 @@ describe('Wallet.Deposit.Controller', function() {

// Initialization of the module before each test case
beforeEach(module('waves.core'));
beforeEach(module('app.ui'));
beforeEach(module('app.wallet'));

// Injection of dependencies
Expand All @@ -22,13 +24,19 @@ describe('Wallet.Deposit.Controller', function() {
events = $injector.get('wallet.events');
dialogService = $injector.get('dialogService');
notificationService = $injector.get('notificationService');
utilsService = $injector.get('utilsService');
timeout = $timeout;
coinomatService = {
getDepositDetails: function () {}
};

spyOn(dialogService, 'open');

// Emulate mainnet so the popup may be shown
spyOn(utilsService, 'isTestnet').and.callFake(function () {
return false;
});

controller = $controller('walletDepositController', {
'$scope': scope,
'$timeout': timeout,
Expand All @@ -42,7 +50,8 @@ describe('Wallet.Deposit.Controller', function() {
'formattingService': $injector.get('formattingService'),
'notificationService': notificationService,
'applicationContext': applicationContext,
'coinomatService': coinomatService
'coinomatService': coinomatService,
'utilsService': utilsService
});
}));

Expand Down
36 changes: 15 additions & 21 deletions src/js/wallet/list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

function WavesWalletListController($scope, $interval, events, applicationContext,
apiService, transactionLoadingService, dialogService) {
var walletList = this;
var ctrl = this;
var refreshPromise;
var refreshDelay = 10 * 1000;

Expand All @@ -18,12 +18,12 @@
}

function findWalletByCurrency(currency) {
return _.find(walletList.wallets, function (w) {
return _.find(ctrl.wallets, function (w) {
return w.balance.currency === currency;
});
}

walletList.wallets = [
ctrl.wallets = [
{
balance: new Money(0, Currency.USD),
depositWith: Currency.USD
Expand All @@ -38,19 +38,15 @@
},
{
balance: new Money(0, Currency.WAVES),
depositWith: Currency.BTC,
leasingAvailable: true
},
{
balance: new Money(0, Currency.CNY),
depositWith: Currency.CNY
depositWith: Currency.BTC
}
];
walletList.transactions = [];
walletList.send = send;
walletList.withdraw = withdraw;
walletList.deposit = deposit;
walletList.depositFromCard = depositFromCard;

ctrl.transactions = [];
ctrl.send = send;
ctrl.withdraw = withdraw;
ctrl.deposit = deposit;
ctrl.depositFromCard = depositFromCard;

loadDataFromBackend();
patchCurrencyIdsForTestnet();
Expand Down Expand Up @@ -116,7 +112,7 @@
assetBalance.reissuable, assetBalance.quantity);
});

_.forEach(walletList.wallets, function (wallet) {
_.forEach(ctrl.wallets, function (wallet) {
var asset = applicationContext.cache.assets[wallet.balance.currency.id];
if (asset) {
wallet.balance = asset.balance;
Expand All @@ -134,13 +130,11 @@
return transactionLoadingService.refreshAssetCache(applicationContext.cache.assets, transactions);
})
.then(function () {
walletList.transactions = txArray;
ctrl.transactions = txArray;
});
}

/* AssetId substitution for testnet only.
Mainnet version uses default asset identifiers.
*/
// Assets ID substitution for testnet
function patchCurrencyIdsForTestnet() {
if ($scope.isTestnet()) {
Currency.EUR.id = '2xnE3EdpqXtFgCP156qt1AbyjpqdZ5jGjWo3CwTawcux';
Expand All @@ -152,8 +146,8 @@
}
}

WavesWalletListController.$inject = ['$scope', '$interval', 'wallet.events',
'applicationContext', 'apiService', 'transactionLoadingService', 'dialogService'];
WavesWalletListController.$inject = ['$scope', '$interval', 'wallet.events', 'applicationContext',
'apiService', 'transactionLoadingService', 'dialogService'];

angular
.module('app.wallet')
Expand Down

0 comments on commit 9dd92ef

Please sign in to comment.