-
Notifications
You must be signed in to change notification settings - Fork 162
feat(taxcode): seed default Stripe tax codes at server startup #4039
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||||||
| package taxcode | ||||||||||
|
|
||||||||||
| import "github.com/samber/lo" | ||||||||||
|
|
||||||||||
| // DefaultTaxCodeSeed holds the minimal inputs needed to seed one well-known tax code. | ||||||||||
| type DefaultTaxCodeSeed struct { | ||||||||||
| Key string | ||||||||||
| Name string | ||||||||||
| Description *string | ||||||||||
| StripeCode string | ||||||||||
| } | ||||||||||
|
|
||||||||||
| // DefaultStripeTaxCodes is a curated list of commonly used Stripe tax codes for | ||||||||||
| // software and SaaS businesses. These are seeded at startup so users can browse | ||||||||||
| // and select from known codes without having to look up Stripe-specific identifiers. | ||||||||||
| // | ||||||||||
| // Keys follow the same convention used by GetOrCreateByAppMapping: "stripe_<code>". | ||||||||||
| // This ensures that if a code was already auto-created by the billing flow, the | ||||||||||
| // seed CreateTaxCode call will hit the unique constraint and be silently skipped. | ||||||||||
| var DefaultStripeTaxCodes = []DefaultTaxCodeSeed{ | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should come from config. |
||||||||||
| { | ||||||||||
| Key: "stripe_txcd_00000000", | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd choose a key that's specific to our platform. When we support other providers, the same tax code will map between providers.
Suggested change
or we can define a format for OM
Suggested change
|
||||||||||
| Name: "Non-taxable", | ||||||||||
| Description: lo.ToPtr("Use for products or services that are explicitly exempt from tax."), | ||||||||||
| StripeCode: "txcd_00000000", | ||||||||||
| }, | ||||||||||
| { | ||||||||||
| Key: "stripe_txcd_10103001", | ||||||||||
| Name: "SaaS - Business Use", | ||||||||||
| Description: lo.ToPtr("Software as a Service intended for business use."), | ||||||||||
| StripeCode: "txcd_10103001", | ||||||||||
| }, | ||||||||||
| { | ||||||||||
| Key: "stripe_txcd_10101000", | ||||||||||
| Name: "Infrastructure as a Service (IaaS)", | ||||||||||
| Description: lo.ToPtr("Cloud infrastructure services such as compute, storage, and networking."), | ||||||||||
| StripeCode: "txcd_10101000", | ||||||||||
| }, | ||||||||||
| { | ||||||||||
| Key: "stripe_txcd_10102000", | ||||||||||
| Name: "Platform as a Service (PaaS)", | ||||||||||
| Description: lo.ToPtr("Cloud platform services providing a managed environment for building and deploying applications."), | ||||||||||
| StripeCode: "txcd_10102000", | ||||||||||
| }, | ||||||||||
| { | ||||||||||
| Key: "stripe_txcd_10000000", | ||||||||||
| Name: "Digital Goods - General", | ||||||||||
| Description: lo.ToPtr("General category for digital goods and electronically supplied services. Use when no more specific code applies."), | ||||||||||
| StripeCode: "txcd_10000000", | ||||||||||
| }, | ||||||||||
| { | ||||||||||
| Key: "stripe_txcd_20030000", | ||||||||||
| Name: "Professional Services", | ||||||||||
| Description: lo.ToPtr("Consulting, advisory, and other professional services."), | ||||||||||
| StripeCode: "txcd_20030000", | ||||||||||
| }, | ||||||||||
| } | ||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we reuse the
CreateTaxCodeInputtype?