This commit is contained in:
Gustavo Maximiliano Cortez 2016-08-24 11:33:43 -03:00
commit ecdc3d2057
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
19 changed files with 1127 additions and 931 deletions

View file

@ -1,24 +0,0 @@
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="tabs.home">
Close
</button>
</ion-nav-buttons>
<ion-nav-title translate>Buy and sell</ion-nav-title>
</ion-nav-bar>
<ion-content>
<ion-list>
<ion-item class="item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="glidera">
<img src="img/glidera-logo.png" width="100">
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
<ion-item class="item-remove-animate item-icon-right" type="item-text-wrap" ui-sref="coinbase">
<img src="img/coinbase-logo.png" width="100">
<i class="icon ion-chevron-right icon-accessory"></i>
</ion-item>
</ion-list>
</ion-content>
</ion-view>

View file

@ -1,28 +1,31 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Buy'; goBackToState = 'glidera'; noColor = true">
</div>
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="glidera.main">
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
<ion-nav-title>Buy</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="buyGlideraController as buy" ng-init="init()">
<div class="content glidera" ng-controller="buyGlideraController as buy">
<div ng-show="index.glideraLimits && !buy.show2faCodeInput && !buy.success">
<h4 class="title m0 text-left">
<span class="text-light">Daily buy limit</span>:
{{index.glideraLimits.dailyBuy|currency:'':2}} {{index.glideraLimits.currency}}
(remaining {{index.glideraLimits.dailyBuyRemaining|currency:'':2}} {{index.glideraLimits.currency}})
<br>
<span class="text-light">Monthly buy limit</span>:
{{index.glideraLimits.monthlyBuy|currency:'':2}} {{index.glideraLimits.currency}}
(remaining {{index.glideraLimits.monthlyBuyRemaining|currency:'':2}} {{index.glideraLimits.currency}})
</h4>
<div class="box-notification text-center size-12 text-warning" ng-show="network == 'testnet'">
<i class="fi-info"></i>
Testnet wallets only work with Glidera Sandbox Accounts
</div>
<div class="row m20t">
<div class="columns">
<h5 class="padding" 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}})
</h5>
<div class="box-notification m20b" ng-show="index.glideraLimits.transactDisabledPendingFirstTransaction && !buy.success">
<div class="box-notification m20b" ng-show="limits.transactDisabledPendingFirstTransaction && !buy.success">
<span class="text-warning">
This operation was disabled because you have a pending first transaction
</span>
@ -30,38 +33,55 @@
<div ng-show="!buy.show2faCodeInput && !buy.success">
<form name="buyPriceForm"
ng-submit="buy.get2faCode(index.glideraToken)" novalidate>
<form name="buyPriceForm" ng-if="token"
ng-submit="buy.get2faCode(token)" novalidate>
<div ng-if="index.glideraToken"
ng-init="buy.init(index.glideraTestnet)"
ng-click="openWalletsModal(buy.allWallets)">
<label>Wallet</label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="buy.selectedWalletId"
<div class="list">
<label class="item item-input item-stacked-label">
<span class="input-label">Wallet</span>
<input type="text"
id="address"
name="address"
ng-disabled="buy.selectedWalletId"
ng-attr-placeholder="{{'Choose your destination wallet'}}"
ng-model="buy.selectedWalletName" required>
<a class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>
<a on-tap="openWalletsModal(buy.allWallets)">
<i class="icon ion-briefcase size-18"></i>
</a>
</label>
<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>
</div>
<label>Amount in {{showAlternative ? 'USD' : 'BTC'}}</label>
<div class="input">
<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(index.glideraToken, {'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(index.glideraToken, {'fiat': fiat})">
<a ng-show="!showAlternative" class="postfix"
ng-click="showAlternative = true; qty = null; buy.buyPrice = null">BTC</a>
<a ng-show="showAlternative" class="postfix"
ng-click="showAlternative = false; fiat = null; buy.buyPrice = null">USD</a>
<div class="text-center text-gray size-12 m20b" ng-show="!buy.gettingBuyPrice && buy.buyPrice.qty">
Buy
@ -77,30 +97,34 @@
...
</div>
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Continue'}}"
ng-disabled="index.glideraLimits.transactDisabledPendingFirstTransaction || !buy.buyPrice.qty ||
!buy.selectedWalletId || buy.loading">
</div>
<button class="button button-block"
type="submit"
ng-disabled="limits.transactDisabledPendingFirstTransaction || !buy.buyPrice.qty || !buy.selectedWalletId || 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
{{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(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
<input type="number" ng-model="twoFaCode" required ignore-mouse-wheel>
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Buy'}}" ng-disabled="buyForm.$invalid || buy.loading">
ng-submit="buy.sendRequest(token, permissions, twoFaCode)" novalidate>
<div class="list">
<label class="item item-input">
<input type="number" ng-model="twoFaCode" placeholder="2FA Code" required ignore-mouse-wheel>
</label>
</div>
<button class="button button-block"
type="submit" ng-disabled="buyForm.$invalid || buy.loading">
Buy
</button>
</form>
<p class="m10t size-12 text-gray">
Fiat will be immediately withdrawn from your bank account. The bitcoins will be purchased and deposited to your wallet ({{index.walletName}}) in 2-4 business days.
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>
@ -115,9 +139,7 @@
A transfer has been initiated from your bank account. Your bitcoins should arrive to your wallet in 2-4 business days.
</p>
<button class="outline dark-gray round expand" href ui-sref="glidera">OK</button>
<button class="button button-block" ui-sref="glidera.main">OK</button>
</div>
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>
</ion-content>
</ion-view>

View file

@ -1,53 +1,53 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Buy & Sell Bitcoin'; closeToHome = true; noColor = true">
</div>
<div class="content glidera p20b" ng-controller="glideraController as glidera">
<div class="row">
<div class="m20b box-notification" ng-if="index.glideraError">
<div class="text-warning">
<span>{{index.glideraError}}</span>
</div>
</div>
<div class="m10t text-center" ng-show="index.glideraError">
<button
class="dark-gray outline round tiny"
ng-show="index.glideraError.indexOf('Forbidden') == 40"
ng-click="index.glideraToken = null; index.glideraError = null">
Request a new token
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="tabs.home">
Close
</button>
<div ng-show="index.glideraError.indexOf('Forbidden') != 40">
<button
class="dark-gray outline round tiny"
ng-click="index.initGlidera(index.glideraToken)">
Retry
</button>
<div class="m20t size-12">
<a class="text-gray" href ui-sref="preferencesGlidera">Preferences</a>
</div>
</div>
</div>
</div>
</ion-nav-buttons>
<ion-nav-title>Glidera</ion-nav-title>
</ion-nav-bar>
<div ng-if="!index.glideraToken && !index.glideraError"
class="row">
<div class="box-notification text-center size-12 text-warning" ng-show="index.glideraTestnet">
<ion-content ng-controller="glideraController as glidera" ng-init="init()">
<div class="box-notification text-center size-12 text-warning" ng-show="network == 'testnet'">
<i class="fi-info"></i>
Testnet wallets only work with Glidera Sandbox Accounts
</div>
<div class="columns" ng-init="showOauthForm = false">
<div class="text-center m20v">
<img src="img/glidera-logo.png" ng-click="index.updateGlidera(index.glideraToken, index.glideraPermissions)" width="200">
<div class="m20b box-notification" ng-if="error">
<div class="text-warning">
<span>{{error}}</span>
</div>
</div>
<div class="m10t text-center" ng-show="error">
<button
class="button"
ng-show="error.indexOf('Forbidden') == 40"
ng-click="token = null; error = null">
Request a new token
</button>
<div ng-show="error.indexOf('Forbidden') != 40">
<button
class="button"
ng-click="init(token)">
Retry
</button>
<div class="m20t size-12">
<a class="text-gray" href ui-sref="glidera.preferences">Preferences</a>
</div>
</div>
</div>
<div ng-if="!token && !error">
<div ng-init="showOauthForm = false">
<div class="text-center m20b">
<img src="img/glidera-logo.png" ng-click="update(token, permissions)" width="200">
</div>
<div class="text-center small-10 small-centered columns" ng-show="!showOauthForm">
<p class="m10b">You can buy and sell Bitcoin with a US bank account directly in Copay.</p>
<p class="m20t text-gray size-12 text-left">
<p class="m20t padding text-gray size-12 text-left">
DISCLOSURE.<br>
Glidera Inc. (Glidera) is providing the service of buying or selling bitcoins to Copay users. To enable this
service, Glidera has registered with US Treasury Departments FinCEN as a Money Service Business
@ -59,128 +59,117 @@
<p class="m20t text-gray size-12">Connect your Glidera account to get started</p>
<a class="button light-gray outline round small"
ng-click="$root.openExternalLink(glidera.getAuthenticateUrl(), '_system'); showOauthForm = true">
<button class="button"
ng-click="openExternalLink(glidera.getAuthenticateUrl(), '_system'); showOauthForm = true">
Connect to Glidera
</a>
<div>
</button>
<div class="m10t">
<a href ng-click="showOauthForm = true" class="text-gray size-12">
Do you already have the Oauth Code?
</a>
</div>
</div>
<div class="text-center" ng-show="showOauthForm">
<div class="text-left box-notification size-12 text-warning" ng-show="glidera.error">
{{glidera.error}}
<div ng-show="showOauthForm">
<div class="text-left box-notification size-12 text-warning" ng-show="error">
{{error}}
</div>
<form name="oauthCodeForm" ng-submit="glidera.submitOauthCode(code)" novalidate>
<label>OAuth Code</label>
<input type="text" ng-model="code" ng-disabled="glidera.loading"
<div class="list">
<label class="item item-input item-stacked-label">
<span class="input-label">OAuth Code</span>
<input type="text"
ng-model="code"
ng-attr-placeholder="{{'Paste the authorization code here'}}" required>
</label>
</div>
<div class="row">
<div class="col">
<input type="button"
value="Cancel"
class="button button-block"
ng-click="showOauthForm = false; error = null">
</div>
<div class="col">
<input
class="button expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="Get started" ng-disabled="oauthCodeForm.$invalid || glidera.loading">
class="button button-block"
type="submit"
value="Get started"
ng-disabled="oauthCodeForm.$invalid">
</div>
</div>
</form>
<button class="button light-gray expand outline round"
ng-click="showOauthForm = false; index.glideraError = null; glidera.error = null">
<i class="fi-arrow-left"></i> <span class="tu">Back</span>
</button>
</div>
</div>
</div>
<div ng-if="index.glideraToken && index.glideraPermissions">
<div class="p20v text-center white">
<img src="img/glidera-logo.png" ng-click="index.updateGlidera(index.glideraToken, index.glideraPermissions)" width="100">
<div ng-if="token && permissions">
<div class="p20v text-center">
<img src="img/glidera-logo.png" ng-click="update(token, permissions)" width="100">
</div>
<div class="sub-header" href ui-sref="preferencesGlidera">
<div class="left">
<div ng-show="!index.glideraPersonalInfo && !index.glideraEmail">
Preferences
</div>
<div ng-show="index.glideraPersonalInfo" class="size-12">
<b>
{{index.glideraPersonalInfo.firstName}} {{index.glideraPersonalInfo.lastName}}
</b>
</div>
<div class="size-12" ng-show="index.glideraEmail">
{{index.glideraEmail}}
</div>
</div>
<div class="right">
<div class="pointer m5t">
<i class="fi-widget size-16 text-gray"></i>
<span class="right text-gray">
<i class="icon-arrow-right3 size-24 right"></i>
<div class="list">
<a class="item item-icon-left" href ui-sref="glidera.preferences">
<i class="icon ion-gear-a"></i>
<span ng-show="personalInfo">{{personalInfo.firstName}} {{personalInfo.lastName}}</span>
<span class="item-note" ng-show="email">
{{email}}
</span>
</a>
</div>
</div>
</div>
<div class="row">
<div class="text-center columns small-8 small-centered m30v size-12"
ng-show="index.glideraStatus && !index.glideraStatus.userCanTransact">
<div class="padding">
<div class="text-center m30v size-12"
ng-show="status && !status.userCanTransact">
<h4 class="text-bold"> Complete Setup</h4>
<div>Your Glidera account is not ready to transact. Please, verify it at <b>Glidera.io</b></div>
<a class="button m20t light-gray outline round tiny"
ng-init="glideraUrl = index.glideraTestnet ? 'https://sandbox.glidera.io/login' :
<a class="button"
ng-init="glideraUrl = network == 'testnet' ? 'https://sandbox.glidera.io/login' :
'https://glidera.io/login'"
ng-click="$root.openExternalLink(glideraUrl)">
ng-click="openExternalLink(glideraUrl)">
Go to Glidera
</a>
</div>
</div>
</div>
<ul class="no-bullet m0 size-14"
ng-show="index.glideraStatus && index.glideraStatus.userCanTransact">
<li ng-show="index.glideraStatus.userCanBuy"
class="line-b line-t p20 pointer"
href ui-sref="buyGlidera">
<div class="list"
ng-show="status && status.userCanTransact">
<a ng-show="status.userCanBuy"
class="item item-avatar"
href ui-sref="glidera.buy">
<img src="img/buy-bitcoin.svg" alt="buy bitcoin" width="40">
<span class="m10 text-normal text-bold">Buy Bitcoin</span>
<span class="right text-gray">
<i class="icon-arrow-right3 size-24 right"></i>
</span>
</li>
<li class="line-b p20 pointer"
ng-show="index.glideraStatus.userCanSell"
href ui-sref="sellGlidera">
Buy Bitcoin
</a>
<a class="item item-avatar"
ng-show="status.userCanSell"
href ui-sref="glidera.sell">
<img src="img/sell-bitcoin.svg" alt="buy bitcoin" width="40">
<span class="m10 text-normal text-bold">Sell Bitcoin</span>
<span class="right text-gray">
<i class="icon-arrow-right3 size-24 right"></i>
</span>
</li>
</ul>
Sell Bitcoin
</a>
</div>
<div ng-show="index.glideraPermissions.transaction_history">
<div ng-show="permissions.transaction_history">
<h4>Activity</h4>
<div ng-show="index.glideraTxs.length == 0 "
<div ng-show="txs.length == 0 "
class="size-12 p10 text-center text-gray">
No activity in your account
</div>
<div ng-repeat="tx in index.glideraTxs"
ng-click="glidera.openTxModal(index.glideraToken, tx)"
class="row collapse last-transactions-content">
<div class="large-3 medium-3 small-3 columns">
<div class="list">
<a ng-repeat="tx in txs"
ng-click="glidera.openTxModal(token, tx)"
class="item item-avatar">
<img src="img/bought.svg" alt="bought" width="39" ng-show="tx.type == 'BUY' && tx.status == 'COMPLETE'">
<img src="img/bought-pending.svg" alt="bought" width="33" ng-show="tx.type == 'BUY' && tx.status == 'PROCESSING'">
<img src="img/sold.svg" alt="bought" width="39" ng-show="tx.type == 'SELL' && tx.status == 'COMPLETE'">
<img src="img/sold-pending.svg" alt="bought" width="33" ng-show="tx.type == 'SELL' && tx.status == 'PROCESSING'">
</div>
<div class="large-4 medium-4 small-4 columns">
<div class="size-14">
<h2>
<span ng-show="tx.type == 'BUY'">Bought</span>
<span ng-show="tx.type == 'SELL'">Sold</span>
<b>{{tx.qty}}</b> BTC
</div>
<span class="size-14 text-bold">
</h2>
<p>
{{tx.subtotal|currency:'':2}} {{tx.currency}}
</span>
</div>
<div class="large-4 medium-4 small-4 columns text-right">
</p>
<div class="right">
<div class="m5t size-12 text-gray">
<div ng-show="tx.status == 'COMPLETE'">
<time ng-if="tx.transactionDate">{{tx.transactionDate | amTimeAgo}}</time>
@ -190,12 +179,9 @@
</div>
</div>
</div>
<div class="large-1 medium-1 small-1 columns text-right">
<i class="icon-arrow-right3 size-18"></i>
</a>
</div>
</div>
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>
</ion-content>
</ion-view>

View file

@ -1,18 +1,14 @@
<ion-modal-view ng-controller="glideraConfirmationController">
<div class="m20tp text-center">
<div class="row">
<ion-modal-view>
<ion-content ng-controller="glideraConfirmationController">
<div class="text-center">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Glidera account?</h1>
<p class="text-gray p20h">You will need to log back in to buy or sell bitcoin in Copay.</p>
<div class="large-6 medium-6 small-6 columns">
<button class="button light-gray expand outline round" ng-click="cancel()">
<i class="fi-arrow-left"></i> <span class="tu">Back</span>
<button class="button" ng-click="cancel()">
Cancel
</button>
<button class="button" ng-click="ok()">
Log out
</button>
</div>
<div class="large-6 medium-6 small-6 columns">
<button class="button warning expand round" ng-click="ok()">
<span>Log out</span>
</button>
</div>
</div>
</div>
</ion-content>
</ion-modal-view>

View file

@ -1,12 +1,10 @@
<ion-modal-view ng-controller="glideraTxDetailsController">
<ion-header-bar align-title="center" class="tab-bar">
<div class="left-small">
<a ng-click="cancel()">
<i class="icon-arrow-left3 icon-back"></i>
<span class="text-back">Back</span>
</a>
</div>
<h1 class="title ellipsis" translate>Details</h1>
<button class="button button-clear button-positive"
ng-click="cancel()">
Close
</button>
<h1 class="title" translate>Details</h1>
</ion-header-bar>
<ion-content>

View file

@ -1,266 +1,278 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Preferences'; goBackToState = 'glidera'; noColor = true">
</div>
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="glidera.main">
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
<ion-nav-title>Preferences</ion-nav-title>
</ion-nav-bar>
<div class="content preferences" ng-controller="preferencesGlideraController as glidera">
<ion-content ng-controller="preferencesGlideraController" ng-init="init()">
<ul ng-if="index.glideraToken" class="no-bullet m0">
<h4 class="title m0">Permissions</h4>
<li>
<ul ng-if="token" class="list">
<div class="item item-divider">
Permissions
</div>
<li class="item">
<span>Email</span>
<span class="right text-gray">
{{index.glideraPermissions.view_email_address}}
<span class="item-note">
{{permissions.view_email_address}}
</span>
</li>
<li>
<li class="item">
<span>Personal Information</span>
<span class="right text-gray">
{{index.glideraPermissions.personal_info}}
<span class="item-note">
{{permissions.personal_info}}
</span>
</li>
<li>
<li class="item">
<span>Buy/Sell</span>
<span class="right text-gray">
{{index.glideraPermissions.transact}}
<span class="item-note">
{{permissions.transact}}
</span>
</li>
<li>
<li class="item">
<span>Transaction History</span>
<span class="right text-gray">
{{index.glideraPermissions.transaction_history}}
<span class="item-note">
{{permissions.transaction_history}}
</span>
</li>
</ul>
<ul ng-if="index.glideraPermissions.view_email_address"
ng-init="glidera.getEmail(index.glideraToken)"
class="no-bullet m0">
<h4 class="title m0">Email</h4>
<li>
<ul ng-if="permissions.view_email_address"
class="list">
<div class="item item-divider">
Email
</div>
<li class="item">
<span>Email</span>
<span class="right text-gray">
{{glidera.email.email}}
<span class="item-note">
{{email.email}}
</span>
</li>
<li>
<li class="item">
<span>Active</span>
<span class="right text-gray">
{{glidera.email.userEmailIsSetup}}
<span class="item-note">
{{email.userEmailIsSetup}}
</span>
</li>
</ul>
<ul ng-if="index.glideraPermissions.personal_info"
ng-init="glidera.getPersonalInfo(index.glideraToken)"
class="no-bullet m0">
<h4 class="title m0">Personal Information</h4>
<ul ng-if="permissions.personal_info"
class="list">
<div class="item item-divider">
Personal Information
</div>
<li>
<li class="item">
<span>First Name</span>
<span class="right text-gray">
{{glidera.personalInfo.firstName}}
<span class="item-note">
{{personalInfo.firstName}}
</span>
</li>
<li>
<li class="item">
<span>Middle Name</span>
<span class="right text-gray">
{{glidera.personalInfo.middleName}}
<span class="item-note">
{{personalInfo.middleName}}
</span>
</li>
<li>
<li class="item">
<span>Last Name</span>
<span class="right text-gray">
{{glidera.personalInfo.lastName}}
<span class="item-note">
{{personalInfo.lastName}}
</span>
</li>
<li>
<li class="item">
<span>Birth Date</span>
<span class="right text-gray">
{{glidera.personalInfo.birthDate}}
<span class="item-note">
{{personalInfo.birthDate}}
</span>
</li>
<li>
<li class="item">
<span>Address 1</span>
<span class="right text-gray">
{{glidera.personalInfo.address1}}
<span class="item-note">
{{personalInfo.address1}}
</span>
</li>
<li>
<li class="item">
<span>Address 2</span>
<span class="right text-gray">
{{glidera.personalInfo.address2}}
<span class="item-note">
{{personalInfo.address2}}
</span>
</li>
<li>
<li class="item">
<span>City</span>
<span class="right text-gray">
{{glidera.personalInfo.city}}
<span class="item-note">
{{personalInfo.city}}
</span>
</li>
<li>
<li class="item">
<span>State</span>
<span class="right text-gray">
{{glidera.personalInfo.state}}
<span class="item-note">
{{personalInfo.state}}
</span>
</li>
<li>
<li class="item">
<span>ZIP Code</span>
<span class="right text-gray">
{{glidera.personalInfo.zipCode}}
<span class="item-note">
{{personalInfo.zipCode}}
</span>
</li>
<li>
<li class="item">
<span>Country</span>
<span class="right text-gray">
{{glidera.personalInfo.countryCode}}
<span class="item-note">
{{personalInfo.countryCode}}
</span>
</li>
<li>
<li class="item">
<span>Occupation</span>
<span class="right text-gray">
{{glidera.personalInfo.occupation}}
<span class="item-note">
{{personalInfo.occupation}}
</span>
</li>
<li>
<li class="item">
<span>Basic Information State</span>
<span class="right text-gray">
{{glidera.personalInfo.basicInfoState}}
<span class="item-note">
{{personalInfo.basicInfoState}}
</span>
</li>
</ul>
<ul ng-if="index.glideraToken" ng-init="glidera.getStatus(index.glideraToken)"
class="no-bullet m0">
<h4 class="title m0">Status</h4>
<ul ng-if="token"
class="list">
<div class="item item-divider">
Status
</div>
<li>
<li class="item">
<span>Buy/Sell</span>
<span class="right text-gray">
{{glidera.status.userCanTransact}}
<span class="item-note">
{{status.userCanTransact}}
</span>
</li>
<li>
<li class="item">
<span>Buy</span>
<span class="right text-gray">
{{glidera.status.userCanBuy}}
<span class="item-note">
{{status.userCanBuy}}
</span>
</li>
<li>
<li class="item">
<span>Sell</span>
<span class="right text-gray">
{{glidera.status.userCanSell}}
<span class="item-note">
{{status.userCanSell}}
</span>
</li>
<li>
<li class="item">
<span>Email Is Setup</span>
<span class="right text-gray">
{{glidera.status.userEmailIsSetup}}
<span class="item-note">
{{status.userEmailIsSetup}}
</span>
</li>
<li>
<li class="item">
<span>Phone Is Setup</span>
<span class="right text-gray">
{{glidera.status.userPhoneIsSetup}}
<span class="item-note">
{{status.userPhoneIsSetup}}
</span>
</li>
<li>
<li class="item">
<span>Bank Account Is Setup</span>
<span class="right text-gray">
{{glidera.status.userBankAccountIsSetup}}
<span class="item-note">
{{status.userBankAccountIsSetup}}
</span>
</li>
<li>
<li class="item">
<span>Personal Information State</span>
<span class="right text-gray">
{{glidera.status.personalInfoState}}
<span class="item-note">
{{status.personalInfoState}}
</span>
</li>
<li>
<li class="item">
<span>Bank Account State</span>
<span class="right text-gray">
{{glidera.status.bankAccountState}}
<span class="item-note">
{{status.bankAccountState}}
</span>
</li>
<li>
<li class="item">
<span>Country</span>
<span class="right text-gray">
{{glidera.status.country}}
<span class="item-note">
{{status.country}}
</span>
</li>
</ul>
<ul ng-if="index.glideraToken" ng-init="glidera.getLimits(index.glideraToken)"
class="no-bullet m0">
<h4 class="title m0">Limits</h4>
<ul ng-if="token"
class="list">
<div class="item item-divider">
Limits
</div>
<li>
<li class="item">
<span>Daily Buy</span>
<span class="right text-gray">
{{glidera.limits.dailyBuy|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.dailyBuy|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Daily Sell</span>
<span class="right text-gray">
{{glidera.limits.dailySell|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.dailySell|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Monthly Buy</span>
<span class="right text-gray">
{{glidera.limits.monthlyBuy|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Monthly Sell</span>
<span class="right text-gray">
{{glidera.limits.monthlySell|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.monthlySell|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Daily Buy Remaining</span>
<span class="right text-gray">
{{glidera.limits.dailyBuyRemaining|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Daily Sell Remaining</span>
<span class="right text-gray">
{{glidera.limits.dailySellRemaining|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.dailySellRemaining|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Monthly Buy Remaining</span>
<span class="right text-gray">
{{glidera.limits.monthlyBuyRemaining|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Monthly Sell Remaining</span>
<span class="right text-gray">
{{glidera.limits.monthlySellRemaining|currency:'':2}} {{glidera.limits.currency}}
<span class="item-note">
{{limits.monthlySellRemaining|currency:'':2}} {{limits.currency}}
</span>
</li>
<li>
<li class="item">
<span>Buy/Sell Disabled (pending first transaction)</span>
<span class="right text-gray">
{{glidera.limits.transactDisabledPendingFirstTransaction}}
<span class="item-note">
{{limits.transactDisabledPendingFirstTransaction}}
</span>
</li>
</ul>
<ul class="no-bullet m0">
<h4 class="title m0">Account</h4>
<ul class="list">
<div class="item item-divider">
Account
</div>
<li ng-click="glidera.revokeToken(index.glideraTestnet)">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<span class="text-warning">Log out</span>
<li class="item" ng-click="revokeToken()">
<span class="assertive">Log out</span>
</li>
</ul>
<h4></h4>
</ion-content>
</ion-view>
</div>
<div class="extra-margin-bottom"></div>

View file

@ -1,66 +1,79 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Sell'; goBackToState = 'glidera'; noColor = true">
</div>
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="glidera.main">
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
<ion-nav-title>Sell</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="sellGlideraController as sell" ng-init="init()">
<div class="content glidera" ng-controller="sellGlideraController as sell">
<div ng-show="index.glideraLimits && !sell.show2faCodeInput && !sell.success">
<h4 class="title m0 text-left">
<h4 class="padding" ng-show="limits && !sell.show2faCodeInput && !sell.success">
<span class="text-light">Daily sell limit</span>:
{{index.glideraLimits.dailySell|currency:'':2}} {{index.glideraLimits.currency}}
(remaining {{index.glideraLimits.dailySellRemaining|currency:'':2}} {{index.glideraLimits.currency}})
{{limits.dailySell|currency:'':2}} {{limits.currency}}
(remaining {{limits.dailySellRemaining|currency:'':2}} {{limits.currency}})
<br>
<span class="text-light">Monthly sell limit</span>:
{{index.glideraLimits.monthlySell|currency:'':2}} {{index.glideraLimits.currency}}
(remaining {{index.glideraLimits.monthlySellRemaining|currency:'':2}} {{index.glideraLimits.currency}})
{{limits.monthlySell|currency:'':2}} {{limits.currency}}
(remaining {{limits.monthlySellRemaining|currency:'':2}} {{limits.currency}})
</h4>
</div>
<div class="row m20t">
<div class="columns">
<div class="box-notification m20b" ng-show="index.glideraLimits.transactDisabledPendingFirstTransaction">
<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-submit="sell.get2faCode(index.glideraToken)" novalidate>
<form name="sellPriceForm" ng-if="token"
ng-submit="sell.get2faCode(token)" novalidate>
<div ng-if="index.glideraToken"
ng-init="sell.init(index.glideraTestnet)"
ng-click="openWalletsModal(sell.allWallets)">
<label>Wallet</label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="sell.selectedWalletId"
<div class="list">
<label class="item item-input item-stacked-label">
<span class="input-label">Wallet</span>
<input type="text"
id="address"
name="address"
ng-disabled="sell.selectedWalletId"
ng-attr-placeholder="{{'Choose your source wallet'}}"
ng-model="sell.selectedWalletName" required>
<a class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>
<a on-tap="openWalletsModal(sell.allWallets)">
<i class="icon ion-briefcase size-18"></i>
</a>
</label>
<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>
</div>
<label><span>Amount in</span> {{showAlternative ? 'USD' : 'BTC'}}</label>
<div class="input">
<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(index.glideraToken, {'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(index.glideraToken, {'fiat': fiat})">
<a ng-show="!showAlternative" class="postfix"
ng-click="showAlternative = true; qty = null; sell.sellPrice = null">BTC</a>
<a ng-show="showAlternative" class="postfix"
ng-click="showAlternative = false; fiat = null; sell.sellPrice = null">USD</a>
<div class="text-center text-gray size-12 m20b" ng-show="!sell.gettingSellPrice && sell.sellPrice.qty">
Sell
@ -77,12 +90,11 @@
...
</div>
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Continue'}}"
ng-disabled="index.glideraLimits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty ||
!sell.selectedWalletId ">
</div>
<button class="button button-block"
type="submit"
ng-disabled="limits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty || !sell.selectedWalletId ">
Continue
</button>
</form>
</div>
<div ng-show="sell.show2faCodeInput && !sell.success">
@ -93,11 +105,17 @@
Please, enter the code below
</p>
<form name="sellForm"
ng-submit="sell.createTx(index.glideraToken, index.glideraPermissions, twoFaCode)" novalidate>
<input type="number" ng-model="twoFaCode" required ignore-mouse-wheel>
<input class="button black expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="{{'Sell'}}" ng-disabled="sellForm.$invalid ">
ng-submit="sell.createTx(token, permissions, twoFaCode)" novalidate>
<div class="list">
<label class="item item-input">
<input type="number" ng-model="twoFaCode" placeholder="2FA Code" required ignore-mouse-wheel>
</label>
</div>
<button class="button button-block"
type="submit"
ng-disabled="sellForm.$invalid ">
Sell
</button>
</form>
<p class="m10t size-12 text-gray">
Bitcoins will be immediately sent from your wallet to Glidera. Fiat will be deposited in your bank account in 4-6 business days.
@ -115,9 +133,8 @@
A transfer has been initiated to your bank account and should arrive in 4-6 business days.
</p>
<button class="outline dark-gray round expand"
ng-click="$root.go('glidera')">OK</button>
<button class="button button-block" ui-sref="glidera.main">OK</button>
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>
</ion-content>
</ion-view>

View file

@ -75,6 +75,18 @@
</div>
</div>
<div ng-show="glideraEnabled || coinbaseEnabled">
<h3>Buy & Sell Bitcoin</h3>
<div class="card">
<div ng-show="glideraEnabled" ui-sref="glidera.main" class="item">
<img src="img/glidera-logo.png" width="90">
</div>
<div ng-show="coinbaseEnabled" ui-sref="exchange.coinbase" class="item">
<img src="img/coinbase-logo.png" width="90">
</div>
</div>
</div>
<h3>Next steps </h3>
<div class="list card">
<ul class="pr">
@ -82,10 +94,6 @@
<i class="icon ion-card"></i>
BitPay Card
</li>
<li ng-show="buyAndSellEnabled" ui-sref="buyandsell" class="item item-icon-left">
<i class="icon ion-cash"></i>
Buy and Sell
</li>
<li ui-sref="amazon.main" class="item item-icon-left">
<i class="icon ion-ios-cart"></i>
Gift Cards

View file

@ -1,26 +1,89 @@
'use strict';
angular.module('copayApp.controllers').controller('buyGlideraController',
function($scope, $timeout, $ionicModal, profileService, addressService, glideraService, bwcError, lodash, ongoingProcess) {
function($scope, $timeout, $log, $ionicModal, profileService, walletService, glideraService, bwcError, lodash, ongoingProcess) {
var wallet;
var self = this;
this.show2faCodeInput = null;
this.error = null;
this.success = null;
this.init = function(testnet) {
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet');
$scope.init = function(accessToken) {
$scope.network = glideraService.getEnvironment();
var client = profileService.focusedClient;
if (client) {
$scope.token = accessToken;
$scope.error = 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) {
$scope.error = err;
return;
}
$scope.token = glidera.token;
$scope.permissions = glidera.permissions;
$scope.update({fullUpdate: true});
});
self.allWallets = profileService.getWallets({
network: $scope.network,
n: 1,
onlyComplete: true
});
if (lodash.isEmpty(self.allWallets)) return;
wallet = self.allWallets[0];
if (wallet) {
$timeout(function() {
self.selectedWalletId = client.credentials.walletId;
self.selectedWalletName = client.credentials.walletName;
self.selectedWalletId = wallet.credentials.walletId;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
}
};
$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;
});
}
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
@ -39,9 +102,9 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
$scope.$on('walletSelected', function(ev, walletId) {
$timeout(function() {
var client = profileService.getClient(walletId);
wallet = profileService.getClient(walletId);
self.selectedWalletId = walletId;
self.selectedWalletName = client.credentials.walletName;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
$scope.walletsModal.hide();
@ -87,7 +150,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
self.error = null;
ongoingProcess.set('Buying Bitcoin...', true);
$timeout(function() {
addressService.getAddress(self.selectedWalletId, false, function(err, walletAddr) {
walletService.getAddress(wallet, false, function(err, walletAddr) {
if (err) {
ongoingProcess.set('Buying Bitcoin...', false);
self.error = bwcError.cb(err, 'Could not create address');

View file

@ -1,33 +1,98 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraController',
function($rootScope, $scope, $timeout, $ionicModal, profileService, configService, storageService, glideraService, lodash, ongoingProcess, platformInfo) {
function($rootScope, $scope, $timeout, $ionicModal, $log, profileService, storageService, glideraService, lodash, ongoingProcess, platformInfo, nodeWebkit) {
if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
$scope.openExternalLink = function(url, target) {
if (platformInfo.isNW) {
nodeWebkit.openExternalLink(url);
} else {
target = target || '_blank';
var ref = window.open(url, target, 'location=no');
}
};
$scope.init = function(accessToken) {
$scope.network = glideraService.getEnvironment();
$scope.token = null;
$scope.error = 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) {
$scope.error = err;
return;
}
$scope.token = glidera.token;
$scope.permissions = glidera.permissions;
$scope.update({fullUpdate: true});
});
};
$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.getAuthenticateUrl = function() {
return glideraService.getOauthCodeUrl();
};
this.submitOauthCode = function(code) {
var self = this;
var glideraTestnet = configService.getSync().glidera.testnet;
var network = glideraTestnet ? 'testnet' : 'livenet';
ongoingProcess.set('connectingGlidera', true);
this.error = null;
$scope.error = null;
$timeout(function() {
glideraService.getToken(code, function(err, data) {
ongoingProcess.set('connectingGlidera', false);
if (err) {
self.error = err;
$scope.error = err;
$timeout(function() {
$scope.$apply();
}, 100);
} else if (data && data.access_token) {
storageService.setGlideraToken(network, data.access_token, function() {
$scope.$emit('Local/GlideraUpdated', data.access_token);
storageService.setGlideraToken($scope.network, data.access_token, function() {
$scope.init(data.access_token);
$timeout(function() {
$scope.$apply();
}, 100);

View file

@ -1,11 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraConfirmationController', function($scope, $timeout, storageService, applicationService) {
angular.module('copayApp.controllers').controller('glideraConfirmationController', function($scope, $timeout, $state, glideraService) {
$scope.ok = function() {
storageService.removeGlideraToken($scope.network, function() {
glideraService.removeToken(function() {
$timeout(function() {
applicationService.restart();
$state.go('glidera.main');
}, 100);
});
$scope.cancel();

View file

@ -1,43 +1,70 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesGlideraController',
function($scope, $timeout, $ionicModal, profileService, applicationService, glideraService, storageService) {
function($scope, $log, $ionicModal, ongoingProcess, glideraService) {
this.getEmail = function(token) {
var self = this;
glideraService.getEmail(token, function(error, data) {
self.email = data;
$scope.init = function(accessToken) {
$scope.network = glideraService.getEnvironment();
$scope.token = accessToken;
$scope.error = 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) {
$scope.error = err;
return;
}
$scope.token = glidera.token;
$scope.permissions = glidera.permissions;
$scope.update({fullUpdate: true});
});
};
this.getPersonalInfo = function(token) {
var self = this;
glideraService.getPersonalInfo(token, function(error, info) {
self.personalInfo = info;
$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.getStatus = function(token) {
var self = this;
glideraService.getStatus(token, function(error, data) {
self.status = data;
});
};
this.getLimits = function(token) {
var self = this;
glideraService.getLimits(token, function(error, limits) {
self.limits = limits;
});
};
this.revokeToken = function(testnet) {
$scope.network = testnet ? 'testnet' : 'livenet';
$scope.loading = false;
$scope.revokeToken = function() {
$ionicModal.fromTemplateUrl('views/modals/glidera-confirmation.html', {
scope: $scope,
animation: 'slide-in-up'
scope: $scope
}).then(function(modal) {
$scope.glideraConfirmationModal = modal;
$scope.glideraConfirmationModal.show();

View file

@ -1,38 +1,97 @@
'use strict';
angular.module('copayApp.controllers').controller('sellGlideraController',
function($rootScope, $scope, $timeout, $ionicModal, $log, configService, profileService, addressService, feeService, glideraService, bwcError, lodash, walletService, fingerprintService, ongoingProcess, go) {
function($rootScope, $scope, $timeout, $ionicModal, $log, profileService, glideraService, bwcError, lodash, walletService, fingerprintService, configService, ongoingProcess) {
var self = this;
var config = configService.getSync();
this.data = {};
this.show2faCodeInput = null;
this.success = null;
this.error = null;
var client;
var wallet;
var handleEncryptedWallet = function(client, cb) {
if (!walletService.isEncrypted(client)) return cb();
var handleEncryptedWallet = function(wallet, cb) {
if (!walletService.isEncrypted(wallet)) return cb();
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
if (err) return cb(err);
return cb(walletService.unlock(client, password));
return cb(walletService.unlock(wallet, password));
});
};
this.init = function(testnet) {
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1);
$scope.init = function(accessToken) {
$scope.network = glideraService.getEnvironment();
client = profileService.focusedClient;
if (client && client.credentials.m == 1) {
$scope.token = accessToken;
$scope.error = 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) {
$scope.error = err;
return;
}
$scope.token = glidera.token;
$scope.permissions = glidera.permissions;
$scope.update({fullUpdate: true});
});
self.allWallets = profileService.getWallets({
network: $scope.network,
n: 1,
onlyComplete: true
});
if (lodash.isEmpty(self.allWallets)) return;
wallet = self.allWallets[0];
if (wallet) {
$timeout(function() {
self.selectedWalletId = client.credentials.walletId;
self.selectedWalletName = client.credentials.walletName;
self.selectedWalletId = wallet.credentials.walletId;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
}
};
$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;
});
}
};
$scope.openWalletsModal = function(wallets) {
self.error = null;
@ -52,9 +111,9 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
$scope.$on('walletSelected', function(ev, walletId) {
$timeout(function() {
client = profileService.getClient(walletId);
wallet = profileService.getClient(walletId);
self.selectedWalletId = walletId;
self.selectedWalletName = client.credentials.walletName;
self.selectedWalletName = wallet.credentials.walletName;
$scope.$apply();
}, 100);
$scope.walletsModal.hide();
@ -98,16 +157,17 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
var self = this;
self.error = null;
var outputs = [];
var config = configService.getSync();
var configWallet = config.wallet;
var walletSettings = configWallet.settings;
if (!client) {
if (!wallet) {
self.error = 'No wallet selected';
return;
}
ongoingProcess.set('creatingTx', true);
addressService.getAddress(client.credentials.walletId, null, function(err, refundAddress) {
walletService.getAddress(wallet, null, function(err, refundAddress) {
if (!refundAddress) {
ongoingProcess.clear();
@ -142,36 +202,34 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
}
};
walletService.createTx(client, txp, function(err, createdTxp) {
walletService.createTx(wallet, txp, function(err, createdTxp) {
ongoingProcess.clear();
if (err) {
self.error = err.message ||  bwcError.msg(err);
return;
}
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
if (accept) {
fingerprintService.check(client, function(err) {
fingerprintService.check(wallet, function(err) {
if (err) {
self.error = err.message ||  bwcError.msg(err);
return;
}
handleEncryptedWallet(client, function(err) {
handleEncryptedWallet(wallet, function(err) {
if (err) {
self.error = err.message ||  bwcError.msg(err);
return;
}
ongoingProcess.set('signingTx', true);
walletService.publishTx(client, createdTxp, function(err, publishedTxp) {
walletService.publishTx(wallet, createdTxp, function(err, publishedTxp) {
if (err) {
ongoingProcess.clear();
self.error = err.message ||  bwcError.msg(err);
}
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
walletService.lock(client);
walletService.removeTx(client, signedTxp, function(err) {
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
walletService.lock(wallet);
walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err);
});
ongoingProcess.clear();
@ -192,22 +250,15 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
ongoingProcess.clear();
if (err) {
self.error = err.message ||  bwcError.msg(err);
$timeout(function() {
$scope.$emit('Local/GlideraError');
}, 100);
return;
}
self.success = data;
$scope.$emit('Local/GlideraTx');
$scope.update();
});
});
});
});
});
} else {
go.path('glidera');
}
});
});
});
});

View file

@ -162,10 +162,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
configService.whenAvailable(function() {
var config = configService.getSync();
var glideraEnabled = config.glidera.enabled;
var coinbaseEnabled = config.coinbase.enabled;
var isWindowsPhoneApp = platformInfo.isWP && isCordova;
$scope.buyAndSellEnabled = !isWindowsPhoneApp && (glideraEnabled || coinbaseEnabled);
$scope.glideraEnabled = config.glidera.enabled && !isWindowsPhoneApp;
$scope.coinbaseEnabled = config.coinbase.enabled && !isWindowsPhoneApp;
});
});

View file

@ -104,24 +104,20 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('uri', {
url: '/uri/:url',
needProfile: true,
views: {
'main': {
templateUrl: 'views/uri.html'
}
}
})
.state('uripayment', {
url: '/uri-payment/:url',
templateUrl: 'views/paymentUri.html',
views: {
'main': {
templateUrl: 'views/paymentUri.html',
},
},
needProfile: true
templateUrl: 'views/paymentUri.html'
})
.state('uriglidera', {
url: '/uri-glidera/:url',
templateUrl: 'views/glideraUri.html'
})
.state('uricoinbase', {
url: '/uri-coinbase/:url',
templateUrl: 'views/coinbaseUri.html'
})
/*
*
@ -528,27 +524,97 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*
* Glidera
*
*
*/
.state('uriglidera', {
url: '/uri-glidera/:url',
templateUrl: 'views/glideraUri.html'
})
.state('glidera', {
url: '/glidera',
abstract: true,
template: '<ion-nav-view name="glidera"></ion-nav-view>'
})
.state('glidera.main', {
url: '/main',
views: {
'glidera': {
templateUrl: 'views/glidera.html'
}
}
})
.state('buyGlidera', {
.state('glidera.buy', {
url: '/buy',
views: {
'glidera': {
templateUrl: 'views/buyGlidera.html'
}
}
})
.state('sellGlidera', {
.state('glidera.sell', {
url: '/sell',
views: {
'glidera': {
templateUrl: 'views/sellGlidera.html'
}
}
})
.state('preferencesGlidera', {
url: '/preferencesGlidera',
.state('glidera.preferences', {
url: '/preferences',
views: {
'glidera': {
templateUrl: 'views/preferencesGlidera.html'
}
}
})
/*
*
* Coinbase
*
*/
.state('coinbase', {
url: '/coinbase',
templateUrl: 'views/coinbase.html'
})
.state('preferencesCoinbase', {
url: '/preferencesCoinbase',
templateUrl: 'views/preferencesCoinbase.html'
})
.state('buyCoinbase', {
url: '/buycoinbase',
templateUrl: 'views/buyCoinbase.html'
})
.state('sellCoinbase', {
url: '/sellcoinbase',
templateUrl: 'views/sellCoinbase.html'
})
/*
*
* Amazon Gift Card
*
*/
.state('amazon', {
url: '/amazon',
abstract: true,
template: '<ion-nav-view name="amazon"></ion-nav-view>'
})
.state('amazon.main', {
url: '/main',
views: {
'amazon': {
templateUrl: 'views/amazon.html'
}
}
})
.state('amazon.buy', {
url: '/buy',
views: {
'amazon': {
templateUrl: 'views/buyAmazon.html'
}
}
})
/*
@ -577,70 +643,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
templateUrl: 'views/preferencesBitpayCard.html'
}
}
})
/*
*
* Coinbase
*
*/
.state('coinbase', {
url: '/coinbase',
templateUrl: 'views/coinbase.html'
})
.state('preferencesCoinbase', {
url: '/preferencesCoinbase',
templateUrl: 'views/preferencesCoinbase.html'
})
.state('uricoinbase', {
url: '/uri-coinbase/:url',
templateUrl: 'views/coinbaseUri.html'
})
.state('buyCoinbase', {
url: '/buycoinbase',
templateUrl: 'views/buyCoinbase.html'
})
.state('sellCoinbase', {
url: '/sellcoinbase',
templateUrl: 'views/sellCoinbase.html'
})
.state('buyandsell', {
url: '/buyandsell',
templateUrl: 'views/buyAndSell.html',
controller: function(platformInfo) {
if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
}
})
/*
*
* Amazon Gift Card
*
*/
.state('amazon', {
url: '/amazon',
abstract: true,
template: '<ion-nav-view name="amazon"></ion-nav-view>'
})
.state('amazon.main', {
url: '/main',
views: {
'amazon': {
templateUrl: 'views/amazon.html'
}
}
})
.state('amazon.buy', {
url: '/buy',
views: {
'amazon': {
templateUrl: 'views/buyAmazon.html'
}
}
});
})
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog) {

View file

@ -123,11 +123,6 @@ angular.module('copayApp.services').factory('configService', function(storageSer
configCache.colorFor = configCache.colorFor || {};
configCache.aliasFor = configCache.aliasFor || {};
// Glidera
// Disabled for testnet
configCache.glidera.testnet = false;
// Coinbase
// Disabled for testnet
configCache.coinbase.testnet = false;

View file

@ -4,11 +4,15 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
var root = {};
var credentials = {};
var isCordova = platformInfo.isCordova;
//
//
root.setCredentials = function(network) {
if (network == 'testnet') {
var _setCredentials = function() {
/*
* Development: 'testnet'
* Production: 'livenet'
*/
credentials.NETWORK = 'livenet';
if (credentials.NETWORK == 'testnet') {
credentials.HOST = 'https://sandbox.glidera.io';
if (isCordova) {
credentials.REDIRECT_URI = 'copay://glidera';
@ -33,11 +37,25 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
};
};
root.getEnvironment = function() {
_setCredentials();
return credentials.NETWORK;
};
root.getOauthCodeUrl = function() {
_setCredentials();
return credentials.HOST + '/oauth2/auth?response_type=code&client_id=' + credentials.CLIENT_ID + '&redirect_uri=' + credentials.REDIRECT_URI;
};
root.removeToken = function(cb) {
_setCredentials();
storageService.removeGlideraToken(credentials.NETWORK, function() {
return cb();
});
};
root.getToken = function(code, cb) {
_setCredentials();
var req = {
method: 'POST',
url: credentials.HOST + '/api/v1/oauth/token',
@ -64,6 +82,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
};
var _get = function(endpoint, token) {
_setCredentials();
return {
method: 'GET',
url: credentials.HOST + '/api/v1' + endpoint,
@ -176,6 +195,7 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
};
var _post = function(endpoint, token, twoFaCode, data) {
_setCredentials();
return {
method: 'POST',
url: credentials.HOST + '/api/v1' + endpoint,
@ -251,91 +271,39 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
});
};
root.init = function(accessToken) {
root.glideraEnabled = configService.getSync().glidera.enabled;
root.glideraTestnet = configService.getSync().glidera.testnet;
var network = root.glideraTestnet ? 'testnet' : 'livenet';
root.init = function(accessToken, cb) {
_setCredentials();
$log.debug('Init Glidera...');
root.glideraToken = null;
root.glideraError = null;
root.glideraPermissions = null;
root.glideraEmail = null;
root.glideraPersonalInfo = null;
root.glideraTxs = null;
root.glideraStatus = null;
if (!root.glideraEnabled) return;
root.setCredentials(network);
var glidera = {
token: null,
permissions: null
}
var getToken = function(cb) {
if (accessToken) {
cb(null, accessToken);
} else {
storageService.getGlideraToken(network, cb);
storageService.getGlideraToken(credentials.NETWORK, cb);
}
};
getToken(function(err, accessToken) {
if (err || !accessToken) return;
if (err || !accessToken) return cb();
else {
root.getAccessTokenPermissions(accessToken, function(err, p) {
if (err) {
root.glideraError = err;
return cb(err);
} else {
root.glideraToken = accessToken;
root.glideraPermissions = p;
root.update({
fullUpdate: true
});
glidera.token = accessToken;
glidera.permissions = p;
return cb(null, glidera);
}
});
}
});
};
root.update = function(opts) {
if (!root.glideraToken || !root.glideraPermissions) return;
var accessToken = root.glideraToken;
var permissions = root.glideraPermissions;
opts = opts || {};
root.getStatus(accessToken, function(err, data) {
root.glideraStatus = data;
});
root.getLimits(accessToken, function(err, limits) {
root.glideraLimits = limits;
});
if (permissions.transaction_history) {
root.getTransactions(accessToken, function(err, data) {
root.glideraTxs = data;
});
}
if (permissions.view_email_address && opts.fullUpdate) {
root.getEmail(accessToken, function(err, data) {
root.glideraEmail = data.email;
});
}
if (permissions.personal_info && opts.fullUpdate) {
root.getPersonalInfo(accessToken, function(err, data) {
root.glideraPersonalInfo = data;
});
}
};
configService.whenAvailable(function() {
$log.debug('Init Glidera Service...');
root.init();
});
$rootScope.$on('NewBlock', function() {    
root.update();   
});
return root;
});

View file

@ -67,7 +67,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
window.plugins.spinnerDialog.show(null, showName, true);
} else {
var tmpl = '<ion-spinner class="spinner-stable" icon="lines"></ion-spinner>' + showName;
var tmpl = '<div class="item-icon-left">' + showName + '<ion-spinner class="spinner-stable" icon="lines"></ion-spinner></div>';
$ionicLoading.show({
template: tmpl
});

View file

@ -1055,3 +1055,14 @@ input[type=number] {
}
}
/* Spinner */
.item-icon-left ion-spinner {
float: left;
margin-left: -3.2em;
margin-right: 1em;
margin-top: -0.2em;
height: 24px;
}