paypro: parse bitcoin uri. show merchant uri properly.

This commit is contained in:
Christopher Jeffrey 2014-07-30 14:40:58 -07:00 committed by Manuel Araoz
parent ad64ad1e0e
commit a7f176890f
1 changed files with 3 additions and 2 deletions

View File

@ -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);