-
Notifications
You must be signed in to change notification settings - Fork 63
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
Ensure coupons are applied for all team subscriptions #1889
Conversation
This happened because this particular coupon was marked as 'one time use only'. The problem is we don't have a sensible way to handle this combination. There are just too many combinations of how these things can be configured. I'll check to see if we can detect this flag is set on the coupon and then automatically clear our record of it locally after then successfully setup stripe the first time. |
We know when setting up a team subscription if we're actually setting up the subscription for an existing team (ie preview sub has been cancelled). In that case, we can check the flag on the coupon to know if its restricted to first time only and then withhold the coupon from the request if needed. This allows the coupon to stay associated with the user so that it gets applied if they create a new team. |
Add support for past_due subscriptions
Fixes #1788
Description
The current coupon handling approach is broken. Accessing the sign-up page with
?code=BLAH
doesn't guarantee that coupon gets applied when they eventually checkout on stripe.This PR does the following:
UserBillingCode
model - this is a simple table mapping UserID to a coupon code?code=BLAH
, we validate it is a valid code and then store the code in theUserBillingCode
table. Note we store the code as-is - we do not store the stripe API id for the coupon.As it stands, there is no ability to remove a user's coupon code. Given we validate it each time we try to use it, there is no issue of applying an invalid code and leaving them unable to checkout.
The most significant change in behaviour between this and previous coupon logic is that the coupon will be applied (if valid) every time the user sets up a billing session, not just the first time.
Checklist
flowforge.yml
?flowforge/helm
to update ConfigMap Templateflowforge/CloudProject
to update values for Staging/ProductionLabels
backport
labelarea:migration
label