This Flask-based REST API calculates one's owed taxes based on tax bracket information retrieved from The Points Interview Test Server
- Clone this repository onto your local machine.
- Install The Points Interview Test Server and run it locally.
- Set up a virtual environment.
- Install all requirements using
pip3 install requirements.txt
. - Run the server with
flask run
or test withpytest
.
The app is configured to send requests to http://127.0.0.1:5000/
which is the default address for the The Points Interview Test Server.
GET requests to the app should be structured as follows:
/api/v1/calculate-tax/<tax_year>/?income=<income_value>
where the parameters are defined as
- income_value - the value of one's annual income represented in cents.
- tax_year - the year for which the tax information should be retrieved.
The API will return a JSON response structured as follows:
{
"effective_rate": 0.15,
"income": 5000000,
"tax_brackets": [
{
"max": 5019700,
"min": 0,
"owed": 750000.0,
"rate": 0.15
},
{
"max": null,
"min": 5019700,
"owed": 0,
"rate": 0.205
},
],
"total_owed": 750000.0
}
Once again, all monetary values are represented in cents.