posthog icon indicating copy to clipboard operation
posthog copied to clipboard

fix: refactor billing api and update usage correctly

Open kappa90 opened this issue 3 years ago • 1 comments

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 BillingManager object, to simplify handling of billing data received from the billing service
  • When sending a usage report, we now check if there is an organization_usage object, 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

kappa90 avatar Dec 30 '22 17:12 kappa90

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.

posthog-bot avatar Jan 11 '23 07:01 posthog-bot

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

posthog-bot avatar Jan 18 '23 07:01 posthog-bot

Closing as this has been added to https://github.com/PostHog/posthog/pull/13521

kappa90 avatar Jan 31 '23 15:01 kappa90