Refactor metered plan configuration#2432
Open
JackVeneyMIRK wants to merge 7 commits into
Open
Conversation
Refactor email handling in BillingService to simplify parsing and usage of financeAccountingEmail. Update sendInvoiceByEmail method to accept a single recipientEmail instead of an array.
Add metered plan Stripe price IDs to config.
Added a function to ensure metered plan price IDs are set in the test environment.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Add cross-env as a dependency and update the lint and fix-lint npm scripts to set NODE_OPTIONS via cross-env (replacing export ...) for cross-platform compatibility. Also update package-lock.json to reflect the dependency changes.
Adjust indentation for BillingService.getMeteredPlanPriceId and remove extra blank lines/trailing whitespace in BillingServiceHelper test utilities. These are purely formatting changes with no logic modifications.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title of this pull request?
Refactor metered plan configuration
Small Description?
This pull request refactors how metered plan Stripe price IDs are managed for billing, moving away from hardcoded values in the codebase to using environment variables. This change improves security, flexibility, and ease of configuration across different environments (production, staging, testing). It also updates the test utilities to ensure these environment variables are set during tests and documents the new variables in the example environment configuration.
Billing Service Refactor:
BillingService.getMeteredPlanPriceIdwith environment variables, throwing descriptive errors if not configured. This makes the billing logic environment-agnostic and easier to manage.Testing Improvements:
ensureMeteredPlanPriceIdsInTestEnv) in test utilities to set default test values for the new environment variables, ensuring tests remain stable and do not fail due to missing configuration.Configuration Documentation:
config.example.envso users know to configure them for each product type.Pull Request Checklist:
closes #XXXXin your comment to auto-close the issue that your PR fixes (if such).Related Issue?
Screenshots (if appropriate):