Giter Club home page Giter Club logo

retailer-rewards's Introduction

Problem

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))

Database

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:

Customer Schema

Customer Schema

Customer Transactions Schema

Customer Transactions

Data Access layer

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.

Service layer

Contains the Core logic of retriving the data from database and preparing the summary per user and per month level.

Controller Layer

Broadly classified into 3 categories Customer, Transactions and Summary:

Customer Controller:

Customer Transactions Controller:

Rewards Summary Controller:

Customer Schema

Customer Schema

Testing Layer

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

Start the Project

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

retailer-rewards's People

Contributors

suhas-coursera avatar

Watchers

James Cloos avatar Suhas avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.