paypro: fix parseBitcoinURI. start using bitcoin uris in tests.
This commit is contained in:
parent
283dec1f2e
commit
e0ff9ca6bd
3 changed files with 21 additions and 4 deletions
|
|
@ -86,8 +86,10 @@ angular.module('copayApp.controllers').controller('SendController',
|
|||
$rootScope.pendingPayment = null;
|
||||
}
|
||||
|
||||
if (~address.indexOf('://')) {
|
||||
w.createTx(address, commentText, done);
|
||||
var uri = address.indexOf('bitcoin:') === 0
|
||||
&& copay.Structure.parseBitcoinURI(address);
|
||||
if (uri && uri.merchant) {
|
||||
w.createTx(uri.merchant, commentText, done);
|
||||
} else {
|
||||
w.createTx(address, amount, commentText, done);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ var http = require('http');
|
|||
var EventEmitter = imports.EventEmitter || require('events').EventEmitter;
|
||||
var async = require('async');
|
||||
var preconditions = require('preconditions').singleton();
|
||||
var parseBitcoinURI = require('./Structure').parseBitcoinURI;
|
||||
|
||||
var bitcore = require('bitcore');
|
||||
var bignum = bitcore.Bignum;
|
||||
|
|
@ -774,6 +775,13 @@ Wallet.prototype.createPaymentTx = function(options, cb) {
|
|||
options = { uri: options };
|
||||
}
|
||||
|
||||
if (options.uri.indexOf('bitcoin:') === 0) {
|
||||
options.uri = parseBitcoinURI(options.uri).merchant;
|
||||
if (!options.uri) {
|
||||
return cb(new Error('No URI.'));
|
||||
}
|
||||
}
|
||||
|
||||
return $http({
|
||||
method: options.method || 'POST',
|
||||
url: options.uri || options.url,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue