Skip to content

Net Calculator service for a company which provides financial services worldwide. Developed with Java. It is a service which allows consumers to calculate the net price based on the input gross price and VAT (MWSt).

Notifications You must be signed in to change notification settings

rishiraj88/netcalculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Net Price Calculator

Net Price Calculator (netcalculator) as a web service for any company which provides financial services across currencies, be it international or even worldwide. Developed with Java 17. It is a service which allows consumers to calculate the net price based on the input gross price and VAT (MWSt).

Calculation formula:

The simplest interface for the net price formula expects two parameters from end users or integrated services:

  • gross price
  • ISO country code

The formula is listed below:

'''netPrice = calculateNetPrice(grossPrice, countryIso);'''

Some Examples of the Usage of Net Price Formula:

'''81 = calculateNetPrice(100, DE); 1.6 = calculateNetPrice(1.99, FR);'''

This service accesses

taxRateProvider
service which returns the current VAT rate required to calculate the net price for a given country. The tax data used by the
taxRateProvider
is represented as a simple map of country code to tax rate.

Some Examples of CountryCode To TaxRate:

  • "DE":"0.19", // Germany has 19% VAT on standard taxable goods
  • "FR":"0.20", // France has 20% VAT on standard taxable goods

It is a fully runnable (with mvn) and testable Java implementation along with the instructions required for a reviewer.

Projects and Components

  • eureka: Eureka server for service discovery
  • api-gateway: to welcome incoming requests for services
  • net-calculator: to present the net price data to consumers
  • tax-rate-provider: to retrieve VAT rate for specified country

Instructions for a Reviewer to Execute the Services

Compile and Install Projects

  • Inside eureka project directory: Run mvn install.
  • Inside api-gateway project directory: Run mvn install.
  • Inside net-calculator project directory: Run mvn install.
  • Inside tax-rate-provider project directory: Run mvn install.

Start Services

The services should be started in the following order to ensure smooth functioning:

  • Start eureka project as a Java Application or Spring Boot App.
  • Start api-gateway project as a Java Application or Spring Boot App.
  • Start net-calculator project as a Java Application or Spring Boot App.
  • Start tax-rate-provider project as a Java Application or Spring Boot App.

Access the Services

Hit the following URLs with a modern web browser or a REST client:

The last two parts of URL paths signify the following semantics:

  • de / fr: country codes
  • 129 / 1.39: gross prices

In response, respective net prices are be returned. You may try other values of country code and gross price as well. Also, we may together think over how to make this library more versatile as a value generator for clients.

Future Steps

  • Translate the app into Kotlin.
  • Translate the app into Go (Golang) to observe performance gain, if any (just for fun).
  • Try to add more testing scenarios.

For any queries, feel free to contact at:

About

Net Calculator service for a company which provides financial services worldwide. Developed with Java. It is a service which allows consumers to calculate the net price based on the input gross price and VAT (MWSt).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages