This commit is contained in:
Gustavo Maximiliano Cortez 2016-08-24 11:33:43 -03:00
parent ea3ea2686f
commit ecdc3d2057
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
19 changed files with 1183 additions and 987 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,123 +1,145 @@
<div <ion-view>
class="topbar-container" <ion-nav-bar class="bar-stable">
ng-include="'views/includes/topbar.html'" <ion-nav-buttons side="primary">
ng-init="titleSection='Buy'; goBackToState = 'glidera'; noColor = true"> <button class="button no-border" ui-sref="glidera.main">
</div> <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 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 ng-show="index.glideraLimits && !buy.show2faCodeInput && !buy.success"> <h5 class="padding" ng-show="limits && !buy.show2faCodeInput && !buy.success">
<h4 class="title m0 text-left">
<span class="text-light">Daily buy limit</span>: <span class="text-light">Daily buy limit</span>:
{{index.glideraLimits.dailyBuy|currency:'':2}} {{index.glideraLimits.currency}} {{limits.dailyBuy|currency:'':2}} {{limits.currency}}
(remaining {{index.glideraLimits.dailyBuyRemaining|currency:'':2}} {{index.glideraLimits.currency}}) (remaining {{limits.dailyBuyRemaining|currency:'':2}} {{limits.currency}})
<br> <br>
<span class="text-light">Monthly buy limit</span>: <span class="text-light">Monthly buy limit</span>:
{{index.glideraLimits.monthlyBuy|currency:'':2}} {{index.glideraLimits.currency}} {{limits.monthlyBuy|currency:'':2}} {{limits.currency}}
(remaining {{index.glideraLimits.monthlyBuyRemaining|currency:'':2}} {{index.glideraLimits.currency}}) (remaining {{limits.monthlyBuyRemaining|currency:'':2}} {{limits.currency}})
</h4> </h5>
</div>
<div class="row m20t"> <div class="box-notification m20b" ng-show="limits.transactDisabledPendingFirstTransaction && !buy.success">
<div class="columns"> <span class="text-warning">
This operation was disabled because you have a pending first transaction
</span>
</div>
<div class="box-notification m20b" ng-show="index.glideraLimits.transactDisabledPendingFirstTransaction && !buy.success"> <div ng-show="!buy.show2faCodeInput && !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>
<form name="buyPriceForm" <div class="list">
ng-submit="buy.get2faCode(index.glideraToken)" novalidate>
<div ng-if="index.glideraToken" <label class="item item-input item-stacked-label">
ng-init="buy.init(index.glideraTestnet)" <span class="input-label">Wallet</span>
ng-click="openWalletsModal(buy.allWallets)"> <input type="text"
<label>Wallet</label> id="address"
<div class="input"> name="address"
<input type="text" id="address" name="address" ng-disabled="buy.selectedWalletId" ng-disabled="buy.selectedWalletId"
ng-attr-placeholder="{{'Choose your destination wallet'}}" ng-attr-placeholder="{{'Choose your destination wallet'}}"
ng-model="buy.selectedWalletName" required> ng-model="buy.selectedWalletName" required>
<a class="postfix size-12 m0 text-gray"> <a on-tap="openWalletsModal(buy.allWallets)">
<i class="icon-wallet size-18"></i> <i class="icon ion-briefcase size-18"></i>
</a> </a>
</div> </label>
</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 <label class="item item-input item-stacked-label">
name="fiat" ng-attr-placeholder="{{'Amount'}}" <span class="input-label">Amount in {{showAlternative ? 'USD' : 'BTC'}}</span>
ng-model="fiat" autocomplete="off" ng-change="buy.getBuyPrice(index.glideraToken, {'fiat': fiat})"> <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})">
<a ng-show="!showAlternative" class="postfix" <input ng-show="showAlternative"
ng-click="showAlternative = true; qty = null; buy.buyPrice = null">BTC</a> type="number"
<a ng-show="showAlternative" class="postfix" id="fiat" ignore-mouse-wheel
ng-click="showAlternative = false; fiat = null; buy.buyPrice = null">USD</a> name="fiat"
ng-attr-placeholder="{{'Amount'}}"
ng-model="fiat"
autocomplete="off"
ng-change="buy.getBuyPrice(token, {'fiat': fiat})">
<div class="text-center text-gray size-12 m20b" ng-show="!buy.gettingBuyPrice && buy.buyPrice.qty"> <a ng-show="!showAlternative"
Buy class="postfix"
<span ng-show="qty">{{buy.buyPrice.subtotal|currency:'':2}} {{buy.buyPrice.currency}} in Bitcoin</span> on-tap="showAlternative = true; qty = null; buy.buyPrice = null">BTC</a>
<span ng-show="fiat">{{buy.buyPrice.qty}} BTC</span> <a ng-show="showAlternative"
at {{buy.buyPrice.price}} {{buy.buyPrice.currency}}/BTC class="postfix"
</div> on-tap="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"> </label>
(Enter the amount to get the exchange rate)
</div>
<div class="text-center text-gray size-12 m20b" ng-show="buy.gettingBuyPrice">
...
</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>
</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(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">
</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.
</p>
</div> </div>
</div>
<div class="box-notification m20b" ng-show="buy.error && !buy.success">
<span class="text-warning">
{{buy.error}}
</span>
</div>
<div class="text-center" 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="outline dark-gray round expand" href ui-sref="glidera">OK</button> <div class="text-center text-gray size-12 m20b" 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-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
<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">
<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 in 2-4 business days.
</p>
</div> </div>
</div> </div>
</div> <div class="box-notification m20b" ng-show="buy.error && !buy.success">
</div> <span class="text-warning">
<div class="extra-margin-bottom"></div> {{buy.error}}
</span>
</div>
<div class="text-center" 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-block" ui-sref="glidera.main">OK</button>
</div>
</ion-content>
</ion-view>

View File

@ -1,201 +1,187 @@
<ion-view>
<div <ion-nav-bar class="bar-stable">
class="topbar-container" <ion-nav-buttons side="primary">
ng-include="'views/includes/topbar.html'" <button class="button no-border" ui-sref="tabs.home">
ng-init="titleSection='Buy & Sell Bitcoin'; closeToHome = true; noColor = true"> Close
</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
</button> </button>
<div ng-show="index.glideraError.indexOf('Forbidden') != 40"> </ion-nav-buttons>
<button <ion-nav-title>Glidera</ion-nav-title>
class="dark-gray outline round tiny" </ion-nav-bar>
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>
<div ng-if="!index.glideraToken && !index.glideraError" <ion-content ng-controller="glideraController as glidera" ng-init="init()">
class="row">
<div class="box-notification text-center size-12 text-warning" ng-show="index.glideraTestnet"> <div class="box-notification text-center size-12 text-warning" ng-show="network == 'testnet'">
<i class="fi-info"></i> <i class="fi-info"></i>
Testnet wallets only work with Glidera Sandbox Accounts Testnet wallets only work with Glidera Sandbox Accounts
</div> </div>
<div class="columns" ng-init="showOauthForm = false"> <div class="m20b box-notification" ng-if="error">
<div class="text-center m20v"> <div class="text-warning">
<img src="img/glidera-logo.png" ng-click="index.updateGlidera(index.glideraToken, index.glideraPermissions)" width="200"> <span>{{error}}</span>
</div> </div>
<div class="text-center small-10 small-centered columns" ng-show="!showOauthForm"> </div>
<p class="m10b">You can buy and sell Bitcoin with a US bank account directly in Copay.</p> <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>
<p class="m20t text-gray size-12 text-left"> <div ng-if="!token && !error">
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
(#31000042625755). Users of Copay must agree to the service agreement presented by Glidera prior to obtaining
Glideras service of buying or selling bitcoins. Service available in U.S. and Canada only. In U.S. (buy & sell) CA, GA, IL, KS,
MA, MD, MO, MT, MN, SC, TX, AZ, CO, DE, ME, NJ, PA, TN, UT, NV, WI. In Canada (buy & sell) AB, BC, MB, NB, NL, NS, NT, NU,
ON, PE, SK, YT.
</p>
<p class="m20t text-gray size-12">Connect your Glidera account to get started</p> <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>
<a class="button light-gray outline round small" <p class="m20t padding text-gray size-12 text-left">
ng-click="$root.openExternalLink(glidera.getAuthenticateUrl(), '_system'); showOauthForm = true"> DISCLOSURE.<br>
Connect to Glidera 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
(#31000042625755). Users of Copay must agree to the service agreement presented by Glidera prior to obtaining
Glideras service of buying or selling bitcoins. Service available in U.S. and Canada only. In U.S. (buy & sell) CA, GA, IL, KS,
MA, MD, MO, MT, MN, SC, TX, AZ, CO, DE, ME, NJ, PA, TN, UT, NV, WI. In Canada (buy & sell) AB, BC, MB, NB, NL, NS, NT, NU,
ON, PE, SK, YT.
</p>
<p class="m20t text-gray size-12">Connect your Glidera account to get started</p>
<button class="button"
ng-click="openExternalLink(glidera.getAuthenticateUrl(), '_system'); showOauthForm = true">
Connect to Glidera
</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 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>
<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 button-block"
type="submit"
value="Get started"
ng-disabled="oauthCodeForm.$invalid">
</div>
</div>
</form>
</div>
</div>
</div>
<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="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> </a>
<div> </div>
<a href ng-click="showOauthForm = true" class="text-gray size-12"> <div class="padding">
Do you already have the Oauth Code? <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"
ng-init="glideraUrl = network == 'testnet' ? 'https://sandbox.glidera.io/login' :
'https://glidera.io/login'"
ng-click="openExternalLink(glideraUrl)">
Go to Glidera
</a>
</div>
</div>
</div>
<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">
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">
Sell Bitcoin
</a>
</div>
<div ng-show="permissions.transaction_history">
<h4>Activity</h4>
<div ng-show="txs.length == 0 "
class="size-12 p10 text-center text-gray">
No activity in your account
</div>
<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'">
<h2>
<span ng-show="tx.type == 'BUY'">Bought</span>
<span ng-show="tx.type == 'SELL'">Sold</span>
<b>{{tx.qty}}</b> BTC
</h2>
<p>
{{tx.subtotal|currency:'':2}} {{tx.currency}}
</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>
</div>
<div ng-show="tx.status == 'PROCESSING'">
<span class="label outline gray radius text-gray text-info" ng-if="tx.status == 'PROCESSING'">Processing</span>
</div>
</div>
</div>
</a> </a>
</div> </div>
</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>
<form name="oauthCodeForm" ng-submit="glidera.submitOauthCode(code)" novalidate>
<label>OAuth Code</label>
<input type="text" ng-model="code" ng-disabled="glidera.loading"
ng-attr-placeholder="{{'Paste the authorization code here'}}" required>
<input
class="button expand round"
ng-style="{'background-color':index.backgroundColor}"
type="submit" value="Get started" ng-disabled="oauthCodeForm.$invalid || glidera.loading">
</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> </ion-content>
</ion-view>
<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>
<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>
</span>
</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">
<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' :
'https://glidera.io/login'"
ng-click="$root.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">
<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">
<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>
<div ng-show="index.glideraPermissions.transaction_history">
<h4>Activity</h4>
<div ng-show="index.glideraTxs.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">
<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">
<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">
{{tx.subtotal|currency:'':2}} {{tx.currency}}
</span>
</div>
<div class="large-4 medium-4 small-4 columns text-right">
<div class="m5t size-12 text-gray">
<div ng-show="tx.status == 'COMPLETE'">
<time ng-if="tx.transactionDate">{{tx.transactionDate | amTimeAgo}}</time>
</div>
<div ng-show="tx.status == 'PROCESSING'">
<span class="label outline gray radius text-gray text-info" ng-if="tx.status == 'PROCESSING'">Processing</span>
</div>
</div>
</div>
<div class="large-1 medium-1 small-1 columns text-right">
<i class="icon-arrow-right3 size-18"></i>
</div>
</div>
</div>
</div>
</div>
<div class="extra-margin-bottom"></div>

View File

@ -1,18 +1,14 @@
<ion-modal-view ng-controller="glideraConfirmationController"> <ion-modal-view>
<div class="m20tp text-center"> <ion-content ng-controller="glideraConfirmationController">
<div class="row"> <div class="text-center">
<h1 class="text-center m20b p20h">Are you sure you would like to log out of your Glidera account?</h1> <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> <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" ng-click="cancel()">
<button class="button light-gray expand outline round" ng-click="cancel()"> Cancel
<i class="fi-arrow-left"></i> <span class="tu">Back</span> </button>
<button class="button" ng-click="ok()">
Log out
</button> </button>
</div> </div>
<div class="large-6 medium-6 small-6 columns"> </ion-content>
<button class="button warning expand round" ng-click="ok()">
<span>Log out</span>
</button>
</div>
</div>
</div>
</ion-modal-view> </ion-modal-view>

View File

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

View File

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

View File

@ -1,123 +1,140 @@
<div <ion-view>
class="topbar-container" <ion-nav-bar class="bar-stable">
ng-include="'views/includes/topbar.html'" <ion-nav-buttons side="primary">
ng-init="titleSection='Sell'; goBackToState = 'glidera'; noColor = true"> <button class="button no-border" ui-sref="glidera.main">
</div> <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"> <h4 class="padding" ng-show="limits && !sell.show2faCodeInput && !sell.success">
<div ng-show="index.glideraLimits && !sell.show2faCodeInput && !sell.success">
<h4 class="title m0 text-left">
<span class="text-light">Daily sell limit</span>: <span class="text-light">Daily sell limit</span>:
{{index.glideraLimits.dailySell|currency:'':2}} {{index.glideraLimits.currency}} {{limits.dailySell|currency:'':2}} {{limits.currency}}
(remaining {{index.glideraLimits.dailySellRemaining|currency:'':2}} {{index.glideraLimits.currency}}) (remaining {{limits.dailySellRemaining|currency:'':2}} {{limits.currency}})
<br> <br>
<span class="text-light">Monthly sell limit</span>: <span class="text-light">Monthly sell limit</span>:
{{index.glideraLimits.monthlySell|currency:'':2}} {{index.glideraLimits.currency}} {{limits.monthlySell|currency:'':2}} {{limits.currency}}
(remaining {{index.glideraLimits.monthlySellRemaining|currency:'':2}} {{index.glideraLimits.currency}}) (remaining {{limits.monthlySellRemaining|currency:'':2}} {{limits.currency}})
</h4> </h4>
</div>
<div class="row m20t"> <div class="box-notification m20b" ng-show="limits.transactDisabledPendingFirstTransaction">
<div class="columns"> <span class="text-warning">
This operation was disabled because you have a pending first transaction
</span>
</div>
<div class="box-notification m20b" ng-show="index.glideraLimits.transactDisabledPendingFirstTransaction"> <div ng-show="!sell.show2faCodeInput && !sell.success">
<span class="text-warning"> <form name="sellPriceForm" ng-if="token"
This operation was disabled because you have a pending first transaction ng-submit="sell.get2faCode(token)" novalidate>
</span>
</div>
<div ng-show="!sell.show2faCodeInput && !sell.success"> <div class="list">
<form name="sellPriceForm" <label class="item item-input item-stacked-label">
ng-submit="sell.get2faCode(index.glideraToken)" novalidate> <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 on-tap="openWalletsModal(sell.allWallets)">
<i class="icon ion-briefcase size-18"></i>
</a>
</label>
<div ng-if="index.glideraToken" <label class="item item-input item-stacked-label">
ng-init="sell.init(index.glideraTestnet)" <span class="input-label"><span>Amount in</span> {{showAlternative ? 'USD' : 'BTC'}}</span>
ng-click="openWalletsModal(sell.allWallets)"> <input ng-show="!showAlternative"
<label>Wallet</label> type="number"
<div class="input"> id="qty" ignore-mouse-wheel
<input type="text" id="address" name="address" ng-disabled="sell.selectedWalletId" name="qty"
ng-attr-placeholder="{{'Choose your source wallet'}}" ng-attr-placeholder="{{'Amount'}}"
ng-model="sell.selectedWalletName" required> ng-minlength="0.00000001"
<a class="postfix size-12 m0 text-gray"> ng-maxlength="10000000000"
<i class="icon-wallet size-18"></i> ng-model="qty"
</a> autocomplete="off"
</div> ng-change="sell.getSellPrice(token, {'qty': qty})">
</div>
<label><span>Amount in</span> {{showAlternative ? 'USD' : 'BTC'}}</label> <input ng-show="showAlternative"
<div class="input"> type="number"
<input ng-show="!showAlternative" type="number" id="qty" ignore-mouse-wheel id="fiat" ignore-mouse-wheel
name="qty" ng-attr-placeholder="{{'Amount'}}" name="fiat"
ng-minlength="0.00000001" ng-maxlength="10000000000" ng-attr-placeholder="{{'Amount'}}"
ng-model="qty" autocomplete="off" ng-change="sell.getSellPrice(index.glideraToken, {'qty': qty})"> ng-model="fiat"
autocomplete="off"
ng-change="sell.getSellPrice(token, {'fiat': fiat})">
<input ng-show="showAlternative" type="number" id="fiat" ignore-mouse-wheel <a ng-show="!showAlternative"
name="fiat" ng-attr-placeholder="{{'Amount'}}" class="postfix"
ng-model="fiat" autocomplete="off" ng-change="sell.getSellPrice(index.glideraToken, {'fiat': fiat})"> on-tap="showAlternative = true; qty = null; sell.sellPrice = null">BTC</a>
<a ng-show="showAlternative"
<a ng-show="!showAlternative" class="postfix" class="postfix"
ng-click="showAlternative = true; qty = null; sell.sellPrice = null">BTC</a> on-tap="showAlternative = false; fiat = null; sell.sellPrice = null">USD</a>
<a ng-show="showAlternative" class="postfix" </label>
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
<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>
<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>
</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(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 ">
</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.
</p>
</div> </div>
</div>
<div class="box-notification" ng-show="sell.error && !sell.success">
<span class="text-warning size-14">
{{sell.error}}
</span>
</div>
<div class="text-center" 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="outline dark-gray round expand" <div class="text-center text-gray size-12 m20b" ng-show="!sell.gettingSellPrice && sell.sellPrice.qty">
ng-click="$root.go('glidera')">OK</button> 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-block"
type="submit"
ng-disabled="limits.transactDisabledPendingFirstTransaction || !sell.sellPrice.qty || !sell.selectedWalletId ">
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">
<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.
</p>
</div> </div>
</div> </div>
</div> <div class="box-notification" ng-show="sell.error && !sell.success">
<div class="extra-margin-bottom"></div> <span class="text-warning size-14">
{{sell.error}}
</span>
</div>
<div class="text-center" 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-block" ui-sref="glidera.main">OK</button>
</div>
</ion-content>
</ion-view>

View File

@ -75,6 +75,18 @@
</div> </div>
</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> <h3>Next steps </h3>
<div class="list card"> <div class="list card">
<ul class="pr"> <ul class="pr">
@ -82,10 +94,6 @@
<i class="icon ion-card"></i> <i class="icon ion-card"></i>
BitPay Card BitPay Card
</li> </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"> <li ui-sref="amazon.main" class="item item-icon-left">
<i class="icon ion-ios-cart"></i> <i class="icon ion-ios-cart"></i>
Gift Cards Gift Cards

View File

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

View File

@ -1,33 +1,98 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('glideraController', 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) { if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178"); 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() { this.getAuthenticateUrl = function() {
return glideraService.getOauthCodeUrl(); return glideraService.getOauthCodeUrl();
}; };
this.submitOauthCode = function(code) { this.submitOauthCode = function(code) {
var self = this;
var glideraTestnet = configService.getSync().glidera.testnet;
var network = glideraTestnet ? 'testnet' : 'livenet';
ongoingProcess.set('connectingGlidera', true); ongoingProcess.set('connectingGlidera', true);
this.error = null; $scope.error = null;
$timeout(function() { $timeout(function() {
glideraService.getToken(code, function(err, data) { glideraService.getToken(code, function(err, data) {
ongoingProcess.set('connectingGlidera', false); ongoingProcess.set('connectingGlidera', false);
if (err) { if (err) {
self.error = err; $scope.error = err;
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 100); }, 100);
} else if (data && data.access_token) { } else if (data && data.access_token) {
storageService.setGlideraToken(network, data.access_token, function() { storageService.setGlideraToken($scope.network, data.access_token, function() {
$scope.$emit('Local/GlideraUpdated', data.access_token); $scope.init(data.access_token);
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
}, 100); }, 100);

View File

@ -1,11 +1,11 @@
'use strict'; '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() { $scope.ok = function() {
storageService.removeGlideraToken($scope.network, function() { glideraService.removeToken(function() {
$timeout(function() { $timeout(function() {
applicationService.restart(); $state.go('glidera.main');
}, 100); }, 100);
}); });
$scope.cancel(); $scope.cancel();

View File

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

View File

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

View File

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

View File

@ -103,25 +103,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*/ */
.state('uri', { .state('uri', {
url: '/uri/:url', url: '/uri/:url',
needProfile: true, templateUrl: 'views/uri.html'
views: { })
'main': { .state('uripayment', {
templateUrl: 'views/uri.html' url: '/uri-payment/:url',
} templateUrl: 'views/paymentUri.html'
} })
}) .state('uriglidera', {
.state('uripayment', { url: '/uri-glidera/:url',
url: '/uri-payment/:url', templateUrl: 'views/glideraUri.html'
templateUrl: 'views/paymentUri.html', })
views: { .state('uricoinbase', {
'main': { url: '/uri-coinbase/:url',
templateUrl: 'views/paymentUri.html', templateUrl: 'views/coinbaseUri.html'
}, })
},
needProfile: true
})
/* /*
* *
@ -528,27 +524,97 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
* *
* Glidera * Glidera
* *
*
*/ */
.state('uriglidera', {
url: '/uri-glidera/:url',
templateUrl: 'views/glideraUri.html'
})
.state('glidera', { .state('glidera', {
url: '/glidera', url: '/glidera',
templateUrl: 'views/glidera.html' abstract: true,
template: '<ion-nav-view name="glidera"></ion-nav-view>'
}) })
.state('buyGlidera', { .state('glidera.main', {
url: '/main',
views: {
'glidera': {
templateUrl: 'views/glidera.html'
}
}
})
.state('glidera.buy', {
url: '/buy', url: '/buy',
templateUrl: 'views/buyGlidera.html' views: {
'glidera': {
templateUrl: 'views/buyGlidera.html'
}
}
}) })
.state('sellGlidera', { .state('glidera.sell', {
url: '/sell', url: '/sell',
templateUrl: 'views/sellGlidera.html' views: {
'glidera': {
templateUrl: 'views/sellGlidera.html'
}
}
}) })
.state('preferencesGlidera', { .state('glidera.preferences', {
url: '/preferencesGlidera', url: '/preferences',
templateUrl: 'views/preferencesGlidera.html' 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' 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) { .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.colorFor = configCache.colorFor || {};
configCache.aliasFor = configCache.aliasFor || {}; configCache.aliasFor = configCache.aliasFor || {};
// Glidera
// Disabled for testnet
configCache.glidera.testnet = false;
// Coinbase // Coinbase
// Disabled for testnet // Disabled for testnet
configCache.coinbase.testnet = false; configCache.coinbase.testnet = false;

View File

@ -4,11 +4,15 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
var root = {}; var root = {};
var credentials = {}; var credentials = {};
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
//
//
root.setCredentials = function(network) { var _setCredentials = function() {
if (network == 'testnet') { /*
* Development: 'testnet'
* Production: 'livenet'
*/
credentials.NETWORK = 'livenet';
if (credentials.NETWORK == 'testnet') {
credentials.HOST = 'https://sandbox.glidera.io'; credentials.HOST = 'https://sandbox.glidera.io';
if (isCordova) { if (isCordova) {
credentials.REDIRECT_URI = 'copay://glidera'; 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() { root.getOauthCodeUrl = function() {
_setCredentials();
return credentials.HOST + '/oauth2/auth?response_type=code&client_id=' + credentials.CLIENT_ID + '&redirect_uri=' + credentials.REDIRECT_URI; 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) { root.getToken = function(code, cb) {
_setCredentials();
var req = { var req = {
method: 'POST', method: 'POST',
url: credentials.HOST + '/api/v1/oauth/token', 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) { var _get = function(endpoint, token) {
_setCredentials();
return { return {
method: 'GET', method: 'GET',
url: credentials.HOST + '/api/v1' + endpoint, 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) { var _post = function(endpoint, token, twoFaCode, data) {
_setCredentials();
return { return {
method: 'POST', method: 'POST',
url: credentials.HOST + '/api/v1' + endpoint, url: credentials.HOST + '/api/v1' + endpoint,
@ -251,91 +271,39 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
}); });
}; };
root.init = function(accessToken) { root.init = function(accessToken, cb) {
root.glideraEnabled = configService.getSync().glidera.enabled; _setCredentials();
root.glideraTestnet = configService.getSync().glidera.testnet; $log.debug('Init Glidera...');
var network = root.glideraTestnet ? 'testnet' : 'livenet';
root.glideraToken = null; var glidera = {
root.glideraError = null; token: null,
root.glideraPermissions = null; permissions: null
root.glideraEmail = null; }
root.glideraPersonalInfo = null;
root.glideraTxs = null;
root.glideraStatus = null;
if (!root.glideraEnabled) return;
root.setCredentials(network);
var getToken = function(cb) { var getToken = function(cb) {
if (accessToken) { if (accessToken) {
cb(null, accessToken); cb(null, accessToken);
} else { } else {
storageService.getGlideraToken(network, cb); storageService.getGlideraToken(credentials.NETWORK, cb);
} }
}; };
getToken(function(err, accessToken) { getToken(function(err, accessToken) {
if (err || !accessToken) return; if (err || !accessToken) return cb();
else { else {
root.getAccessTokenPermissions(accessToken, function(err, p) { root.getAccessTokenPermissions(accessToken, function(err, p) {
if (err) { if (err) {
root.glideraError = err; return cb(err);
} else { } else {
root.glideraToken = accessToken; glidera.token = accessToken;
root.glideraPermissions = p; glidera.permissions = p;
root.update({ return cb(null, glidera);
fullUpdate: true
});
} }
}); });
} }
}); });
}; };
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; return root;
}); });

View File

@ -67,7 +67,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
window.plugins.spinnerDialog.show(null, showName, true); window.plugins.spinnerDialog.show(null, showName, true);
} else { } 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({ $ionicLoading.show({
template: tmpl 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;
}