refactor: remove commented-out code and clean up Stripe router

- Eliminated outdated comments related to legacy plan detection and current pricing calculations.
- Improved code readability by removing unnecessary comments that no longer serve a purpose.
This commit is contained in:
Mauricio Siu
2026-02-19 14:53:28 -06:00
parent 66190434a7
commit 781bf5e116
3 changed files with 0 additions and 8 deletions

View File

@@ -15,7 +15,6 @@ const STARTUP_BASE_PRICE_IDS = [
const STARTUP_SERVERS_INCLUDED = 3;
/** Total de servidores: ítem "Startup base" (qty 1) = 3 servidores; el resto = quantity por ítem. */
function getSubscriptionServersQuantity(
items: Stripe.SubscriptionItem[],
): number {

View File

@@ -65,7 +65,6 @@ export const stripeRouter = createTRPCRouter({
expand: ["data.items.data.price"],
});
// Detectar plan actual para mostrar upgrade a usuarios legacy
type CurrentPlan = "legacy" | "hobby" | "startup";
let currentPlan: CurrentPlan = "legacy";
let isAnnualCurrent = false;
@@ -96,7 +95,6 @@ export const stripeRouter = createTRPCRouter({
| Stripe.Price
| undefined;
isAnnualCurrent = firstPrice?.recurring?.interval === "year";
// Precio actual total del intervalo (mes o año) desde Stripe
const totalCents = activeSub.items.data.reduce((sum, item) => {
const price = item.price as Stripe.Price;
const amount = price.unit_amount ?? 0;
@@ -202,7 +200,6 @@ export const stripeRouter = createTRPCRouter({
}
}),
/** Cambiar de plan o cantidad de servidores (legacy→Hobby/Startup, o Hobby/Startup→cambiar tier/cantidad). Portal deshabilitado para esto; se hace desde la app. */
upgradeSubscription: adminProcedure
.input(
z

View File

@@ -3,19 +3,16 @@ export const WEBSITE_URL =
? "http://localhost:3000"
: process.env.SITE_URL;
// Legacy: precios/productos actuales. No borrar; usuarios existentes siguen con estos.
export const BASE_PRICE_MONTHLY_ID = process.env.BASE_PRICE_MONTHLY_ID!;
export const BASE_ANNUAL_MONTHLY_ID = process.env.BASE_ANNUAL_MONTHLY_ID!;
export const PRODUCT_MONTHLY_ID = process.env.PRODUCT_MONTHLY_ID!;
export const PRODUCT_ANNUAL_ID = process.env.PRODUCT_ANNUAL_ID!;
/** Price IDs legacy: suscripciones con estos IDs no se migran y siguen con los mismos beneficios. */
export const LEGACY_PRICE_IDS = [
process.env.BASE_PRICE_MONTHLY_ID,
process.env.BASE_ANNUAL_MONTHLY_ID,
].filter(Boolean) as string[];
// Nuevos planes (opcionales hasta que crees los productos en Stripe)
export const HOBBY_PRODUCT_ID = process.env.HOBBY_PRODUCT_ID ?? "";
export const HOBBY_PRICE_MONTHLY_ID = process.env.HOBBY_PRICE_MONTHLY_ID ?? "";
export const HOBBY_PRICE_ANNUAL_ID = process.env.HOBBY_PRICE_ANNUAL_ID ?? "";
@@ -28,7 +25,6 @@ export const STARTUP_BASE_PRICE_ANNUAL_ID =
export type BillingTier = "legacy" | "hobby" | "startup";
/** Line items para Stripe Checkout según tier y cantidad de servidores. */
export const getStripeItems = (
tier: BillingTier,
serverQuantity: number,