<% include( '/elements/header.html', 'Developer Documentation' ) %> <& /elements/menubar.html, 'Freeside Perl Modules' => $fsurl.'docs/library/FS.html', 'Complete Index' => $fsurl.'docs/library/index.html', &>

FS::Misc::Geo

NAME

FS::Misc::Geo - routines to fetch geographic information

CLASS METHODS

get_censustract_ffiec LOCATION YEAR

Given a location hash (see FS::location_Mixin) and a census map year, returns a census tract code (consisting of state, county, and tract codes) or an error message.

Data source: Federal Financial Institutions Examination Council

Note: This is the old method for pre-2022 (census year 2020) reporting.

get_censustract_uscensus LOCATION YEAR

Given a location hash (see FS::location_Mixin) and a census map year, returns a census tract code (consisting of state, county, tract, and block codes) or an error message.

Data source: US Census Bureau

This is the new method for 2022+ (census year 2020) reporting.

get_district LOCATION METHOD

For the location hash in LOCATION, using lookup method METHOD, fetch tax district information. Currently the only available method is 'wa_sales' (the Washington Department of Revenue sales tax lookup).

Returns a hash reference containing the following fields:

- district - tax (percentage) - taxname - exempt_amount (currently zero) - city, county, state, country (from

The intent is that you can assign this to an FS::cust_main_county object and insert it if there's not yet a tax rate defined for that district.

get_district will die on error.

wa_sales location_hash

Expects output of location_hash() as parameter

Returns undef on error, or if tax rate cannot be found using given address

Query the WA State Dept of Revenue API with an address, and return tax district information for that address.

Documentation for the API can be found here:

https://dor.wa.gov/find-taxes-rates/retail-sales-tax/destination-based-sales-tax-and-streamlined-sales-tax/wa-sales-tax-rate-lookup-url-interface

This API does not return consistent usable county names, as the county name may include appreviations or labels referring to PTBA (public transport benefit area) or CEZ (community empowerment zone). It's recommended to use the tool freeside-wa-tax-table-update to fully populate the city/county/districts for WA state every financial quarter.

Returns a hashref with the following keys:

  - district        the wa state tax district id
  - tax             the combined total tax rate, as a percentage
  - city            the API rate name
  - county          The API address PTBA
  - state           WA
  - country         US
  - exempt_amount   0

If api returns no district for address, generates system log error and returns undef

Given 'address1' and 'address2' strings, extract the sublocation part (from either one) and return it. If the sublocation was found in ADDRESS1, also return ADDRESS2 (cleaned up for postal standards) as it's assumed to contain something relevant.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 228:

You forgot a '=back' before '=head2'

You forgot a '=back' before '=head2'

Around line 614:

Unknown directive: =iten

Around line 842:

=back without =over

<% include ('/elements/footer.html' ) %>