Fix payment uri handling

This commit is contained in:
Yemel Jardi 2014-10-09 10:19:13 -03:00
commit d849df98c6
3 changed files with 17 additions and 6 deletions

View file

@ -3,8 +3,15 @@
var bitcore = require('bitcore');
angular.module('copayApp.controllers').controller('UriPaymentController', function($rootScope, $scope, $routeParams, $timeout, $location) {
var data = decodeURIComponent($routeParams.data);
$rootScope.pendingPayment = new bitcore.BIP21($routeParams.data);
// Build bitcoinURI with querystring
var query = [];
angular.forEach($location.search(), function(value, key) {
query.push(key + "=" + value);
});
var queryString = query ? "?" + query.join("&") : "";
var bitcoinURI = $routeParams.data + queryString;
$rootScope.pendingPayment = new bitcore.BIP21(bitcoinURI);
$timeout(function() {
$location.path('/open');

View file

@ -17,7 +17,7 @@ function onDeviceReady() {
function handleBitcoinURI(url) {
if (!url) return;
window.location = '#!/uri-payment/' + encodeURIComponent(url);
window.location = '#!/uri-payment/' + url;
}
window.plugins.webintent.getUri(handleBitcoinURI);