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) {
|
||||
var validator = function(value) {
|
||||
// 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);
|
||||
return value;
|
||||
return 'Merchant: '+ uri.merchant;
|
||||
}
|
||||
var a = new Address(value);
|
||||
ctrl.$setValidity('validAddress', a.isValid() && a.network().name === config.networkName);
|
||||
|
|
Loading…
Reference in New Issue