flowfuse icon indicating copy to clipboard operation
flowfuse copied to clipboard

billing: Start billing cycle on the 1st each month

Open ZJvandeWeg opened this issue 10 months ago • 2 comments

For billing insights and understand early in the month about where our revenue is going to end I've updated the billing cycle to start the 1st of each month. The default behaviour is to start the month the date + time they start their subscription.

Checklist

  • [ ] I have read the contribution guidelines
  • [ ] Suitable unit/system level tests have been added and they pass
  • [ ] Documentation has been updated
    • [ ] Upgrade instructions
    • [ ] Configuration details
    • [ ] Concepts
  • [ ] Changes flowforge.yml?
    • [ ] Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • [ ] Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • [ ] Backport needed? -> add the backport label
  • [ ] Includes a DB migration? -> add the area:migration label

ZJvandeWeg avatar Apr 18 '24 17:04 ZJvandeWeg

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 79.25%. Comparing base (05a4c0d) to head (71d525f). Report is 7 commits behind head on main.

:exclamation: Current head 71d525f differs from pull request most recent head 4b614fe

Please upload reports for the commit 4b614fe to get more accurate results.

Files Patch % Lines
forge/ee/lib/billing/index.js 75.00% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3748      +/-   ##
==========================================
- Coverage   79.26%   79.25%   -0.01%     
==========================================
  Files         281      281              
  Lines       12723    12728       +5     
  Branches     2838     2838              
==========================================
+ Hits        10085    10088       +3     
- Misses       2638     2640       +2     
Flag Coverage Δ
backend 79.25% <75.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

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

codecov[bot] avatar Apr 18 '24 17:04 codecov[bot]

@knolleary I'm sorry; I don't quite now how to validate my changes. The only test I could think of was to spy on the map/hash constructed, which felt silly. But I don't have a great Stripe test setup. Do you know how to achieve this and validate my hacking?

ZJvandeWeg avatar May 15 '24 17:05 ZJvandeWeg

@ZJvandeWeg I'll take a look. I have stripe setup locally; what is harder to test is time-based events in the future where you want to check what happens at invoice time etc. That's something we have to do fairly manually.

knolleary avatar May 16 '24 08:05 knolleary

Initial test looks good. Here is what the checkout page shows:

image

Are we happy with that?

knolleary avatar May 16 '24 14:05 knolleary

I like this a lot, thanks @knolleary !

ZJvandeWeg avatar May 16 '24 15:05 ZJvandeWeg