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">
<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>
<ion-content ng-controller="amazonController as amazon" ng-init="amazon.init()">
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
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>
<div ng-show="amazon.sandbox">
<i class="icon ion-information-circled"></i>
Sandbox version. Only for testing purpose
</div>
<div class="m20t text-center" ng-click="amazon.updatePendingGiftCards()">
<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 ng-if="!giftCards" class="m20t text-center size-12">
<div ng-if="!giftCards" class="m20t padding text-center">
<div class="row">
<div class="columns">
<button class="m20t button black round expand"
ui-sref="buyAmazon">
Buy now
</button>
</div>
</div>
<button class="button button-positive" ui-sref="amazon.buy">
Buy now
</button>
<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
<a ng-click="$root.openExternalLink('https://www.amazon.com')">www.amazon.com</a>
</div>
</div>
<div class="p20t" ng-if="giftCards">
<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>
@ -61,7 +45,7 @@
<h4 class="title">Your cards</h4>
<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">
class="row collapse last-transactions-content size-12">
<div class="large-2 medium-2 small-2 columns">
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
</div>
@ -82,7 +66,6 @@
</div>
</div>
</div>
</div>
</ion-content>
</ion-view>
<div class="extra-margin-bottom"></div>
</div>

View file

@ -1,19 +1,19 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Buy'; goBackToState = 'amazon'; noColor = true">
</div>
<ion-view>
<ion-nav-bar class="bar-stable">
<ion-nav-buttons side="primary">
<button class="button no-border" ui-sref="amazon.main">
<i class="icon ion-chevron-left"></i> Back
</button>
</ion-nav-buttons>
<ion-nav-title>Buy</ion-nav-title>
</ion-nav-bar>
<ion-content ng-controller="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="columns">
<div class="box-notification m20b" ng-show="buy.error" ng-click="buy.error = null">
<span class="text-warning">
{{buy.error}}
</span>
<div class="assertive" ng-show="buy.error" ng-click="buy.error = null">
{{buy.error}}
<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
BitPay to refund your bitcoin
@ -29,138 +29,145 @@
<div class="text-center">
<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.
</div>
</div>
<form
class="m30v"
name="buyAmazonForm"
ng-submit="buy.createTx()"
novalidate>
<label>
Amount
</label>
<div class="input">
<input type="number" id="fiat"
name="fiat" ng-attr-placeholder="{{'Amount in USD'}}"
min="0.01" max="500"
ng-model="fiat" autocomplete="off" required>
<form class="m20t"
name="buyAmazonForm"
ng-submit="buy.createTx()"
novalidate>
<a class="postfix button black">USD</a>
</div>
<div class="list">
<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">
<label>Pay From Copay Wallet</label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="buy.selectedWalletId"
ng-attr-placeholder="{{'Choose your source wallet'}}"
ng-model="buy.selectedWalletName" required>
<a ng-click="openWalletsModal(buy.allWallets)" class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>
<a class="postfix button black">USD</a>
</label>
<label class="item item-input item-stacked-label">
<span class="input-label">Pay From Copay Wallet</span>
<input type="text"
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>
</div>
</label>
</div>
<div class="input m20t">
<input class="button black round expand"
ng-disabled="!buy.selectedWalletId || !fiat"
type="submit" value="Buy now">
<div class="size-10 text-gray text-center">
Purchase Amount is limited to USD 500 per day
</div>
<button class="button button-block button-positive"
ng-disabled="!buy.selectedWalletId || !fiat"
type="submit"
value="Buy now">
Buy now
</button>
<div class="size-10 text-gray text-center">
Purchase Amount is limited to USD 500 per day
</div>
</form>
</div>
</div>
<div class="m10t" ng-show="buy.giftCard">
<div class="m10h" ng-show="buy.giftCard.status != 'SUCCESS' && buy.giftCard.status != 'PENDING'">
<h1 class="text-center">Gift card could not be created</h1>
<div class="box-notification m20b">
<span class="text-warning">
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 }}
<div class="m10t" ng-show="buy.giftCard">
<div class="m10h" ng-show="buy.giftCard.status != 'SUCCESS' && buy.giftCard.status != 'PENDING'">
<h1 class="text-center">Gift card could not be created</h1>
<div class="box-notification m20b">
<span class="text-warning">
There was an error when trying to create the Amazon.com Gift Card. Status: {{buy.giftCard.status}}
</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
<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 class="size-12 m10t text-center">
<a ng-click="$root.openExternalLink(buy.giftCard.invoiceUrl)">See invoice</a>
</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>
</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 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 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>
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
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>.
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.
No expiration date or service fees.
</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>
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
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>.
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.
No expiration date or service fees.
</div>
</ion-content>
</ion-view>
</div>
<div class="extra-margin-bottom"></div>

View file

@ -89,7 +89,7 @@
<i class="icon ion-cash"></i>
Buy and Sell
</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>
Gift Cards
<span class="item-note">

View file

@ -16,14 +16,15 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
this.init = function() {
var network = amazonService.getEnvironment();
self.allWallets = profileService.getWallets(network, 1);
client = profileService.focusedClient;
if (!client) return;
self.allWallets = profileService.getWallets({
network: network,
n: 1,
onlyComplete: true
});
if (lodash.isEmpty(self.allWallets)) return;
if (client.credentials.network != network) return;
client = self.allWallets[0];
$timeout(function() {
self.selectedWalletId = client.credentials.walletId;
@ -157,28 +158,24 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
});
return;
}
$scope.$emit('Local/NeedsConfirmation', createdTxp, function(accept) {
if (accept) {
self.confirmTx(createdTxp, function(err, tx) {
if (err) {
ongoingProcess.set('Processing Transaction...', false);
self.error = bwcError.msg(err);
$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);
self.confirmTx(createdTxp, function(err, tx) {
if (err) {
ongoingProcess.set('Processing Transaction...', false);
self.error = bwcError.msg(err);
$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);
});
});
});

View file

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

View file

@ -1,6 +1,6 @@
'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 isCordova = platformInfo.isCordova;