hngprojects / hng_boilerplate_php_laravel_web

Apache License 2.0
148 stars 58 forks source link

[FIX](PHP) Refactor Billing API Endpoint for Updating a Plan #586

Open tulbadex opened 3 weeks ago

tulbadex commented 3 weeks ago

Description:

Refactor our current API endpoint for updating an existing billing plan to have the following route, parameter, and request body.

Route:

PUT: /api/v1/billing-plans/{id}

Parameters:

Request Body:

{
  "name": "string",
  "frequency": "Monthly",
  "is_active": true,
  "amount": 0,
  "description": "string"
}

Response Body:

Status Code: 200 OK

{
  "data": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "string",
    "frequency": "Monthly",
    "is_active": true,
    "amount": 0,
    "description": "string",
    "created_at": "2024-08-24T14:58:23.617Z",
    "updated_at": "2024-08-24T14:58:23.617Z"
  },
  "message": "string",
  "status_code": 0
}

Status Code:

404 Not Found

{
  "data": "string",
  "error": "string",
  "message": "string",
  "status_code": 0
}