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] Add A Yearly plan option to billings and validate billing. #1321

Open
AndreD17 opened this issue Mar 1, 2025 · 0 comments
Open

[FEAT] Add A Yearly plan option to billings and validate billing. #1321

AndreD17 opened this issue Mar 1, 2025 · 0 comments
Labels

Comments

@AndreD17
Copy link

AndreD17 commented Mar 1, 2025

Feature Description
The BillingPlanDto currently does not support a yearly billing plan properly. The frequency field is a simple string without validation for allowed values, and amount is incorrectly validated as a string instead of a number.

Steps to Reproduce
Attempt to create a billing plan with frequency: 'yearly'.
The request is accepted, but there's no validation ensuring only "monthly" or "yearly" are allowed.
The amount field expects a string instead of a number, which could cause unintended behavior in the system.

Expected Behavior
The frequency field should only accept "monthly" or "yearly" to prevent invalid values.
The amount field should be validated as a number instead of a string.

Current Behavior
The frequency field accepts any string value, leading to potential incorrect configurations.
The amount field is treated as a string, which might cause issues when performing calculations.
The frequency field only supports monthly as a value.

Attempting to use yearly results in validation errors.

Screenshots/Logs
Feature not bug

Environment
OS: Windows/macOS/Linux
Browser/Device: Postman, Chrome, Firefox
Version: Current version of the application.

Possible Solution
Use @isin(['monthly', 'yearly']) for the frequency field to restrict allowed values.
Change @IsNumberString() to @IsNumber() for the amount field to ensure proper type validation.

Additional Context
This issue affects the ability to create and manage billing plans effectively.
Proper validation would improve system stability and prevent misconfigurations.
This feature will provide more flexibility for users and align with common billing practices.

Expected Json Response for both Monthly and Yearly

[
{
"name": "Free",
"description": "Free",
"frequency": "monthly",
"amount": 0,
"is_active": true
},
{
"name": "Premium",
"description": "Premium yearly plan",
"frequency": "yearly",
"amount": 100,
"is_active": true
}
]

@AndreD17 AndreD17 changed the title [CHORE] Feature [FEAT] Add Endpoint to Delete Product Comments #1266 Mar 1, 2025
@AndreD17 AndreD17 changed the title [FEAT] Add Endpoint to Delete Product Comments #1266 [FEAT] Add A Yearly plan option to billings and validate billing. Mar 1, 2025
@AndreD17 AndreD17 changed the title [FEAT] Add A Yearly plan option to billings and validate billing. [FEAT] Add A Yearly plan option to billings and validate billing. Mar 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants