mirror of https://github.com/BTCPrivate/copay.git
fix payment intent
This commit is contained in:
parent
a70e7e61a4
commit
aa43273f8d
|
@ -7,11 +7,12 @@ angular.module('copayApp.controllers').controller('paymentUriController', functi
|
||||||
angular.forEach($location.search(), function(value, key) {
|
angular.forEach($location.search(), function(value, key) {
|
||||||
query.push(key + "=" + value);
|
query.push(key + "=" + value);
|
||||||
});
|
});
|
||||||
var queryString = query ? "?" + query.join("&") : "";
|
var queryString = query ? query.join("&") : null;
|
||||||
var bitcoinURI = $routeParams.data + queryString;
|
var bitcoinURI = $routeParams.data + ( queryString ? '?' + queryString : '');
|
||||||
var uri = new bitcore.BIP21(bitcoinURI);
|
var uri = new bitcore.BIP21(bitcoinURI);
|
||||||
|
|
||||||
if (uri.isValid()) {
|
if (uri && uri.address && (_.isString(uri.address) || uri.address.isValid()) ) {
|
||||||
|
copay.logger.debug('Payment Intent:', bitcoinURI);
|
||||||
$rootScope.pendingPayment = bitcoinURI;
|
$rootScope.pendingPayment = bitcoinURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,10 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
$scope.isMobile = isMobile.any();
|
$scope.isMobile = isMobile.any();
|
||||||
|
|
||||||
if ($rootScope.pendingPayment) {
|
if ($rootScope.pendingPayment) {
|
||||||
$scope.setFromUri($rootScope.pendingPayment)
|
$timeout(function() {
|
||||||
$rootScope.pendingPayment = null;
|
$scope.setFromUri($rootScope.pendingPayment)
|
||||||
|
$rootScope.pendingPayment = null;
|
||||||
|
},100);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.setInputs();
|
$scope.setInputs();
|
||||||
|
@ -154,11 +156,8 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
amountSat: amount,
|
amountSat: amount,
|
||||||
comment: comment,
|
comment: comment,
|
||||||
}, function(err, txid, status) {
|
}, function(err, txid, status) {
|
||||||
console.log('[send.js.156:txid:]', txid); //TODO
|
|
||||||
console.log('[send.js.156:status:]', status); //TODO
|
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
||||||
console.log('[send.js.158]'); //TODO
|
|
||||||
if (err)
|
if (err)
|
||||||
return $scope.setError(err);
|
return $scope.setError(err);
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,9 @@
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('walletForPaymentController', function($rootScope, $scope, $modal, go) {
|
angular.module('copayApp.controllers').controller('walletForPaymentController', function($rootScope, $scope, $modal, identityService, go) {
|
||||||
|
|
||||||
console.log('[walletForPayment.js.4]'); //TODO
|
|
||||||
if (!$rootScope.pendingPayment) {
|
|
||||||
go.walletHome();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
console.log('[walletForPayment.js.9]'); //TODO
|
|
||||||
$scope.selectWallet(function(w) {
|
|
||||||
if (w) {
|
|
||||||
identityService.setFocusedWallet(w);
|
|
||||||
go.send();
|
|
||||||
} else {
|
|
||||||
go.walletHome();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.selectWallet = function(cb) {
|
$scope.selectWallet = function(cb) {
|
||||||
|
var ModalInstanceCtrl = function($scope, $modalInstance, identityService) {
|
||||||
console.log('[walletForPayment.js.22]'); //TODO
|
|
||||||
var ModalInstanceCtrl = function($scope, $modalInstance, $identityService) {
|
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
preconditions.checkState($rootScope.iden);
|
preconditions.checkState($rootScope.iden);
|
||||||
|
|
||||||
|
@ -31,9 +13,7 @@ console.log('[walletForPayment.js.22]'); //TODO
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.setWallets = function() {
|
$scope.setWallets = function() {
|
||||||
$scope.wallets = _.filter($rootScope.iden.listWallets(), function(w) {
|
$scope.wallets = $rootScope.iden.listWallets();
|
||||||
return w.balanceInfo && w.balanceInfo.totalBalanceBTC;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.ok = function(w) {
|
$scope.ok = function(w) {
|
||||||
|
@ -47,11 +27,25 @@ console.log('[walletForPayment.js.22]'); //TODO
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('[walletForPayment.js.49]'); //TODO
|
|
||||||
$modal.open({
|
$modal.open({
|
||||||
templateUrl: 'views/modals/walletSelect.html',
|
templateUrl: 'views/modals/walletSelection.html',
|
||||||
windowClass: 'tiny',
|
windowClass: 'tiny',
|
||||||
controller: ModalInstanceCtrl,
|
controller: ModalInstanceCtrl,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// INIT: (not it a function, since there is no associated html)
|
||||||
|
if (!$rootScope.pendingPayment) {
|
||||||
|
go.walletHome();
|
||||||
|
} else {
|
||||||
|
$scope.selectWallet(function(w) {
|
||||||
|
if (w) {
|
||||||
|
identityService.setFocusedWallet(w);
|
||||||
|
go.send();
|
||||||
|
} else {
|
||||||
|
go.walletHome();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -73,7 +73,6 @@ angular.module('copayApp.services').factory('go', function($window, $rootScope,
|
||||||
};
|
};
|
||||||
|
|
||||||
root.home = function() {
|
root.home = function() {
|
||||||
console.log('[go.js.48:home:]'); //TODO
|
|
||||||
if ($rootScope.iden)
|
if ($rootScope.iden)
|
||||||
root.walletHome();
|
root.walletHome();
|
||||||
else
|
else
|
||||||
|
@ -82,8 +81,6 @@ console.log('[go.js.48:home:]'); //TODO
|
||||||
|
|
||||||
|
|
||||||
root.send = function() {
|
root.send = function() {
|
||||||
|
|
||||||
console.log('[go.js.58]'); //TODO
|
|
||||||
$location.path('send');
|
$location.path('send');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<a class="close-reveal-modal" ng-click="cancel()">×</a>
|
<a class="close-reveal-modal" ng-click="cancel()">×</a>
|
||||||
|
|
||||||
<h3>Select a wallet to make the payment</h3>
|
<h3 ng-init="setWallets()">Select a wallet to make the payment</h3>
|
||||||
<span ng-show="!wallets[0]">Loading...</span>
|
<span ng-show="!wallets[0]">Loading...</span>
|
||||||
<ul class="w-popup-menu" ng-show="wallets[0]" ng-class="{'large':wallets.length > 4, 'medium':wallets.length > 2 && wallets.length < 5}">
|
<ul class="w-popup-menu" ng-show="wallets[0]" ng-class="{'large':wallets.length > 4, 'medium':wallets.length > 2 && wallets.length < 5}">
|
||||||
<li data-ng-repeat="item in wallets track by $index" class="nav-item" ng-click="ok(item)">
|
<li data-ng-repeat="item in wallets track by $index" class="nav-item" ng-click="ok(item)" ng-show="+item.balanceInfo.totalBalanceBTC > 0">
|
||||||
<div class="w-popup-icon">
|
<div class="w-popup-icon">
|
||||||
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
|
<div class="avatar-wallet">{{(item.name || item.id) | limitTo: 1}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue