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

New generator request: Faker::Company.indian_gst_number #2823

Closed
ankitkhadria opened this issue Sep 6, 2023 · 3 comments · Fixed by #2825
Closed

New generator request: Faker::Company.indian_gst_number #2823

ankitkhadria opened this issue Sep 6, 2023 · 3 comments · Fixed by #2825

Comments

@ankitkhadria
Copy link
Contributor

ankitkhadria commented Sep 6, 2023

Is your feature request related to a problem? Please describe it.
So, in India, every business needs a goods and service tax number, my requirement was to assign random valid tax numbers to companies.

If you're adding new objects, please describe how you would use them
Provide examples of how the proposed feature could be useful and relevant.

I kind of started working on PR, It is useful to many ways

Instead of creating random numbers, we can actually create a valid GST(Tax) number, so that if applicable it passes all the validations and other checks.

For example, if proposing a new generator, explain why it's useful and relevant to Faker, and examples of how to use it in a real project.

image

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

It's a 15 character Alphanumeric number, so for now creating a random one

Additional context
Add any other context or screenshots about the feature request here.
No translation is needed, it is an alphanumeric character.

@stefannibrasil
Copy link
Contributor

Hi @ankitkhadria thanks for the description!

Could you clarify more what makes a generated value a valid GST(Tax) number? Thanks!

@ankitkhadria
Copy link
Contributor Author

ankitkhadria commented Oct 27, 2023

Hi @ankitkhadria thanks for the description!

Could you clarify more what makes a generated value a valid GST(Tax) number? Thanks!

Here is a format break-down of the GSTIN:

The first two digits represent the state code as per Indian Census 2021. Every state has a unique code. For instance,
The state code of Karnataka is 29
The state code of Delhi is 07
The next ten digits will be the PAN number of the taxpayer
The thirteenth digit will be assigned based on the number of registrations within a state
The fourteenth digit will be “Z” by default
The last digit will be for the check code. It may be an alphabet or a number.

I am using the same format to generate a dummy GST number so that it can go with a real project.

@stefannibrasil
Copy link
Contributor

Awesome, thank you @ankitkhadria I have tested it locally as well and it's looking good.

stefannibrasil pushed a commit that referenced this issue Nov 2, 2023
* Added Faker::Company.indian_gst_number fixed #2823

* refactor: using positional generator and added state code validation

* fix: state code validation condition

* Update styling of if condition to check state code validation

Co-authored-by: Stefanni Brasil <[email protected]>

---------

Co-authored-by: Stefanni Brasil <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants