amazon integration refactor

This commit is contained in:
Gabriel Bazán 2016-07-21 11:18:48 -03:00 committed by Gustavo Maximiliano Cortez
commit 6dff2840c8
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
12 changed files with 336 additions and 454 deletions

View file

@ -9,12 +9,6 @@
</a>
</section>
<section class="right-small">
<a class="p10" ui-sref="buyAmazon">
<i class="fi-shopping-cart size-24"></i>
</a>
</section>
<section class="middle tab-bar-section">
<h1 class="title ellipsis">
Gift cards
@ -32,16 +26,16 @@
Sandbox version. Only for testing purpose
</div>
<div class="m20t text-center" ng-click="amazon.init()">
<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>
<div ng-if="!amazon.giftCards" class="m20t text-center size-12">
<div ng-if="!giftCards" class="m20t text-center size-12">
<div class="row">
<div class="columns">
<button class="m20t button black round expand"
<button class="m20t button black round expand"
ui-sref="buyAmazon">
Buy now
</button>
@ -49,26 +43,39 @@
</div>
<div class="text-left p10h 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>
</div>
</div>
<div ng-if="amazon.giftCards">
<div class="p20t" 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 p10 vm dib"></i>
<span class="m10 text-normal text-bold">Buy Gift Card</span>
<span class="right text-gray p15t">
<i class="icon-arrow-right3 size-24 right"></i>
</span>
</li>
</ul>
<h4 class="title">Your cards</h4>
<div ng-repeat="(id, item) in amazon.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)"
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>
<div class="large-4 medium-4 small-4 columns m5t size-18">
{{item.cardInfo.value.amount | currency : '$ ' : 2}}
<div class="large-4 medium-4 small-4 columns m5t size-18" 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">
-
</div>
<div class="large-5 medium-5 small-5 columns text-right m10t">
<span class="text-warning" ng-if="item.status == 'FAILURE'">Error</span>
<span class="text-secondary" ng-if="item.status == 'RESEND'">Resend is required</span>
<span class="text-gray" ng-if="item.status == 'SUCCESS'">{{item.date * 1000 | amTimeAgo}}</span>
<span class="text-gray" ng-if="item.status == 'PENDING'">Pending to confirmation</span>
<span class="text-gray" ng-if="item.status == 'SUCCESS'">{{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>

View file

@ -1,5 +1,5 @@
<div
class="topbar-container"
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Buy'; goBackToState = 'amazon'; noColor = true">
</div>
@ -18,14 +18,14 @@
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
<div class="p10 m10t">
Amount: {{buy.errorInfo.amount}} {{buy.errorInfo.currencyCode}}<br>
BitPay Invoice ID: {{buy.errorInfo.bitpayInvoiceId}}.
Amount: {{buy.errorInfo.amount}} {{buy.errorInfo.currency}}<br>
BitPay Invoice ID: {{buy.errorInfo.invoiceId}}.
</div>
<div class="text-center">
<a ng-click="$root.openExternalLink(buy.errorInfo.bitpayInvoiceUrl)">Open invoice</a>
<a ng-click="$root.openExternalLink(buy.errorInfo.invoiceUrl)">Open invoice</a>
</div>
</div>
</div>
</div>
<div class="text-center">
<img src="img/a_generic.jpg" alt="Amazon.com Gift Card" width="180">
@ -35,8 +35,8 @@
</div>
<form
class="m30v"
name="buyAmazonForm"
ng-submit="buy.createTx()"
name="buyAmazonForm"
ng-submit="buy.createTx()"
novalidate>
<label>
@ -51,22 +51,22 @@
<a class="postfix button black">USD</a>
</div>
<div
<div
class="m10b"
ng-click="openWalletsModal(buy.allWallets)">
<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'}}"
<input type="text" id="address" name="address" ng-disabled="buy.selectedWalletId"
ng-attr-placeholder="{{'Choose your source wallet'}}"
ng-model="buy.selectedWalletName" required>
<a class="postfix size-12 m0 text-gray">
<i class="icon-wallet size-18"></i>
</a>
</div>
</div>
</div>
<div class="input m20t">
<input class="button black round expand"
<input class="button black round expand"
ng-disabled="!buy.selectedWalletId || !fiat"
type="submit" value="Buy now">
</div>
@ -75,7 +75,7 @@
</div>
<div class="m10t" ng-show="buy.giftCard">
<div class="m10h" ng-show="buy.giftCard.status != 'SUCCESS'">
<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">
@ -88,38 +88,41 @@
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
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
Back
</button>
</div>
</div>
<div ng-show="buy.giftCard.status == 'SUCCESS'">
<div class="size-12 m10h">
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
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&rsquo;ll need the gift card claim code below
</div>
<div class="oh m20t 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:
Gift Card Amount:
<span class="text-bold">
{{buy.giftCard.cardInfo.value.amount | currency : '$ ' : 2 }}
{{buy.giftCard.amount | currency : '$ ' : 2 }}
</span>
</div>
<div class="size-14">
Claim code: <span class="text-bold enable_text_select">{{buy.giftCard.gcClaimCode}}</span>
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.gcClaimCode, '_system')">
<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>
</div>
@ -129,11 +132,11 @@
reseller of Amazon.com Gift Cards. Except as required by law, GCs cannot be transferred for value or redeemed for cash.
GCs may be used only for purchases of eligible goods at Amazon.com or certain of its affiliated websites. Purchases are
deducted from the GC balance. To redeem or view a GC balance, visit &ldquo;Your Account&rdquo; at Amazon.com. Amazon is
not responsible if a GC is lost, stolen, destroyed or used without permission. See
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a> for complete terms,
restrictions and exceptions. For any other questions, see
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>. GCs are issued
by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP of
not responsible if a GC is lost, stolen, destroyed or used without permission. See
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a> for complete terms,
restrictions and exceptions. For any other questions, see
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>. GCs are issued
by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP of
Amazon.com, Inc. or its affiliates. No expiration date or service fees.
</div>

View file

@ -13,45 +13,48 @@
</section>
</nav>
<ion-content overflow-scroll="true">
<ion-content class="has-header" overflow-scroll="true">
<div class="modal-content fix-modals-touch">
<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.gcClaimCode">
<div ng-show="card.claimCode">
<div class="m10t">
Gift Card Amount:
Gift Card Amount:
<span class="text-bold">
{{card.cardInfo.value.amount | currency : '$ ' : 2}}
{{card.amount | currency : '$ ' : 2}}
</span>
</div>
<div>
Claim code: <span class="text-bold enable_text_select">{{card.gcClaimCode}}</span>
Claim code: <span class="text-bold enable_text_select">{{card.claimCode}}</span>
</div>
<div class="m10t" ng-show="card.cardInfo.cardStatus == 'Fulfilled'">
<button class="button black round tiny"
ng-click="$root.openExternalLink('https://www.amazon.com/gc/redeem?claimCode=' + card.gcClaimCode, '_system')">
<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')">
Redeem Now
</button>
</div>
<div class="text-warning text-center" ng-if="card.cardInfo.cardStatus == 'RefundedToPurchaser'">
Cancelled (Refunded)
</div>
<div class="size-12 m10t text-center">
<a ng-click="$root.openExternalLink(card.bitpayInvoiceUrl)">See invoice</a>
</div>
<div ng-show="!card.claimCode">
<div class="m10t">
Status:
<span class="text-bold">
PENDING
</span>
</div>
</div>
<div class="size-12 m10t text-center">
<a ng-click="$root.openExternalLink(card.invoiceUrl)">See invoice</a>
</div>
</div>
<div class="box-notification m20b" ng-show="error" ng-click="error = null">
<span class="text-warning">
{{error}}
</span>
</div>
</div>
<div class="text-center size-12" ng-show="card.status != 'SUCCESS'">
<div ng-show="card.status == 'RESEND'">
@ -72,20 +75,17 @@
reseller of Amazon.com Gift Cards. Except as required by law, GCs cannot be transferred for value or redeemed for cash.
GCs may be used only for purchases of eligible goods at Amazon.com or certain of its affiliated websites. Purchases are
deducted from the GC balance. To redeem or view a GC balance, visit &ldquo;Your Account&rdquo; at Amazon.com. Amazon is
not responsible if a GC is lost, stolen, destroyed or used without permission. See
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a> for complete terms,
restrictions and exceptions. For any other questions, see
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>. GCs are issued
by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP of
not responsible if a GC is lost, stolen, destroyed or used without permission. See
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc-legal')">www.amazon.com/gc-legal</a> for complete terms,
restrictions and exceptions. For any other questions, see
<a ng-click="$root.openExternalLink('https://www.amazon.com/gc')">www.amazon.com/gc</a>. GCs are issued
by ACI Gift Cards, Inc., a Washington corporation. All Amazon &reg;, &trade; &amp; &copy; are IP of
Amazon.com, 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.cardInfo.cardStatus == 'Fulfilled'" ng-click="cancelGiftCard()">
<span class="text-warning">Cancel gift card</span>
</li>
<li class="line-b p10 oh pointer" ng-show="card.status == 'FAILURE' || card.cardInfo.cardStatus == 'RefundedToPurchaser'
|| card.cardInfo.cardStatus == 'Expired'" ng-click="remove()">
<li class="line-b p10 oh pointer" ng-show="card.status == 'FAILURE' || card.cardStatus == 'RefundedToPurchaser'
|| card.cardStatus == 'Expired'" ng-click="remove()">
<span class="text-warning">Remove gift card</span>
</li>
</ul>

View file

@ -11,7 +11,8 @@
</h1>
</ion-header-bar>
<ion-content>
<ion-content ng-style="{'background-color': '#F6F7F9'}">
<div class="modal-content">
<div class="box-notification text-center size-12 text-warning m10t" ng-show="error">
<i class="fi-error"></i> {{error}}

View file

@ -25,7 +25,6 @@
</div>
</div>
<div class="oh" ng-show="!index.noFocusedWallet">
<!--