projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT# 73993 - added new API call to list and documented it.
[freeside.git]
/
FS
/
FS
/
Misc
/
Geo.pm
diff --git
a/FS/FS/Misc/Geo.pm
b/FS/FS/Misc/Geo.pm
index
5bba5e0
..
2050fdf
100644
(file)
--- a/
FS/FS/Misc/Geo.pm
+++ b/
FS/FS/Misc/Geo.pm
@@
-6,6
+6,7
@@
use vars qw( $DEBUG @EXPORT_OK $conf );
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common qw( GET POST );
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common qw( GET POST );
+use IO::Socket::SSL;
use HTML::TokeParser;
use JSON;
use URI::Escape 3.31;
use HTML::TokeParser;
use JSON;
use URI::Escape 3.31;
@@
-209,13
+210,13
@@
sub wa_sales {
if ( lc($text) eq 'location code' ) {
$p->get_tag('td'); # skip to the next column
undef $u;
if ( lc($text) eq 'location code' ) {
$p->get_tag('td'); # skip to the next column
undef $u;
- $u = $p->get_token until
$u->[0]
eq 'T'; # and then skip non-text
+ $u = $p->get_token until
($u->[0] || '')
eq 'T'; # and then skip non-text
$return->{'district'} = $u->[1];
}
elsif ( lc($text) eq 'total tax rate' ) {
$p->get_tag('td');
undef $u;
$return->{'district'} = $u->[1];
}
elsif ( lc($text) eq 'total tax rate' ) {
$p->get_tag('td');
undef $u;
- $u = $p->get_token until
$u->[0]
eq 'T';
+ $u = $p->get_token until
($u->[0] || '')
eq 'T';
$return->{'tax'} = $u->[1];
}
} # get_token
$return->{'tax'} = $u->[1];
}
} # get_token
@@
-736,7
+737,12
@@
sub standardize_freeside {
return $location;
}
return $location;
}
- my $ua = LWP::UserAgent->new( 'ssl_opts' => { 'verify_hostname'=>0 });
+ my $ua = LWP::UserAgent->new(
+ 'ssl_opts' => {
+ verify_hostname => 0,
+ SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+ },
+ );
my $response = $ua->request( POST $url, [
'support-key' => scalar($conf->config('support-key')),
%$location,
my $response = $ua->request( POST $url, [
'support-key' => scalar($conf->config('support-key')),
%$location,
@@
-747,7
+753,10
@@
sub standardize_freeside {
local $@;
my $content = eval { decode_json($response->content) };
local $@;
my $content = eval { decode_json($response->content) };
- die "Address normalization JSON error : $@\n" if $@;
+ if ( $@ ) {
+ warn $response->content;
+ die "Address normalization JSON error : $@\n";
+ }
die $content->{error}."\n"
if $content->{error};
die $content->{error}."\n"
if $content->{error};