Skip to content

Latest commit

 

History

History
519 lines (388 loc) · 8.61 KB

File metadata and controls

519 lines (388 loc) · 8.61 KB

Clinic and Payment API

Version 1.0.0

API for managing clinics, plans, and payments.

Path Table

Method Path Description
DELETE /deleteClinic/{id} Delete a clinic by ID
DELETE /deletePayment/{id} Delete a payment by ID
GET /getClinicById/{id} Get a clinic by ID
GET /getPaymentById/{id} Get a payment by ID
GET /obtainAllClinics Retrieve all clinics
GET /obtainAllPayments Retrieve all payments
GET /obtainAllPlans Retrieve all plans
GET /obtainPlanById/{id} Retrieve a plan by ID
POST /payment Process a payment
POST /registerClinic Register a new clinic
POST /registerPayment Register a new payment
PUT /updateClinic/{id} Update a clinic by ID

Reference Table

Name Path Description
Clinic #/components/schemas/Clinic
Payment #/components/schemas/Payment
Plan #/components/schemas/Plan

Path Details


[DELETE]/deleteClinic/{id}

  • Summary
    Delete a clinic by ID

  • Description
    Deletes a specific clinic by its unique ID.

Responses

  • 204 Clinic successfully deleted

  • 404 Clinic not found


[DELETE]/deletePayment/{id}

  • Summary
    Delete a payment by ID

  • Description
    Deletes a specific payment by its unique ID.

Responses

  • 204 Payment successfully deleted

  • 404 Payment not found


[GET]/getClinicById/{id}

  • Summary
    Get a clinic by ID

  • Description
    Retrieve a specific clinic by its unique ID.

Responses

  • 200 Clinic found

application/json

{
  // Unique identifier for the clinic
  _id?: string
  // Name of the clinic
  name?: string
  // City where the clinic is located
  city?: string
  // District of the clinic
  district?: string
  // Subscription plan of the clinic
  plan?: string
  // Status of the clinic
  active?: boolean
  // Postal code of the clinic
  postalCode?: string
  // ISO 3166-1 alpha-2 country code
  countryCode?: string
}
  • 404 Clinic not found

[GET]/getPaymentById/{id}

  • Summary
    Get a payment by ID

  • Description
    Retrieve a specific payment by its unique ID.

Responses

  • 200 Payment found

application/json

{
  // Unique identifier for the payment
  _id?: string
  // Date of the payment
  date?: string
  // UUID of the clinic associated with the payment
  clinicId?: string
  // Status of the payment
  status?: enum[Pending, Completed, Failed]
  // UUID of the plan associated with the payment
  planId?: string
}
  • 404 Payment not found

[GET]/obtainAllClinics

  • Summary
    Retrieve all clinics

  • Description
    Returns a list of all registered clinics.

Responses

  • 200 List of clinics

application/json

{
  // Unique identifier for the clinic
  _id?: string
  // Name of the clinic
  name?: string
  // City where the clinic is located
  city?: string
  // District of the clinic
  district?: string
  // Subscription plan of the clinic
  plan?: string
  // Status of the clinic
  active?: boolean
  // Postal code of the clinic
  postalCode?: string
  // ISO 3166-1 alpha-2 country code
  countryCode?: string
}[]

[GET]/obtainAllPayments

  • Summary
    Retrieve all payments

  • Description
    Returns a list of all registered payments.

Responses

  • 200 List of payments

application/json

{
  // Unique identifier for the payment
  _id?: string
  // Date of the payment
  date?: string
  // UUID of the clinic associated with the payment
  clinicId?: string
  // Status of the payment
  status?: enum[Pending, Completed, Failed]
  // UUID of the plan associated with the payment
  planId?: string
}[]

[GET]/obtainAllPlans

  • Summary
    Retrieve all plans

  • Description
    Returns a list of all registered plans.

Responses

  • 200 List of plans

application/json

{
  // Unique identifier for the plan
  _id?: string
  // Name of the plan
  name?: string
  // Price of the plan
  price?: number
  features?: string[]
}[]

[GET]/obtainPlanById/{id}

  • Summary
    Retrieve a plan by ID

  • Description
    Retrieves details of a specific plan by its unique ID.

Parameters

  • path
    • name: id in: path required: true description: Unique identifier for the plan schema: type: string

Responses

  • 200 Plan successfully retrieved

application/json

{
  "_id": "string",
  "name": "string",
  "price": 0,
  "features": ["string"]
}

- 404 Plan not found
- 400 Missing plan ID

***

### [POST]/payment

- Summary  
Process a payment

- Description  
Endpoint to process a payment, save the payment data, and activate the clinic.

#### RequestBody

- application/json

```ts
{
  // ID of the clinic making the payment.
  clinicId?: string
  // ID of the plan being paid for.
  planId?: string
}

Responses

  • 200 Payment processed successfully.

application/json

{
  message?: string
  // Information about the payment intent created by Stripe.
  paymentIntent: {
  }
}
  • 400 Error processing payment.

application/json

{
  error?: string
}
  • 404 Plan not found.

application/json

{
  error?: string
}

[POST]/registerClinic

  • Summary
    Register a new clinic

  • Description
    Creates a new clinic and saves it in the database.

RequestBody

  • application/json
{
  // Name of the clinic
  name: string
  // City where the clinic is located
  city: string
  // District of the clinic
  district: string
  // Subscription plan of the clinic
  plan: string
  // Status of the clinic
  active: boolean
  // Postal code of the clinic
  postalCode: string
  // ISO 3166-1 alpha-2 country code
  countryCode: string
}

Responses

  • 201 Clinic successfully created

  • 400 Invalid input data


[POST]/registerPayment

  • Summary
    Register a new payment

  • Description
    Creates a new payment and saves it in the database.

RequestBody

  • application/json
{
  // Date of the payment
  date: string
  // UUID of the clinic
  clinicId: string
  // Status of the payment
  status: enum[Pending, Completed, Failed]
  // UUID of the plan
  planId: string
}

Responses

  • 201 Payment successfully created

  • 400 Invalid input data


[PUT]/updateClinic/{id}

  • Summary
    Update a clinic by ID

  • Description
    Updates a clinic's details based on its unique ID.

RequestBody

  • application/json
{
  // Updated name of the clinic
  name?: string
  // Updated city where the clinic is located
  city?: string
  // Updated district of the clinic
  district?: string
  // Updated subscription plan of the clinic
  plan?: string
  // Updated status of the clinic
  active?: boolean
  // Updated postal code of the clinic
  postalCode?: string
  // Updated ISO 3166-1 alpha-2 country code
  countryCode?: string
}

Responses

  • 200 Clinic successfully updated

application/json

{
  // Unique identifier for the clinic
  _id?: string
  // Name of the clinic
  name?: string
  // City where the clinic is located
  city?: string
  // District of the clinic
  district?: string
  // Subscription plan of the clinic
  plan?: string
  // Status of the clinic
  active?: boolean
  // Postal code of the clinic
  postalCode?: string
  // ISO 3166-1 alpha-2 country code
  countryCode?: string
}
  • 400 Invalid input data

  • 404 Clinic not found

References

#/components/schemas/Clinic

{
  // Unique identifier for the clinic
  _id?: string
  // Name of the clinic
  name?: string
  // City where the clinic is located
  city?: string
  // District of the clinic
  district?: string
  // Subscription plan of the clinic
  plan?: string
  // Status of the clinic
  active?: boolean
  // Postal code of the clinic
  postalCode?: string
  // ISO 3166-1 alpha-2 country code
  countryCode?: string
}

#/components/schemas/Payment

{
  // Unique identifier for the payment
  _id?: string
  // Date of the payment
  date?: string
  // UUID of the clinic associated with the payment
  clinicId?: string
  // Status of the payment
  status?: enum[Pending, Completed, Failed]
  // UUID of the plan associated with the payment
  planId?: string
}

#/components/schemas/Plan

{
  // Unique identifier for the plan
  _id?: string
  // Name of the plan
  name?: string
  // Price of the plan
  price?: number
  features?: string[]
}