paypro: remove old parse uri code. more debugging.
This commit is contained in:
parent
7c39915dd0
commit
7915008433
3 changed files with 16 additions and 21 deletions
|
|
@ -15,6 +15,12 @@ angular.module('copayApp.directives')
|
||||||
var validator = function(value) {
|
var validator = function(value) {
|
||||||
// Is payment protocol address?
|
// Is payment protocol address?
|
||||||
var uri = copay.HDPath.parseBitcoinURI(value);
|
var uri = copay.HDPath.parseBitcoinURI(value);
|
||||||
|
var total = '00001000';
|
||||||
|
console.log('TOTAL:');
|
||||||
|
console.log(total);
|
||||||
|
var amount = angular.element(document).find('#amount');
|
||||||
|
amount.prop('disabled', true);
|
||||||
|
amount.val(total);
|
||||||
if (uri && uri.merchant) {
|
if (uri && uri.merchant) {
|
||||||
scope.wallet.createPaymentTx(uri.merchant, function(ntxid, ca) {
|
scope.wallet.createPaymentTx(uri.merchant, function(ntxid, ca) {
|
||||||
var txp = scope.wallet.txProposals.txps[ntxid];
|
var txp = scope.wallet.txProposals.txps[ntxid];
|
||||||
|
|
@ -22,8 +28,7 @@ angular.module('copayApp.directives')
|
||||||
var total = txp.merchant.total;
|
var total = txp.merchant.total;
|
||||||
console.log('TOTAL:');
|
console.log('TOTAL:');
|
||||||
console.log(total);
|
console.log(total);
|
||||||
var sendForm = angular.element(document).find('[name=sendForm]');
|
var amount = angular.element(document).find('#amount');
|
||||||
var amount = angular.element(sendForm).find('#amount')
|
|
||||||
amount.prop('disabled', true);
|
amount.prop('disabled', true);
|
||||||
amount.val(total);
|
amount.val(total);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -59,19 +59,6 @@ HDPath.parseBitcoinURI = function(uri) {
|
||||||
var splitQuestion = data.split('?');
|
var splitQuestion = data.split('?');
|
||||||
ret.address = splitQuestion[0];
|
ret.address = splitQuestion[0];
|
||||||
|
|
||||||
/*
|
|
||||||
if (splitQuestion.length > 1) {
|
|
||||||
var search = splitQuestion[1];
|
|
||||||
data = JSON.parse('{"' + search.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
|
|
||||||
function(key, value) {
|
|
||||||
return key === "" ? value : decodeURIComponent(value);
|
|
||||||
});
|
|
||||||
ret.amount = parseFloat(data.amount);
|
|
||||||
ret.message = data.message;
|
|
||||||
ret.merchant = data.r;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (splitQuestion.length > 1) {
|
if (splitQuestion.length > 1) {
|
||||||
var data = {};
|
var data = {};
|
||||||
var search = splitQuestion[1];
|
var search = splitQuestion[1];
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,17 @@ var TxProposals = require('./TxProposals');
|
||||||
var PrivateKey = require('./PrivateKey');
|
var PrivateKey = require('./PrivateKey');
|
||||||
var copayConfig = require('../../../config');
|
var copayConfig = require('../../../config');
|
||||||
|
|
||||||
if (typeof angular !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
var $http = angular.bootstrap().get('$http');
|
var G = window;
|
||||||
|
} else {
|
||||||
|
var G = global;
|
||||||
}
|
}
|
||||||
|
|
||||||
var $http = function $http(options, callback) {
|
if (typeof angular !== 'undefined') {
|
||||||
|
var $http = G.$http || angular.bootstrap().get('$http');
|
||||||
|
}
|
||||||
|
|
||||||
|
var $http = G.$http || function $http(options, callback) {
|
||||||
if (typeof options === 'string') {
|
if (typeof options === 'string') {
|
||||||
options = { uri: options };
|
options = { uri: options };
|
||||||
}
|
}
|
||||||
|
|
@ -81,7 +87,6 @@ var $http = function $http(options, callback) {
|
||||||
xhr.onload = function(event) {
|
xhr.onload = function(event) {
|
||||||
var response = xhr.response;
|
var response = xhr.response;
|
||||||
var buf = new Uint8Array(response);
|
var buf = new Uint8Array(response);
|
||||||
// return callback(null, xhr, buf);
|
|
||||||
var headers = {};
|
var headers = {};
|
||||||
(xhr.getAllResponseHeaders() || '').replace(
|
(xhr.getAllResponseHeaders() || '').replace(
|
||||||
/(?:\r?\n|^)([^:\r\n]+): *([^\r\n]+)/g,
|
/(?:\r?\n|^)([^:\r\n]+): *([^\r\n]+)/g,
|
||||||
|
|
@ -93,7 +98,7 @@ var $http = function $http(options, callback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
xhr.onerror = function(event) {
|
xhr.onerror = function(event) {
|
||||||
return ret._error(null, event, null, options);
|
return ret._error(null, new Error(event.message), null, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options.body) {
|
if (options.body) {
|
||||||
|
|
@ -105,8 +110,6 @@ var $http = function $http(options, callback) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// require('request')(options, callback);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue