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">
<button class="button button-positive" ui-sref="amazon.buy">
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
<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>
@ -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">
<div class="assertive" ng-show="buy.error" ng-click="buy.error = null">
{{buy.error}}
</span>
<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,51 +29,57 @@
<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"
<form class="m20t"
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>
<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>
<a class="postfix button black">USD</a>
</div>
</label>
<div class="m10b">
<label>Pay From Copay Wallet</label>
<div class="input">
<input type="text" id="address" name="address" ng-disabled="buy.selectedWalletId"
<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 ng-click="openWalletsModal(buy.allWallets)" class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>
<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"
<button class="button button-block button-positive"
ng-disabled="!buy.selectedWalletId || !fiat"
type="submit" value="Buy now">
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>
</div>
</form>
</div>
</div>
<div class="m10t" ng-show="buy.giftCard">
<div class="m10h" ng-show="buy.giftCard.status != 'SUCCESS' && buy.giftCard.status != 'PENDING'">
@ -162,5 +168,6 @@
No expiration date or service fees.
</div>
</div>
<div class="extra-margin-bottom"></div>
</ion-content>
</ion-view>

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,8 +158,6 @@ 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);
@ -178,8 +177,6 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
self.debounceCreate(count, dataSrc);
});
}
});
});
});
});

View file

@ -610,11 +610,24 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('amazon', {
url: '/amazon',
templateUrl: 'views/amazon.html'
abstract: true,
template: '<ion-nav-view name="amazon"></ion-nav-view>'
})
.state('buyAmazon', {
url: '/buyamazon',
.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;