-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[UBP] Add server method to create a stripe customers for an individual user #12753
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
Implement `findCustomerByTeamId` and `findCustomerByUserId` in terms of this more general method.
Directly analogous to createOrUpdateStripeCustomerForTeam, the only difference is the metadata on the resulting Stripe customer.
started the job as gitpod-build-af-server-create-stripe-customer-for-user.6 because the annotations in the pull request description changed |
@@ -2086,6 +2086,24 @@ export class GitpodServerEEImpl extends GitpodServerImpl { | |||
} | |||
} | |||
|
|||
async createOrUpdateStripeCustomerForUser(ctx: TraceContext, currency: string): Promise<void> { | |||
const user = this.checkAndBlockUser("createOrUpdateStripeCustomerForUser"); | |||
await this.ensureStripeApiIsAllowed({ 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.
💯
@@ -2086,6 +2086,24 @@ export class GitpodServerEEImpl extends GitpodServerImpl { | |||
} | |||
} | |||
|
|||
async createOrUpdateStripeCustomerForUser(ctx: TraceContext, currency: string): Promise<void> { |
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.
☁️ Originally I thought about merging these two methods on attributionId
. But I think it makes sense to have them separate as they have different semantics around access rights etc.
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.
Code LGTM, tested and works. ✔️
Description
Add a
createOrUpdateStripeCustomerForUser
method toserver
to allow the creation of Stripe customers for individual users. Previously we had only thecreateOrUpdateStripeCustomerForTeam
method which would create a Stripe customer for a Gitpod team.The only difference between the
createOrUpdateStripeCustomerForUser
andcreateOrUpdateStripeCustomerForTeam
methods is the metadata in the resulting Stripe customer object. For teams we store[teamId]: foo
and for users we store[userId]: bar
.Related Issue(s)
Part of #12685
How to test
Gitpod
in the name.Release Notes
Documentation
Werft options: