Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Create Billing Plan Endpoint #221

Open
Micah-Shallom opened this issue Jul 31, 2024 · 0 comments
Open

FEAT: Create Billing Plan Endpoint #221

Micah-Shallom opened this issue Jul 31, 2024 · 0 comments

Comments

@Micah-Shallom
Copy link
Contributor

Description

Develop an endpoint that allows for the creation of a new billing plan within the system.

Endpoint

POST /api/v1/billing-plans

Request

Headers

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

Body

{
  "name": "string",
  "price": "number"
}

Response

Success (201 Created)

Body

{
  "Status": 201,
  "Message": "Billing plan created successfully",
  "Data": {
    "id": "string",
    "name": "string",
    "price": "number"
  }
}

Failure (401 Unauthorized)

Body

{
  "Status": 401,
  "Message": "Unauthorized"
}

Failure (500 Internal Server Error)

Body

{
  "Status": 500,
  "Message": "Internal server error"
}

Acceptance Criteria

  • The endpoint must require authorization and return a 401 error if the user is not authenticated.
  • Upon successful creation, the endpoint must return a 201 status with a message indicating success, a status code of 201, and the details of the created billing plan under the Data key.
  • The endpoint should handle unexpected errors and return a 500 status with an appropriate error message.

Additional Details

  • Authorization: Ensure that only authenticated users can access this endpoint. Unauthorized users should receive a clear 401 error response.
  • Data Validation: Implement validation for the request body to ensure name is a non-empty string and price is a valid number.
  • Error Handling: Ensure proper error handling to return meaningful error messages and appropriate HTTP status codes.
  • Logging: Include logging for both successful operations and errors to facilitate debugging and monitoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants