diff --git a/src/js/controllers/amount.js b/src/js/controllers/amount.js index 589269b27..4ff6ada67 100644 --- a/src/js/controllers/amount.js +++ b/src/js/controllers/amount.js @@ -1,6 +1,6 @@ '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 satToUnit; @@ -244,11 +244,22 @@ angular.module('copayApp.controllers').controller('amountController', function($ } else if ($scope.buyAmazon) { 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 dataSrc = { currency: 'USD', amount: amountUSD, - uuid: moment().unix() * 1000 + uuid: uuid }; amazonService.createBitPayInvoice(dataSrc, function(err, dataInvoice) { diff --git a/www/views/amazon.html b/www/views/amazon.html index f3f45af49..444046cda 100644 --- a/www/views/amazon.html +++ b/www/views/amazon.html @@ -18,7 +18,7 @@