Skip to content

shivanshjais22/Price-Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🧾 Price Service

A dedicated microservice in the E-Commerce system responsible for managing product pricing, including base prices and discounts. This service supports pricing persistence and calculates discounted prices on demand.


πŸ“Œ Overview

The Price Service enables CRUD operations on product pricing and integrates with the Product Service using RESTful APIs. It stores base price and discount percentage for each product and exposes endpoints to fetch both raw and discounted price data.


πŸ—οΈ Tech Stack

  • Language: Java 17+
  • Framework: Spring Boot
  • Database: H2 (In-memory) / MySQL
  • Tools: Maven, Lombok
  • Communication: REST (Spring Web)

πŸ“‚ Project Structure

com.example.demo
β”œβ”€β”€ controller
β”‚ └── Controllerprice.java
β”œβ”€β”€ dto
β”‚ └── Pricedto.java
β”œβ”€β”€ model
β”‚ └── Price.java
β”œβ”€β”€ repository
β”‚ └── PriceRepository.java
β”œβ”€β”€ service
β”‚ └── PriceService.java
β”‚ └── PriceServiceImpl.java
└── DemoApplication.java

πŸ”— REST API Endpoints

1. Create Price

POST /price

Registers a new price for a product.

Request Body:

{
  "productId": 1,
  "basePrice": 999.99,
  "discountPercent": 10.0
}

###2. Get Price by Product ID
**GET** /price/{productId}

Returns the base price and discount percentage for a given product.

Sample Response:

**Request Body**:
```json
{
  "productId": 1,
  "basePrice": 999.99,
  "discountPercent": 10.0
}

About

This service for discount

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages