Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve canceled subs handling #3148

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

knolleary
Copy link
Member

Description

This improves our handling around canceled stripe subscriptions.

We have seen a couple instances where subscription is canceled on stripe, but our local state thinks it is active.

This PR adds a check whenever we come to do billable work to resync our local status with the true stripe status. If we find the status has changed, and that it is now canceled, we suspend all team instances and log it.

It also:

  • adds a proper entry for the billing.subscription.updated audit-log event
  • fixes the Team Billing page for when the subscription has expired/canceled - it was previously talking about trials which isn't correct for this state.

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Comparison is base (1f10793) 39.82% compared to head (8a772a3) 40.31%.
Report is 59 commits behind head on main.

Files Patch % Lines
forge/db/controllers/Team.js 75.00% 4 Missing ⚠️
forge/ee/lib/billing/index.js 80.95% 4 Missing ⚠️
...end/src/components/audit-log/AuditEntryVerbose.vue 0.00% 3 Missing ⚠️
frontend/src/pages/team/Billing.vue 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3148      +/-   ##
==========================================
+ Coverage   39.82%   40.31%   +0.49%     
==========================================
  Files         582      582              
  Lines       21247    21356     +109     
  Branches     5103     5144      +41     
==========================================
+ Hits         8461     8610     +149     
+ Misses      12786    12746      -40     
Flag Coverage Δ
backend 76.30% <90.14%> (+0.87%) ⬆️
frontend 1.97% <0.00%> (-0.02%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@knolleary knolleary marked this pull request as ready for review December 4, 2023 14:40
@knolleary knolleary requested a review from Pezmc December 4, 2023 14:40
forge/ee/lib/billing/index.js Outdated Show resolved Hide resolved
forge/ee/lib/billing/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@Pezmc Pezmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a couple of suggested tweaks!

Co-authored-by: Pez Cuckow <email@pezcuckow.com>
Copy link
Contributor

@Pezmc Pezmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still 👍

@hardillb
Copy link
Contributor

hardillb commented Jan 9, 2024

@knolleary did you want to include this in the billing fix push to prod? It will need the merge conflicts fixing

@knolleary
Copy link
Member Author

@hardillb no, need to revisit this before it merges. For another day.

@knolleary knolleary marked this pull request as draft January 17, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants