This project is a Django-based application for calculating congestion tax fees for vehicles within specific cities. The application takes into account various rules such as tax-free vehicles, specific time-based tax amounts, and maximum daily tax limits.
- Calculate congestion tax based on vehicle type and timestamps.
- Different tax rules for different cities.
- Tax-free vehicle types (e.g., Emergency vehicles, Motorbikes, Diplomat vehicles).
- Maximum daily tax limit.
- Supports JSON-based API requests.
- Python 3.8+
- Django 3.2+
- Django REST Framework
- Clone the repository:
git clone https://github.com/yourusername/congestion-tax-calculator.git
cd congestion-tax-calculator
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver
- POST /api/vehicles/calculate_tax/
{
"vehicle_type": "Car",
"dates": [
"2013-02-08T06:20:27",
"2013-02-08T14:35:00"
],
"city": "Gothenburg"
}
{
"tax": 16
}
To run the tests, execute the following command:
python manage.py test