0d6f4a32a7
Solves : https://github.com/twentyhq/private-issues/issues/241 https://github.com/twentyhq/private-issues/issues/254 **TLDR:** - Add BillingMeterEventService and StripeBillingMeterEventService in order to send billing meter events to stripe. - Plugged the service into workflow node execution for testing purposes (more improvements on this area will be done in the next PR's) **In order to test:** - Have the environment variable IS_BILLING_ENABLED set to true and add the other required environment variables for Billing to work - Do a database reset (to ensure that the new feature flag is properly added and that the billing tables are created) - 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) - Run the server , the frontend, the worker, and the stripe listen command (stripe listen --forward-to http://localhost:3000/billing/webhooks) - Buy a subscription for the Acme workspace - Create a workflow and run it - 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. **Take into consideration:** - I used an eventName that I have made a long time ago, so it hasn't a significant naming. I'm updating the meters and associated prices in stripe to use the correct meter with a more clearer eventName. - I put some error handling in the execution of the workflow nodes, this is still incomplete and needs some refinement, I would like the feedback of the workflows track for a more cleaner approach