Skip to content

Commit

Permalink
[server] Show "Team Plans" to users who are about to uprgade to usage…
Browse files Browse the repository at this point in the history
…-based
  • Loading branch information
geropl authored and mrzarquon committed Sep 21, 2022
1 parent 4cc6bac commit 3924900
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/server/ee/src/billing/billing-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ export class BillingModesImpl implements BillingModes {
const hasCbTeamSeat = cbTeamSubscriptions.length > 0;
const hasCbTeamSubscription = cbOwnedTeamSubscriptions.length > 0;

if (hasUbbPaidTeam || hasUbbPersonal) {
// UBB is greedy: once a user has at least a paid team membership, they should benefit from it!
function usageBased() {
const result: BillingMode = { mode: "usage-based" };
if (hasCbTeam) {
result.hasChargebeeTeamPlan = true;
Expand All @@ -143,14 +142,19 @@ export class BillingModesImpl implements BillingModes {
}
return result;
}

if (hasUbbPaidTeam || hasUbbPersonal) {
// UBB is greedy: once a user has at least a paid team membership, they should benefit from it!
return usageBased();
}
if (hasCbTeam || hasCbTeamSeat || canUpgradeToUBB) {
// TODO(gpl): Q: How to test the free-tier, then? A: Make sure you have no CB seats anymore
// For that we could add a new field here, which lists all seats that are "blocking" you, and display them in the UI somewhere.
return { mode: "chargebee", canUpgradeToUBB: true }; // UBB is enabled, but no seat nor subscription yet.
}

// UBB free tier
return { mode: "usage-based" };
return usageBased();
}

async getBillingModeForTeam(team: Team, _now: Date): Promise<BillingMode> {
Expand Down

0 comments on commit 3924900

Please sign in to comment.