Skip to content

Endpoint to Get Billing Plan Details #298

@FreemanBoss

Description

@FreemanBoss

Implement Endpoint to Get Billing Plan Details

Description:
Implement an endpoint to retrieve billing plan details for a specific organization. This endpoint will fetch the details of a specified billing plan.

Endpoint:
GET /api/v1/organizations/{organization_id}/billing-plans/{plan_name}

Request Parameters:

  • organization_id (path parameter): The unique identifier of the organization.
  • plan_name (path parameter): The name of the billing plan to fetch details for.

Request Headers:

  • Content-Type: application/json
  • Authorization: Bearer <token>

Response:

  • status: HTTP status code indicating the request outcome.
  • message: Description of the response.
  • data: The billing plan details.

Response Body Example:

{
  "status": 200,
  "message": "details fetched successfully",
  "data": {
    "plan": {
      "id": "premium",
      "name": "Premium Plan",
      "price": 20.00,
      "features": ["Feature 1", "Feature 2", "Feature 3"],
      "description": "Detailed description of the Premium Plan."
    }
  }
}

Tasks:

  1. Route Handler:

    • Create a route handler for the endpoint.
  2. Authentication & Authorization:

    • Implement authentication and authorization middleware to verify the Bearer token.
  3. Database Design:

    • Ensure the database schema supports storing billing plan details.
    • Define necessary relationships between organizations and billing plans.
  4. Fetch Billing Plan Details:

    • Fetch billing plan details based on the provided organization_id and plan_name.
  5. Response Format:

    • Return the billing plan details in the specified response format.
  6. Unit Testing:

    • Write unit tests to ensure the endpoint works as expected.
    • Test cases should include valid requests, invalid requests (e.g., missing or invalid token), and error handling.
  7. API Documentation:

    • Update the API documentation to include this new endpoint.

Acceptance Criteria:

  • The endpoint should validate the presence of organization_id and plan_name.
  • The endpoint should return a 401 status code if the authorization token is invalid or missing.
  • The endpoint should return a 200 status code with the billing plan details if the request is successful.
  • The endpoint should handle errors gracefully and return appropriate error messages and status codes.
  • Unit tests should cover all scenarios, including success, failure, and edge cases.
  • Database design should support efficient retrieval and storage of billing plan details.

Notes:

  • Ensure that the organization_id and plan_name are validated and sanitized to prevent SQL injection or other security issues.
  • Follow RESTful API design principles and best practices.
  • Ensure that unit tests are comprehensive and cover all possible edge cases.
  • Review and adhere to the existing database design and conventions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions