suretax-hostname option, and minor UI fix, #33015
authorMark Wells <mark@freeside.biz>
Wed, 3 Jun 2015 03:43:05 +0000 (20:43 -0700)
committerMark Wells <mark@freeside.biz>
Wed, 3 Jun 2015 03:43:05 +0000 (20:43 -0700)
FS/FS/Conf.pm
FS/FS/TaxEngine/suretax.pm
httemplate/edit/process/part_pkg.cgi

index 17a7c23..8cd8e27 100644 (file)
@@ -2500,6 +2500,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'suretax-hostname',
+    'section'     => 'taxation',
+    'description' => 'SureTax server name; defaults to the test server.',
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'suretax-client_number',
     'section'     => 'taxation',
     'description' => 'SureTax tax service client ID.',
index 327a728..8139b1d 100644 (file)
@@ -20,9 +20,6 @@ our %taxproduct_cache;
 
 our $conf;
 
-our $host = 'testapi.taxrating.net';
-# production: 'api.taxrating.net'
-
 FS::UID->install_callback( sub {
     $conf = FS::Conf->new;
     # should we enable conf caching here?
@@ -314,6 +311,9 @@ sub make_taxlines {
   my $request_json = $json->encode($request);
   warn $request_json if $DEBUG > 1;
 
+  my $host = $conf->config('suretax-hostname');
+  $host ||= 'testapi.taxrating.net';
+
   # We are targeting the "V05" interface:
   # - accepts both telecom and general sales transactions
   # - produces results broken down by "invoice" (Freeside line item)
index f3ee061..61a6337 100755 (executable)
@@ -97,8 +97,7 @@ my $args_callback = sub {
         @options;
 
   foreach my $class ( '', split(',', $cgi->param('taxproductnums') ) ) {
-    my $param = 'taxproductnum';
-    $param .= "_$class" if length($class); # gah, "_$class"?
+    my $param = "taxproductnum_$class";
     my $value = $cgi->param($param);
 
     if ( $value == -1 ) {