commit
d521e031a1
4 changed files with 29 additions and 12 deletions
|
|
@ -29,15 +29,18 @@ angular.module('copayApp.controllers').controller('amazonCardsController',
|
||||||
var index = 0;
|
var index = 0;
|
||||||
var gcds = $scope.giftCards;
|
var gcds = $scope.giftCards;
|
||||||
lodash.forEach(gcds, function(dataFromStorage) {
|
lodash.forEach(gcds, function(dataFromStorage) {
|
||||||
if (dataFromStorage.status == 'PENDING') {
|
if (dataFromStorage.status == 'PENDING' || dataFromStorage.status == 'invalid') {
|
||||||
$log.debug("creating gift card");
|
$log.debug("Creating / Updating gift card");
|
||||||
$scope.updatingPending[dataFromStorage.invoiceId] = true;
|
$scope.updatingPending[dataFromStorage.invoiceId] = true;
|
||||||
|
|
||||||
amazonService.createGiftCard(dataFromStorage, function(err, giftCard) {
|
amazonService.createGiftCard(dataFromStorage, function(err, giftCard) {
|
||||||
|
|
||||||
$scope.updatingPending[dataFromStorage.invoiceId] = false;
|
$scope.updatingPending[dataFromStorage.invoiceId] = false;
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert('Error creating gift card', err);
|
popupService.showAlert('Error creating gift card', err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (giftCard.status != 'PENDING') {
|
if (giftCard.status != 'PENDING') {
|
||||||
var newData = {};
|
var newData = {};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,10 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
|
||||||
if (opts && opts.remove) {
|
if (opts && opts.remove) {
|
||||||
delete(inv[gc.invoiceId]);
|
delete(inv[gc.invoiceId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
inv = JSON.stringify(inv);
|
inv = JSON.stringify(inv);
|
||||||
|
|
||||||
|
|
||||||
storageService.setAmazonGiftCards(network, inv, function(err) {
|
storageService.setAmazonGiftCards(network, inv, function(err) {
|
||||||
|
|
||||||
homeIntegrationsService.register(homeItem);
|
homeIntegrationsService.register(homeItem);
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,16 @@
|
||||||
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
|
<img src="img/a-smile_color_btn.png" alt="{{id}}" width="40">
|
||||||
<ion-spinner class="spinner-dark recent right m10 size-16" icon="crescent" ng-show="updatingPending[item.invoiceId]">
|
<ion-spinner class="spinner-dark recent right m10 size-16" icon="crescent" ng-show="updatingPending[item.invoiceId]">
|
||||||
</ion-spinner>
|
</ion-spinner>
|
||||||
<h2>
|
<h2 ng-if="item.amount">
|
||||||
<span ng-if="item.claimCode">{{item.amount | currency : '$ ' : 2}} {{item.currency}}</span>
|
{{item.amount | currency : '$ ' : 2}} {{item.currency}}
|
||||||
<span ng-if="!item.claimCode">-</span>
|
|
||||||
</h2>
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
<span class="assertive" ng-if="item.status == 'FAILURE' || item.status == 'RESEND'">Error</span>
|
<span class="assertive" ng-if="item.status == 'FAILURE' || item.status == 'RESEND'">Error</span>
|
||||||
<span class="assertive" ng-if="item.status == 'expired'">Expired</span>
|
<span class="assertive" ng-if="item.status == 'expired'">Expired</span>
|
||||||
|
<span class="assertive" ng-if="item.status == 'invalid'">Still waiting confirmation<br> (Use higher fees setting to faster delivery)</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="assertive" ng-if="item.status == 'SUCCESS' && item.cardStatus == 'Canceled'">Canceled</span>
|
<span class="assertive" 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">{{item.date | amTimeAgo}}</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,21 @@
|
||||||
<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 class="m10t">
|
||||||
|
Gift Card Amount:
|
||||||
|
<span class="text-bold">
|
||||||
|
{{card.amount | currency : '$ ' : 2}}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="m10t">
|
||||||
|
Created
|
||||||
|
{{card.date | amTimeAgo}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div ng-show="card.claimCode">
|
<div ng-show="card.claimCode">
|
||||||
<div class="m10t">
|
|
||||||
Gift Card Amount:
|
|
||||||
<span class="text-bold">
|
|
||||||
{{card.amount | currency : '$ ' : 2}}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div ng-show="card.cardStatus !== 'Canceled'">
|
<div ng-show="card.cardStatus !== 'Canceled'">
|
||||||
Claim code: <span class="text-bold" copy-to-clipboard="card.claimCode">{{card.claimCode}}</span>
|
Claim code: <span class="text-bold" copy-to-clipboard="card.claimCode">{{card.claimCode}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -42,6 +50,10 @@
|
||||||
<span class="text-bold" ng-show="card.status == 'PENDING'">
|
<span class="text-bold" ng-show="card.status == 'PENDING'">
|
||||||
PENDING
|
PENDING
|
||||||
</span>
|
</span>
|
||||||
|
<span class="text-bold" ng-show="card.status=='invalid'">
|
||||||
|
STILL PENDING
|
||||||
|
</span>
|
||||||
|
|
||||||
<span class="text-bold" ng-show="card.status == 'FAILURE' || card.status == 'RESEND'">
|
<span class="text-bold" ng-show="card.status == 'FAILURE' || card.status == 'RESEND'">
|
||||||
FAILURE
|
FAILURE
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue