INFO

Application written using Clean Architecture designed to add loyalty points for the customer based on an order value as described below

How to run application

  1. Download repository
  2. Build root module
  3. Open ShopServiceApplication starter class
  4. Run

How to test

The application includes unit tests, however, to check its full functionality you can use the prepared http query covering application API, which can be found in the file http.client

Predefined data

Users and transaction are added when the program is started in @PostContruct init() method

Coding task

A retailer offers a rewards program to its customers, awarding points based on each recorded purchase.

A customer receives 2 points for every dollar spent over $100 in each transaction, plus 1 point for every dollar spent over $50 in each transaction (e.g. a $120 purchase = 2x$20 + 1x$50 = 90 points).

Given a record of every transaction during a three month period, calculate the reward points earned for each customer per month and total.

Submission Checklist:

  • Follow standard best practices for structuring the code.
  • Prepare and provide Test Data along with the code.
  • Both positive and negative unit test cases for all operations – to be run as part of the build process.
  • Implement RestAPI’s for all CRUD operations – in this case – creating/updating transactions, calculating and providing reward information for a User. (Java Backend/Full Stack)
  • Consistent error handling and reporting of all failures including unexpected error conditions
  • Use of appropriate logging levels, framework
  • Reward calculation logic should be accurate
  • Readme file is mandatory – must contain the steps required to build and run/test the code
  • The solution must be checked into Github (provide a public github url)

Java Backend :

-OOPs concepts as much as possible when designing classes.
-Swagger/OpenAPI (Optional) - helps communicate the contract in a better way
-Document all response codes expected. The REST API should be sending the appropriate code and not 200 always.
-Functional Programming constructs of Java 8 as appropriate.
-Generic exception handler for un-anticipated exceptions.