Merge pull request #211 from cmgustavo/ref/design-09

Amazon gift card
This commit is contained in:
Matias Alejo Garcia 2016-08-19 18:05:40 -03:00 committed by GitHub
commit 24c45060f2
6 changed files with 203 additions and 203 deletions

View file

@ -1,54 +1,38 @@
<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>Gift cards</ion-nav-title>
</ion-nav-bar>
<div class="topbar-container"> <ion-content ng-controller="amazonController as amazon" ng-init="amazon.init()">
<nav ng-controller="topbarController as topbar"
class="tab-bar">
<section class="left-small">
<a class="p10"
ng-click="topbar.goHome()">
<span class="text-close">Close</span>
</a>
</section>
<section class="middle tab-bar-section"> <div ng-show="amazon.sandbox">
<h1 class="title ellipsis"> <i class="icon ion-information-circled"></i>
Gift cards
</h1>
</section>
</nav>
</div>
<div class="content amazon p20b" ng-controller="amazonController as amazon">
<div ng-init="amazon.init()">
<div class="box-notification text-center size-12 text-warning" ng-show="amazon.sandbox">
<i class="fi-info"></i>
Sandbox version. Only for testing purpose Sandbox version. Only for testing purpose
</div> </div>
<div class="m20t text-center" ng-click="amazon.updatePendingGiftCards()"> <div class="m20t text-center" ng-click="amazon.updatePendingGiftCards()">
<img src="img/GCs-logo-cllb.png" alt="Amazon.com Gift Card" width="200"> <img src="img/GCs-logo-cllb.png" alt="Amazon.com Gift Card" width="200">
<div class="size-10 m5t text-gray"><b>Only</b> redeemable on www.amazon.com (USA website)</div> <div class="size-11 m10t"><b>Only</b> redeemable on www.amazon.com (USA website)</div>
</div> </div>
<div ng-if="!giftCards" class="m20t text-center size-12"> <div ng-if="!giftCards" class="m20t padding text-center">
<div class="row"> <button class="button button-positive" ui-sref="amazon.buy">
<div class="columns"> Buy now
<button class="m20t button black round expand" </button>
ui-sref="buyAmazon">
Buy now
</button>
</div>
</div>
<div class="text-left p10h 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="$root.openExternalLink('https://www.amazon.com')">www.amazon.com</a>
</div> </div>
</div> </div>
<div class="p20t" ng-if="giftCards"> <div class="m20t" ng-if="giftCards">
<ul class="no-bullet m0 size-14"> <ul class="no-bullet m0 size-14">
<li class="line-b line-t p10 pointer" href ui-sref="buyAmazon"> <li class="line-b line-t p10 pointer" href ui-sref="buyAmazon">
<i class="fi-shopping-cart size-24 m5l vm dib"></i> <i class="fi-shopping-cart size-24 m5l vm dib"></i>
@ -61,7 +45,7 @@
<h4 class="title">Your cards</h4> <h4 class="title">Your cards</h4>
<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="row collapse last-transactions-content size-12">
<div class="large-2 medium-2 small-2 columns"> <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> </div>
@ -82,7 +66,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </ion-content>
</ion-view>
<div class="extra-margin-bottom"></div>
</div>

View file

