fix: refactor billing api and update usage correctly
Problem
Every time we report usage to the billing service, we receive an organization usage report, that we want to save on the organization model.
Needs https://github.com/PostHog/billing/pull/66 and a new billing service release to be fully functional
Changes
- Refactored the billing internal API to create a
BillingManagerobject, to simplify handling of billing data received from the billing service - When sending a usage report, we now check if there is an
organization_usageobject, and in case we use that to update the organization usage
How did you test this code?
- Added a new test, and fixed old ones
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.
This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.
Closing as this has been added to https://github.com/PostHog/posthog/pull/13521