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

Add support for past_due subscriptions #1892

Merged
merged 4 commits into from
Mar 31, 2023
Merged

Conversation

knolleary
Copy link
Member

@knolleary knolleary commented Mar 29, 2023

Fixes #1878

As I originally thought this was going to collide with the changes in #1889 I chose to based this work on the fix-coupons branch. In hindsight, I think the changes are somewhat more self-contained so don't strictly need to be based on that branch... but they both need to go in regardless.

Description

This adds track of 'past_due' stripe subscriptions. This is the state they go into as soon as a payment has failed.

With this PR, we update our internal state to 'past_due', but we still treat that as 'active' as far as all the billing logic goes. This ensures no change in functionality at this point in time. We may choose to restrict behaviour in the future - but not as part of this PR.

This then allows us to add a banner notifying the user if there is an over due payment:

image

This also includes a related fix where, when a subscription is canceled and we suspend all projects, we weren't resetting the billing state. This prevented them being re-added to new subscription once setup.

Related Issue(s)

#1878

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 flowforge/helm to update ConfigMap Template
    • Issue/PR raised on flowforge/CloudProject to update values for Staging/Production

Labels

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

@knolleary knolleary requested a review from Pezmc March 29, 2023 16:53
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.

Overall looks good! But the test failures are related, but this does need test coverage added!

@knolleary
Copy link
Member Author

Yup - looking at the tests now.

@knolleary
Copy link
Member Author

knolleary commented Mar 30, 2023

Have updated the tests around handling the Stripe callback - was bad luck the tests were using past_due as an example unsupported state... but I should have spotted it regardless.

Also added a test that verifies a past_due subscription still reports as active - so all existing behaviours that rely on the active state are not affected.

@Pezmc good for another review

@knolleary knolleary merged commit 2f20593 into fix-coupons Mar 31, 2023
@knolleary knolleary deleted the handle-over-due-subs branch March 31, 2023 08:40
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.

2 participants