clean code and normalize billing eventNames (#9928)
Solves : https://github.com/twentyhq/private-issues/issues/251 **TLDR:** Clean Billing Code using feedback of the previous PR (#9865). Normalized the metadata and names of the products, prices, and meters in Stripe so that they can be accessed in stripe's test mode and live mode. **In order to test:** 1. Have the environment variable IS_BILLING_ENABLED set to true and add the other required environment variables for Billing to work 2. Do a database reset (to ensure that the new feature flag is properly added and that the billing tables are created) 3. Run the command: npx nx run twenty-server:command billing:sync-plans-data (if you don't do that the products and prices will not be present in the database) 4. Run the server , the frontend, the worker, and the stripe listen command (stripe listen --forward-to http://localhost:3000/billing/webhooks) 5. Buy a subscription for the Acme workspace 6. Create a workflow and run it 7. After the run has been finished check in sprite the quantity of events in the CreditMeter, you should see that there is a new occurence with value one.
This commit is contained in:
committed by
GitHub
parent
625466f38d
commit
d777f62651
@ -27,10 +27,10 @@ export class WorkflowRunnerWorkspaceService {
|
||||
payload: object,
|
||||
source: ActorMetadata,
|
||||
) {
|
||||
const canExecuteBilledFunction =
|
||||
await this.billingUsageService.canExecuteBilledFunction(workspaceId);
|
||||
const canFeatureBeUsed =
|
||||
await this.billingUsageService.canFeatureBeUsed(workspaceId);
|
||||
|
||||
if (!canExecuteBilledFunction) {
|
||||
if (!canFeatureBeUsed) {
|
||||
this.logger.log(
|
||||
'Cannot execute billed function, there is no subscription for this workspace',
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user