Skip to content

A standalone re-implementation of the WA DOR's WA Sale Tax Rate Lookup URL interface project.

License

Notifications You must be signed in to change notification settings

uncheckederror/WASalesTaxLookup

Repository files navigation

WASalesTaxLookup

A standalone re-implementation of the WA DOR's WA Sale Tax Rate Lookup URL interface project.

Why we built this

Getting the correct sale tax rate for ecommerce transactions in Washington State can be tricky because tax rates vary by municipality. Making this process as simple, fast, and reliable as possible is a good way to support a high-quality checkout experience.

How we built this

The state published the source code for their current API on their website: Source code for the existing API

But this project was developed 13 years ago, as a Windows only app, and it contains a variety of functionality that isn't strictly necessary for the ecommerce use case. To leverage these opportunities for enhancement this project is a ground up re-implementation of the DOR's existing sales tax API.

This is a .NET 8 Web API app that exposes a REST API with friendly Swagger documentation and OpenAPI 3 support. You can reuse your existing API integrations with the state's sales tax API, by simply switching in the base URL while retaining the specific HTTP route and parameters. This is because we have directly re-implemented the state's existing API to make to make switching to this stand-alone app as low-effort as possible.

The data required to perform the sale tax rate lookups is downloaded from the DOR's data download page when you start the application up. Then its read into a SQLite 3 database, which is created and destroyed as needed, and lives in the root directory of the app. This first time startup process can take up to 10 minutes. Every time you start the app it performs a check to make sure that its data is current and in good health, if anything is off it re-ingests all the data from the state. Ideally you would redeploy the app once per quarter, on the first of the month, as that's when the new sales tax rates take effect.

Outside of this process to download data from the state and the requirement that you expose it to the internet through a webserver (nginx, IIS) this app has no external dependencies. Because .NET 8 is multiplatform this project offers support for Windows and Linux. It may work on OS X, but this has not been tested.

How to use this API

Read through our Swagger docs and make some test requests.

Documentation on the DOR's existing API which applies to this API as well.

How to run this locally

  • Clone this repo
  • Install the latest version of dotnet 8 on your system
  • Open a shell in your local copy of this repo
  • cd into the WASaleTax folder
  • Execute the "dotnet run" command
  • Use a browser navigate to the localhost URL provided in the shell window
  • Optionally view the docs by adding "/swagger" to the localhost URL

Troubleshooting

All of the data the app requires is ingested on start up. If the database has to be rebuilt from the state's data this may take a few minutes to complete (about 6 minutes and 1.3 GBs of memory consumed at maximum) once this process is complete the API is read to use. You can verify that everything is working correctly by executing a test request from the Swagger docs.

About

A standalone re-implementation of the WA DOR's WA Sale Tax Rate Lookup URL interface project.

Topics

Resources

License

Stars

Watchers

Forks

Languages