TaxApi API endpoints provide detailed sales tax rates and calculations. Currently this Api supports below two methods
GET /v1/tax/rate
: Gets the Tax rates for a given locationPOST /v1/tax/ordersaletax
: Calculates the taxes for an order
- Getting Started
- Prerequisites
- Required software instalations
- Code Structure
- ApiConsumer Configuration
- Api Actions/Methods
- Swagger Documentation
These instructions will help you to get a copy of this project up and running on your local machine for development and testing purposes.
- Coding Platform : .Net Core v3.1
- Testing Tool (Optional) : Postman
- Code Editors : Visual Studio 2022 / Visual Studio Code
As per the Screenshot there are 6 projects in the solution
- Juniper.TaxApi :WebApi Starting point of the project with all the dependency injections and settings required to start the solution.This Also contains middleware and extensions which are required
- Juniper.TaxApi.Core.Application : This is the heart of the business logic layer.It interacts with the Entities project This Project has the following directories.
- Exceptions : Different kind of exception thrown by the project.
- Interfaces :(This can be seperated out to a different project all together) This contains the interface definitions for all the infrastructure services and any other interfaces required for communicating with webapi.
- Models : Contains all the Request and response objects for the webapi.
- Wrappers : Implementations for any wrapper required for Entities or response objects.
- Juniper.TaxApi.Core.Domain : This contains all the domain entities and core objects required for the business layer. This should be independent from any other external serivces or influences.This could also encompass relations between entitiesa and other pure business validations.
- Juniper.TaxApi.Tests : Unit test project for for Juniper.TaxApi project
- Juniper.Taxation.Infrastructure.Providers : Any external apis/providers which are required for accomplishing the work required by the business layer. For example Taxjar is the provider now, but it could have some more provider in the future 6.. Juniper.Taxation.Infrastructure.ExternalCommunicationService : This project contains all the external communication methods like HttpClient, Wcf services, Socker Communication etc.
The Actions require a consumer key for the provide ( Taxjar in this case). The provider configurations are stored here appSettings.json "ConsumerKeyProviderConfiguration": { "ProviderConfigurations": [ { "ProviderKey": "Juniper", "ProviderBaseEndPoint": "https://api.taxjar.com/", "AuthToken": "5da2f821eee4035db4771edab942a4cc", "IsTokenAuthRequired": true }, { "ProviderKey": "Test", "ProviderBaseEndPoint": "https://sample.com", "AuthToken": "test_key", "IsTokenAuthRequired": false } ] }
-
GET /v1/tax/rate
: Gets the Tax rates for a given location -
POST /v1/tax/ordersaletax
: Calculates the taxes for an order
LaunchSetting.js has the swagger URL as the launch URL. Once the code is executed users will be able to see the SwaggerUI on their browsers as below.