feat(billing): planes Free/Pro con Suscripciones de Mercado Pago
- Módulo billing: suscripción Pro mensual vía /preapproval con credenciales de plataforma por país, webhook firmado y reconciliación por polling. - PlanGuard en los use-cases que crean grupos/alumnos, cobran con MP o activan automatizaciones (402 plan_limit_reached / plan_feature_required / plan_read_only), detrás de BILLING_ENFORCEMENT. - Onboarding: paso Plan obligatorio (POST /onboarding/plan); con Free se saltean Cobros y WhatsApp. - Web: pantalla /billing, aviso de Pro desde el MutationCache. - Migración billing_subscriptions y docs/billing.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { z } from 'zod';
|
||||
import { planSchema, subscriptionStatusSchema } from './billing.js';
|
||||
import { countryCodeSchema, DEFAULT_COUNTRY } from './country.js';
|
||||
import { billingTypeSchema, weekdaySchema } from './enums.js';
|
||||
import { GroupDtoSchema } from './groups.js';
|
||||
@@ -65,5 +66,12 @@ export const OnboardingStatusDtoSchema = z.object({
|
||||
// WhatsApp is its own skippable step and does not move `step`.
|
||||
whatsappConnected: z.boolean(),
|
||||
completed: z.boolean(),
|
||||
// The "Plan" step is mandatory: these survive the round trip to Mercado Pago
|
||||
// and a reload, so the flow resumes where it was.
|
||||
planSelected: z.boolean(),
|
||||
// PRO as soon as the professor chose it, even while the subscription is PENDING.
|
||||
selectedPlan: planSchema.nullable(),
|
||||
subscriptionStatus: subscriptionStatusSchema.nullable(),
|
||||
country: countryCodeSchema.nullable(),
|
||||
});
|
||||
export type OnboardingStatusDto = z.output<typeof OnboardingStatusDtoSchema>;
|
||||
Reference in New Issue
Block a user