From 1af5d2a0fc8c594e815dfb92142c5546e2b6b123 Mon Sep 17 00:00:00 2001 From: Gustavo Maximiliano Cortez Date: Tue, 29 Nov 2016 10:50:48 -0300 Subject: [PATCH] Uses walletID as UUID. Fix buy now link --- src/js/controllers/amount.js | 15 +++++++++++++-- www/views/amazon.html | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) 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 @@
-