@ -1,19 +1,19 @@
<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 = 'amazon'; noColor = true"> <button class="button no-border" ui-sref="amazon.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="buyAmazonController as buy" ng-init="buy.init()">
<div class="content amazon" ng-controller="buyAmazonController as buy"> <div class="padding" ng-show="!buy.giftCard">
<div class="row m10t" ng-show="!buy.giftCard" ng-init="buy.init()"> <div class="assertive" ng-show="buy.error" ng-click="buy.error = null">
<div class="columns"> {{buy.error}}
<div class="box-notification m20b" ng-show="buy.error" ng-click="buy.error = null">
<span class="text-warning">
{{buy.error}}
</span>
<div class="m10t size-12" ng-show="buy.errorInfo"> <div class="m10t size-12" ng-show="buy.errorInfo">
There was an error when trying to buy gift card, but the funds were sent to BitPay Invoice. Please, contact There was an error when trying to buy gift card, but the funds were sent to BitPay Invoice. Please, contact
BitPay to refund your bitcoin BitPay to refund your bitcoin
@ -29,138 +29,145 @@
<div class="text-center"> <div class="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-left size-10 m10t"> <div class="text-center size-10 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>
<form
class="m30v"
name="buyAmazonForm"
ng-submit="buy.createTx()"
novalidate>
<label> <form class="m20t"
Amount name="buyAmazonForm"
</label> ng-submit="buy.createTx()"
<div class="input"> novalidate>
<input type="number" id="fiat"
name="fiat" ng-attr-placeholder="{{'Amount in USD'}}"
min="0.01" max="500"
ng-model="fiat" autocomplete="off" required>
<a class="postfix button black">USD</a> <div class="list">
</div> <label class="item item-input item-stacked-label">
<span class="input-label">Amount</span>
<input type="number"
id="fiat"
name="fiat"
ng-attr-placeholder="{{'Amount in USD'}}"
min="0.01"
max="500"
ng-model="fiat"
autocomplete="off" required>
<div class="m10b"> <a class="postfix button black">USD</a>
<label>Pay From Copay Wallet</label> </label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="buy.selectedWalletId"
ng-attr-placeholder="{{'Choose your source wallet'}}" <label class="item item-input item-stacked-label">
ng-model="buy.selectedWalletName" required> <span class="input-label">Pay From Copay Wallet</span>
<a ng-click="openWalletsModal(buy.allWallets)" class="postfix size-12 m0 text-gray"> <input type="text"
<i class="icon-wallet size-18"></i> id="address"
name="address"
ng-disabled="buy.selectedWalletId"
ng-attr-placeholder="{{'Choose your source wallet'}}"
ng-model="buy.selectedWalletName" required>
<a on-tap="openWalletsModal(buy.allWallets)" class="button button-light">
<i class="icon ion-folder size-18"></i>
</a> </a>
</div> </label>
</div> </div>
<div class="input m20t"> <button class="button button-block button-positive"
<input class="button black round expand" ng-disabled="!buy.selectedWalletId || !fiat"
ng-disabled="!buy.selectedWalletId || !fiat" type="submit"
type="submit" value="Buy now"> value="Buy now">
<div class="size-10 text-gray text-center"> Buy now
Purchase Amount is limited to USD 500 per day </button>
</div> <div class="size-10 text-gray text-center">
Purchase Amount is limited to USD 500 per day
</div> </div>
</form> </form>
</div> </div>
</div>
<div class="m10t" ng-show="buy.giftCard"> <div class="m10t" ng-show="buy.giftCard">
<div class="m10h" ng-show="buy.giftCard.status != 'SUCCESS' && buy.giftCard.status != 'PENDING'"> <div class="m10h" ng-show="buy.giftCard.status != 'SUCCESS' && buy.giftCard.status != 'PENDING'">
<h1 class="text-center">Gift card could not be created</h1> <h1 class="text-center">Gift card could not be created</h1>
<div class="box-notification m20b"> <div class="box-notification m20b">
<span class="text-warning"> <span class="text-warning">
There was an error when trying to create the Amazon.com Gift Card. Status: {{buy.giftCard.status}} There was an error when trying to create the Amazon.com Gift Card. Status: {{buy.giftCard.status}}
</span>
</div>
<div class="text-gray size-12 m20t">
<span ng-show="buy.giftCard.status == 'RESEND'">
This is a temporary/recoverable system failure that can be
resolved retrying the request from your list of cards
</span>
<span ng-show="buy.giftCard.status == 'FAILURE'">
This failure could not be recoverable. Request your refund from your list of cards
</span>
<button class="m20t button outline round dark-gray expand" ng-click="$root.go('amazon')">
Back
</button>
</div>
</div>
<div ng-show="buy.giftCard.status == 'SUCCESS'">
<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>.
You may want to print this screen for easy reference later you will need the gift card claim code below.
</div>
<div class="oh m20t p15 white size-12 text-center">
<img class="m10h" src="img/a_generic.jpg" alt="Amazon.com Gift Cards" width="200">
<div class="m10t size-14">
Gift Card Amount:
<span class="text-bold">
{{buy.giftCard.amount | currency : '$ ' : 2 }}
</span> </span>
</div> </div>
<div class="size-14"> <div class="text-gray size-12 m20t">
Claim code: <span class="text-bold enable_text_select">{{buy.giftCard.claimCode}}</span> <span ng-show="buy.giftCard.status == 'RESEND'">
</div> This is a temporary/recoverable system failure that can be
<div class="m10t"> resolved retrying the request from your list of cards
<button class="button black round tiny" </span>
ng-click="$root.openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + buy.giftCard.claimCode, '_system')"> <span ng-show="buy.giftCard.status == 'FAILURE'">
Redeem Now This failure could not be recoverable. Request your refund from your list of cards
</span>
<button class="m20t button outline round dark-gray expand" ng-click="$root.go('amazon')">
Back
</button> </button>
</div> </div>
<div class="size-12 m10t text-center"> </div>
<a ng-click="$root.openExternalLink(buy.giftCard.invoiceUrl)">See invoice</a> <div ng-show="buy.giftCard.status == 'SUCCESS'">
<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>.
You may want to print this screen for easy reference later you will need the gift card claim code below.
</div>
<div class="oh m20t p15 white size-12 text-center">
<img class="m10h" src="img/a_generic.jpg" alt="Amazon.com Gift Cards" width="200">
<div class="m10t size-14">
Gift Card Amount:
<span class="text-bold">
{{buy.giftCard.amount | currency : '$ ' : 2 }}
</span>
</div>
<div class="size-14">
Claim code: <span class="text-bold enable_text_select">{{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')">
Redeem Now
</button>
</div>
<div class="size-12 m10t text-center">
<a ng-click="$root.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>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.
</ol>
<p class="size-12">
Your gift card claim code may also be entered when prompted during checkout. To redeem your gift card using
the Amazon.com 1-Click&reg; service, first add the gift card funds to Your Account.
</p>
<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>.
If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p>
</div> </div>
</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>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.
</ol>
<p class="size-12">
Your gift card claim code may also be entered when prompted during checkout. To redeem your gift card using
the Amazon.com 1-Click&reg; service, first add the gift card funds to Your Account.
</p>
<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>.
If you have questions regarding the BitPay Introductory offer, please contact BitPay.
</p>
</div>
</div> </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="$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> Except as required by law, <a ng-click="$root.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="$root.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="$root.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="$root.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>
</ion-content>
</ion-view>
</div>
<div class="extra-margin-bottom"></div>

View file

@ -89,7 +89,7 @@
<i class="icon ion-cash"></i> <i class="icon ion-cash"></i>
Buy and Sell Buy and Sell
</li> </li>
<li menu-toggle href ui-sref="amazon" class="item item-icon-left"> <li menu-toggle href 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
<span class="item-note"> <span class="item-note">

View file

@ -16,14 +16,15 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
this.init = function() { this.init = function() {
var network = amazonService.getEnvironment(); var network = amazonService.getEnvironment();
self.allWallets = profileService.getWallets(network, 1); self.allWallets = profileService.getWallets({
client = profileService.focusedClient; network: network,
n: 1,
if (!client) return; onlyComplete: true
});
if (lodash.isEmpty(self.allWallets)) return; if (lodash.isEmpty(self.allWallets)) return;
if (client.credentials.network != network) return; client = self.allWallets[0];
$timeout(function() { $timeout(function() {
self.selectedWalletId = client.credentials.walletId; self.selectedWalletId = client.credentials.walletId;
@ -157,28 +158,24 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
}); });
return; return;
} }
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) { self.confirmTx(createdTxp, function(err, tx) {
if (accept) { if (err) {
self.confirmTx(createdTxp, function(err, tx) { ongoingProcess.set('Processing Transaction...', false);
if (err) { self.error = bwcError.msg(err);
ongoingProcess.set('Processing Transaction...', false); $timeout(function() {
self.error = bwcError.msg(err); $scope.$digest();
$timeout(function() {
$scope.$digest();
});
return;
}
var count = 0;
ongoingProcess.set('Processing Transaction...', true);
dataSrc.accessKey = dataInvoice.accessKey;
dataSrc.invoiceId = invoice.id;
dataSrc.invoiceUrl = invoice.url;
dataSrc.invoiceTime = invoice.invoiceTime;
self.debounceCreate(count, dataSrc);
}); });
return;
} }
var count = 0;
ongoingProcess.set('Processing Transaction...', true);
dataSrc.accessKey = dataInvoice.accessKey;
dataSrc.invoiceId = invoice.id;
dataSrc.invoiceUrl = invoice.url;
dataSrc.invoiceTime = invoice.invoiceTime;
self.debounceCreate(count, dataSrc);
}); });
}); });
}); });

View file

@ -608,13 +608,26 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
* *
*/ */
.state('amazon', { .state('amazon', {
url: '/amazon', url: '/amazon',
templateUrl: 'views/amazon.html' abstract: true,
template: '<ion-nav-view name="amazon"></ion-nav-view>'
}) })
.state('buyAmazon', { .state('amazon.main', {
url: '/buyamazon', url: '/main',
templateUrl: 'views/buyAmazon.html' views: {
'amazon': {
templateUrl: 'views/amazon.html'
}
}
})
.state('amazon.buy', {
url: '/buy',
views: {
'amazon': {
templateUrl: 'views/buyAmazon.html'
}
}
}); });
}) })
.run(function($rootScope, $state, $location, $log, $timeout, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog) { .run(function($rootScope, $state, $location, $log, $timeout, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog) {

View file

@ -1,6 +1,6 @@
'use strict'; 'use strict';
angular.module('copayApp.services').factory('txStatus', function(lodash, profileService, $timeout, platformInfo) { angular.module('copayApp.services').factory('txStatus', function($stateParams, lodash, profileService, $timeout, platformInfo) {
var root = {}; var root = {};
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;