Uses walletID as UUID. Fix buy now link
This commit is contained in:
parent
1d1b632886
commit
1af5d2a0fc
2 changed files with 14 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('amountController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, amazonService) {
|
angular.module('copayApp.controllers').controller('amountController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, txFormatService, ongoingProcess, bitpayCardService, popupService, bwcError, payproService, amazonService, profileService) {
|
||||||
|
|
||||||
var unitToSatoshi;
|
var unitToSatoshi;
|
||||||
var satToUnit;
|
var satToUnit;
|
||||||
|
|
@ -244,11 +244,22 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
||||||
|
|
||||||
} else if ($scope.buyAmazon) {
|
} else if ($scope.buyAmazon) {
|
||||||
ongoingProcess.set('Preparing transaction...', true);
|
ongoingProcess.set('Preparing transaction...', true);
|
||||||
|
// Get first wallet as UUID
|
||||||
|
var uuid;
|
||||||
|
try {
|
||||||
|
uuid = profileService.getWallets({
|
||||||
|
onlyComplete: true,
|
||||||
|
network: 'livenet',
|
||||||
|
})[0].id;
|
||||||
|
} catch(err) {
|
||||||
|
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('No wallet found!'));
|
||||||
|
return;
|
||||||
|
};
|
||||||
var amountUSD = $scope.showAlternativeAmount ? _amount : $filter('formatFiatAmount')(toFiat(_amount));
|
var amountUSD = $scope.showAlternativeAmount ? _amount : $filter('formatFiatAmount')(toFiat(_amount));
|
||||||
var dataSrc = {
|
var dataSrc = {
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
amount: amountUSD,
|
amount: amountUSD,
|
||||||
uuid: moment().unix() * 1000
|
uuid: uuid
|
||||||
};
|
};
|
||||||
|
|
||||||
amazonService.createBitPayInvoice(dataSrc, function(err, dataInvoice) {
|
amazonService.createBitPayInvoice(dataSrc, function(err, dataInvoice) {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<div ng-if="!giftCards" class="m20t padding text-center">
|
<div ng-if="!giftCards" class="m20t padding text-center">
|
||||||
|
|
||||||
<button class="button button-standard button-primary" ui-sref="tabs.giftcards.amazon.buy">
|
<button class="button button-standard button-primary" ui-sref="tabs.giftcards.amazon.amount">
|
||||||
Buy now
|
Buy now
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue