save giftcards data when reedem failed
This commit is contained in:
parent
23417fe1b3
commit
7334d06c89
3 changed files with 9 additions and 4 deletions
|
|
@ -45,9 +45,12 @@
|
||||||
<div ng-show="!card.claimCode">
|
<div ng-show="!card.claimCode">
|
||||||
<div class="m10t">
|
<div class="m10t">
|
||||||
Status:
|
Status:
|
||||||
<span class="text-bold">
|
<span class="text-bold" ng-show="card.status == 'PENDING'">
|
||||||
PENDING
|
PENDING
|
||||||
</span>
|
</span>
|
||||||
|
<span class="text-bold" ng-show="card.status == 'FAILURE'">
|
||||||
|
FAILURE
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="size-12 m10t text-center">
|
<div class="size-12 m10t text-center">
|
||||||
|
|
@ -71,7 +74,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-warning m10" ng-show="card.status == 'FAILURE'">
|
<div class="text-warning m10" ng-show="card.status == 'FAILURE'">
|
||||||
There was a failure to the create gift card that could not be recoverable. Please, contact BitPay to refund your bitcoin
|
There was a failure to the create gift card. Please, contact BitPay to refund your bitcoin
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,14 +194,16 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
||||||
amazonService.createGiftCard(dataSrc, function(err, giftCard) {
|
amazonService.createGiftCard(dataSrc, function(err, giftCard) {
|
||||||
$log.debug("creating gift card " + count);
|
$log.debug("creating gift card " + count);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
giftCard = {};
|
||||||
|
giftCard.status = 'FAILURE';
|
||||||
ongoingProcess.set('Processing Transaction...', false);
|
ongoingProcess.set('Processing Transaction...', false);
|
||||||
self.error = bwcError.msg(err);
|
self.error = bwcError.msg(err);
|
||||||
self.errorInfo = dataSrc;
|
self.errorInfo = dataSrc;
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (giftCard.status == 'PENDING' && count < 3) {
|
if (giftCard.status == 'PENDING' && count < 3) {
|
||||||
$log.debug("pending gift card not available yet");
|
$log.debug("pending gift card not available yet");
|
||||||
self.debounceCreate(count + 1, dataSrc, dataSrc);
|
self.debounceCreate(count + 1, dataSrc, dataSrc);
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
|
||||||
};
|
};
|
||||||
|
|
||||||
$http(_postBitPay('/amazon-gift/redeem', dataSrc)).then(function(data) {
|
$http(_postBitPay('/amazon-gift/redeem', dataSrc)).then(function(data) {
|
||||||
var status = data.data.status == ('new' || 'paid') ? 'PENDING' : data.data.status;
|
var status = data.data.status == 'new' ? 'PENDING' : (data.data.status == 'paid') ? 'PENDING' : data.data.status;
|
||||||
data.data.status = status;
|
data.data.status = status;
|
||||||
$log.info('Amazon.com Gift Card Create/Update: ' + status);
|
$log.info('Amazon.com Gift Card Create/Update: ' + status);
|
||||||
return cb(null, data.data);
|
return cb(null, data.data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue