Improves datetime. Adds invoice URL
This commit is contained in:
parent
2c89ff7f66
commit
05e57983c6
5 changed files with 29 additions and 10 deletions
|
|
@ -61,7 +61,7 @@
|
|||
</div>
|
||||
<div class="large-5 medium-5 small-5 columns text-right">
|
||||
<span class="text-warning" ng-if="item.status == 'ERROR'">Error</span>
|
||||
<span class="text-light" ng-if="item.status != 'ERROR'">{{item.date * 1000 | amCalendar}}</span>
|
||||
<span class="text-light" ng-if="item.status != 'ERROR'">{{item.date * 1000 | amTimeAgo}}</span>
|
||||
</div>
|
||||
<div class="large-1 medium-1 small-1 columns text-right">
|
||||
<i class="icon-arrow-right3 size-18"></i>
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
<div class="tu text-gray size-12 text-left">BitPay invoice</div>
|
||||
<div class="text-bold size-16 m5t text-left">{{buy.giftCard.bitpayInvoiceId}}</div>
|
||||
<button class="m20t button outline round dark-gray tiny"
|
||||
ng-click="$root.openExternalLink('https://bitpay.com/invoice/' + buy.giftCard.bitpayInvoiceId)">
|
||||
ng-click="$root.openExternalLink(buy.giftCard.bitpayInvoiceUrl)">
|
||||
<span class="text-gray">View invoice</span>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,18 +25,24 @@
|
|||
</div>
|
||||
|
||||
<ul class="no-bullet size-14">
|
||||
<li class="line-b p10 oh">
|
||||
<li class="line-b p10 oh pointer" ng-click="$root.openExternalLink()">
|
||||
<i class="icon-arrow-right3 size-24 right text-bold"></i>
|
||||
<span class="text-gray">Claim code</span>
|
||||
<span class="text-bold right enable_text_select">{{card.gcClaimCode}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh">
|
||||
<span class="text-gray">Created at</span>
|
||||
<span class="test-gray right enable_text_select">{{card.date * 1000 | amDateFormat:'MM/DD/YYYY HH:mm a'}}</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh">
|
||||
<span class="text-gray">Status</span>
|
||||
<span class="text-success right" ng-if="card.status == 'SUCCESS'">Completed</span>
|
||||
<span class="text-info right" ng-if="card.status == 'PENDING'">Pending</span>
|
||||
<span class="text-warning right" ng-if="card.status == 'ERROR'">Error</span>
|
||||
</li>
|
||||
<li class="line-b p10 oh">
|
||||
<span class="text-gray">BitPay Invoice ID</span>
|
||||
<li class="line-b p10 oh pointer" ng-click="$root.openExternalLink(card.bitpayInvoiceUrl)">
|
||||
<i class="icon-arrow-right3 size-24 right text-gray"></i>
|
||||
<span class="text-gray">BitPay Invoice</span>
|
||||
<span class="text-gray right enable_text_select">{{card.bitpayInvoiceId}}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
|
|||
var gift = {
|
||||
amount: dataSrc.price,
|
||||
currencyCode: dataSrc.currency,
|
||||
bitpayInvoiceId: data.data.id
|
||||
bitpayInvoiceId: data.data.id,
|
||||
bitpayInvoiceUrl: data.data.url
|
||||
};
|
||||
self.loading = 'Buying gift card...';
|
||||
amazonService.buyGiftCard(gift, function(err, giftCard) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
|
|||
"gcExpirationDate":null,
|
||||
"gcId":"A2GCN9BRX5QS76",
|
||||
"status":"SUCCESS",
|
||||
"bitpayInvoiceId":"NJtevvEponHbQVmYoL7FYp"
|
||||
"bitpayInvoiceId":"NJtevvEponHbQVmYoL7FYp",
|
||||
"bitpayInvoiceUrl":"http://test.bitpay.com/invoice?id=XwrLryQEypTKg4nq37t3bN"
|
||||
};
|
||||
|
||||
root.setCredentials = function(network) {
|
||||
|
|
@ -36,7 +37,7 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
|
|||
};
|
||||
};
|
||||
|
||||
var _getBitPay = function(endpoint, token) {
|
||||
var _getBitPay = function(endpoint) {
|
||||
return {
|
||||
method: 'GET',
|
||||
url: credentials.BITPAY_API + endpoint,
|
||||
|
|
@ -67,8 +68,18 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
|
|||
$log.info('BitPay Create Invoice: SUCCESS');
|
||||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('BitPay Create Invoice: ERROR ' + data.statusText);
|
||||
return cb(data);
|
||||
$log.error('BitPay Create Invoice: ERROR ' + data.data.error);
|
||||
return cb(data.data.error);
|
||||
});
|
||||
};
|
||||
|
||||
root.getBitPayInvoice = function(id, cb) {
|
||||
$http(_getBitPay('/invoices/' + id)).then(function(data) {
|
||||
$log.info('BitPay Get Invoice: SUCCESS');
|
||||
return cb(null, data.data);
|
||||
}, function(data) {
|
||||
$log.error('BitPay Get Invoice: ERROR ' + data.data.error);
|
||||
return cb(data.data.error);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -112,6 +123,7 @@ angular.module('copayApp.services').factory('amazonService', function($http, $lo
|
|||
saveData.cardInfo.value.amount = gift.amount;
|
||||
saveData.cardInfo.value.currencyCode = gift.currencyCode;
|
||||
saveData['bitpayInvoiceId'] = gift.bitpayInvoiceId;
|
||||
saveData['bitpayInvoiceUrl'] = gift.bitpayInvoiceUrl;
|
||||
saveData['date'] = newId;
|
||||
root.saveGiftCard(saveData, null, function(err) {
|
||||
return cb(null, fakeData);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue