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
feat: resolved veria issue
=29cc0c7d4411
diff --git a/backend/src/ee/routes/v1/license-v2-router.ts b/backend/src/ee/routes/v1/license-v2-router.tsindex 9a1b5ce358..85f06bed29 100644--- a/backend/src/ee/routes/v1/license-v2-router.ts+++ b/backend/src/ee/routes/v1/license-v2-router.ts@@ -177,7 +177,6 @@ const BillingV2PreviewSchema = z.object({prorationAmount: z.number(),nextInvoiceTotal: z.number(),nextRecurringTotal: z.number(),- prorationDate: z.number(),lines: BillingV2PreviewLineSchema.array()});@@ -437,10 +436,8 @@ export const registerLicenseV2Router = async (server: FastifyZodProvider) => {schema: {params: z.object({ organizationId: z.string().trim() }),body: z.object({- // One or more per_resource commitment changes; the service applies them per dimension.- changes: BillingV2CommitmentChangeSchema.array().min(1),- // Echo the prorationDate from a preview so the billed total matches the confirmation.- prorationDate: z.number().optional()+ // One or more per_resource commitment changes; the service applies them per dimension. The+ changes: BillingV2CommitmentChangeSchema.array().min(1)}),response: {200: BillingV2MutationResultSchema@@ -451,8 +448,7 @@ export const registerLicenseV2Router = async (server: FastifyZodProvider) => {return server.services.licenseV2.changeCommitment({orgId: req.params.organizationId,actor: buildActor(req.permission),- changes: req.body.changes,- prorationDate: req.body.prorationDate+ changes: req.body.changes});}});diff --git a/backend/src/ee/services/license-v2/license-v2-service.ts b/backend/src/ee/services/license-v2/license-v2-service.tsindex 3c788928e6..a763140dcc 100644--- a/backend/src/ee/services/license-v2/license-v2-service.ts+++ b/backend/src/ee/services/license-v2/license-v2-service.ts@@ -937,7 +937,6 @@ export const licenseV2ServiceFactory = ({prorationAmount: centsToDollars(preview.prorationAmount),nextInvoiceTotal: centsToDollars(preview.nextInvoiceTotal),nextRecurringTotal: centsToDollars(preview.nextRecurringTotal),- prorationDate: preview.prorationDate,lines: preview.lines.map((line) => ({description: line.description,amount: centsToDollars(line.amount),@@ -958,10 +957,10 @@ export const licenseV2ServiceFactory = ({};// Apply one or more previewed per_resource commitment changes. The License Server's apply endpoint- // is single-dimension, so loop per change reusing the previewed prorationDate (assumption C): the- // per-dimension prorations, pinned to the same instant, sum to the "charged today" the user saw. A- // mid-loop failure leaves earlier changes applied and surfaces the error to retry the rest.- const changeCommitment = async ({ orgId, actor, changes, prorationDate }: TChangeBillingV2CommitmentDTO) => {+ // is single-dimension, so loop per change; the server prorates each at commit time, so the preview+ // total may drift slightly if the user waits before confirming. A mid-loop failure leaves earlier+ // changes applied and surfaces the error to retry the rest.+ const changeCommitment = async ({ orgId, actor, changes }: TChangeBillingV2CommitmentDTO) => {await ensureManageBilling(orgId, actor);if (!changes.length) {throw new BadRequestError({ message: "Provide at least one commitment change" });@@ -972,8 +971,7 @@ export const licenseV2ServiceFactory = ({// eslint-disable-next-line no-await-in-loopconst result = await licenseClient.changeCommitment(orgId, {dimensionKey: change.dimensionKey,- quantity: change.quantity,- prorationDate+ quantity: change.quantity});subscriptionId = result.subscriptionId ?? subscriptionId;}diff --git a/backend/src/ee/services/license-v2/license-v2-types.ts b/backend/src/ee/services/license-v2/license-v2-types.tsindex 5929735d48..188c5567f3 100644--- a/backend/src/ee/services/license-v2/license-v2-types.ts+++ b/backend/src/ee/services/license-v2/license-v2-types.ts@@ -232,7 +232,6 @@ export type BillingV2Preview = {prorationAmount: number;nextInvoiceTotal: number;nextRecurringTotal: number;- prorationDate: number;lines: BillingV2PreviewLine[];};@@ -274,12 +273,11 @@ export type TRemoveBillingV2ProductDTO = {};// Apply one or more previewed per_resource commitment changes. The service loops the single-dimension-// apply per change, reusing prorationDate so the billed total matches the preview.+// apply per change; each prorates at commit time on the server (no client-supplied timestamp).export type TChangeBillingV2CommitmentDTO = {orgId: string;actor: OrgServiceActor;changes: BillingV2CommitmentChange[];- prorationDate?: number;};export type TStartBillingV2TrialDTO = {diff --git a/backend/src/services/license-client/license-client-backends.ts b/backend/src/services/license-client/license-client-backends.tsindex f1b132daca..ed20bb1356 100644--- a/backend/src/services/license-client/license-client-backends.ts+++ b/backend/src/services/license-client/license-client-backends.ts@@ -246,15 +246,8 @@ export const licenseServerBackend = (return checkoutResultSchema.parse(body);},- removeSubscriptionItem: async (- orgId: string,- productId: string,- prorationDate?: number- ): Promise<TCheckoutResult> => {+ removeSubscriptionItem: async (orgId: string, productId: string): Promise<TCheckoutResult> => {const url = new URL(orgScoped(orgId, `/subscription/items/${encodeURIComponent(productId)}`), serverUrl);- if (prorationDate !== undefined) {- url.searchParams.set("prorationDate", String(prorationDate));- }const res = await fetch(url, {method: "DELETE",headers: { Authorization: `Bearer ${mintServiceToken(signingKey)}` },@@ -265,8 +258,8 @@ export const licenseServerBackend = (return checkoutResultSchema.parse(body);},- // Apply a previewed per_resource commitment change; echoes the preview's prorationDate so the- // billed amount matches the confirmation the customer saw.+ // Apply a previewed per_resource commitment change. The server prorates at commit time; the payload+ // carries no proration timestamp, so the caller can't influence the charged amount.changeCommitment: async (orgId: string, payload: TChangeCommitmentPayload): Promise<TCheckoutResult> => {const url = new URL(orgScoped(orgId, "/subscription/commitments"), serverUrl);const res = await fetch(url, {diff --git a/backend/src/services/license-client/license-client-types.ts b/backend/src/services/license-client/license-client-types.tsindex f81ba9bb7f..a6909b8bd9 100644--- a/backend/src/services/license-client/license-client-types.ts+++ b/backend/src/services/license-client/license-client-types.ts@@ -228,8 +228,9 @@ export const checkoutResultSchema = z.passthrough();// Proration preview for an add/remove against an existing subscription. prorationAmount is signed:-// positive is charged now (an add), negative is a credit toward the next invoice (a removal).-// prorationDate is the timestamp the preview was computed at.+// positive is charged now (an add), negative is a credit toward the next invoice (a removal). The+// server prorates at request time; no client-supplied timestamp is accepted (it would let a caller+// pick a cheaper proration instant), so the preview carries an amount but not a timestamp to echo.const subscriptionPreviewLineSchema = z.object({description: z.string(),@@ -244,7 +245,6 @@ export const subscriptionPreviewResponseSchema = zprorationAmount: z.number(),nextInvoiceTotal: z.number(),nextRecurringTotal: z.number(),- prorationDate: z.number(),lines: z.array(subscriptionPreviewLineSchema).default([])}).passthrough();@@ -372,12 +372,11 @@ export type TCreatePortalPayload = {returnPath?: string;};-// Self-serve apply of a previewed commitment change. prorationDate echoes the preview's value so the-// billed amount matches; omit to prorate at now.+// Self-serve apply of a previewed commitment change. The server prorates at commit time; the caller+// cannot supply a proration timestamp (that would let a billing user pick a cheaper instant).export type TChangeCommitmentPayload = {dimensionKey: string;quantity: number;- prorationDate?: number;};export type TStartTrialPayload = {@@ -439,7 +438,7 @@ export type TLicenseClientBackend = {createPortalSession: (orgId: string, payload: TCreatePortalPayload) => Promise<TSessionResponse>;previewSubscriptionChange: (orgId: string, payload: TSubscriptionPreviewPayload) => Promise<TSubscriptionPreview>;addSubscriptionItems: (orgId: string, payload: TAddSubscriptionItemsPayload) => Promise<TCheckoutResult>;- removeSubscriptionItem: (orgId: string, productId: string, prorationDate?: number) => Promise<TCheckoutResult>;+ removeSubscriptionItem: (orgId: string, productId: string) => Promise<TCheckoutResult>;// Apply a previewed per_resource commitment change (self-serve).changeCommitment: (orgId: string, payload: TChangeCommitmentPayload) => Promise<TCheckoutResult>;// Start a plan-scoped self-serve trial.diff --git a/backend/src/services/license-client/license-client.ts b/backend/src/services/license-client/license-client.tsindex 0b6ac9d1be..ed970d41e5 100644--- a/backend/src/services/license-client/license-client.ts+++ b/backend/src/services/license-client/license-client.ts@@ -162,11 +162,11 @@ export const licenseClientFactory = ({ envConfig, keyStore }: TLicenseClientFactreturn backend.addSubscriptionItems(orgId, payload);};- const removeSubscriptionItem = async (orgId: string, productId: string, prorationDate?: number) => {+ const removeSubscriptionItem = async (orgId: string, productId: string) => {if (!backend) {throw new Error("license client backend is not configured");}- return backend.removeSubscriptionItem(orgId, productId, prorationDate);+ return backend.removeSubscriptionItem(orgId, productId);};const changeCommitment = async (orgId: string, payload: TChangeCommitmentPayload) => {diff --git a/backend/src/services/license-client/usage/usage-metering-service.ts b/backend/src/services/license-client/usage/usage-metering-service.tsindex e28c7327c1..164c03c883 100644--- a/backend/src/services/license-client/usage/usage-metering-service.ts+++ b/backend/src/services/license-client/usage/usage-metering-service.ts@@ -44,8 +44,7 @@ export const usageMeteringServiceFactory = ({void enqueue(orgId, dimensionKey).catch((error) => {logger.error(error,- `usage-metering: failed to enqueue usage event [orgId=${orgId}] [dimensionKey- =${dimensionKey}]`+ `usage-metering: failed to enqueue usage event [orgId=${orgId}] [dimensionKey=${dimensionKey}]`);});};@@ -67,8 +66,7 @@ export const usageMeteringServiceFactory = ({})().catch((error) => {logger.error(error,- `usage-metering: failed to enqueue usage event [projectId=${projectId}] [dimensionKey- =${dimensionKey}]`+ `usage-metering: failed to enqueue usage event [projectId=${projectId}] [dimensionKey=${dimensionKey}]`);});};diff --git a/frontend/src/hooks/api/billingV2/mutations.tsx b/frontend/src/hooks/api/billingV2/mutations.tsxindex 916ee785a5..bceb2439c7 100644--- a/frontend/src/hooks/api/billingV2/mutations.tsx+++ b/frontend/src/hooks/api/billingV2/mutations.tsx@@ -124,10 +124,10 @@ export const useAddBillingV2Product = () => {export const useChangeBillingV2Commitment = () => {const queryClient = useQueryClient();return useMutation({- mutationFn: async ({ orgId, changes, prorationDate }: TChangeBillingV2CommitmentDTO) => {+ mutationFn: async ({ orgId, changes }: TChangeBillingV2CommitmentDTO) => {const { data } = await apiRequest.post<BillingV2MutationResult>(`/api/v1/organizations/${orgId}/billing/v2/subscription/commitments`,- { changes, prorationDate }+ { changes });return data;diff --git a/frontend/src/hooks/api/billingV2/types.ts b/frontend/src/hooks/api/billingV2/types.tsindex 899ee5427d..79da61eeff 100644--- a/frontend/src/hooks/api/billingV2/types.ts+++ b/frontend/src/hooks/api/billingV2/types.ts@@ -213,13 +213,12 @@ export type BillingV2PreviewLine = {};// prorationAmount is signed: positive is charged now (an add), negative is a credit toward the next-// invoice (a removal). prorationDate is the timestamp the preview was computed at, for display only.+// invoice (a removal). The server prorates at commit time, so no proration timestamp is echoed back.export type BillingV2Preview = {currency: string;prorationAmount: number;nextInvoiceTotal: number;nextRecurringTotal: number;- prorationDate: number;lines: BillingV2PreviewLine[];};@@ -260,11 +259,10 @@ export type TRemoveBillingV2ProductDTO = {};// Apply one or more previewed per_resource commitment changes; the backend loops the per-dimension-// apply, reusing prorationDate so the billed total matches the preview.+// apply and the server prorates at commit time (no client-supplied proration timestamp).export type TChangeBillingV2CommitmentDTO = {orgId: string;changes: BillingV2CommitmentChange[];- prorationDate?: number;};export type TStartBillingV2TrialDTO = {diff --git a/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsx b/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsxindex 9a9b3eb1b6..091917f010 100644--- a/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/CommitmentView.tsx@@ -105,8 +105,7 @@ export const CommitmentView = ({ orgId, prod, entitlement, renewsOn, onBack, onDtry {await applyCommitment.mutateAsync({orgId,- changes,- prorationDate: preview.data?.prorationDate+ changes});createNotification({type: "success",