Skip to content

rajforweb/TaxApi-Dot-Net-Core-App

Repository files navigation

TaxApi

Dot Net Core Web Api to Communicate with External Tax Api (e.g. TaxJar)

TaxApi Detail:

Api UML

  1. Get Tax Rate

    image

    Sequence Source: https://github.com/rajforweb/TaxApi-Dot-Net-Core-App/blob/main/UML/GetTaxRate.yuml

  2. Calculate Tax for an Order

    image

    Sequence Source: https://github.com/rajforweb/TaxApi-Dot-Net-Core-App/blob/main/UML/TaxForOrder.yuml

Api Prerequisite

  • Prerequisite : .Net Core 3.1.
  • Dev Tools : VS2019 / VSCode

Api Architecture

  • This Api is build on .Net Core 3.1 which is a lightweight, cross platform and high performance framewrok.

  • Api is build on #f03c15Onion Architecture pattern which provides a better way to build applications for better testability, maintainability, and dependability on the infrastructures like databases and service.

    image

  • TaxApi.Host

    • To Get Tax Rate [Route : /api/Tax/TaxRate]
    • Calculate Tax for an Order [Route: /api/Tax/OrderTax]
    • ActionFilter : Validates consumer and returns 401 unauthorized if consumer not allowed.
    • ExceptionFilter : Catches all exception and returns appropriate error message with status code.
  • TaxApi.Core

    • Service : Enables to communicates with Repositories. One controller will have one Service. Service layer validates the request and populates a valid apiRequest and sends to repository.
    • Repository : Enables to make ApiCall and returns response.
    • Validators : Validates Api request to ensure valid request sent to TaxJarApi.
    • ApiClient : ApiClient makes call to external TaxJar Api using HttpClient.
    • Helpers : This enables to load configured consumers.
    • Excetpions : This enables custom exception handling and return error message.
  • TaxApi.Domain

    • This layer keep all model & entities required to process a request.
  • Unit Tests

    • TaxApi.Host.Tests
    • TaxApi.Core.Tests
      • Test Driven development : Xunit enables early detection of failures and provides robust software delivery. XUnit used to test app components.

    image

Api Security

  • TaxApi is Secure and only allowed to Consumer with having valid consumer key. User without valid consumer key won’t be able to use this API and request will fail. Please use consumerKey as "f4b358d793ce4105b46d9f055cf53f79" to use this App. This is configured using AppSettings.Json.

    e.g. ConsumerKey: #f03c15f4b358d793ce4105b46d9f055cf53f79

Api Configuration

  • This allows to add consumers with external Tax provider(e.g. TaxJar) URL & their Authentication token. So, this App having capability to onboard a consumer and configure external tax api like TaxJar. As long as data contract not changing this app will handle multiple external Api to get Tax information.

    • consumerKey : TaxApi consumer key to access TaxApi.
    • taxApiUrl : Configure external Api (e.g. TaxJarApi) which provides Tax Data.
    • taxApiAuthToken : Configure AuthToken for external Api.

    image

Api Swagger

  • This provides standard TaxApi documentation and capability to consume it.

    image

Api In Action

  1. GetTax Rate:

    • Success image

    • Error image

  2. Order Tax:

    • Success image

    • Error image

  3. Invalid Consumer

    image

Authors

  • Raj Kumar

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages