Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(billing): address review feedback on plan slug and checkout shape
Tre Dubrava0e1e7022009f
diff --git a/backend/src/ee/services/license-v2/license-v2-service.ts b/backend/src/ee/services/license-v2/license-v2-service.tsindex 9d2c7502c1..bfaec3a16d 100644--- a/backend/src/ee/services/license-v2/license-v2-service.ts+++ b/backend/src/ee/services/license-v2/license-v2-service.ts@@ -430,12 +430,11 @@ export const licenseV2ServiceFactory = ({return { outcome: "subscription_updated" as const, subscriptionId: result.subscriptionId };}- // checkout_created (or the legacy { url } shape) means the customer must finish in Stripe Checkout.- const checkoutUrl = result.checkoutUrl ?? result.url;- if (!checkoutUrl) {+ // checkout_created: the customer must finish in Stripe Checkout.+ if (!result.checkoutUrl) {throw new InternalServerError({ message: "Checkout session did not return a URL" });}- return { outcome: "checkout_created" as const, checkoutUrl };+ return { outcome: "checkout_created" as const, checkoutUrl: result.checkoutUrl };};const addPaymentMethod = async ({ orgId, actor, returnPath }: TAddBillingV2PaymentMethodDTO) => {diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.tsindex 9a6d8d5445..3094374400 100644--- a/backend/src/ee/services/license/license-service.ts+++ b/backend/src/ee/services/license/license-service.ts@@ -240,10 +240,12 @@ export const licenseServiceFactory = ({// it non-fatal so a subscription read failure doesn't drop the org to the free fallback.try {const subscription = await licenseClient.getSubscription(rootOrgId);- const tiers = (subscription?.items ?? []).map((item) => item.plan.toLowerCase());- if (tiers.some((tier) => tier.includes("enterprise"))) {+ const paidTiers = (subscription?.items ?? [])+ .map((item) => item.plan.toLowerCase())+ .filter((tier) => tier !== "free");+ if (paidTiers.some((tier) => tier.includes("enterprise"))) {currentPlan.slug = "enterprise";- } else if (tiers.length > 0) {+ } else if (paidTiers.length > 0) {currentPlan.slug = "pro";}} catch (error) {diff --git a/backend/src/services/license-client/license-client-types.ts b/backend/src/services/license-client/license-client-types.tsindex b25490055a..203c5863a9 100644--- a/backend/src/services/license-client/license-client-types.ts+++ b/backend/src/services/license-client/license-client-types.ts@@ -110,14 +110,12 @@ export const sessionResponseSchema = z.passthrough();// Checkout either needs the customer to complete a Stripe Checkout (checkout_created) or is applied-// directly to an existing subscription (subscription_updated). `url` is the legacy shape, tolerated so-// the cloud and license server can deploy in any order.+// directly to an existing subscription (subscription_updated).export const checkoutResultSchema = z.object({- outcome: z.enum(["checkout_created", "subscription_updated"]).optional(),+ outcome: z.enum(["checkout_created", "subscription_updated"]),checkoutUrl: z.string().optional(),- subscriptionId: z.string().optional(),- url: z.string().optional()+ subscriptionId: z.string().optional()}).passthrough();