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 #637

Closed
wants to merge 7 commits into from

Conversation

MuthoniMN
Copy link
Contributor

Description

This PR adds an endpoint for creating a new billing plan.

Related Issue (Link to Github issue)

#633

Motivation and Context

The API doesn't have an endpoint to create a new billing plan. This is different from the source of truth(NestJS).

How Has This Been Tested?

  1. Run the app locally using php artisan serve
  2. In Postman, send a POST request with the following:
    Headers:
{
   Authorization: "Bearer {your-token}"
}

Request Body:

{
    "name": "Discounted Plan",
    "duration": "Yearly",
    "is_active": false,
    "price": 20000,
    "description": "A discounted plan description"
}
  1. You should get either of these responses:
    201 - Created Successfully
{
    "status": "success",
    "status_code": 201,
    "message": "Billing plan successfully created!",
    "data": {
        "name": "Discounted Plan",
        "duration": "Yearly",
        "price": 20000,
        "description": "A discounted plan description",
        "id": "9e52a242-b1ef-4395-ba8c-b6360be43c99",
        "updated_at": "2025-02-28T21:17:47.000000Z",
        "created_at": "2025-02-28T21:17:47.000000Z"
    }
}

403 - Duplicate Billing Plan

{
    "status": "error",
    "status_code": 403,
    "message": "Billing plan already exists!",
    "data": []
}

500 - Internal Server Error

{
    "status": "error",
    "status_code": 500,
    "message": "Internal Server Error!",
    "data": []
}

Screenshots (if appropriate - Postman, etc):

Postman:
image
Passing Tests:
image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

What this PR entails?

  • Creation of a POST endpoint (api/v1/billing-plans)
  • Updating the billing plan documentation
  • Tests for the create billing plan method

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@bhimbho bhimbho closed this Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants