A retailer offers a rewards program to its customers awarding point based on each recorded purchase as follows:
For Every dollar Spend over $50 on the transaction, the customer receives one point. In addition, for every dollar spent over $100, the customer receives another point.
Ex: for a $120 purchase the customer receives 90 points (((120 - 50) * 1) + ((120 - 100) + 1))
Created a local database using H2 which will be initialized by loading sample customers and respective transactions during application start. Schema for both will be shown as below:
Used Hibernate to perform all crud operations which is efficient in terms of session management and also achieves the functionality with the least boilerplate code.
Contains the Core logic of retriving the data from database and preparing the summary per user and per month level.
Broadly classified into 3 categories Customer, Transactions and Summary:
The core logic is to test the logic behind rewards calculation which is covered in testing folder.
Commands to test at root directory: gradle cleanTest test
The entire application is backed by Spring boot which provides the MVC framework for us to start and test the application to test right awat by inbuilt Tomcat, please execute the below to start the application and check the above URL's to verify the application.
gradle bootRun