mirror of https://github.com/BTCPrivate/copay.git
Merge branch 'ref/design' of github.com:matiu/copay into ref/design
This commit is contained in:
commit
38dd54f494
|
@ -10,8 +10,7 @@
|
|||
|
||||
<ion-content ng-controller="amazonController as amazon" ng-init="amazon.init()">
|
||||
|
||||
<div ng-show="amazon.sandbox">
|
||||
<i class="icon ion-information-circled"></i>
|
||||
<div class="text-center" ng-show="network == 'testnet'">
|
||||
Sandbox version. Only for testing purpose
|
||||
</div>
|
||||
|
||||
|
@ -22,47 +21,43 @@
|
|||
|
||||
<div ng-if="!giftCards" class="m20t padding text-center">
|
||||
|
||||
<button class="button button-positive" ui-sref="amazon.buy">
|
||||
<button class="button" ui-sref="amazon.buy">
|
||||
Buy now
|
||||
</button>
|
||||
|
||||
<div class="text-left m30v">
|
||||
Amazon.com Gift Cards never expire and can be redeemed towards millions of items at
|
||||
<a ng-click="$root.openExternalLink('https://www.amazon.com')">www.amazon.com</a>
|
||||
<a ng-click="openExternalLink('https://www.amazon.com')">www.amazon.com</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m20t" ng-if="giftCards">
|
||||
<ul class="no-bullet m0 size-14">
|
||||
<li class="line-b line-t p10 pointer" href ui-sref="buyAmazon">
|
||||
<i class="fi-shopping-cart size-24 m5l vm dib"></i>
|
||||
<span class="m10l text-normal text-bold">Buy Gift Card</span>
|
||||
<span class="right text-gray m5t">
|
||||
<i class="icon-arrow-right3 size-24 right"></i>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
<h4 class="title">Your cards</h4>
|
||||
<div class="list">
|
||||
<a class="item item-icon-left item-icon-right" href ui-sref="amazon.buy">
|
||||
<i class="icon ion-bag"></i>
|
||||
Buy Gift Card
|
||||
<i class="icon ion-ios-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<h4 class="padding">Your cards</h4>
|
||||
<div class="list card">
|
||||
<div ng-repeat="(id, item) in giftCards | orderObjectBy:'date':true track by $index"
|
||||
ng-click="amazon.openCardModal(item)"
|
||||
class="row collapse last-transactions-content size-12">
|
||||
<div class="large-2 medium-2 small-2 columns">
|
||||
class="item item-avatar">
|
||||
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
|
||||
</div>
|
||||
<div class="large-4 medium-4 small-4 columns m5t size-18" ng-if="item.claimCode">
|
||||
<h2 ng-if="item.claimCode">
|
||||
{{item.amount | currency : '$ ' : 2}}
|
||||
</div>
|
||||
<div class="large-4 medium-4 small-4 columns m5t size-18" ng-if="!item.claimCode">
|
||||
</h2>
|
||||
<h2 ng-if="!item.claimCode">
|
||||
-
|
||||
</div>
|
||||
<div class="large-5 medium-5 small-5 columns text-right m10t">
|
||||
</h2>
|
||||
<p>
|
||||
<span class="text-warning" ng-if="item.status == 'FAILURE' || item.status == 'RESEND'">Error</span>
|
||||
<span class="text-gray" ng-if="item.status == 'PENDING'">Pending to confirmation</span>
|
||||
<span class="text-gray" ng-if="item.status == 'SUCCESS' && item.cardStatus == 'Canceled'">Canceled</span>
|
||||
<span class="text-gray" ng-if="item.status == 'SUCCESS' && item.cardStatus == 'Fulfilled'">{{item.date | amTimeAgo}}</span>
|
||||
</div>
|
||||
<div class="large-1 medium-1 small-1 columns text-right m10t">
|
||||
<i class="icon-arrow-right3 size-18"></i>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<ion-content ng-controller="bitpayCardController as bitpayCard" ng-init="bitpayCard.init()">
|
||||
|
||||
<div class="text-center size-12" ng-show="bitpayCard.sandbox">
|
||||
<div class="text-center size-12" ng-show="network == 'testnet'">
|
||||
Sandbox version. Only for testing purpose
|
||||
</div>
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
</div>
|
||||
|
||||
<div ng-show="!bitpayCard.bitpayCardAuthenticated && !bitpayCard.loadingSession">
|
||||
<div class="text-center">
|
||||
<div class="text-center m20t">
|
||||
<img src="img/bitpay-card-visa.svg" width="200">
|
||||
</div>
|
||||
<h4 class="text-center">
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<ion-content ng-controller="buyAmazonController as buy" ng-init="buy.init()">
|
||||
|
||||
<div class="padding" ng-show="!buy.giftCard">
|
||||
<div ng-show="!buy.giftCard">
|
||||
|
||||
<div class="assertive" ng-show="buy.error" ng-click="buy.error = null">
|
||||
{{buy.error}}
|
||||
|
@ -22,14 +22,14 @@
|
|||
BitPay Invoice ID: {{buy.errorInfo.invoiceId}}.
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a ng-click="$root.openExternalLink(buy.errorInfo.invoiceUrl)">Open invoice</a>
|
||||
<a ng-click="openExternalLink(buy.errorInfo.invoiceUrl)">Open invoice</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<div class="padding text-center">
|
||||
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="180">
|
||||
<div class="text-center size-10 m10t">
|
||||
<div class="text-center size-12 m10t">
|
||||
Use your Amazon.com Gift Card* to shop from a huge selection of books, electronics, music, movies, software, apparel, toys, and more.
|
||||
</div>
|
||||
</div>
|
||||
|
@ -51,7 +51,6 @@
|
|||
ng-model="fiat"
|
||||
autocomplete="off" ignore-mouse-wheel required>
|
||||
|
||||
<a class="postfix button black">USD</a>
|
||||
</label>
|
||||
|
||||
|
||||
|
@ -69,7 +68,7 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<button class="button button-block button-positive"
|
||||
<button class="button button-block"
|
||||
ng-disabled="!buy.selectedWalletId || !fiat"
|
||||
type="submit"
|
||||
value="Buy now">
|
||||
|
@ -106,7 +105,7 @@
|
|||
<div class="size-12 p15h">
|
||||
Thank you for participating in the BitPay offer. It is our pleasure to send
|
||||
you this Amazon.com Gift Card* that can be redeemed towards millions of items at
|
||||
<a ng-click="$root.openExternalLink('https://www.amazon.com')">www.amazon.com</a>.
|
||||
<a ng-click="openExternalLink('https://www.amazon.com')">www.amazon.com</a>.
|
||||
You may want to print this screen for easy reference later you will need the gift card claim code below.
|
||||
</div>
|
||||
|
||||
|
@ -119,23 +118,23 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="size-14">
|
||||
Claim code: <span class="text-bold enable_text_select">{{buy.giftCard.claimCode}}</span>
|
||||
Claim code: <span class="text-bold" copy-to-clipboard="buy.giftCard.claimCode">{{buy.giftCard.claimCode}}</span>
|
||||
</div>
|
||||
<div class="m10t">
|
||||
<button class="button black round tiny"
|
||||
ng-click="$root.openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + buy.giftCard.claimCode, '_system')">
|
||||
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + buy.giftCard.claimCode, '_system')">
|
||||
Redeem Now
|
||||
</button>
|
||||
</div>
|
||||
<div class="size-12 m10t text-center">
|
||||
<a ng-click="$root.openExternalLink(buy.giftCard.invoiceUrl)">See invoice</a>
|
||||
<a ng-click="openExternalLink(buy.giftCard.invoiceUrl)">See invoice</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oh m20t p15h size-12">
|
||||
To redeem your gift card, follow these steps:
|
||||
|
||||
<ol class="m10t size-12">
|
||||
<li>1. Visit <a ng-click="$root.openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>
|
||||
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>
|
||||
<li>2. Click Apply to Account and enter the Claim Code when prompted.
|
||||
<li>3. Gift card funds will be applied automatically to eligible orders during the checkout process.
|
||||
<li>4. You must pay for any remaining balance on your order with another payment method.
|
||||
|
@ -148,7 +147,7 @@
|
|||
|
||||
<p class="size-12">
|
||||
If you have questions about redeeming your gift card, please visit
|
||||
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-redeem')">www.amazon.com/gc-redeem</a>.
|
||||
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem')">www.amazon.com/gc-redeem</a>.
|
||||
If you have questions regarding the BitPay Introductory offer, please contact BitPay.
|
||||
</p>
|
||||
|
||||
|
@ -157,14 +156,14 @@
|
|||
</div>
|
||||
|
||||
<div class="size-12 white p15 m20t">
|
||||
* <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion.
|
||||
Except as required by law, <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a>
|
||||
* <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion.
|
||||
Except as required by law, <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>
|
||||
Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of
|
||||
eligible goods at <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its
|
||||
eligible goods at <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its
|
||||
affiliated websites. For complete terms and conditions, see
|
||||
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>.
|
||||
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>.
|
||||
GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon ®, ™ & © are IP
|
||||
of <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates.
|
||||
of <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates.
|
||||
No expiration date or service fees.
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
<ion-modal-view ng-controller="amazonCardDetailsController">
|
||||
<ion-header-bar align-title="center" class="tab-bar">
|
||||
<div class="left-small">
|
||||
<a ng-click="cancel()" class="p10">
|
||||
<span class="text-close">Close</span>
|
||||
</a>
|
||||
</div>
|
||||
<h1 class="title ellipsis">
|
||||
Details
|
||||
</h1>
|
||||
<button class="button button-clear button-positive"
|
||||
ng-click="cancel()">
|
||||
Close
|
||||
</button>
|
||||
<h1 class="title">Details</h1>
|
||||
</ion-header-bar>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<div class="modal-content">
|
||||
<div class="header-modal text-center">
|
||||
|
||||
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="230" ng-click="refreshGiftCard()">
|
||||
|
||||
<div ng-show="card.claimCode">
|
||||
|
@ -25,11 +20,11 @@
|
|||
</span>
|
||||
</div>
|
||||
<div ng-show="card.cardStatus !== 'Canceled'">
|
||||
Claim code: <span class="text-bold enable_text_select">{{card.claimCode}}</span>
|
||||
Claim code: <span class="text-bold" copy-to-clipboard="card.claimCode">{{card.claimCode}}</span>
|
||||
</div>
|
||||
<div class="m10t" ng-show="card.cardStatus == 'Fulfilled'">
|
||||
<button class="button black round tiny"
|
||||
ng-click="$root.openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + card.claimCode, '_system')">
|
||||
ng-click="openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + card.claimCode, '_system')">
|
||||
Redeem Now
|
||||
</button>
|
||||
</div>
|
||||
|
@ -54,7 +49,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="size-12 m10t text-center">
|
||||
<a ng-click="$root.openExternalLink(card.invoiceUrl)">See invoice</a>
|
||||
<a ng-click="openExternalLink(card.invoiceUrl)">See invoice</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -72,7 +67,7 @@
|
|||
To redeem your gift card, follow these steps:
|
||||
|
||||
<ol class="m10t size-12">
|
||||
<li>1. Visit <a ng-click="$root.openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>
|
||||
<li>1. Visit <a ng-click="openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>
|
||||
<li>2. Click Apply to Account and enter the Claim Code when prompted.
|
||||
<li>3. Gift card funds will be applied automatically to eligible orders during the checkout process.
|
||||
<li>4. You must pay for any remaining balance on your order with another payment method.
|
||||
|
@ -85,35 +80,33 @@
|
|||
|
||||
<p class="size-12">
|
||||
If you have questions about redeeming your gift card, please visit
|
||||
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-redeem')">www.amazon.com/gc-redeem</a>.
|
||||
<a ng-click="openExternalLink('https://www.amazon.com/gc-redeem')">www.amazon.com/gc-redeem</a>.
|
||||
If you have questions regarding the BitPay Introductory offer, please contact BitPay.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="size-12 white p15 m30v">
|
||||
* <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion.
|
||||
Except as required by law, <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a>
|
||||
* <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> is not a sponsor of this promotion.
|
||||
Except as required by law, <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>
|
||||
Gift Cards ("GCs") cannot be transferred for value or redeemed for cash. GCs may be used only for purchases of
|
||||
eligible goods at <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its
|
||||
eligible goods at <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a> or certain of its
|
||||
affiliated websites. For complete terms and conditions, see
|
||||
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>.
|
||||
<a ng-click="openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a>.
|
||||
GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon ®, ™ & © are IP
|
||||
of <a ng-click="$root.openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates.
|
||||
of <a ng-click="openExternalLink('http://amazon.com')">Amazon.com</a>, Inc. or its affiliates.
|
||||
No expiration date or service fees.
|
||||
</div>
|
||||
|
||||
<ul class="no-bullet size-14 m30v text-center">
|
||||
<li class="line-b p10 oh pointer" ng-show="card.status == 'SUCCESS' && card.cardStatus == 'Fulfilled'" ng-click="cancelGiftCard()">
|
||||
<span class="text-warning">Cancel</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh pointer" ng-show="card.status == 'FAILURE' || card.cardStatus == 'Canceled'
|
||||
<div class="list text-center">
|
||||
<a class="item" ng-show="card.status == 'SUCCESS' && card.cardStatus == 'Fulfilled'" ng-click="cancelGiftCard()">
|
||||
<span class="assertive">Cancel</span>
|
||||
</a>
|
||||
<a class="item" ng-show="card.status == 'FAILURE' || card.cardStatus == 'Canceled'
|
||||
|| card.cardStatus == 'Expired'" ng-click="remove()">
|
||||
<span class="text-warning">Remove</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="extra-margin-bottom"></div>
|
||||
<span class="assertive">Remove</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
</ion-modal-view>
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
<ion-modal-view ng-controller="txStatusController">
|
||||
<div ng-if="type == 'broadcasted'" class="popup-txsent text-center">
|
||||
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||
<div ng-show="tx.amountStr" class="m20t size-36 text-white">
|
||||
<div ng-if="type == 'broadcasted'" class="popup-txsent text-center m30tp">
|
||||
<i class="icon ion-checkmark-round"></i>
|
||||
<div ng-show="tx.amountStr" class="m20t size-36">
|
||||
{{tx.amountStr}}
|
||||
</div>
|
||||
<div class="size-16 text-gray">
|
||||
<div class="size-16 text-gray m10v">
|
||||
<span translate>Sent</span>
|
||||
</div>
|
||||
<div class="text-center m20t">
|
||||
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||
<a class="button" ng-click="cancel()" translate>OKAY</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-if="type == 'created'" class="popup-txsigned">
|
||||
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}">
|
||||
<div ng-if="type == 'created'" class="popup-txsigned m30tp">
|
||||
<i class="icon ion-checkmark-round"></i>
|
||||
<div class="text-center size-18 tu text-bold m20t">
|
||||
<span translate>Payment Proposal Created</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||
<a class="button" ng-click="cancel()" translate>OKAY</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div ng-if="type == 'accepted'" class="popup-txsigned">
|
||||
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||
<div class="text-center size-18 text-primary tu text-bold p20" ng-style="{'color':color}">
|
||||
<div ng-if="type == 'accepted'" class="popup-txsigned m30tp">
|
||||
<i class="icon ion-checkmark-round"></i>
|
||||
<div class="text-center size-18 tu text-bold m20t">
|
||||
<span translate>Payment Accepted</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||
<a class="button" ng-click="cancel()" translate>OKAY</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="type=='rejected'" class="popup-txrejected">
|
||||
<i class="fi-x small-centered columns m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}">
|
||||
<div ng-if="type=='rejected'" class="popup-txrejected m30tp">
|
||||
<i class="icon ion-close-round"></i>
|
||||
<div class="text-center size-18 tu text-bold m20t">
|
||||
<span translate>Payment Rejected</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<a class="button outline light-gray round tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||
<a class="button" ng-click="cancel()" translate>OKAY</a>
|
||||
</div>
|
||||
</div>
|
||||
</ion-modal-view>
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card" ng-show="wallets[0]">
|
||||
<div class="card" ng-init="updateAllWallets()">
|
||||
<div ng-repeat="item in wallets track by $index"
|
||||
class="item item-icon-left"
|
||||
ui-sref="wallet.details({'walletId': item.id})">
|
||||
|
@ -73,23 +73,21 @@
|
|||
<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">
|
||||
<img src="img/coinbase-logo.png" width="90"> TODO
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Next steps </h3>
|
||||
<div class="list card">
|
||||
<ul class="pr">
|
||||
<li ui-sref="bitpayCard.main" ng-show="bitpayCardEnabled" class="item item-icon-left">
|
||||
<div class="card">
|
||||
<div ui-sref="bitpayCard.main" ng-show="bitpayCardEnabled" class="item item-icon-left">
|
||||
<i class="icon ion-card"></i>
|
||||
BitPay Card
|
||||
</li>
|
||||
<li ui-sref="amazon.main" class="item item-icon-left">
|
||||
</div>
|
||||
<div ui-sref="amazon.main" class="item item-icon-left">
|
||||
<i class="icon ion-ios-cart"></i>
|
||||
Gift Cards
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('amazonController',
|
||||
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo) {
|
||||
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, 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');
|
||||
}
|
||||
};
|
||||
|
||||
this.init = function() {
|
||||
var self = this;
|
||||
self.sandbox = amazonService.getEnvironment() == 'testnet' ? true : false;
|
||||
$scope.network = amazonService.getEnvironment();
|
||||
amazonService.getPendingGiftCards(function(err, gcds) {
|
||||
if (err) {
|
||||
self.error = err;
|
||||
|
|
|
@ -3,22 +3,12 @@
|
|||
angular.module('copayApp.controllers').controller('bitpayCardController', function($scope, $rootScope, $timeout, $log, $ionicModal, lodash, bitpayCardService, configService, profileService, walletService, fingerprintService, ongoingProcess, bwcError, bitcore, pbkdf2Service, moment, platformInfo) {
|
||||
|
||||
var self = this;
|
||||
var client;
|
||||
|
||||
self.sandbox = bitpayCardService.getEnvironment() == 'testnet' ? true : false;
|
||||
var wallet;
|
||||
|
||||
if (platformInfo.isCordova && StatusBar.isVisible) {
|
||||
StatusBar.backgroundColorByHexString("#293C92");
|
||||
}
|
||||
|
||||
var handleEncryptedWallet = function(client, cb) {
|
||||
if (!walletService.isEncrypted(client)) return cb();
|
||||
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
|
||||
if (err) return cb(err);
|
||||
return cb(walletService.unlock(client, password));
|
||||
});
|
||||
};
|
||||
|
||||
var processTransactions = function(invoices, history) {
|
||||
for (var i = 0; i < invoices.length; i++) {
|
||||
var matched = false;
|
||||
|
@ -89,7 +79,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
bitpayCardService.transactionHistory(dateRange, function(err, history) {
|
||||
$scope.loadingHistory = false;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
self.error = err.error || err;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -106,25 +96,26 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
|
||||
this.init = function() {
|
||||
$scope.dateRange = 'last30Days';
|
||||
self.update();
|
||||
|
||||
var network = bitpayCardService.getEnvironment();
|
||||
$scope.network = bitpayCardService.getEnvironment();
|
||||
self.allWallets = profileService.getWallets({
|
||||
network: network,
|
||||
network: $scope.network,
|
||||
n: 1,
|
||||
onlyComplete: true
|
||||
});
|
||||
|
||||
self.update();
|
||||
|
||||
if (lodash.isEmpty(self.allWallets)) return;
|
||||
|
||||
client = self.allWallets[0];
|
||||
wallet = self.allWallets[0];
|
||||
|
||||
if (client.credentials.n > 1)
|
||||
if (wallet.credentials.n > 1)
|
||||
self.isMultisigWallet = true;
|
||||
|
||||
$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);
|
||||
};
|
||||
|
@ -146,11 +137,11 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
|
||||
$scope.$on('walletSelected', function(ev, walletId) {
|
||||
$timeout(function() {
|
||||
client = profileService.getClient(walletId);
|
||||
wallet = profileService.getClient(walletId);
|
||||
self.isMultisigWallet = false;
|
||||
self.selectedWalletId = walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
if (client.credentials.n > 1)
|
||||
self.selectedWalletName = wallet.credentials.walletName;
|
||||
if (wallet.credentials.n > 1)
|
||||
self.isMultisigWallet = true;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
|
@ -161,6 +152,12 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
this.sendFunds = function() {
|
||||
self.error = null;
|
||||
|
||||
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
|
||||
$log.info('No signing proposal: No private key');
|
||||
self.error = bwcError.msg('MISSING_PRIVATE_KEY');
|
||||
return;
|
||||
}
|
||||
|
||||
var dataSrc = {
|
||||
amount: $scope.fiat,
|
||||
currency: 'USD'
|
||||
|
@ -207,7 +204,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
feeLevel: walletSettings.feeLevel || 'normal'
|
||||
};
|
||||
|
||||
walletService.createTx(client, txp, function(err, createdTxp) {
|
||||
walletService.createTx(wallet, txp, function(err, createdTxp) {
|
||||
ongoingProcess.set('Processing Transaction...', false);
|
||||
if (err) {
|
||||
self.error = bwcError.msg(err);
|
||||
|
@ -216,8 +213,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
});
|
||||
return;
|
||||
}
|
||||
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
|
||||
if (accept) {
|
||||
self.confirmTx(createdTxp, function(err, tx) {
|
||||
ongoingProcess.set('Processing Transaction...', false);
|
||||
if (err) {
|
||||
|
@ -233,8 +228,6 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
$scope.$digest();
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -243,39 +236,39 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
|
||||
this.confirmTx = function(txp, cb) {
|
||||
|
||||
fingerprintService.check(client, function(err) {
|
||||
fingerprintService.check(wallet, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
handleEncryptedWallet(client, function(err) {
|
||||
walletService.handleEncryptedWallet(wallet, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
|
||||
ongoingProcess.set('Processing Transaction...', true);
|
||||
walletService.publishTx(client, txp, function(err, publishedTxp) {
|
||||
walletService.publishTx(wallet, txp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
|
||||
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(client);
|
||||
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(wallet);
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
walletService.removeTx(client, signedTxp, function(err) {
|
||||
walletService.removeTx(wallet, signedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
|
||||
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
|
||||
walletService.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
walletService.removeTx(client, broadcastedTxp, function(err) {
|
||||
walletService.removeTx(wallet, broadcastedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return bwcError.cb(err, null, cb);
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||
function($rootScope, $scope, $ionicModal, $log, $timeout, $state, lodash, profileService, bwcError, gettext, configService, walletService, fingerprintService, amazonService, ongoingProcess) {
|
||||
function($rootScope, $scope, $ionicModal, $log, $timeout, $state, $ionicPopup, lodash, profileService, bwcError, gettext, configService, walletService, fingerprintService, amazonService, ongoingProcess, platformInfo, nodeWebkit) {
|
||||
|
||||
var self = this;
|
||||
var client;
|
||||
var wallet;
|
||||
|
||||
var handleEncryptedWallet = function(client, cb) {
|
||||
if (!walletService.isEncrypted(client)) return cb();
|
||||
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
|
||||
if (err) return cb(err);
|
||||
return cb(walletService.unlock(client, password));
|
||||
});
|
||||
$scope.openExternalLink = function(url, target) {
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
};
|
||||
|
||||
this.init = function() {
|
||||
|
@ -24,11 +25,11 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
|
||||
if (lodash.isEmpty(self.allWallets)) return;
|
||||
|
||||
client = self.allWallets[0];
|
||||
wallet = self.allWallets[0];
|
||||
|
||||
$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);
|
||||
};
|
||||
|
@ -50,9 +51,9 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
|
||||
$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();
|
||||
|
@ -63,6 +64,12 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
self.error = null;
|
||||
self.errorInfo = null;
|
||||
|
||||
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
|
||||
$log.info('No signing proposal: No private key');
|
||||
self.error = bwcError.msg('MISSING_PRIVATE_KEY');
|
||||
return;
|
||||
}
|
||||
|
||||
var dataSrc = {
|
||||
currency: 'USD',
|
||||
amount: $scope.fiat,
|
||||
|
@ -98,7 +105,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
|
||||
$log.debug('Fetch PayPro Request...', invoice.paymentUrls.BIP73);
|
||||
|
||||
client.fetchPayPro({
|
||||
wallet.fetchPayPro({
|
||||
payProUrl: invoice.paymentUrls.BIP73,
|
||||
}, function(err, paypro) {
|
||||
|
||||
|
@ -149,7 +156,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
feeLevel: walletSettings.feeLevel || 'normal'
|
||||
};
|
||||
|
||||
walletService.createTx(client, txp, function(err, createdTxp) {
|
||||
walletService.createTx(wallet, txp, function(err, createdTxp) {
|
||||
ongoingProcess.set('Processing Transaction...', false);
|
||||
if (err) {
|
||||
self.error = bwcError.msg(err);
|
||||
|
@ -240,42 +247,41 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.confirmTx = function(txp, cb) {
|
||||
|
||||
fingerprintService.check(client, function(err) {
|
||||
fingerprintService.check(wallet, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
handleEncryptedWallet(client, function(err) {
|
||||
walletService.handleEncryptedWallet(wallet, function(err) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
|
||||
ongoingProcess.set('Processing Transaction...', true);
|
||||
walletService.publishTx(client, txp, function(err, publishedTxp) {
|
||||
walletService.publishTx(wallet, txp, function(err, publishedTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
|
||||
walletService.signTx(client, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(client);
|
||||
walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
|
||||
walletService.lock(wallet);
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
walletService.removeTx(client, signedTxp, function(err) {
|
||||
walletService.removeTx(wallet, signedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return bwcError.cb(err, null, cb);
|
||||
}
|
||||
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) {
|
||||
walletService.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
|
||||
if (err) {
|
||||
$log.debug(err);
|
||||
walletService.removeTx(client, broadcastedTxp, function(err) {
|
||||
walletService.removeTx(wallet, broadcastedTxp, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
return bwcError.cb(err, null, cb);
|
||||
|
|
|
@ -214,7 +214,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
|
|||
return;
|
||||
}
|
||||
|
||||
handleEncryptedWallet(wallet, function(err) {
|
||||
walletService.handleEncryptedWallet(wallet, function(err) {
|
||||
if (err) {
|
||||
self.error = err.message || bwcError.msg(err);
|
||||
return;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
||||
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
|
||||
var self = this;
|
||||
|
||||
var setNotifications = function(notifications) {
|
||||
|
||||
|
@ -18,11 +17,12 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
|
||||
|
||||
|
||||
self.updateAllWallets = function() {
|
||||
$scope.updateAllWallets = function() {
|
||||
$timeout(function() {
|
||||
$scope.wallets = profileService.getWallets();
|
||||
|
||||
var i = $scope.wallets.length, j =0;
|
||||
// var timeSpan = 60 * 60 * 24 * 7;
|
||||
// var timeSpan = 60 * 60 * 24 * 7;
|
||||
var timeSpan = 60 * 60 * 24 * 1;
|
||||
var notifications = [];
|
||||
|
||||
|
@ -53,13 +53,15 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
});
|
||||
|
||||
});
|
||||
}
|
||||
$scope.$digest();
|
||||
}, 100);
|
||||
};
|
||||
|
||||
self.updateWallet = function(wallet) {
|
||||
$scope.updateWallet = function(wallet) {
|
||||
$log.debug('Updating wallet:' + wallet.name)
|
||||
walletService.getStatus(wallet, {}, function(err, status) {
|
||||
if (err) {
|
||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||
$log.error(err); //TODO
|
||||
return;
|
||||
}
|
||||
wallet.status = status;
|
||||
|
@ -71,17 +73,16 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
|
||||
|
||||
|
||||
self.updateAllWallets();
|
||||
$scope.bitpayCardEnabled = true; // TODO
|
||||
|
||||
var listeners = [
|
||||
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||
var wallet = profileService.getWallet(walletId);
|
||||
self.updateWallet(wallet);
|
||||
$scope.updateWallet(wallet);
|
||||
}),
|
||||
$rootScope.$on('Local/TxAction', function(e, walletId) {
|
||||
var wallet = profileService.getWallet(walletId);
|
||||
self.updateWallet(wallet);
|
||||
$scope.updateWallet(wallet);
|
||||
}),
|
||||
];
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.directives')
|
||||
.directive('copyToClipboard', function(platformInfo, gettextCatalog, ionicToast, clipboard) {
|
||||
.directive('copyToClipboard', function(platformInfo, nodeWebkit, gettextCatalog, ionicToast, clipboard) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
scope: {
|
||||
|
|
|
@ -380,36 +380,14 @@ ul.wallet-selection.wallets {
|
|||
bottom: 0;
|
||||
}
|
||||
|
||||
.popup-txsent {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(24, 44, 58, 0.9);
|
||||
i {
|
||||
.popup-txsent i {
|
||||
font-size: 5rem;
|
||||
color: #4A90E2;
|
||||
border-radius: 100%;
|
||||
border-color: #4A90E2;
|
||||
border: 2px solid;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.popup-txsigned i, .popup-txrejected i {
|
||||
font-size: 5rem;
|
||||
color: #4A90E2;
|
||||
border-radius: 100%;
|
||||
border-color: #4A90E2;
|
||||
border: 2px solid;
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
.payment-proposal-head {
|
||||
|
|
Loading…
Reference in New Issue