Create Restapi in Spring Boot for Insurance Management using MYSQL and JPA

BuildĀ  Restapi in Spring boot for insurance management application. that have two actors, Admin, and Customer. with the following API calls and payload.

This is a backend project in spring boot that is using MAVEN, Tomcat, MVC, Spring boot, JPA and postman to run the apis.

Common API:

User and admin Registration with the following payload parameters

{
"firstName": "user",
"lastName": "user",
"gender": "Male",
"city": "Indore",
"address": "gfdg gfgdfgd 5 fgfgfdg",
"username": "user",
"password": "user",
"email": "user@gmail.com",
"role":"User/Admin"
}

Login and generate auth token using spring security

{
    "username" : "admin",
    "password" : "admin"
}

API calls by Admin

Admin can Add/View List/Delete/Update insurance policies with the following payload

{
"policy_id":1,
"policy_number": 123,
"policy_name" "xyz",
"policy_type": "Health",
"yearly_price": 10000,
"benefits": [
    "Heart", 
    "Lungs", 
    "accident"
            ]
}

API calls By the User

  • Get a request to view all the available Insurance policies.
  • Get requests to get policies by type.
  • Post request to apply for Insurance policies with the following payload.
{
"user_id": 1,
"policy_id":1,
"status": "apply",
"applicant_name": "ABC",
"age":25,
"number_of_dependent":3
}
  • Get applied policies by user id.
  • Payment for policies.
{
"user_id": 1,
"policy_id":1,
"totalpayment": "20000",
"card_number": 12345689,
"cvv":251,
"Date of Booking": "Current Date"
}

API Validations:

  • A duplicate username should not allow.
  • Duplicate emails should not allow.
  • If the age is more than 35 years then the policy price will be increased by 20% of the base price.
  • Users can see their own booked polices. it should not allow viewing others booked polices.

Leave a Comment

Your email address will not be published. Required fields are marked *