-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Introduce BillingModes #11601
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
Introduce BillingModes #11601
Conversation
): Promise<MayStartWorkspaceResult> { | ||
const billingMode = await this.billingModes.getBillingModeForUser(user); | ||
switch (billingMode.mode) { | ||
case "none": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my own (and future reviewers) sanity, The mode of none
only gets set for Self-hosted
, bacause it depends on the paymentEnabled
config to be false.
const isUsageBasedBillingEnabled = await getExperimentsClientForBackend().getValueAsync( | ||
"isUsageBasedBillingEnabled", | ||
false, | ||
{ | ||
user, | ||
}, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, isn't UBB flag currently controlled by whether you're part of the Gitpod team or not? In this case I believe you may need to also pass along the teams
of the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's up to discussion. See comment below.
|
||
// UBB enabled? | ||
if (!isUsageBasedBillingEnabled) { | ||
// No Chargebee subscription, and UBB is not enabled: CB free tier? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the question mark? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it make sense for the two of us to discuss the decision tree/scope of the decision made here. 👍
const isUsageBasedBillingEnabled = await getExperimentsClientForBackend().getValueAsync( | ||
"isUsageBasedBillingEnabled", | ||
false, | ||
{ | ||
teamId: team.id, | ||
teamName: team.name, | ||
}, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, we don't yet have anything like this in ConfigCat -- we only enable UBB for users who happen to be part of the Gitpod team, and then everywhere in the UI for them (i.e. for all their teams).
But maybe it could be a good idea to selectively enable UBB for a specific team, and only in that team's UI 👍 we'd just need to code this into ConfigCat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But maybe it could be a good idea to selectively enable UBB for a specific team, and only in that team's UI +1 we'd just need to code this into ConfigCat.
That was the intend. teamId
and team_name
are already available in ConfigCat. 👍
|
||
protected async ensureBillingMode( | ||
sub: { user?: User; team?: Team }, | ||
pred: (m: BillingMode) => boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does pred
mean? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Predicate. Sorry, was a tad late when I wrote this 😛 Will improve.
Many thanks for implementing this! This change makes me very nervous, because we're introducing so much complexity:
However, we are in a complicated situation (with the transition from Chargebee to UBB with many moving parts), and your solution looks like it can work. So, many thanks for powering through this. 💯 I would love to test this somehow. Could you please get this into a testable state (and complete the "TODOs"), and then provide "How to test" instructions? |
💯
It might also make sense to introduce this in steps. Especially the parts that affect current behaviors should be rolled out selectively so we do not break current users! Happy to brainstorm on this. |
started the job as gitpod-build-gpl-entitlement-svc.3 because the annotations in the pull request description changed |
080d381
to
9b1097f
Compare
Closing this one as it's replaced by #11812 and it's successors. |
Description
ToDo
Related Issue(s)
Fixes #
How to test
Release Notes
Documentation
Werft options: