A Spring Boot REST API that automates the SIM activation process for customers.
| Layer | Technology |
|---|---|
| Framework | Spring Boot 3.2.0 |
| Language | Java 17 |
| Database | MySQL 8.x |
| ORM | Spring Data JPA / Hibernate |
| Validation | Spring Boot Validation (Jakarta) |
| Build Tool | Maven |
SimActivationPortal/
├── src/
│ ├── main/
│ │ ├── java/com/sim/portal/
│ │ │ ├── SimActivationPortalApplication.java ← Main class
│ │ │ ├── config/
│ │ │ │ └── DataInitializer.java ← Seeds sample data
│ │ │ ├── controller/
│ │ │ │ ├── SimController.java
│ │ │ │ └── CustomerController.java
│ │ │ ├── service/
│ │ │ │ ├── SimService.java
│ │ │ │ └── CustomerService.java
│ │ │ ├── serviceimpl/
│ │ │ │ ├── SimServiceImpl.java
│ │ │ │ └── CustomerServiceImpl.java
│ │ │ ├── repository/
│ │ │ │ ├── SimDetailsRepository.java
│ │ │ │ ├── SimOffersRepository.java
│ │ │ │ ├── CustomerRepository.java
│ │ │ │ ├── CustomerAddressRepository.java
│ │ │ │ └── CustomerIdentityRepository.java
│ │ │ ├── entity/
│ │ │ │ ├── SimDetails.java
│ │ │ │ ├── SimOffers.java
│ │ │ │ ├── Customer.java
│ │ │ │ ├── CustomerAddress.java
│ │ │ │ └── CustomerIdentity.java
│ │ │ ├── dto/
│ │ │ │ ├── SimValidationRequest.java
│ │ │ │ ├── CustomerBasicDetailsRequest.java
│ │ │ │ ├── CustomerPersonalDetailsRequest.java
│ │ │ │ ├── UpdateAddressRequest.java
│ │ │ │ ├── IdProofValidationRequest.java
│ │ │ │ └── ApiResponse.java
│ │ │ └── exception/
│ │ │ ├── GlobalExceptionHandler.java
│ │ │ ├── SimActivationException.java
│ │ │ └── ResourceNotFoundException.java
│ │ └── resources/
│ │ └── application.properties
│ └── test/
│ └── java/com/sim/portal/
│ ├── SimServiceImplTest.java
│ └── CustomerServiceImplTest.java
├── database_setup.sql
└── pom.xml
Update src/main/resources/application.properties with your MySQL credentials:
spring.datasource.url=jdbc:mysql://localhost:3306/SimPortal?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=YOUR_PASSWORDOption A — Let Hibernate auto-create tables (recommended):
The ddl-auto=update setting in application.properties handles table creation.
The DataInitializer.java seeds all sample data automatically on first run.
Option B — Run the SQL script manually:
mysql -u root -p < database_setup.sql# Build
mvn clean install
# Run
mvn spring-boot:runThe app starts at: http://localhost:8080
Validates SIM number + Service number. Returns available offers on success.
Request:
{
"simNumber": "1234567891235",
"serviceNumber": "1234567892"
}Success Response (200):
{
"success": true,
"message": "SIM validated successfully. Available offers:",
"data": [ { "offerId": 2, "offerName": "Free calls", "cost": 50.0, ... } ]
}Error Responses:
"SIM number should be 13-digit numeric value"— bad SIM format"Service number should be 10-digit numeric value"— bad service number format"Invalid details, please check again SIM number/Service number!"— not found"SIM already active"— SIM status is already active
Validates customer email and date of birth.
Request:
{
"email": "smith@abc.com",
"dob": "1990-12-12"
}Success Response (200):
{
"success": true,
"message": "Customer basic details validated successfully."
}Error Responses:
"Email value is required"/"Dob value is required"— missing fields"Invalid email"— email doesn't match pattern"Date of birth should be in yyyy-mm-dd format"— bad date format"No request placed for you."— email/dob not found in DB
Validates first name, last name, and confirm email (acts as OTP).
Request:
{
"firstName": "Smith",
"lastName": "John",
"confirmEmail": "smith@abc.com"
}Success Response (200):
{
"success": true,
"message": "Customer personal details validated successfully.",
"data": { "firstName": "Smith", "lastName": "John", ... }
}Error Responses:
"Firstname/Lastname should be maximum of 15 characters"— name too long or has special chars"No customer found for the provided details"— name not in DB"Invalid email details!!"— confirm email doesn't match stored email
Updates existing address or creates a new one.
Request:
{
"addressId": 1,
"address": "MG Road 45",
"city": "Bangalore",
"pincode": "560001",
"state": "Karnataka"
}Success Response (200):
{
"success": true,
"message": "Address updated successfully.",
"data": { "addressId": 1, "address": "MG Road 45", ... }
}Error Responses:
"Address should be maximum of 25 characters""Pin should be 6 digit number""City/State should not contain any special characters except space"
Validates Aadhar details against CustomerIdentity table and activates the SIM.
Request:
{
"uniqueIdNumber": "1234567891234568",
"firstName": "Bob",
"lastName": "Sam",
"dateOfBirth": "1998-12-12"
}Success Response (200):
{
"success": true,
"message": "SIM activated successfully!"
}Error Responses:
"Id should be 16 digit"— uniqueIdNumber not 16 digits"Invalid details"— name mismatch or ID not found"Incorrect date of birth details"— DOB mismatch"SIM already active"— SIM was already activated
Import the following requests into SoapUI (Method: POST/PUT, Content-Type: application/json).
| # | Method | Endpoint | Purpose |
|---|---|---|---|
| 1 | POST | /api/sim/validate | SIM validation |
| 2 | POST | /api/customer/validate/basic | Email + DOB validation |
| 3 | POST | /api/customer/validate/personal | Name + confirm email |
| 4 | PUT | /api/customer/address/update | Update address |
| 5 | POST | /api/customer/validate/idproof | ID proof + SIM activation |
| Customer | SIM Number | Service Number | DOB | Unique ID | SIM Status | |
|---|---|---|---|---|---|---|
| Smith John | 1234567891234 | 1234567891 | smith@abc.com | 1990-12-12 | 1234567891234567 | active |
| Bob Sam | 1234567891235 | 1234567892 | bob@abc.com | 1998-12-12 | 1234567891234568 | inactive |
Use Bob Sam's data for the full SIM activation flow (status = inactive).