Uses walletID as UUID. Fix buy now link

This commit is contained in:
Gustavo Maximiliano Cortez 2016-11-29 10:50:48 -03:00
parent 1d1b632886
commit 1af5d2a0fc
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
2 changed files with 14 additions and 3 deletions

View File

@ -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) {

View File

@ -18,7 +18,7 @@
<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
</button>