Fix bitpayCard, Amazon, Glidera. Fixes related with NW

This commit is contained in:
Gustavo Maximiliano Cortez 2016-08-24 19:00:50 -03:00
commit 1e9b60aff4
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
13 changed files with 248 additions and 276 deletions

View file

@ -10,8 +10,7 @@
<ion-content ng-controller="amazonController as amazon" ng-init="amazon.init()"> <ion-content ng-controller="amazonController as amazon" ng-init="amazon.init()">
<div ng-show="amazon.sandbox"> <div class="text-center" ng-show="network == 'testnet'">
<i class="icon ion-information-circled"></i>
Sandbox version. Only for testing purpose Sandbox version. Only for testing purpose
</div> </div>
@ -22,47 +21,43 @@
<div ng-if="!giftCards" class="m20t padding text-center"> <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 Buy now
</button> </button>
<div class="text-left m30v"> <div class="text-left m30v">
Amazon.com Gift Cards never expire and can be redeemed towards millions of items at 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> </div>
<div class="m20t" ng-if="giftCards"> <div class="m20t" ng-if="giftCards">
<ul class="no-bullet m0 size-14"> <div class="list">
<li class="line-b line-t p10 pointer" href ui-sref="buyAmazon"> <a class="item item-icon-left item-icon-right" href ui-sref="amazon.buy">
<i class="fi-shopping-cart size-24 m5l vm dib"></i> <i class="icon ion-bag"></i>
<span class="m10l text-normal text-bold">Buy Gift Card</span> Buy Gift Card
<span class="right text-gray m5t"> <i class="icon ion-ios-arrow-right"></i>
<i class="icon-arrow-right3 size-24 right"></i> </a>
</span> </div>
</li>
</ul> <h4 class="padding">Your cards</h4>
<h4 class="title">Your cards</h4> <div class="list card">
<div ng-repeat="(id, item) in giftCards | orderObjectBy:'date':true track by $index" <div ng-repeat="(id, item) in giftCards | orderObjectBy:'date':true track by $index"
ng-click="amazon.openCardModal(item)" ng-click="amazon.openCardModal(item)"
class="row collapse last-transactions-content size-12"> class="item item-avatar">
<div class="large-2 medium-2 small-2 columns">
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40"> <img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
</div> <h2 ng-if="item.claimCode">
<div class="large-4 medium-4 small-4 columns m5t size-18" ng-if="item.claimCode"> {{item.amount | currency : '$ ' : 2}}
{{item.amount | currency : '$ ' : 2}} </h2>
</div> <h2 ng-if="!item.claimCode">
<div class="large-4 medium-4 small-4 columns m5t size-18" ng-if="!item.claimCode"> -
- </h2>
</div> <p>
<div class="large-5 medium-5 small-5 columns text-right m10t"> <span class="text-warning" ng-if="item.status == 'FAILURE' || item.status == 'RESEND'">Error</span>
<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 == '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 == 'Canceled'">Canceled</span> <span class="text-gray" ng-if="item.status == 'SUCCESS' && item.cardStatus == 'Fulfilled'">{{item.date | amTimeAgo}}</span>
<span class="text-gray" ng-if="item.status == 'SUCCESS' && item.cardStatus == 'Fulfilled'">{{item.date | amTimeAgo}}</span> </p>
</div>
<div class="large-1 medium-1 small-1 columns text-right m10t">
<i class="icon-arrow-right3 size-18"></i>
</div> </div>
</div> </div>
</div> </div>

View file

@ -15,7 +15,7 @@
<ion-content ng-controller="bitpayCardController as bitpayCard" ng-init="bitpayCard.init()"> <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 Sandbox version. Only for testing purpose
</div> </div>
@ -24,7 +24,7 @@
</div> </div>
<div ng-show="!bitpayCard.bitpayCardAuthenticated && !bitpayCard.loadingSession"> <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"> <img src="img/bitpay-card-visa.svg" width="200">
</div> </div>
<h4 class="text-center"> <h4 class="text-center">

View file

@ -10,7 +10,7 @@
<ion-content ng-controller="buyAmazonController as buy" ng-init="buy.init()"> <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"> <div class="assertive" ng-show="buy.error" ng-click="buy.error = null">
{{buy.error}} {{buy.error}}
@ -22,14 +22,14 @@
BitPay Invoice ID: {{buy.errorInfo.invoiceId}}. BitPay Invoice ID: {{buy.errorInfo.invoiceId}}.
</div> </div>
<div class="text-center"> <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>
</div> </div>
<div class="text-center"> <div class="padding text-center">
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="180"> <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. Use your Amazon.com Gift Card* to shop from a huge selection of books, electronics, music, movies, software, apparel, toys, and more.
</div> </div>
</div> </div>
@ -51,7 +51,6 @@
ng-model="fiat" ng-model="fiat"
autocomplete="off" ignore-mouse-wheel required> autocomplete="off" ignore-mouse-wheel required>
<a class="postfix button black">USD</a>
</label> </label>
@ -69,7 +68,7 @@
</label> </label>
</div> </div>
<button class="button button-block button-positive" <button class="button button-block"
ng-disabled="!buy.selectedWalletId || !fiat" ng-disabled="!buy.selectedWalletId || !fiat"
type="submit" type="submit"
value="Buy now"> value="Buy now">
@ -106,7 +105,7 @@
<div class="size-12 p15h"> <div class="size-12 p15h">
Thank you for participating in the BitPay offer. It is our pleasure to send 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 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. You may want to print this screen for easy reference later you will need the gift card claim code below.
</div> </div>
@ -119,23 +118,23 @@
</span> </span>
</div> </div>
<div class="size-14"> <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>
<div class="m10t"> <div class="m10t">
<button class="button black round tiny" <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 Redeem Now
</button> </button>
</div> </div>
<div class="size-12 m10t text-center"> <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> </div>
<div class="oh m20t p15h size-12"> <div class="oh m20t p15h size-12">
To redeem your gift card, follow these steps: To redeem your gift card, follow these steps:
<ol class="m10t size-12"> <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>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>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. <li>4. You must pay for any remaining balance on your order with another payment method.
@ -148,7 +147,7 @@
<p class="size-12"> <p class="size-12">
If you have questions about redeeming your gift card, please visit 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. If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p> </p>
@ -157,14 +156,14 @@
</div> </div>
<div class="size-12 white p15 m20t"> <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. * <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="$root.openExternalLink('http://amazon.com')">Amazon.com</a> 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 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 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 &reg;, &trade; &amp; &copy; are IP GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; 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. No expiration date or service fees.
</div> </div>

View file

@ -1,20 +1,15 @@
<ion-modal-view ng-controller="amazonCardDetailsController"> <ion-modal-view ng-controller="amazonCardDetailsController">
<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()" class="p10"> ng-click="cancel()">
<span class="text-close">Close</span> Close
</a> </button>
</div> <h1 class="title">Details</h1>
<h1 class="title ellipsis">
Details
</h1>
</ion-header-bar> </ion-header-bar>
<ion-content> <ion-content>
<div class="modal-content">
<div class="header-modal text-center"> <div class="header-modal text-center">
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="230" ng-click="refreshGiftCard()"> <img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="230" ng-click="refreshGiftCard()">
<div ng-show="card.claimCode"> <div ng-show="card.claimCode">
@ -25,11 +20,11 @@
</span> </span>
</div> </div>
<div ng-show="card.cardStatus !== 'Canceled'"> <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>
<div class="m10t" ng-show="card.cardStatus == 'Fulfilled'"> <div class="m10t" ng-show="card.cardStatus == 'Fulfilled'">
<button class="button black round tiny" <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 Redeem Now
</button> </button>
</div> </div>
@ -54,7 +49,7 @@
</div> </div>
</div> </div>
<div class="size-12 m10t text-center"> <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>
</div> </div>
@ -72,7 +67,7 @@
To redeem your gift card, follow these steps: To redeem your gift card, follow these steps:
<ol class="m10t size-12"> <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>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>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. <li>4. You must pay for any remaining balance on your order with another payment method.
@ -85,35 +80,33 @@
<p class="size-12"> <p class="size-12">
If you have questions about redeeming your gift card, please visit 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. If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p> </p>
</div> </div>
<div class="size-12 white p15 m30v"> <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. * <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="$root.openExternalLink('http://amazon.com')">Amazon.com</a> 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 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 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 &reg;, &trade; &amp; &copy; are IP GCs are issued by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; 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. No expiration date or service fees.
</div> </div>
<ul class="no-bullet size-14 m30v text-center"> <div class="list text-center">
<li class="line-b p10 oh pointer" ng-show="card.status == 'SUCCESS' && card.cardStatus == 'Fulfilled'" ng-click="cancelGiftCard()"> <a class="item" ng-show="card.status == 'SUCCESS' && card.cardStatus == 'Fulfilled'" ng-click="cancelGiftCard()">
<span class="text-warning">Cancel</span> <span class="assertive">Cancel</span>
</li> </a>
<li class="line-b p10 oh pointer" ng-show="card.status == 'FAILURE' || card.cardStatus == 'Canceled' <a class="item" ng-show="card.status == 'FAILURE' || card.cardStatus == 'Canceled'
|| card.cardStatus == 'Expired'" ng-click="remove()"> || card.cardStatus == 'Expired'" ng-click="remove()">
<span class="text-warning">Remove</span> <span class="assertive">Remove</span>
</li> </a>
</ul> </div>
<div class="extra-margin-bottom"></div>
</div>
</ion-content> </ion-content>
</ion-modal-view> </ion-modal-view>

View file

@ -1,47 +1,47 @@
<ion-modal-view ng-controller="txStatusController"> <ion-modal-view ng-controller="txStatusController">
<div ng-if="type == 'broadcasted'" class="popup-txsent text-center"> <div ng-if="type == 'broadcasted'" class="popup-txsent text-center m30tp">
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i> <i class="icon ion-checkmark-round"></i>
<div ng-show="tx.amountStr" class="m20t size-36 text-white"> <div ng-show="tx.amountStr" class="m20t size-36">
{{tx.amountStr}} {{tx.amountStr}}
</div> </div>
<div class="size-16 text-gray"> <div class="size-16 text-gray m10v">
<span translate>Sent</span> <span translate>Sent</span>
</div> </div>
<div class="text-center m20t"> <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> </div>
<div ng-if="type == 'created'" class="popup-txsigned"> <div ng-if="type == 'created'" class="popup-txsigned m30tp">
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i> <i class="icon ion-checkmark-round"></i>
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}"> <div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Proposal Created</span> <span translate>Payment Proposal Created</span>
</div> </div>
<div class="text-center"> <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> </div>
<div ng-if="type == 'accepted'" class="popup-txsigned"> <div ng-if="type == 'accepted'" class="popup-txsigned m30tp">
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i> <i class="icon ion-checkmark-round"></i>
<div class="text-center size-18 text-primary tu text-bold p20" ng-style="{'color':color}"> <div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Accepted</span> <span translate>Payment Accepted</span>
</div> </div>
<div class="text-center"> <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> </div>
<div ng-if="type=='rejected'" class="popup-txrejected"> <div ng-if="type=='rejected'" class="popup-txrejected m30tp">
<i class="fi-x small-centered columns m30tp" ng-style="{'color':color, 'border-color':color}"></i> <i class="icon ion-close-round"></i>
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}"> <div class="text-center size-18 tu text-bold m20t">
<span translate>Payment Rejected</span> <span translate>Payment Rejected</span>
</div> </div>
<div class="text-center"> <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>
</div> </div>
</ion-modal-view> </ion-modal-view>

View file

@ -47,7 +47,7 @@
</div> </div>
</div> </div>
<div class="card" ng-show="wallets[0]"> <div class="card" ng-init="updateAllWallets()">
<div ng-repeat="item in wallets track by $index" <div ng-repeat="item in wallets track by $index"
class="item item-icon-left" class="item item-icon-left"
ui-sref="wallet.details({'walletId': item.id})"> ui-sref="wallet.details({'walletId': item.id})">
@ -73,23 +73,21 @@
<img src="img/glidera-logo.png" width="90"> <img src="img/glidera-logo.png" width="90">
</div> </div>
<div ng-show="coinbaseEnabled" ui-sref="exchange.coinbase" class="item"> <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> </div>
</div> </div>
<h3>Next steps </h3> <h3>Next steps </h3>
<div class="list card"> <div class="card">
<ul class="pr"> <div ui-sref="bitpayCard.main" ng-show="bitpayCardEnabled" class="item item-icon-left">
<li ui-sref="bitpayCard.main" ng-show="bitpayCardEnabled" class="item item-icon-left">
<i class="icon ion-card"></i> <i class="icon ion-card"></i>
BitPay Card BitPay Card
</li> </div>
<li ui-sref="amazon.main" class="item item-icon-left"> <div 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
</li> </div>
</ul>
</div> </div>
</ion-content> </ion-content>

View file

@ -1,15 +1,24 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('amazonController', 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) { 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');
}
};
this.init = function() { this.init = function() {
var self = this; var self = this;
self.sandbox = amazonService.getEnvironment() == 'testnet' ? true : false; $scope.network = amazonService.getEnvironment();
amazonService.getPendingGiftCards(function(err, gcds) { amazonService.getPendingGiftCards(function(err, gcds) {
if (err) { if (err) {
self.error = err; self.error = err;

View file

@ -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) { 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 self = this;
var client; var wallet;
self.sandbox = bitpayCardService.getEnvironment() == 'testnet' ? true : false;
if (platformInfo.isCordova && StatusBar.isVisible) { if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#293C92"); 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) { var processTransactions = function(invoices, history) {
for (var i = 0; i < invoices.length; i++) { for (var i = 0; i < invoices.length; i++) {
var matched = false; var matched = false;
@ -89,7 +79,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
bitpayCardService.transactionHistory(dateRange, function(err, history) { bitpayCardService.transactionHistory(dateRange, function(err, history) {
$scope.loadingHistory = false; $scope.loadingHistory = false;
if (err) { if (err) {
self.error = err; self.error = err.error || err;
return; return;
} }
@ -106,25 +96,26 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
this.init = function() { this.init = function() {
$scope.dateRange = 'last30Days'; $scope.dateRange = 'last30Days';
self.update();
var network = bitpayCardService.getEnvironment(); $scope.network = bitpayCardService.getEnvironment();
self.allWallets = profileService.getWallets({ self.allWallets = profileService.getWallets({
network: network, network: $scope.network,
n: 1, n: 1,
onlyComplete: true onlyComplete: true
}); });
self.update();
if (lodash.isEmpty(self.allWallets)) return; 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; self.isMultisigWallet = true;
$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);
}; };
@ -146,11 +137,11 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
$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.isMultisigWallet = false; self.isMultisigWallet = false;
self.selectedWalletId = walletId; self.selectedWalletId = walletId;
self.selectedWalletName = client.credentials.walletName; self.selectedWalletName = wallet.credentials.walletName;
if (client.credentials.n > 1) if (wallet.credentials.n > 1)
self.isMultisigWallet = true; self.isMultisigWallet = true;
$scope.$apply(); $scope.$apply();
}, 100); }, 100);
@ -161,6 +152,12 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
this.sendFunds = function() { this.sendFunds = function() {
self.error = null; 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 = { var dataSrc = {
amount: $scope.fiat, amount: $scope.fiat,
currency: 'USD' currency: 'USD'
@ -185,56 +182,52 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
} }
bitpayCardService.getInvoice(invoiceId, function(err, data) { bitpayCardService.getInvoice(invoiceId, function(err, data) {
var address, comment, amount; var address, comment, amount;
address = data.bitcoinAddress; address = data.bitcoinAddress;
amount = parseInt((data.btcPrice * 100000000).toFixed(0)); amount = parseInt((data.btcPrice * 100000000).toFixed(0));
comment = data.itemDesc; comment = data.itemDesc;
outputs.push({ outputs.push({
'toAddress': address, 'toAddress': address,
'amount': amount, 'amount': amount,
'message': comment 'message': comment
}); });
var txp = { var txp = {
toAddress: address, toAddress: address,
amount: amount, amount: amount,
outputs: outputs, outputs: outputs,
message: comment, message: comment,
payProUrl: null, payProUrl: null,
excludeUnconfirmedUtxos: configWallet.spendUnconfirmed ? false : true, excludeUnconfirmedUtxos: configWallet.spendUnconfirmed ? false : true,
feeLevel: walletSettings.feeLevel || 'normal' feeLevel: walletSettings.feeLevel || 'normal'
}; };
walletService.createTx(client, txp, function(err, createdTxp) { walletService.createTx(wallet, txp, function(err, createdTxp) {
ongoingProcess.set('Processing Transaction...', false); ongoingProcess.set('Processing Transaction...', false);
if (err) { if (err) {
self.error = bwcError.msg(err); self.error = bwcError.msg(err);
$timeout(function() { $timeout(function() {
$scope.$digest(); $scope.$digest();
}); });
return; return;
} }
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) { self.confirmTx(createdTxp, function(err, tx) {
if (accept) { ongoingProcess.set('Processing Transaction...', false);
self.confirmTx(createdTxp, function(err, tx) { if (err) {
ongoingProcess.set('Processing Transaction...', false); self.error = bwcError.msg(err);
if (err) {
self.error = bwcError.msg(err);
$timeout(function() {
$scope.$digest();
});
return;
}
self.update();
$scope.addFunds = false;
$timeout(function() { $timeout(function() {
$scope.$digest(); $scope.$digest();
}); });
return;
}
self.update();
$scope.addFunds = false;
$timeout(function() {
$scope.$digest();
}); });
} });
});
}); });
}); });
}); });
@ -243,39 +236,39 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
this.confirmTx = function(txp, cb) { this.confirmTx = function(txp, cb) {
fingerprintService.check(client, function(err) { fingerprintService.check(wallet, function(err) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
return cb(err); return cb(err);
} }
handleEncryptedWallet(client, function(err) { walletService.handleEncryptedWallet(wallet, function(err) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);
} }
ongoingProcess.set('Processing Transaction...', true); ongoingProcess.set('Processing Transaction...', true);
walletService.publishTx(client, txp, function(err, publishedTxp) { walletService.publishTx(wallet, txp, function(err, publishedTxp) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);
} }
walletService.signTx(client, publishedTxp, function(err, signedTxp) { walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
walletService.lock(client); walletService.lock(wallet);
if (err) { if (err) {
$log.debug(err); $log.debug(err);
walletService.removeTx(client, signedTxp, function(err) { walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
}); });
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);
} }
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) { walletService.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
walletService.removeTx(client, broadcastedTxp, function(err) { walletService.removeTx(wallet, broadcastedTxp, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
}); });
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);

View file

@ -1,17 +1,18 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('buyAmazonController', 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 self = this;
var client; var wallet;
var handleEncryptedWallet = function(client, cb) { $scope.openExternalLink = function(url, target) {
if (!walletService.isEncrypted(client)) return cb(); if (platformInfo.isNW) {
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) { nodeWebkit.openExternalLink(url);
if (err) return cb(err); } else {
return cb(walletService.unlock(client, password)); target = target || '_blank';
}); var ref = window.open(url, target, 'location=no');
}
}; };
this.init = function() { this.init = function() {
@ -24,11 +25,11 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
if (lodash.isEmpty(self.allWallets)) return; if (lodash.isEmpty(self.allWallets)) return;
client = self.allWallets[0]; wallet = self.allWallets[0];
$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);
}; };
@ -50,9 +51,9 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
$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();
@ -63,6 +64,12 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
self.error = null; self.error = null;
self.errorInfo = 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 = { var dataSrc = {
currency: 'USD', currency: 'USD',
amount: $scope.fiat, amount: $scope.fiat,
@ -98,7 +105,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
$log.debug('Fetch PayPro Request...', invoice.paymentUrls.BIP73); $log.debug('Fetch PayPro Request...', invoice.paymentUrls.BIP73);
client.fetchPayPro({ wallet.fetchPayPro({
payProUrl: invoice.paymentUrls.BIP73, payProUrl: invoice.paymentUrls.BIP73,
}, function(err, paypro) { }, function(err, paypro) {
@ -149,7 +156,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
feeLevel: walletSettings.feeLevel || 'normal' feeLevel: walletSettings.feeLevel || 'normal'
}; };
walletService.createTx(client, txp, function(err, createdTxp) { walletService.createTx(wallet, txp, function(err, createdTxp) {
ongoingProcess.set('Processing Transaction...', false); ongoingProcess.set('Processing Transaction...', false);
if (err) { if (err) {
self.error = bwcError.msg(err); self.error = bwcError.msg(err);
@ -240,42 +247,41 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
}); });
}); });
}); });
} };
this.confirmTx = function(txp, cb) { this.confirmTx = function(txp, cb) {
fingerprintService.check(wallet, function(err) {
fingerprintService.check(client, function(err) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
return cb(err); return cb(err);
} }
handleEncryptedWallet(client, function(err) { walletService.handleEncryptedWallet(wallet, function(err) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);
} }
ongoingProcess.set('Processing Transaction...', true); ongoingProcess.set('Processing Transaction...', true);
walletService.publishTx(client, txp, function(err, publishedTxp) { walletService.publishTx(wallet, txp, function(err, publishedTxp) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);
} }
walletService.signTx(client, publishedTxp, function(err, signedTxp) { walletService.signTx(wallet, publishedTxp, function(err, signedTxp) {
walletService.lock(client); walletService.lock(wallet);
if (err) { if (err) {
$log.debug(err); $log.debug(err);
walletService.removeTx(client, signedTxp, function(err) { walletService.removeTx(wallet, signedTxp, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
}); });
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);
} }
walletService.broadcastTx(client, signedTxp, function(err, broadcastedTxp) { walletService.broadcastTx(wallet, signedTxp, function(err, broadcastedTxp) {
if (err) { if (err) {
$log.debug(err); $log.debug(err);
walletService.removeTx(client, broadcastedTxp, function(err) { walletService.removeTx(wallet, broadcastedTxp, function(err) {
if (err) $log.debug(err); if (err) $log.debug(err);
}); });
return bwcError.cb(err, null, cb); return bwcError.cb(err, null, cb);

View file

@ -214,7 +214,7 @@ angular.module('copayApp.controllers').controller('sellGlideraController',
return; return;
} }
handleEncryptedWallet(wallet, function(err) { walletService.handleEncryptedWallet(wallet, function(err) {
if (err) { if (err) {
self.error = err.message ||  bwcError.msg(err); self.error = err.message ||  bwcError.msg(err);
return; return;

View file

@ -2,7 +2,6 @@
angular.module('copayApp.controllers').controller('tabHomeController', angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) { function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
var self = this;
var setNotifications = function(notifications) { var setNotifications = function(notifications) {
@ -18,48 +17,51 @@ angular.module('copayApp.controllers').controller('tabHomeController',
self.updateAllWallets = function() { $scope.updateAllWallets = function() {
$scope.wallets = profileService.getWallets(); $timeout(function() {
$scope.wallets = profileService.getWallets();
var i = $scope.wallets.length, j =0; 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 timeSpan = 60 * 60 * 24 * 1;
var notifications = []; var notifications = [];
$scope.fetchingNotifications = true; $scope.fetchingNotifications = true;
lodash.each($scope.wallets, function(wallet) { lodash.each($scope.wallets, function(wallet) {
walletService.getStatus(wallet, {}, function(err, status) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
wallet.status = status;
});
walletService.getNotifications(wallet, {
timeSpan: timeSpan
}, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
notifications.push(n);
if (++j == i) {
$scope.fetchingNotifications = false;
setNotifications(lodash.compact(lodash.flatten(notifications)));
};
});
walletService.getStatus(wallet, {}, function(err, status) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
wallet.status = status;
}); });
$scope.$digest();
}, 100);
};
walletService.getNotifications(wallet, { $scope.updateWallet = function(wallet) {
timeSpan: timeSpan
}, function(err, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
notifications.push(n);
if (++j == i) {
$scope.fetchingNotifications = false;
setNotifications(lodash.compact(lodash.flatten(notifications)));
};
});
});
}
self.updateWallet = function(wallet) {
$log.debug('Updating wallet:' + wallet.name) $log.debug('Updating wallet:' + wallet.name)
walletService.getStatus(wallet, {}, function(err, status) { walletService.getStatus(wallet, {}, function(err, status) {
if (err) { if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO $log.error(err); //TODO
return; return;
} }
wallet.status = status; wallet.status = status;
@ -71,17 +73,16 @@ angular.module('copayApp.controllers').controller('tabHomeController',
self.updateAllWallets();
$scope.bitpayCardEnabled = true; // TODO $scope.bitpayCardEnabled = true; // TODO
var listeners = [ var listeners = [
$rootScope.$on('bwsEvent', function(e, walletId, type, n) { $rootScope.$on('bwsEvent', function(e, walletId, type, n) {
var wallet = profileService.getWallet(walletId); var wallet = profileService.getWallet(walletId);
self.updateWallet(wallet); $scope.updateWallet(wallet);
}), }),
$rootScope.$on('Local/TxAction', function(e, walletId) { $rootScope.$on('Local/TxAction', function(e, walletId) {
var wallet = profileService.getWallet(walletId); var wallet = profileService.getWallet(walletId);
self.updateWallet(wallet); $scope.updateWallet(wallet);
}), }),
]; ];

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.directives') angular.module('copayApp.directives')
.directive('copyToClipboard', function(platformInfo, gettextCatalog, ionicToast, clipboard) { .directive('copyToClipboard', function(platformInfo, nodeWebkit, gettextCatalog, ionicToast, clipboard) {
return { return {
restrict: 'A', restrict: 'A',
scope: { scope: {

View file

@ -380,36 +380,14 @@ ul.wallet-selection.wallets {
bottom: 0; bottom: 0;
} }
.popup-txsent { .popup-txsent i {
position: absolute; font-size: 5rem;
width: 100%; color: #4A90E2;
height: 100%;
background: rgba(24, 44, 58, 0.9);
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 { .popup-txsigned i, .popup-txrejected i {
font-size: 5rem; font-size: 5rem;
color: #4A90E2; 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 { .payment-proposal-head {