Handle membership updates in Stripe (#5992)
This commit is contained in:
1 parent
68c7425922
commit
da0bdfacae
2 files changed
+44
-24
No files matched your search
@@ -8,8 +8,9 @@ import { sendTeamInviteEmail } from "@calcom/emails";
|
||||
import {
|
||||
cancelTeamSubscriptionFromStripe,
|
||||
purchaseTeamSubscription,
|
||||
updateQuantitySubscriptionFromStripe,
|
||||
} from "@calcom/features/ee/teams/lib/payments";
|
||||
import { HOSTED_CAL_FEATURES, IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { IS_TEAM_BILLING_ENABLED, WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||
import { getTeamWithMembers, isTeamAdmin, isTeamMember, isTeamOwner } from "@calcom/lib/server/queries/teams";
|
||||
import slugify from "@calcom/lib/slugify";
|
||||
@@ -242,8 +243,7 @@ export const viewerTeamsRouter = router({
|
||||
|
||||
// Sync Services
|
||||
closeComDeleteTeamMembership(membership.user);
|
||||
// @TODO: Update with new logic
|
||||
// if (HOSTED_CAL_FEATURES) await removeSeat(ctx.user.id, input.teamId, input.memberId);
|
||||
if (IS_TEAM_BILLING_ENABLED) await updateQuantitySubscriptionFromStripe(input.teamId);
|
||||
}),
|
||||
inviteMember: authedProcedure
|
||||
.input(
|
||||
@@ -354,13 +354,7 @@ export const viewerTeamsRouter = router({
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// @TODO: Update with new logic
|
||||
// try {
|
||||
// if (HOSTED_CAL_FEATURES) await addSeat(ctx.user.id, team.id, inviteeUserId);
|
||||
// } catch (e) {
|
||||
// console.log(e);
|
||||
// }
|
||||
if (IS_TEAM_BILLING_ENABLED) await updateQuantitySubscriptionFromStripe(input.teamId);
|
||||
}),
|
||||
acceptOrLeave: authedProcedure
|
||||
.input(
|
||||
@@ -392,10 +386,6 @@ export const viewerTeamsRouter = router({
|
||||
include: { team: true },
|
||||
});
|
||||
|
||||
// TODO: disable if not hosted by Cal
|
||||
// @TODO: Update with new logic
|
||||
// if (teamOwner) await removeSeat(teamOwner.userId, input.teamId, ctx.user.id);
|
||||
|
||||
const membership = await ctx.prisma.membership.delete({
|
||||
where: {
|
||||
userId_teamId: { userId: ctx.user.id, teamId: input.teamId },
|
||||
|
||||
Reference in new issue
Block a user