Skip to content

Address lookup

Using ZIP codes to discover tax names greatly simplifies the process of determining which taxes to apply. However, ZIP codes often don’t align with tax jurisdictions such as cities and counties (or even states). If a ZIP code falls within multiple tax jurisdictions, the TaxNamesForZip method will return all the taxes for each jurisdiction. This gives the user a reduced set of taxes to consider, but it may still be too many.

The TaxControls components provide the TaxQuery method to look up taxes using the workplace and residence addresses, which will further reduce the number of taxes to consider. Using this method requires additional configuration, as it requires a connection to the TaxQuery Docker container.

The TaxQuery container can be run locally or in a cloud setting and is available free of charge. The TaxQuery method in the component will connect to the TaxQuery container, which will then return the taxes for the given addresses.

  1. Enter Code

Enter the following code in a file named ‘Addresses.cs’:

using System;
using TaxControls;
class Test{
public static void Main(){
try {
CTaxControl tc = new CTaxControl();
String url="http://localhost:8000";
// using Plus Code with ZIP for work:
String work="RQ6F+JJ 17325";
String home="1400 Defense Blvd, Washington, VA 20301";
// employer facilities in these states:
String nexus="PA MD";
String taxes=tc.TaxQuery(work, home, url, nexus);
foreach(String t in taxes.Split(",")){
Console.WriteLine(t);
}
} catch (TaxControlException e) {
Console.WriteLine(e.Message);
}
}
}

Enter the following code in a file named ‘Addresses.java’:

import com.boondocks.taxcontrols.TaxControl;
import com.boondocks.taxcontrols.TaxControlException;
public class Addresses{
public static void main(String[] args){
TaxControl tc = new TaxControl();
try{
String url="https://localhost:8443";
// using Plus Code with ZIP for work:
String work="RQ6F+JJ 17325";
String home="1400 Defense Blvd, Washington, VA 20301";
// employer facilities in these states:
String nexus="PA MD";
String taxes=tc.getTaxQuery(work, home, url, nexus);
for (String t: taxes.split(",")){
System.out.println(t);
}
} catch (TaxControlException e){
e.printStackTrace();
}
}
}
  1. Compile

Compile the code at the command prompt by executing the following:

Terminal window
\...\csc.exe /reference:TaxControls.dll Addresses.cs
Terminal window
javac -classpath .;bigloo_u.zip;TaxControls.jar Addresses.java
  1. Start TaxQuery

Start up the TaxQuery container if it’s not already running:

Terminal window
docker run -p 8443:8443 calibertechnology/taxquery

The -p 8443:8443 argument tells the image to listen for an https connection on port 8443.

  1. Run

Run the code by typing:

Terminal window
Addresses
Terminal window
java -classpath .;bigloo_u.zip;TaxControls.jar Addresses