mirror of https://github.com/BTCPrivate/copay.git
paypro: parse bitcoin uri. show merchant uri properly.
This commit is contained in:
parent
ad64ad1e0e
commit
a7f176890f
|
@ -13,9 +13,10 @@ angular.module('copayApp.directives')
|
||||||
link: function(scope, elem, attrs, ctrl) {
|
link: function(scope, elem, attrs, ctrl) {
|
||||||
var validator = function(value) {
|
var validator = function(value) {
|
||||||
// Is payment protocol address?
|
// Is payment protocol address?
|
||||||
if (value.indexOf('bitcoin:') === 0 && /r=/.test(value)) {
|
var uri = copay.HDPath.parseBitcoinURI(value);
|
||||||
|
if (uri && uri.merchant) {
|
||||||
ctrl.$setValidity('validAddress', true);
|
ctrl.$setValidity('validAddress', true);
|
||||||
return value;
|
return 'Merchant: '+ uri.merchant;
|
||||||
}
|
}
|
||||||
var a = new Address(value);
|
var a = new Address(value);
|
||||||
ctrl.$setValidity('validAddress', a.isValid() && a.network().name === config.networkName);
|
ctrl.$setValidity('validAddress', a.isValid() && a.network().name === config.networkName);
|
||||||
|
|
Loading…
Reference in New Issue