Coder Social home page Coder Social logo

retailstore's Introduction

Introduction:

This project consists of RESTful services that implement a checkout counter for an online retail store that scans products and generates itemized bill.

It provides services for managing products and orders. Products can be configured with rate and category (A,B or C). Sales tax is applied based on the category of the product:

  • Category A - 10%
  • Category B - 20%
  • Category C- 0%

Bill details the products, quantity, total cost,sales tax and the total value of the bill.Data for 10 Products and 1 bill are added during startup to browse.

REST endpoints

Client can add/update/modify products and orders using the REST endpoints.Below is overview of REST end points:

Products

  • GET /products - fetches list of all product data
  • GET /products/{id} - fetch a specific product
  • POST /products - Creates a new product based on request JSON
  • PUT /products/{id} - Updates product data based on request JSON
  • DELETE /products/{id} - Delete an existing product if it is not associated with a bill.

Bills

  • GET /bills - fetches all bill data
  • GET /bills/{id} - fetches bill of a particular id
  • POST /bills - creates a bill Id. Client has to use this bill Id while adding and removing products
  • PUT /bills/{id} - Updates bill data. Client can add or remove products to bill sending a JSON request.
  • DELETE /bills/{id} - Delete bill from the system.

These REST end points are secured using basic authentication mechanism. Code uses in-memory repository with 'bob' as single user.

About Implementation

This application has been using SpringBoot as it provides a wide variety of features that aid development and maintainence. Some features that were utilised were: Spring Security, Spring Data/JPA and starters.

This program and instructions have been tested on following versions on Windows laptop.

  • Apache Maven 3.5.0
  • Java version: 1.8.0_131
  • git version 2.9.0.windows.1

How to run the application locally?

Pre-requisites to run application are Java, Maven and Git.

Steps to build and run locally:

  • Open commandline
  • Create a new directory called "retailstoreapp"
  • Clone repository using following command=> git clone https://github.com/satishpeyyety/retailstore.git .
  • Build the executable jar using maven=> mvn package
  • Go to target folder => cd target
  • Run following command to start the server on port 8080=> java -jar RetaileStoreApplication-0.0.1-SNAPSHOT.jar
  • Optionally, one can configure port using commandline parameter => --server.port=9090
  • Access and invoke APIs using url => http://localhost:8080/swagger-ui.html
  • Application will ask for authentication credentials during invocation of API's. Use 'bob' as user id and password.

This application uses H2 database and does not persist data on application restarts.

retailstore's People

Contributors

satishpeyyety avatar

Watchers

James Cloos avatar  avatar

Forkers

ramanjineyuluv

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.