# SmartShop - Backend API
SmartShop is a B2B commercial management web application backend for MicroTech Maroc, a Casablanca-based IT equipment distributor. The application provides a REST API to manage clients, products, orders, and payments, featuring a progressive loyalty system and split payment capabilities.
This is a backend-only application. All interactions and tests are intended to be performed via an API testing tool like Postman or Swagger.
## Features
- **Client Management**: CRUD operations for clients, tracking of order history, and cumulative spending.
- **Automated Loyalty System**: A tier-based loyalty system (BASIC, SILVER, GOLD, PLATINUM) that updates automatically based on client's order history and total spending.
- **Product Management**: CRUD operations for products with support for soft-deletes.
- **Order Management**: Create and manage multi-product orders with automatic calculations for discounts, VAT, and totals.
- **Multi-Method Payments**: Supports split payments for a single order via Cash, Check, or Bank Transfer.
- **Role-Based Access**: Simple role management for ADMIN and CLIENT users using HTTP Sessions.
- **Centralized Exception Handling**: Clear and consistent error responses for better API client integration.
## Built With
- Spring Boot - The web framework used
- Spring Data JPA - For database interaction
- PostgreSQL - Relational database
- Maven - Dependency Management
- Lombok - To reduce boilerplate code
- Java 17
## Getting Started
To get a local copy up and running, follow these simple steps.
### Prerequisites
- JDK 17 or later
- Maven 3.2+
- A running instance of PostgreSQL
### Installation & Configuration
1. **Clone the repository**
```sh
git clone
cd demo
```
2. **Configure the database**
Open `src/main/resources/application.properties` and update the database connection details:
```properties
spring.datasource.url=jdbc:postgresql://localhost:5432/your_database_name
spring.datasource.username=your_usernam …