flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

feat: Add API usage billing

Open zachaysan opened this issue 1 year ago • 3 comments

Thanks for submitting a PR! Please check the boxes below:

  • [x] I have run pre-commit to check linting
  • [x] I have added information to docs/ if required so people know about the feature!
  • [x] I have filled in the "Changes" section below?
  • [x] I have filled in the "How did you test this code" section below?
  • [x] I have used a Conventional Commit title for this Pull Request

Changes

Pretty complicated PR. This introduces charges for API usage overages for monthly billed customers. Once a customer is billed for overages, a record is created and stops them from being billed twice in the same month. Only monthly billed customers are permitted to be billed, as the yearly paying customers need to be handled by sales. In order to ensure that customers are notified before they're billed, there is a pre-step that checks to see if the API usage notification has been sent out before including the customer in the billing step.

How did you test this code?

Manually tested against ChargeBee's backend and verified the results and also added four or five tests to ensure the workflow is proceeding according to plan.

zachaysan avatar Apr 08 '24 18:04 zachaysan

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 1:56pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 1:56pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 1:56pm

vercel[bot] avatar Apr 08 '24 18:04 vercel[bot]

Uffizzi Preview deployment-51574 was deleted.

github-actions[bot] avatar Apr 08 '24 18:04 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.21%. Comparing base (fbaaaa5) to head (3410d36). Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3729      +/-   ##
==========================================
+ Coverage   96.18%   96.21%   +0.02%     
==========================================
  Files        1141     1142       +1     
  Lines       36494    36699     +205     
==========================================
+ Hits        35101    35309     +208     
+ Misses       1393     1390       -3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 08 '24 18:04 codecov-commenter

If the merge conflicts wasn't enough now I'm hitting the codecov :(

Will update the tests for this when I can.

zachaysan avatar May 10 '24 14:05 zachaysan

Ok the code coverage is now at 100%. @matthewelwell did you want to take a look at the introduced tests before merging or are we good to go?

zachaysan avatar May 13 '24 17:05 zachaysan