In the code sample shows how to set a coordinate (latitude, longitude) to receive sales and use tax information such as total tax rate, state tax rate, and municipal tax rate.
TaxRateLookupConfiguration configuration
= new TaxRateLookupConfigurationBuilder().withData(dataSourceList)
.withResources(Paths.get("/resources/taxing-resources"))
.build();
TaxRateLookup lookup
= new TaxRateLookupBuilder().withConfiguration(configuration)
.register(new SDKTaxLookupFactory())
.build();
OutputPreference outputPreference = new OutputPreference();
outputPreference.setSalesTaxRateType("General");
GeocodingPreference geocodingPreference = new GeocodingPreference();
geocodingPreference.setUsePointData("Y");
geocodingPreference.setLatLongOffset("none");
geocodingPreference.setSqueeze("Y");
geocodingPreference.setLatLongAltFormat("NoDecimalSign");
Preferences preferences = new PreferencesBuilder().withOutputPreferences(outputPreference)
.withGeocodingPreferences(geocodingPreference)
.build();
Location location = new Location();
location.setGeometry(new Geometry());
location.getGeometry().setLatLongAltFmt("35218490,-79457302");
TaxResponse response = lookup.lookupByLocation(location, preferences);
try {
lookup.close();
} catch (Exception e) {
e.printStackTrace();
}