-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Implement a new Team Billing where Owners can conveniently manage a paid plan for their Team #8041
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
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
8658b8d
to
5ce2124
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
781bacd
to
6f646d9
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
617bd55
to
ffa5298
Compare
ffa5298
to
9863513
Compare
9863513
to
5fa7475
Compare
/hold because of rebase dependent PR #9655 |
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.
Great stuff - everything works (small pro-rata comment)
Hold before merging and complete caveats.
a76c3c4
to
b3cc98b
Compare
@jankeromnes please hold this PR while we review the question of seat limits.
Some options to mitigate this: (open to other ideas)
|
b3cc98b
to
5390aa8
Compare
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.
Left a few comments. Looks very good!
`chargeForUpgrade: paymentReference=${teamSubscription.paymentReference}, currentTermRemainingRatio=${currentTermRemainingRatio}, diffInCents=${diffInCents}`, | ||
); | ||
await this.upgradeHelper.chargeForUpgrade( | ||
"", |
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 ""
?
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.
Ah, good catch. This is supposed to be a userId
, but it's only used in a logContext
:
gitpod/components/ee/payment-endpoint/src/chargebee/upgrade-helper.ts
Lines 25 to 26 in 8a51b9d
async chargeForUpgrade(userId: string, chargebeeSubscriptionId: string, amountInCents: number, description: string, upgradeTimestamp: string) { | |
const logContext: LogContext = { userId }; |
For team subscription changes, a userId
doesn't really make sense (i.e. do we want the user who is joining or leaving the team? or a billing owner? which one if there are multiple? etc)
A "cleaner" solution would be to refactor or implement a new upgradeHelper.chargeForUpgrade
, but I thought it wasn't worth it, since we'd like to deprecate all this code soon anyway.
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.
@AlexTugarev Would you like this to be changed/improved somehow?
|
||
const coupon = await this.findAvailableCouponForPlan(user, planId); | ||
|
||
const email = User.getPrimaryEmail(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.
😢
at least this is not used to id the customers.
just the regular note: User.getPrimaryEmail
is not stable.
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.
This was copied over from the non-team checkout
method (although I did skip the check/error).
Would you like this code to be changed/improved somehow?
components/ee/payment-endpoint/src/chargebee/team-subscription-handler.ts
Outdated
Show resolved
Hide resolved
@jankeromnes - regarding the PR hold to resolve the question of seat limits: |
94cd550
to
c106f85
Compare
Oops, looks like this doesn't work with the new VM/payment setup. I'm able to buy something from Chargebee, but the team plan never materializes, and the
I wonder what's up. 🤔 |
/werft run 👍 started the job as gitpod-build-jx-better-team-subscriptions.83 |
c106f85
to
17f5738
Compare
…veniently manage a paid plan for their Team
17f5738
to
fd0ded8
Compare
This error is still here 😭
EDIT: But it does look unrelated to this PR, maybe. I suspect it might be a MySQL/TypeOrm incompatibility issue, which might not affect staging. 🤞 I have battle-tested this PR again -- everything seems to work fine, with purchase/update/cancel in both legacy Team Plans and the (hidden) new Team Plans. ✅ However, in the spirit of safety, holding off on merging this now, given the mysterious SQL error + tomorrow's prod deployment + that I'm off until Monday. However, please do feel free to have a look, and merge if this looks safe to you (and revert it again if you notice the SQL error or other weirdness once deployed on staging). |
Many thanks @AlexTugarev for spotting and fixing the SQL error above in #9957 ! 🎉 ❤️ This is now ready to go then. 🚀 /unhold |
Description
Allow teams to easily purchase and manage a Team Plan directly from their team's Settings.
TODO:
Related Issue(s)
Fixes #7759
How to test
Release Notes
Documentation