fix: Allow less than 30 seats for orgs (#14995)

* fix: Allow less than 30 seats for orgs

* Add test

* Stub env variables
This commit is contained in:
Hariom Balhara authored and GitHub committed 2024-05-13 11:37:10 +00:00
1 parent fd64b0f468
commit 917c7b0764
5 files changed
+157 -7

No files matched your search

@@ -39,7 +39,10 @@ export const publishHandler = async ({ ctx }: PublishOptions) => {
if (IS_TEAM_BILLING_ENABLED) {
const checkoutSession = await purchaseTeamOrOrgSubscription({
teamId: prevTeam.id,
seats: Math.max(prevTeam.members.length, metadata.data?.orgSeats ?? 0),
seatsUsed: prevTeam.members.length,
seatsToChargeFor: metadata.data?.orgSeats
? Math.max(prevTeam.members.length, metadata.data?.orgSeats ?? 0)
: null,
userId: ctx.user.id,
isOrg: true,
pricePerSeat: metadata.data?.orgPricePerSeat ?? null,
@@ -45,7 +45,7 @@ const generateCheckoutSession = async ({
const checkoutSession = await purchaseTeamOrOrgSubscription({
teamId,
seats,
seatsUsed: seats,
userId,
pricePerSeat: null,
});