BIP70 in IncomingDataService uses new BitcoinUriService.
This commit is contained in:
parent
5738bab13e
commit
89f4328f8e
1 changed files with 9 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('incomingData', function($log, $state, $timeout, $ionicHistory, bitcore, bitcoreCash, $rootScope, payproService, scannerService, sendFlowService, appConfigService, popupService, gettextCatalog, bitcoinCashJsService) {
|
angular.module('copayApp.services').factory('incomingData', function(bitcoinUriService, $log, $state, $timeout, $ionicHistory, bitcore, bitcoreCash, $rootScope, payproService, scannerService, sendFlowService, appConfigService, popupService, gettextCatalog, bitcoinCashJsService) {
|
||||||
|
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
||||||
|
|
@ -11,6 +11,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
root.redir = function(data, serviceId, serviceData) {
|
root.redir = function(data, serviceId, serviceData) {
|
||||||
var originalAddress = null;
|
var originalAddress = null;
|
||||||
var noPrefixInAddress = 0;
|
var noPrefixInAddress = 0;
|
||||||
|
var allParsed = bitcoinUriService.parse(data);
|
||||||
|
|
||||||
if (data.toLowerCase().indexOf('bitcoin') < 0) {
|
if (data.toLowerCase().indexOf('bitcoin') < 0) {
|
||||||
noPrefixInAddress = 1;
|
noPrefixInAddress = 1;
|
||||||
|
|
@ -114,10 +115,10 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
// data extensions for Payment Protocol with non-backwards-compatible request
|
// data extensions for Payment Protocol with non-backwards-compatible request
|
||||||
if ((/^bitcoin(cash)?:\?r=[\w+]/).exec(data)) {
|
if (allParsed.isValid && allParsed.coin && allParsed.url) {
|
||||||
var coin = data.indexOf('bitcoincash') >= 0 ? 'bch' : 'btc';
|
var coin = allParsed.coin;
|
||||||
data = decodeURIComponent(data.replace(/bitcoin(cash)?:\?r=/, ''));
|
data = allParsed.url;
|
||||||
if (coin == 'bch') {
|
if (allParsed.coin == 'bch') {
|
||||||
payproService.getPayProDetailsViaHttp(data, function onGetPayProDetailsViaHttp(err, details) {
|
payproService.getPayProDetailsViaHttp(data, function onGetPayProDetailsViaHttp(err, details) {
|
||||||
if (err) {
|
if (err) {
|
||||||
var message = err.toString();
|
var message = err.toString();
|
||||||
|
|
@ -127,15 +128,15 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
||||||
}
|
}
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), message)
|
popupService.showAlert(gettextCatalog.getString('Error'), message)
|
||||||
} else {
|
} else {
|
||||||
handlePayPro(details, coin);
|
handlePayPro(details, allParsed.coin);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
payproService.getPayProDetails(data, coin, function onGetPayProDetails(err, details) {
|
payproService.getPayProDetails(data, allParsed.coin, function onGetPayProDetails(err, details) {
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||||
} else {
|
} else {
|
||||||
handlePayPro(details, coin);
|
handlePayPro(details, allParsed.coin);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue