founder-schema 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access/permissions.d.ts +5 -1
- package/dist/access/permissions.d.ts.map +1 -1
- package/dist/access/permissions.js +2 -0
- package/dist/access/permissions.js.map +1 -1
- package/dist/access/standing.d.ts +1 -1
- package/dist/access/standing.js +1 -1
- package/dist/access/standing.js.map +1 -1
- package/dist/domains/audit/audit.d.ts +6 -1
- package/dist/domains/audit/audit.d.ts.map +1 -1
- package/dist/domains/audit/audit.js +8 -0
- package/dist/domains/audit/audit.js.map +1 -1
- package/dist/domains/billing/billing.d.ts +35 -2
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +5 -3
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/members/signups.d.ts +113 -0
- package/dist/domains/members/signups.d.ts.map +1 -0
- package/dist/domains/members/signups.js +69 -0
- package/dist/domains/members/signups.js.map +1 -0
- package/dist/domains/membership/membership.d.ts +74 -16
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +136 -34
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/onboarding/onboarding.d.ts +142 -93
- package/dist/domains/onboarding/onboarding.d.ts.map +1 -1
- package/dist/domains/onboarding/onboarding.js +107 -20
- package/dist/domains/onboarding/onboarding.js.map +1 -1
- package/dist/domains/profile/founder-profile.d.ts +3 -3
- package/dist/domains/profile/founder-profile.js +3 -3
- package/dist/domains/profile/founder-profile.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../src/domains/billing/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAC,QAAQ,EAAE;IAC3E,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACjD,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CACnD,CAAC;KACD,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: buying, paying, invoices, refunds and coupons (0.12.0)\n *\n * POST /api/v1/billing/quote quoteBodySchema -> quoteSchema\n * POST /api/v1/billing/orders createOrderBodySchema -> createOrderResponseSchema\n * GET /api/v1/billing/orders/:orderId orderStateSchema (polled while \"processing\")\n * POST /api/v1/billing/orders/:orderId/confirm confirmOrderBodySchema -> orderStateSchema\n * GET /api/v1/billing/payments paymentPageSchema (mine)\n * GET /api/v1/billing/payments/:orderId paymentDetailSchema (mine, with the invoice)\n *\n * Staff (by the ability: support reads; managers refund and run coupons):\n * GET /api/v1/staff/payments staffPaymentsQuerySchema -> staffPaymentPageSchema\n * GET /api/v1/staff/payments/:orderId staffPaymentDetailSchema\n * POST /api/v1/staff/payments/:orderId/refund refundPaymentBodySchema -> staffPaymentDetailSchema\n * GET /api/v1/staff/coupons couponListSchema\n * POST /api/v1/staff/coupons createCouponBodySchema -> couponSchema\n * PATCH /api/v1/staff/coupons/:couponId updateCouponBodySchema -> couponSchema\n * PUT /api/v1/members/:memberId/membership setMembershipBodySchema -> memberDetailSchema\n *\n * Auto-renewal (0.31.0, payments v2; founder-circle-backend docs/payments-v2-plan.md 3a):\n * POST /api/v1/billing/auto-renewals startAutoRenewalBodySchema -> createOrderResponseSchema ('subscription')\n * GET /api/v1/billing/auto-renewals/:autoRenewalId autoRenewalStateSchema (polled after authorising)\n * POST /api/v1/billing/auto-renewals/:autoRenewalId/confirm confirmAutoRenewalBodySchema -> autoRenewalStateSchema\n * POST /api/v1/billing/auto-renewals/:autoRenewalId/cancel -> autoRenewalStateSchema (off at the period's end)\n * POST /api/v1/billing/auto-renewals/:autoRenewalId/payment-method -> paymentMethodUpdateSchema\n * (a plan bought with `autoRenew: true` on POST /billing/orders answers 'subscription' too)\n *\n * THE ONE RULE: THE SERVER PRICES, THE CLIENT CHOOSES. A request names what it\n * wants (an item) and maybe a coupon CODE; it never names an amount. Every\n * amount here is the server's, in integer paise, GST included.\n *\n * TWO PATHS IN, ONE GRANT. A payment reaches the server from the browser the\n * moment checkout returns (`confirm`) and from the gateway's webhook. Either\n * grants; the second is a no-op. So a member who closes the tab is still\n * granted, and `confirm` failing never means \"not paid\": the web says\n * \"processing\" and polls the order.\n *\n * GST: the company is registered, every captured payment gets a tax invoice,\n * every refund a credit note. Where the buyer is decides the tax: in the\n * supplier's state CGST + SGST, elsewhere IGST. So checkout asks for the state.\n *\n * @module founder-schema/domains/billing\n */\n\nimport { z } from 'zod';\nimport {\n eachOnce,\n emptyStringToUndefined,\n objectIdSchema,\n paginationQuerySchema,\n} from '../../core/common.js';\nimport {\n BILLING_REASON_MAX,\n BILLING_REASON_MIN,\n COUPON_CODE_MAX,\n COUPON_CODE_MIN,\n COUPON_LABEL_MAX,\n COUPON_LABEL_MIN,\n COUPON_PERCENT_MAX,\n COUPON_PERCENT_MIN,\n COUPON_USES_MAX,\n INVOICE_NUMBER_MAX,\n RAZORPAY_ID_MAX,\n RAZORPAY_SIGNATURE_MAX,\n} from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport {\n autoRenewalStatusSchema,\n paiseSchema,\n planPeriodSchema,\n planTierSchema,\n} from '../membership/membership.js';\nimport { personSchema } from '../people/person.js';\nimport { billingDetailsSchema, gstStateCodeSchema } from './gst.js';\nimport { paymentMethodSnapshotSchema } from './payment-method.js';\n\nexport {\n type BillingDetails,\n billingDetailsSchema,\n GST_RATE_PERCENT,\n GST_STATE_CODE_VALUES,\n GST_STATES,\n type GstStateCode,\n gstinChecksumValid,\n gstinSchema,\n gstStateCodeOf,\n gstStateCodeSchema,\n gstStateName,\n} from './gst.js';\n\n// ─── What can be bought ──────────────────────────────────────────────────────\n\n/** ⚠ Stored on every order: append only. */\nexport const PURCHASE_KIND_VALUES = ['membership', 'plan', 'upgrade'] as const;\nexport type PurchaseKind = (typeof PURCHASE_KIND_VALUES)[number];\n\n/**\n * The thing asked for.\n *\n * membership Rs 99, once\n * plan a month or a year of Premium or Business, appended\n * upgrade the Premium time left, turned into Business, for the difference\n */\nexport const purchaseItemSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('membership') }),\n z.object({ kind: z.literal('plan'), tier: planTierSchema, period: planPeriodSchema }),\n z.object({ kind: z.literal('upgrade') }),\n]);\nexport type PurchaseItem = z.infer<typeof purchaseItemSchema>;\n\n/** A coupon code as typed: letters, digits, hyphens; compared upper-case. */\nexport const couponCodeSchema = z\n .string()\n .trim()\n .min(COUPON_CODE_MIN)\n .max(COUPON_CODE_MAX)\n .regex(/^[A-Za-z0-9-]+$/, VALIDATION_MESSAGE.couponCodeInvalid)\n .transform((v) => v.toUpperCase());\n\n// ─── Quote ───────────────────────────────────────────────────────────────────\n\n/**\n * The tax inside a total. `taxable + cgst + sgst + igst = total`; either\n * CGST + SGST (buyer in the supplier's state) or IGST, never both.\n */\nexport const taxSplitSchema = z.object({\n ratePercent: z.number().int().positive(),\n taxable: paiseSchema,\n cgst: paiseSchema,\n sgst: paiseSchema,\n igst: paiseSchema,\n total: paiseSchema,\n});\nexport type TaxSplit = z.infer<typeof taxSplitSchema>;\n\n/**\n * `POST /billing/quote`. The state is optional: without it, no tax split.\n * `autoRenew` (0.31.0): price it as an auto-renewing plan, so the quote carries\n * the terms the member must see before authorising (`quote.autoRenew`).\n */\nexport const quoteBodySchema = z.object({\n item: purchaseItemSchema,\n couponCode: couponCodeSchema.optional(),\n stateCode: gstStateCodeSchema.optional(),\n autoRenew: z.boolean().optional(),\n});\nexport type QuoteBody = z.infer<typeof quoteBodySchema>;\n\n/** What a plan or an upgrade would do to the plan, priced now. */\nexport const planEffectSchema = z.object({\n tier: planTierSchema,\n /** When this purchase's time starts (later than now when it waits its turn). */\n startsAt: z.iso.datetime(),\n endsAt: z.iso.datetime(),\n /** For an upgrade: the days of Premium turned into Business. */\n upgradedDays: z.number().int().positive().nullable(),\n});\nexport type PlanEffect = z.infer<typeof planEffectSchema>;\n\n/** A coupon as a purchase carries it: its code and staff's name for it. */\nexport const appliedCouponSchema = z.object({ code: z.string(), label: z.string() });\nexport type AppliedCoupon = z.infer<typeof appliedCouponSchema>;\n\n/**\n * Why a captured payment was NOT applied (`grantFailed`), and so refunded\n * (0.18.0: the one list; the backend wrote two of these as loose strings and\n * the contract said `string`). Stored on the order: append only.\n *\n * AMOUNT_MISMATCH the gateway captured another amount than the price\n * ACCOUNT_DELETED paid after the account was deleted\n * COUPON_ALREADY_USED the code went to another of their orders, paid first\n * MEMBERSHIP_REQUIRED a plan, but the membership is gone (refunded, withdrawn)\n * ALREADY_MEMBER a membership, but they are a member already\n * PLAN_CHANGED an upgrade priced on a plan that has since changed\n * PLAN_NOTHING_TO_UPGRADE an upgrade with no Premium time left\n * PLAN_TERM_LIMIT past `PLAN_AHEAD_MAX_YEARS` of plan time\n * PLAN_UPGRADE_INSTEAD Business bought while on Premium (that is an upgrade)\n * AUTO_RENEW_STOPPED an auto-renewal's charge that landed after the\n * auto-renewal was stopped at once (a refund, the\n * membership ended, the account deleted) and the\n * gateway's cancel had not taken yet (0.31.0)\n * GRANT_REFUSED any other refusal of the grant: still recorded and\n * refunded, never left captured for nothing (the\n * server logs which one, to add it here)\n */\nexport const GRANT_FAILURE_VALUES = [\n 'AMOUNT_MISMATCH',\n 'ACCOUNT_DELETED',\n 'COUPON_ALREADY_USED',\n 'MEMBERSHIP_REQUIRED',\n 'ALREADY_MEMBER',\n 'PLAN_CHANGED',\n 'PLAN_NOTHING_TO_UPGRADE',\n 'PLAN_TERM_LIMIT',\n 'PLAN_UPGRADE_INSTEAD',\n 'GRANT_REFUSED',\n 'AUTO_RENEW_STOPPED',\n] as const;\nexport const grantFailureSchema = z.enum(GRANT_FAILURE_VALUES);\nexport type GrantFailure = z.infer<typeof grantFailureSchema>;\n\n/**\n * What an auto-renewing plan will charge (0.31.0), for the disclosure next to\n * Pay. India's 2023 dark-pattern guidelines: the member is told, before\n * authorising, that it renews, how much, how often and from when, and that it\n * can be turned off.\n *\n * chargesNow true: `amount` is taken now and buys the first period.\n * false: time of this tier is already held, so nothing is\n * taken now; the mandate is authorised and the first charge is\n * on `firstChargeAt`, when that time ends.\n * firstChargeAt now (chargesNow) or the end of the time held\n * nextChargeAt the charge after the first: one `period` later, India's calendar\n */\nexport const autoRenewTermsSchema = z.object({\n amount: paiseSchema,\n period: planPeriodSchema,\n chargesNow: z.boolean(),\n firstChargeAt: z.iso.datetime(),\n nextChargeAt: z.iso.datetime(),\n});\nexport type AutoRenewTerms = z.infer<typeof autoRenewTermsSchema>;\n\nexport const quoteSchema = z.object({\n item: purchaseItemSchema,\n /** \"Membership\", \"Premium, 1 month\", \"Upgrade to Business\": the server's words. */\n title: z.string(),\n listPrice: paiseSchema,\n discount: paiseSchema,\n /** What would be charged. Zero for a free-membership coupon: no checkout at all. */\n total: paiseSchema,\n coupon: appliedCouponSchema.nullable(),\n /** Null for a membership. */\n plan: planEffectSchema.nullable(),\n /** Null without a state. */\n tax: taxSplitSchema.nullable(),\n refundWindowDays: z.number().int().positive(),\n /**\n * The auto-renewing terms, when asked with `autoRenew: true` (0.31.0):\n *\n * a plan its own terms\n * an upgrade the BUSINESS terms it would continue as, only while a\n * Premium auto-renewal runs (not being turned off): its\n * period, first charge at the Business end (corrected\n * 2026-11-28; this said \"null for an upgrade\", and the web's\n * \"Keep auto-renew on, as Business\" needs these terms)\n *\n * Null otherwise: a coupon, the membership, auto-renew off on this server,\n * an upgrade with no Premium auto-renewal running. A PREVIEW: it ignores\n * whether another auto-renewal holds the slot, so \"Switch to Premium at\n * renewal\" can show its terms while Business still renews; only\n * `POST /billing/auto-renewals` (or the order) refuses on the slot.\n */\n autoRenew: autoRenewTermsSchema.nullable().default(null),\n});\nexport type Quote = z.infer<typeof quoteSchema>;\n\n// ─── Orders ──────────────────────────────────────────────────────────────────\n\n/**\n * Where an order stands. ⚠ Stored: append only.\n *\n * created checkout open, nothing paid yet\n * paid captured and granted; has an invoice\n * granted_free a free coupon: granted with no payment and no invoice\n * expired not paid within `ORDER_TTL_MINUTES`\n * refund_pending staff refunded it; the gateway is returning the money\n * refunded the money is back; has a credit note\n * refund_failed the gateway could not return it; staff act from its dashboard\n */\nexport const ORDER_STATUS_VALUES = [\n 'created',\n 'paid',\n 'granted_free',\n 'expired',\n 'refund_pending',\n 'refunded',\n 'refund_failed',\n] as const;\nexport const orderStatusSchema = z.enum(ORDER_STATUS_VALUES);\nexport type OrderStatus = z.infer<typeof orderStatusSchema>;\n\n/**\n * `POST /billing/orders`. Billing details are required for anything paid (the\n * invoice needs a place of supply): the server refuses a paid order without\n * them (`billing.stateCode`, VALIDATION_ERROR). A free coupon issues no\n * invoice, so it needs none (0.12.0).\n */\nexport const createOrderBodySchema = z.object({\n item: purchaseItemSchema,\n couponCode: couponCodeSchema.optional(),\n billing: billingDetailsSchema.optional(),\n /**\n * Buy the plan as an AUTO-RENEWAL (0.31.0): consent, said explicitly on the\n * wire (the web's switch is on by default, the user's ruling; the request\n * still says it). Only for `item.kind: 'plan'`, without a coupon, while the\n * catalog's `autoRenewEnabled`: otherwise `AUTO_RENEW_NOT_OFFERED`. The\n * answer is then `status: 'subscription'`.\n */\n autoRenew: z.boolean().optional(),\n});\nexport type CreateOrderBody = z.infer<typeof createOrderBodySchema>;\n\n/**\n * Either done (a free coupon granted at once) or a checkout to open. The\n * checkout fields are Razorpay Checkout's own options; identity (name, email,\n * phone) is the server's, never typed by the caller.\n */\nexport const createOrderResponseSchema = z.discriminatedUnion('status', [\n z.object({ status: z.literal('granted'), orderId: objectIdSchema }),\n z.object({\n status: z.literal('checkout'),\n orderId: objectIdSchema,\n expiresAt: z.iso.datetime(),\n checkout: z.object({\n keyId: z.string().min(1),\n razorpayOrderId: z.string().min(1),\n amount: paiseSchema,\n currency: z.literal('INR'),\n /** The merchant name on the dialog. */\n name: z.string(),\n /** What is being bought, under the name. */\n description: z.string(),\n prefill: z.object({\n name: z.string(),\n email: z.string(),\n contact: z.string().optional(),\n }),\n }),\n }),\n /**\n * An auto-renewal to authorise at Checkout (0.31.0): Razorpay Checkout is\n * opened with `subscription_id`, never `order_id` or an amount. `orderId` is\n * the first charge's order when one is taken now (`terms.chargesNow`): poll\n * it as any order. With nothing taken now it is null: poll the\n * auto-renewal instead. Its handler's answer goes to\n * `POST /billing/auto-renewals/:autoRenewalId/confirm`.\n */\n z.object({\n status: z.literal('subscription'),\n autoRenewalId: objectIdSchema,\n orderId: objectIdSchema.nullable(),\n /** Authorise before this, or it lapses (`expired`). */\n expiresAt: z.iso.datetime(),\n terms: autoRenewTermsSchema,\n checkout: z.object({\n keyId: z.string().min(1),\n razorpaySubscriptionId: z.string().min(1),\n name: z.string(),\n description: z.string(),\n prefill: z.object({\n name: z.string(),\n email: z.string(),\n contact: z.string().optional(),\n }),\n }),\n }),\n]);\nexport type CreateOrderResponse = z.infer<typeof createOrderResponseSchema>;\n\nexport const orderParamsSchema = z.object({ orderId: objectIdSchema });\nexport type OrderParams = z.infer<typeof orderParamsSchema>;\n\n/** What Razorpay Checkout's `handler` hands back, as it names it. */\nexport const confirmOrderBodySchema = z.object({\n razorpayOrderId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpayPaymentId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpaySignature: z.string().min(1).max(RAZORPAY_SIGNATURE_MAX),\n});\nexport type ConfirmOrderBody = z.infer<typeof confirmOrderBodySchema>;\n\n// ─── Auto-renewals (0.31.0) ──────────────────────────────────────────────────\n\nexport const autoRenewalParamsSchema = z.object({ autoRenewalId: objectIdSchema });\nexport type AutoRenewalParams = z.infer<typeof autoRenewalParamsSchema>;\n\n/**\n * `POST /billing/auto-renewals`: turn auto-renew ON for the plan time already\n * held (Me > Plans, after turning it off, after an upgrade). Nothing is taken\n * now; the first charge is when the time it follows ends (`terms.chargesNow`\n * false):\n *\n * the tier's own time held it starts when that tier's time ends\n * Premium while only Business is held (a DOWNGRADE, \"switch to Premium at\n * renewal\") it starts when the Business time ends\n *\n * Refused (`AUTO_RENEW_NOT_OFFERED`) with no plan time held (buy the plan with\n * `autoRenew` instead), for Business while only Premium is held (that is an\n * upgrade), while another auto-renewal holds the slot (one whose stop is\n * already requested does not), or while auto-renew is off on this server.\n *\n * `billing`: the place of supply every renewal's invoice needs. Without it the\n * member's saved details are used; with neither, `VALIDATION_ERROR` on\n * `billing.stateCode`, as for an order.\n */\nexport const startAutoRenewalBodySchema = z.object({\n tier: planTierSchema,\n period: planPeriodSchema,\n billing: billingDetailsSchema.optional(),\n});\nexport type StartAutoRenewalBody = z.infer<typeof startAutoRenewalBodySchema>;\n\n/**\n * What Razorpay Checkout's `handler` hands back for a subscription, as it\n * names it. The server checks the signature over its OWN stored subscription\n * id, never the one sent here: HMAC_SHA256(razorpay_payment_id + \"|\" +\n * subscription_id, key secret).\n */\nexport const confirmAutoRenewalBodySchema = z.object({\n razorpaySubscriptionId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpayPaymentId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpaySignature: z.string().min(1).max(RAZORPAY_SIGNATURE_MAX),\n});\nexport type ConfirmAutoRenewalBody = z.infer<typeof confirmAutoRenewalBodySchema>;\n\n/** An auto-renewal as its member polls or changes it. */\nexport const autoRenewalStateSchema = z.object({\n autoRenewalId: objectIdSchema,\n status: autoRenewalStatusSchema,\n tier: planTierSchema,\n period: planPeriodSchema,\n /** The first charge's order, when one was taken at authorisation: poll it for the grant. */\n orderId: objectIdSchema.nullable(),\n nextChargeAt: z.iso.datetime().nullable(),\n cancelAtCycleEnd: z.boolean(),\n});\nexport type AutoRenewalState = z.infer<typeof autoRenewalStateSchema>;\n\n/**\n * `POST /billing/auto-renewals/:id/payment-method`: how the member updates the\n * method a failed charge used. A card mandate opens Checkout to change the\n * card (`subscription_card_change`); any other opens Razorpay's own page,\n * where a UPI or eMandate can move to a card only (Razorpay's rule).\n */\nexport const paymentMethodUpdateSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('checkout'),\n keyId: z.string().min(1),\n razorpaySubscriptionId: z.string().min(1),\n name: z.string(),\n prefill: z.object({\n name: z.string(),\n email: z.string(),\n contact: z.string().optional(),\n }),\n }),\n z.object({ kind: z.literal('link'), url: z.url() }),\n]);\nexport type PaymentMethodUpdate = z.infer<typeof paymentMethodUpdateSchema>;\n\n/**\n * Where an order came from (0.31.0). ⚠ Stored: append only.\n *\n * checkout the member bought it (or a free code granted it)\n * renewal an auto-renewal's charge\n */\nexport const ORDER_SOURCE_VALUES = ['checkout', 'renewal'] as const;\nexport const orderSourceSchema = z.enum(ORDER_SOURCE_VALUES);\nexport type OrderSource = z.infer<typeof orderSourceSchema>;\n\n/** An order as its buyer polls it. */\nexport const orderStateSchema = z.object({\n orderId: objectIdSchema,\n item: purchaseItemSchema,\n status: orderStatusSchema,\n /**\n * The money was taken but what it bought could not be applied (bought\n * twice in two tabs, the plan changed while paying): it is refunded in\n * full, by itself. The client says so instead of \"done\".\n */\n notApplied: z.boolean(),\n});\nexport type OrderState = z.infer<typeof orderStateSchema>;\n\n// ─── Payments, invoices, credit notes ────────────────────────────────────────\n\n/** A party on an invoice. The supplier always has a GSTIN on a real invoice; a buyer, only on B2B. */\nexport const invoicePartySchema = z.object({\n name: z.string(),\n address: z.string().nullable(),\n gstin: z.string().nullable(),\n stateCode: gstStateCodeSchema,\n stateName: z.string(),\n});\nexport type InvoiceParty = z.infer<typeof invoicePartySchema>;\n\n/** B2B with the buyer's GSTIN, B2C without (0.18.0: the values, for the backend's model). */\nexport const INVOICE_KIND_VALUES = ['b2b', 'b2c'] as const;\nexport const invoiceKindSchema = z.enum(INVOICE_KIND_VALUES);\nexport type InvoiceKind = z.infer<typeof invoiceKindSchema>;\n\n/** A tax invoice, frozen when the payment was captured. */\nexport const invoiceSchema = z.object({\n /** e.g. `FC/26-27/000123`: sequential within a financial year, at most `INVOICE_NUMBER_MAX`. */\n number: z.string().max(INVOICE_NUMBER_MAX),\n issuedAt: z.iso.datetime(),\n /**\n * Issued where the supplier's GSTIN is not configured (dev, Razorpay test\n * mode): marked \"TEST: not a tax invoice\". Never true in production.\n */\n test: z.boolean(),\n supplier: invoicePartySchema,\n buyer: invoicePartySchema,\n kind: invoiceKindSchema,\n /** The service's accounting code (SAC). */\n sac: z.string(),\n description: z.string(),\n tax: taxSplitSchema,\n /** Always false: these services are never under reverse charge. */\n reverseCharge: z.literal(false),\n razorpayPaymentId: z.string(),\n});\nexport type Invoice = z.infer<typeof invoiceSchema>;\n\n/** A refund's credit note, against its invoice. */\nexport const creditNoteSchema = z.object({\n /** e.g. `FCCN/26-27/00012`: the invoice series + `CN`, sequential within a financial year. */\n number: z.string().max(INVOICE_NUMBER_MAX),\n issuedAt: z.iso.datetime(),\n invoiceNumber: z.string().max(INVOICE_NUMBER_MAX),\n tax: taxSplitSchema,\n});\nexport type CreditNote = z.infer<typeof creditNoteSchema>;\n\n/** One purchase in a member's history. Only settled orders are listed, never an abandoned checkout. */\nexport const paymentSummarySchema = z.object({\n id: objectIdSchema,\n item: purchaseItemSchema,\n title: z.string(),\n total: paiseSchema,\n status: orderStatusSchema,\n /** When it was captured, or granted for a free coupon. */\n paidAt: z.iso.datetime(),\n invoiceNumber: z.string().nullable(),\n /** Until when a refund may be asked for; null once refunded or for a free coupon. */\n refundableUntil: z.iso.datetime().nullable(),\n /** A purchase or an auto-renewal's charge (0.31.0): the history says \"Renewal\". */\n source: orderSourceSchema.default('checkout'),\n /** How it was paid (0.31.0); null for a free coupon and for payments from before 0.31.0. */\n method: paymentMethodSnapshotSchema.nullable().default(null),\n});\nexport type PaymentSummary = z.infer<typeof paymentSummarySchema>;\n\nexport const paymentPageSchema = paginatedSchema(paymentSummarySchema);\nexport type PaymentPage = z.infer<typeof paymentPageSchema>;\n\nexport const paymentDetailSchema = paymentSummarySchema.extend({\n listPrice: paiseSchema,\n discount: paiseSchema,\n coupon: appliedCouponSchema.nullable(),\n invoice: invoiceSchema.nullable(),\n creditNote: creditNoteSchema.nullable(),\n refundedAt: z.iso.datetime().nullable(),\n});\nexport type PaymentDetail = z.infer<typeof paymentDetailSchema>;\n\n// ─── Staff: payments and refunds ─────────────────────────────────────────────\n\n/** Who paid, as they are now, so staff can find them. Email only for a role that may read it. */\nexport const payerSchema = personSchema.extend({\n email: z.string().nullable(),\n});\nexport type Payer = z.infer<typeof payerSchema>;\n\nexport const staffPaymentsQuerySchema = paginationQuerySchema.extend({\n status: orderStatusSchema.optional(),\n memberId: objectIdSchema.optional(),\n /** Only the ones a person must act on (`needsAction` below). */\n needsAction: z.preprocess(emptyStringToUndefined, z.stringbool().default(false)),\n});\nexport type StaffPaymentsQuery = z.infer<typeof staffPaymentsQuerySchema>;\nexport type StaffPaymentsQueryInput = z.input<typeof staffPaymentsQuerySchema>;\n\nexport const staffPaymentSummarySchema = paymentSummarySchema.extend({\n payer: payerSchema,\n /**\n * A person must act (0.12.0): taken but not applied and not yet refunded\n * (the automatic refund did not go through), a refund that failed at the\n * gateway, or an open chargeback.\n */\n needsAction: z.boolean(),\n});\nexport type StaffPaymentSummary = z.infer<typeof staffPaymentSummarySchema>;\nexport const staffPaymentPageSchema = paginatedSchema(staffPaymentSummarySchema);\nexport type StaffPaymentPage = z.infer<typeof staffPaymentPageSchema>;\n\nexport const staffPaymentDetailSchema = paymentDetailSchema.extend({\n payer: payerSchema,\n razorpay: z.object({\n orderId: z.string().nullable(),\n paymentId: z.string().nullable(),\n refundId: z.string().nullable(),\n /** The auto-renewal's subscription, for a renewal charge (0.31.0). */\n subscriptionId: z.string().nullable().default(null),\n }),\n /** Why staff refunded it, on record. */\n refundReason: z.string().nullable(),\n /**\n * The money was taken but what it bought could not be applied when it was\n * captured (they were a member already, the Premium time to upgrade had\n * run out, past the 3-year cap): refund it. Null when it applied. One of\n * `GRANT_FAILURE_VALUES` (0.18.0; a plain string before).\n */\n grantFailed: grantFailureSchema.nullable(),\n /** A chargeback was opened on it (cleared when it is won or closed). */\n disputedAt: z.iso.datetime().nullable(),\n /**\n * What refunds made outside Founder Circle (the Razorpay dashboard) have\n * already given back of this payment. A Refund here gives back the rest:\n * `total` less this. 0 when there were none.\n */\n refundedOutside: paiseSchema,\n /**\n * Payments captured on this order other than the one that settled it (a\n * late authorisation, a second Checkout attempt): each is refunded by\n * itself; `refunded: false` means that refund has not gone through yet and\n * the payment needs a person.\n */\n strayPayments: z.array(\n z.object({\n paymentId: z.string(),\n amount: paiseSchema,\n refunded: z.boolean(),\n at: z.iso.datetime(),\n }),\n ),\n /**\n * When the payer asked for a refund (0.13.0): their first \"Payments and\n * refunds\" ticket opened inside the refund window. An ask in time keeps the\n * payment refundable after the window ends. Null when they did not ask in\n * time, or it is not a paid payment.\n */\n refundAskedAt: z.iso.datetime().nullable(),\n viewer: z.object({\n /**\n * Paid, within the window (or asked for within it), not their own, and\n * the asker may refund.\n */\n canRefund: z.boolean(),\n }),\n});\nexport type StaffPaymentDetail = z.infer<typeof staffPaymentDetailSchema>;\n\nconst reasonSchema = z.string().trim().min(BILLING_REASON_MIN).max(BILLING_REASON_MAX);\n\n/** `POST /staff/payments/:orderId/refund`. The reason is on the audit record. */\nexport const refundPaymentBodySchema = z.object({ reason: reasonSchema });\nexport type RefundPaymentBody = z.infer<typeof refundPaymentBodySchema>;\n\n/**\n * `PUT /members/:memberId/membership`: grant (a partner, a press account) or\n * revoke (a fake or duplicate account holding a founding place). A paid one\n * is never revoked: refund its payment.\n */\nexport const setMembershipBodySchema = z.object({\n granted: z.boolean(),\n reason: reasonSchema,\n});\nexport type SetMembershipBody = z.infer<typeof setMembershipBodySchema>;\n\n// ─── Staff: coupons ──────────────────────────────────────────────────────────\n\n/** What a coupon is good for. A percent coupon names what it applies to. */\nexport const COUPON_TARGET_VALUES = ['membership', 'premium', 'business'] as const;\nexport const couponTargetSchema = z.enum(COUPON_TARGET_VALUES);\nexport type CouponTarget = z.infer<typeof couponTargetSchema>;\n\n/**\n * ⚠ Stored: append only.\n *\n * free_membership the membership at Rs 0; `founding` numbers its holders\n * (\"Founding member #N\"). ⚠ A NEW founding coupon is refused\n * (0.14.0, COUPON_FOUNDING_RETIRED): founding places come\n * from the launch waitlist alone. The field stays, because\n * stored coupons carry it.\n * percent_off a share off the listed price of what it applies to\n */\nexport const COUPON_KIND_VALUES = ['free_membership', 'percent_off'] as const;\nexport type CouponKind = (typeof COUPON_KIND_VALUES)[number];\n\nexport const couponBenefitSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('free_membership'), founding: z.boolean() }),\n z.object({\n kind: z.literal('percent_off'),\n percent: z.number().int().min(COUPON_PERCENT_MIN).max(COUPON_PERCENT_MAX),\n appliesTo: z\n .array(couponTargetSchema)\n .min(1)\n .max(COUPON_TARGET_VALUES.length)\n .refine(eachOnce, {\n error: VALIDATION_MESSAGE.couponTargetsDuplicate,\n }),\n }),\n]);\nexport type CouponBenefit = z.infer<typeof couponBenefitSchema>;\n\nexport const couponSchema = z.object({\n id: objectIdSchema,\n code: z.string(),\n label: z.string(),\n benefit: couponBenefitSchema,\n /** Redemptions allowed in all; null is no cap. */\n max: z.number().int().positive().nullable(),\n /** Redemptions in force (a revoked founding place frees one). */\n used: z.number().int().nonnegative(),\n active: z.boolean(),\n validFrom: z.iso.datetime().nullable(),\n validUntil: z.iso.datetime().nullable(),\n createdAt: z.iso.datetime(),\n});\nexport type Coupon = z.infer<typeof couponSchema>;\n\n/** Never paged: coupons are few. Newest first. */\nexport const couponListSchema = z.object({ items: z.array(couponSchema) });\nexport type CouponList = z.infer<typeof couponListSchema>;\n\nexport const couponParamsSchema = z.object({ couponId: objectIdSchema });\nexport type CouponParams = z.infer<typeof couponParamsSchema>;\n\nconst windowValid = (body: { validFrom?: string | null; validUntil?: string | null }) =>\n !body.validFrom || !body.validUntil || Date.parse(body.validFrom) < Date.parse(body.validUntil);\n\nexport const createCouponBodySchema = z\n .object({\n code: couponCodeSchema,\n label: z.string().trim().min(COUPON_LABEL_MIN).max(COUPON_LABEL_MAX),\n benefit: couponBenefitSchema,\n max: z.number().int().positive().max(COUPON_USES_MAX).nullable(),\n validFrom: z.iso.datetime().nullable().optional(),\n validUntil: z.iso.datetime().nullable().optional(),\n })\n .refine(windowValid, { path: ['validUntil'], error: VALIDATION_MESSAGE.couponWindowInvalid });\nexport type CreateCouponBody = z.infer<typeof createCouponBodySchema>;\n\n/**\n * What may change on a live coupon. The code and the benefit never change: a\n * redemption is a record of what a code gave when it was used.\n */\nexport const updateCouponBodySchema = z\n .object({\n label: z.string().trim().min(COUPON_LABEL_MIN).max(COUPON_LABEL_MAX).optional(),\n active: z.boolean().optional(),\n max: z.number().int().positive().max(COUPON_USES_MAX).nullable().optional(),\n validFrom: z.iso.datetime().nullable().optional(),\n validUntil: z.iso.datetime().nullable().optional(),\n })\n .refine(windowValid, { path: ['validUntil'], error: VALIDATION_MESSAGE.couponWindowInvalid });\nexport type UpdateCouponBody = z.infer<typeof updateCouponBodySchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../src/domains/billing/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,QAAQ,EACR,sBAAsB,EACtB,cAAc,EACd,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,E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E,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: buying, paying, invoices, refunds and coupons (0.12.0)\n *\n * POST /api/v1/billing/quote quoteBodySchema -> quoteSchema\n * POST /api/v1/billing/orders createOrderBodySchema -> createOrderResponseSchema\n * GET /api/v1/billing/orders/:orderId orderStateSchema (polled while \"processing\")\n * POST /api/v1/billing/orders/:orderId/confirm confirmOrderBodySchema -> orderStateSchema\n * GET /api/v1/billing/payments paymentPageSchema (mine)\n * GET /api/v1/billing/payments/:orderId paymentDetailSchema (mine, with the invoice)\n *\n * Staff (by the ability: support reads; managers refund and run coupons):\n * GET /api/v1/staff/payments staffPaymentsQuerySchema -> staffPaymentPageSchema\n * GET /api/v1/staff/payments/:orderId staffPaymentDetailSchema\n * POST /api/v1/staff/payments/:orderId/refund refundPaymentBodySchema -> staffPaymentDetailSchema\n * GET /api/v1/staff/coupons couponListSchema\n * POST /api/v1/staff/coupons createCouponBodySchema -> couponSchema\n * PATCH /api/v1/staff/coupons/:couponId updateCouponBodySchema -> couponSchema\n * PUT /api/v1/members/:memberId/membership setMembershipBodySchema -> memberDetailSchema\n *\n * Auto-renewal (0.31.0, payments v2; founder-circle-backend docs/payments-v2-plan.md 3a):\n * POST /api/v1/billing/auto-renewals startAutoRenewalBodySchema -> createOrderResponseSchema ('subscription')\n * GET /api/v1/billing/auto-renewals/:autoRenewalId autoRenewalStateSchema (polled after authorising)\n * POST /api/v1/billing/auto-renewals/:autoRenewalId/confirm confirmAutoRenewalBodySchema -> autoRenewalStateSchema\n * POST /api/v1/billing/auto-renewals/:autoRenewalId/cancel -> autoRenewalStateSchema (off at the period's end)\n * POST /api/v1/billing/auto-renewals/:autoRenewalId/payment-method -> paymentMethodUpdateSchema\n * (a plan bought with `autoRenew: true` on POST /billing/orders answers 'subscription' too)\n *\n * THE ONE RULE: THE SERVER PRICES, THE CLIENT CHOOSES. A request names what it\n * wants (an item) and maybe a coupon CODE; it never names an amount. Every\n * amount here is the server's, in integer paise, GST included.\n *\n * TWO PATHS IN, ONE GRANT. A payment reaches the server from the browser the\n * moment checkout returns (`confirm`) and from the gateway's webhook. Either\n * grants; the second is a no-op. So a member who closes the tab is still\n * granted, and `confirm` failing never means \"not paid\": the web says\n * \"processing\" and polls the order.\n *\n * GST: the company is registered, every captured payment gets a tax invoice,\n * every refund a credit note. Where the buyer is decides the tax: in the\n * supplier's state CGST + SGST, elsewhere IGST. So checkout asks for the state.\n *\n * @module founder-schema/domains/billing\n */\n\nimport { z } from 'zod';\nimport {\n eachOnce,\n emptyStringToUndefined,\n objectIdSchema,\n paginationQuerySchema,\n} from '../../core/common.js';\nimport {\n BILLING_REASON_MAX,\n BILLING_REASON_MIN,\n COUPON_CODE_MAX,\n COUPON_CODE_MIN,\n COUPON_LABEL_MAX,\n COUPON_LABEL_MIN,\n COUPON_PERCENT_MAX,\n COUPON_PERCENT_MIN,\n COUPON_USES_MAX,\n INVOICE_NUMBER_MAX,\n RAZORPAY_ID_MAX,\n RAZORPAY_SIGNATURE_MAX,\n} from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { VALIDATION_MESSAGE } from '../../core/validation.js';\nimport {\n autoRenewalStatusSchema,\n paiseSchema,\n planPeriodSchema,\n planTierSchema,\n} from '../membership/membership.js';\nimport { personSchema } from '../people/person.js';\nimport { billingDetailsSchema, gstStateCodeSchema } from './gst.js';\nimport { paymentMethodSnapshotSchema } from './payment-method.js';\n\nexport {\n type BillingDetails,\n billingDetailsSchema,\n GST_RATE_PERCENT,\n GST_STATE_CODE_VALUES,\n GST_STATES,\n type GstStateCode,\n gstinChecksumValid,\n gstinSchema,\n gstStateCodeOf,\n gstStateCodeSchema,\n gstStateName,\n} from './gst.js';\n\n// ─── What can be bought ──────────────────────────────────────────────────────\n\n/** ⚠ Stored on every order: append only. */\nexport const PURCHASE_KIND_VALUES = ['membership', 'plan', 'upgrade'] as const;\nexport type PurchaseKind = (typeof PURCHASE_KIND_VALUES)[number];\n\n/**\n * The thing asked for.\n *\n * membership paid once (Rs 299 in the launch offer, 2026-12-06)\n * plan a month or a year of Premium or Business, appended\n * upgrade the Premium time left, turned into Business, for the difference\n */\nexport const purchaseItemSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('membership') }),\n z.object({ kind: z.literal('plan'), tier: planTierSchema, period: planPeriodSchema }),\n z.object({ kind: z.literal('upgrade') }),\n]);\nexport type PurchaseItem = z.infer<typeof purchaseItemSchema>;\n\n/** A coupon code as typed: letters, digits, hyphens; compared upper-case. */\nexport const couponCodeSchema = z\n .string()\n .trim()\n .min(COUPON_CODE_MIN)\n .max(COUPON_CODE_MAX)\n .regex(/^[A-Za-z0-9-]+$/, VALIDATION_MESSAGE.couponCodeInvalid)\n .transform((v) => v.toUpperCase());\n\n// ─── Quote ───────────────────────────────────────────────────────────────────\n\n/**\n * The tax inside a total. `taxable + cgst + sgst + igst = total`; either\n * CGST + SGST (buyer in the supplier's state) or IGST, never both.\n */\nexport const taxSplitSchema = z.object({\n ratePercent: z.number().int().positive(),\n taxable: paiseSchema,\n cgst: paiseSchema,\n sgst: paiseSchema,\n igst: paiseSchema,\n total: paiseSchema,\n});\nexport type TaxSplit = z.infer<typeof taxSplitSchema>;\n\n/**\n * `POST /billing/quote`. The state is optional: without it, no tax split.\n * `autoRenew` (0.31.0): price it as an auto-renewing plan, so the quote carries\n * the terms the member must see before authorising (`quote.autoRenew`).\n */\nexport const quoteBodySchema = z.object({\n item: purchaseItemSchema,\n couponCode: couponCodeSchema.optional(),\n stateCode: gstStateCodeSchema.optional(),\n autoRenew: z.boolean().optional(),\n});\nexport type QuoteBody = z.infer<typeof quoteBodySchema>;\n\n/** What a plan or an upgrade would do to the plan, priced now. */\nexport const planEffectSchema = z.object({\n tier: planTierSchema,\n /** When this purchase's time starts (later than now when it waits its turn). */\n startsAt: z.iso.datetime(),\n endsAt: z.iso.datetime(),\n /** For an upgrade: the days of Premium turned into Business. */\n upgradedDays: z.number().int().positive().nullable(),\n});\nexport type PlanEffect = z.infer<typeof planEffectSchema>;\n\n/** A coupon as a purchase carries it: its code and staff's name for it. */\nexport const appliedCouponSchema = z.object({ code: z.string(), label: z.string() });\nexport type AppliedCoupon = z.infer<typeof appliedCouponSchema>;\n\n/**\n * Why a captured payment was NOT applied (`grantFailed`), and so refunded\n * (0.18.0: the one list; the backend wrote two of these as loose strings and\n * the contract said `string`). Stored on the order: append only.\n *\n * AMOUNT_MISMATCH the gateway captured another amount than the price\n * ACCOUNT_DELETED paid after the account was deleted\n * COUPON_ALREADY_USED the code went to another of their orders, paid first\n * MEMBERSHIP_REQUIRED a plan, but the membership is gone (refunded, withdrawn)\n * ALREADY_MEMBER a membership, but they are a member already\n * PLAN_CHANGED an upgrade priced on a plan that has since changed\n * PLAN_NOTHING_TO_UPGRADE an upgrade with no Premium time left\n * PLAN_TERM_LIMIT past `PLAN_AHEAD_MAX_YEARS` of plan time\n * PLAN_UPGRADE_INSTEAD Business bought while on Premium (that is an upgrade)\n * AUTO_RENEW_STOPPED an auto-renewal's charge that landed after the\n * auto-renewal was stopped at once (a refund, the\n * membership ended, the account deleted) and the\n * gateway's cancel had not taken yet (0.31.0)\n * GRANT_REFUSED any other refusal of the grant: still recorded and\n * refunded, never left captured for nothing (the\n * server logs which one, to add it here)\n */\nexport const GRANT_FAILURE_VALUES = [\n 'AMOUNT_MISMATCH',\n 'ACCOUNT_DELETED',\n 'COUPON_ALREADY_USED',\n 'MEMBERSHIP_REQUIRED',\n 'ALREADY_MEMBER',\n 'PLAN_CHANGED',\n 'PLAN_NOTHING_TO_UPGRADE',\n 'PLAN_TERM_LIMIT',\n 'PLAN_UPGRADE_INSTEAD',\n 'GRANT_REFUSED',\n 'AUTO_RENEW_STOPPED',\n] as const;\nexport const grantFailureSchema = z.enum(GRANT_FAILURE_VALUES);\nexport type GrantFailure = z.infer<typeof grantFailureSchema>;\n\n/**\n * What an auto-renewing plan will charge (0.31.0), for the disclosure next to\n * Pay. India's 2023 dark-pattern guidelines: the member is told, before\n * authorising, that it renews, how much, how often and from when, and that it\n * can be turned off.\n *\n * chargesNow true: `amount` is taken now and buys the first period.\n * false: time of this tier is already held, so nothing is\n * taken now; the mandate is authorised and the first charge is\n * on `firstChargeAt`, when that time ends.\n * firstChargeAt now (chargesNow) or the end of the time held\n * nextChargeAt the charge after the first: one `period` later, India's calendar\n */\nexport const autoRenewTermsSchema = z.object({\n amount: paiseSchema,\n period: planPeriodSchema,\n chargesNow: z.boolean(),\n firstChargeAt: z.iso.datetime(),\n nextChargeAt: z.iso.datetime(),\n});\nexport type AutoRenewTerms = z.infer<typeof autoRenewTermsSchema>;\n\nexport const quoteSchema = z.object({\n item: purchaseItemSchema,\n /** \"Membership\", \"Premium, 1 month\", \"Upgrade to Business\": the server's words. */\n title: z.string(),\n listPrice: paiseSchema,\n discount: paiseSchema,\n /** What would be charged. Zero for a free-membership coupon: no checkout at all. */\n total: paiseSchema,\n coupon: appliedCouponSchema.nullable(),\n /** Null for a membership. */\n plan: planEffectSchema.nullable(),\n /** Null without a state. */\n tax: taxSplitSchema.nullable(),\n refundWindowDays: z.number().int().positive(),\n /**\n * The auto-renewing terms, when asked with `autoRenew: true` (0.31.0):\n *\n * a plan its own terms\n * an upgrade the BUSINESS terms it would continue as, only while a\n * Premium auto-renewal runs (not being turned off): its\n * period, first charge at the Business end (corrected\n * 2026-11-28; this said \"null for an upgrade\", and the web's\n * \"Keep auto-renew on, as Business\" needs these terms)\n *\n * Null otherwise: a coupon, the membership, auto-renew off on this server,\n * an upgrade with no Premium auto-renewal running. A PREVIEW: it ignores\n * whether another auto-renewal holds the slot, so \"Switch to Premium at\n * renewal\" can show its terms while Business still renews; only\n * `POST /billing/auto-renewals` (or the order) refuses on the slot.\n */\n autoRenew: autoRenewTermsSchema.nullable().default(null),\n});\nexport type Quote = z.infer<typeof quoteSchema>;\n\n// ─── Orders ──────────────────────────────────────────────────────────────────\n\n/**\n * Where an order stands. ⚠ Stored: append only.\n *\n * created checkout open, nothing paid yet\n * paid captured and granted; has an invoice\n * granted_free a free coupon: granted with no payment and no invoice\n * expired not paid within `ORDER_TTL_MINUTES`\n * refund_pending staff refunded it; the gateway is returning the money\n * refunded the money is back; has a credit note\n * refund_failed the gateway could not return it; staff act from its dashboard\n */\nexport const ORDER_STATUS_VALUES = [\n 'created',\n 'paid',\n 'granted_free',\n 'expired',\n 'refund_pending',\n 'refunded',\n 'refund_failed',\n] as const;\nexport const orderStatusSchema = z.enum(ORDER_STATUS_VALUES);\nexport type OrderStatus = z.infer<typeof orderStatusSchema>;\n\n/**\n * `POST /billing/orders`. Billing details are required for anything paid (the\n * invoice needs a place of supply): the server refuses a paid order without\n * them (`billing.stateCode`, VALIDATION_ERROR). A free coupon issues no\n * invoice, so it needs none (0.12.0).\n */\nexport const createOrderBodySchema = z.object({\n item: purchaseItemSchema,\n couponCode: couponCodeSchema.optional(),\n billing: billingDetailsSchema.optional(),\n /**\n * Buy the plan as an AUTO-RENEWAL (0.31.0): consent, said explicitly on the\n * wire (the web's switch is on by default, the user's ruling; the request\n * still says it). Only for `item.kind: 'plan'`, without a coupon, while the\n * catalog's `autoRenewEnabled`, for a term in its `autoRenewPeriods`:\n * otherwise `AUTO_RENEW_NOT_OFFERED`. The\n * answer is then `status: 'subscription'`.\n */\n autoRenew: z.boolean().optional(),\n});\nexport type CreateOrderBody = z.infer<typeof createOrderBodySchema>;\n\n/**\n * Either done (a free coupon granted at once) or a checkout to open. The\n * checkout fields are Razorpay Checkout's own options; identity (name, email,\n * phone) is the server's, never typed by the caller.\n */\nexport const createOrderResponseSchema = z.discriminatedUnion('status', [\n z.object({ status: z.literal('granted'), orderId: objectIdSchema }),\n z.object({\n status: z.literal('checkout'),\n orderId: objectIdSchema,\n expiresAt: z.iso.datetime(),\n checkout: z.object({\n keyId: z.string().min(1),\n razorpayOrderId: z.string().min(1),\n amount: paiseSchema,\n currency: z.literal('INR'),\n /** The merchant name on the dialog. */\n name: z.string(),\n /** What is being bought, under the name. */\n description: z.string(),\n prefill: z.object({\n name: z.string(),\n email: z.string(),\n contact: z.string().optional(),\n }),\n }),\n }),\n /**\n * An auto-renewal to authorise at Checkout (0.31.0): Razorpay Checkout is\n * opened with `subscription_id`, never `order_id` or an amount. `orderId` is\n * the first charge's order when one is taken now (`terms.chargesNow`): poll\n * it as any order. With nothing taken now it is null: poll the\n * auto-renewal instead. Its handler's answer goes to\n * `POST /billing/auto-renewals/:autoRenewalId/confirm`.\n */\n z.object({\n status: z.literal('subscription'),\n autoRenewalId: objectIdSchema,\n orderId: objectIdSchema.nullable(),\n /** Authorise before this, or it lapses (`expired`). */\n expiresAt: z.iso.datetime(),\n terms: autoRenewTermsSchema,\n checkout: z.object({\n keyId: z.string().min(1),\n razorpaySubscriptionId: z.string().min(1),\n name: z.string(),\n description: z.string(),\n prefill: z.object({\n name: z.string(),\n email: z.string(),\n contact: z.string().optional(),\n }),\n }),\n }),\n]);\nexport type CreateOrderResponse = z.infer<typeof createOrderResponseSchema>;\n\nexport const orderParamsSchema = z.object({ orderId: objectIdSchema });\nexport type OrderParams = z.infer<typeof orderParamsSchema>;\n\n/** What Razorpay Checkout's `handler` hands back, as it names it. */\nexport const confirmOrderBodySchema = z.object({\n razorpayOrderId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpayPaymentId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpaySignature: z.string().min(1).max(RAZORPAY_SIGNATURE_MAX),\n});\nexport type ConfirmOrderBody = z.infer<typeof confirmOrderBodySchema>;\n\n// ─── Auto-renewals (0.31.0) ──────────────────────────────────────────────────\n\nexport const autoRenewalParamsSchema = z.object({ autoRenewalId: objectIdSchema });\nexport type AutoRenewalParams = z.infer<typeof autoRenewalParamsSchema>;\n\n/**\n * `POST /billing/auto-renewals`: turn auto-renew ON for the plan time already\n * held (Me > Plans, after turning it off, after an upgrade). Nothing is taken\n * now; the first charge is when the time it follows ends (`terms.chargesNow`\n * false):\n *\n * the tier's own time held it starts when that tier's time ends\n * Premium while only Business is held (a DOWNGRADE, \"switch to Premium at\n * renewal\") it starts when the Business time ends\n *\n * Refused (`AUTO_RENEW_NOT_OFFERED`) with no plan time held (buy the plan with\n * `autoRenew` instead), for Business while only Premium is held (that is an\n * upgrade), while another auto-renewal holds the slot (one whose stop is\n * already requested does not), for a term not in the catalog's\n * `autoRenewPeriods`, or while auto-renew is off on this server.\n *\n * `billing`: the place of supply every renewal's invoice needs. Without it the\n * member's saved details are used; with neither, `VALIDATION_ERROR` on\n * `billing.stateCode`, as for an order.\n */\nexport const startAutoRenewalBodySchema = z.object({\n tier: planTierSchema,\n period: planPeriodSchema,\n billing: billingDetailsSchema.optional(),\n});\nexport type StartAutoRenewalBody = z.infer<typeof startAutoRenewalBodySchema>;\n\n/**\n * What Razorpay Checkout's `handler` hands back for a subscription, as it\n * names it. The server checks the signature over its OWN stored subscription\n * id, never the one sent here: HMAC_SHA256(razorpay_payment_id + \"|\" +\n * subscription_id, key secret).\n */\nexport const confirmAutoRenewalBodySchema = z.object({\n razorpaySubscriptionId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpayPaymentId: z.string().min(1).max(RAZORPAY_ID_MAX),\n razorpaySignature: z.string().min(1).max(RAZORPAY_SIGNATURE_MAX),\n});\nexport type ConfirmAutoRenewalBody = z.infer<typeof confirmAutoRenewalBodySchema>;\n\n/** An auto-renewal as its member polls or changes it. */\nexport const autoRenewalStateSchema = z.object({\n autoRenewalId: objectIdSchema,\n status: autoRenewalStatusSchema,\n tier: planTierSchema,\n period: planPeriodSchema,\n /** The first charge's order, when one was taken at authorisation: poll it for the grant. */\n orderId: objectIdSchema.nullable(),\n nextChargeAt: z.iso.datetime().nullable(),\n cancelAtCycleEnd: z.boolean(),\n});\nexport type AutoRenewalState = z.infer<typeof autoRenewalStateSchema>;\n\n/**\n * `POST /billing/auto-renewals/:id/payment-method`: how the member updates the\n * method a failed charge used. A card mandate opens Checkout to change the\n * card (`subscription_card_change`); any other opens Razorpay's own page,\n * where a UPI or eMandate can move to a card only (Razorpay's rule).\n */\nexport const paymentMethodUpdateSchema = z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('checkout'),\n keyId: z.string().min(1),\n razorpaySubscriptionId: z.string().min(1),\n name: z.string(),\n prefill: z.object({\n name: z.string(),\n email: z.string(),\n contact: z.string().optional(),\n }),\n }),\n z.object({ kind: z.literal('link'), url: z.url() }),\n]);\nexport type PaymentMethodUpdate = z.infer<typeof paymentMethodUpdateSchema>;\n\n/**\n * Where an order came from (0.31.0). ⚠ Stored: append only.\n *\n * checkout the member bought it (or a free code granted it)\n * renewal an auto-renewal's charge\n */\nexport const ORDER_SOURCE_VALUES = ['checkout', 'renewal'] as const;\nexport const orderSourceSchema = z.enum(ORDER_SOURCE_VALUES);\nexport type OrderSource = z.infer<typeof orderSourceSchema>;\n\n/** An order as its buyer polls it. */\nexport const orderStateSchema = z.object({\n orderId: objectIdSchema,\n item: purchaseItemSchema,\n status: orderStatusSchema,\n /**\n * The money was taken but what it bought could not be applied (bought\n * twice in two tabs, the plan changed while paying): it is refunded in\n * full, by itself. The client says so instead of \"done\".\n */\n notApplied: z.boolean(),\n});\nexport type OrderState = z.infer<typeof orderStateSchema>;\n\n// ─── Payments, invoices, credit notes ────────────────────────────────────────\n\n/** A party on an invoice. The supplier always has a GSTIN on a real invoice; a buyer, only on B2B. */\nexport const invoicePartySchema = z.object({\n name: z.string(),\n address: z.string().nullable(),\n gstin: z.string().nullable(),\n stateCode: gstStateCodeSchema,\n stateName: z.string(),\n});\nexport type InvoiceParty = z.infer<typeof invoicePartySchema>;\n\n/** B2B with the buyer's GSTIN, B2C without (0.18.0: the values, for the backend's model). */\nexport const INVOICE_KIND_VALUES = ['b2b', 'b2c'] as const;\nexport const invoiceKindSchema = z.enum(INVOICE_KIND_VALUES);\nexport type InvoiceKind = z.infer<typeof invoiceKindSchema>;\n\n/** A tax invoice, frozen when the payment was captured. */\nexport const invoiceSchema = z.object({\n /** e.g. `FC/26-27/000123`: sequential within a financial year, at most `INVOICE_NUMBER_MAX`. */\n number: z.string().max(INVOICE_NUMBER_MAX),\n issuedAt: z.iso.datetime(),\n /**\n * Issued where the supplier's GSTIN is not configured (dev, Razorpay test\n * mode): marked \"TEST: not a tax invoice\". Never true in production.\n */\n test: z.boolean(),\n supplier: invoicePartySchema,\n buyer: invoicePartySchema,\n kind: invoiceKindSchema,\n /** The service's accounting code (SAC). */\n sac: z.string(),\n description: z.string(),\n tax: taxSplitSchema,\n /** Always false: these services are never under reverse charge. */\n reverseCharge: z.literal(false),\n razorpayPaymentId: z.string(),\n});\nexport type Invoice = z.infer<typeof invoiceSchema>;\n\n/** A refund's credit note, against its invoice. */\nexport const creditNoteSchema = z.object({\n /** e.g. `FCCN/26-27/00012`: the invoice series + `CN`, sequential within a financial year. */\n number: z.string().max(INVOICE_NUMBER_MAX),\n issuedAt: z.iso.datetime(),\n invoiceNumber: z.string().max(INVOICE_NUMBER_MAX),\n tax: taxSplitSchema,\n});\nexport type CreditNote = z.infer<typeof creditNoteSchema>;\n\n/** One purchase in a member's history. Only settled orders are listed, never an abandoned checkout. */\nexport const paymentSummarySchema = z.object({\n id: objectIdSchema,\n item: purchaseItemSchema,\n title: z.string(),\n total: paiseSchema,\n status: orderStatusSchema,\n /** When it was captured, or granted for a free coupon. */\n paidAt: z.iso.datetime(),\n invoiceNumber: z.string().nullable(),\n /** Until when a refund may be asked for; null once refunded or for a free coupon. */\n refundableUntil: z.iso.datetime().nullable(),\n /** A purchase or an auto-renewal's charge (0.31.0): the history says \"Renewal\". */\n source: orderSourceSchema.default('checkout'),\n /** How it was paid (0.31.0); null for a free coupon and for payments from before 0.31.0. */\n method: paymentMethodSnapshotSchema.nullable().default(null),\n});\nexport type PaymentSummary = z.infer<typeof paymentSummarySchema>;\n\nexport const paymentPageSchema = paginatedSchema(paymentSummarySchema);\nexport type PaymentPage = z.infer<typeof paymentPageSchema>;\n\nexport const paymentDetailSchema = paymentSummarySchema.extend({\n listPrice: paiseSchema,\n discount: paiseSchema,\n coupon: appliedCouponSchema.nullable(),\n invoice: invoiceSchema.nullable(),\n creditNote: creditNoteSchema.nullable(),\n refundedAt: z.iso.datetime().nullable(),\n});\nexport type PaymentDetail = z.infer<typeof paymentDetailSchema>;\n\n// ─── Staff: payments and refunds ─────────────────────────────────────────────\n\n/** Who paid, as they are now, so staff can find them. Email only for a role that may read it. */\nexport const payerSchema = personSchema.extend({\n email: z.string().nullable(),\n});\nexport type Payer = z.infer<typeof payerSchema>;\n\nexport const staffPaymentsQuerySchema = paginationQuerySchema.extend({\n status: orderStatusSchema.optional(),\n memberId: objectIdSchema.optional(),\n /** Only the ones a person must act on (`needsAction` below). */\n needsAction: z.preprocess(emptyStringToUndefined, z.stringbool().default(false)),\n});\nexport type StaffPaymentsQuery = z.infer<typeof staffPaymentsQuerySchema>;\nexport type StaffPaymentsQueryInput = z.input<typeof staffPaymentsQuerySchema>;\n\nexport const staffPaymentSummarySchema = paymentSummarySchema.extend({\n payer: payerSchema,\n /**\n * A person must act (0.12.0): taken but not applied and not yet refunded\n * (the automatic refund did not go through), a refund that failed at the\n * gateway, or an open chargeback.\n */\n needsAction: z.boolean(),\n});\nexport type StaffPaymentSummary = z.infer<typeof staffPaymentSummarySchema>;\nexport const staffPaymentPageSchema = paginatedSchema(staffPaymentSummarySchema);\nexport type StaffPaymentPage = z.infer<typeof staffPaymentPageSchema>;\n\nexport const staffPaymentDetailSchema = paymentDetailSchema.extend({\n payer: payerSchema,\n razorpay: z.object({\n orderId: z.string().nullable(),\n paymentId: z.string().nullable(),\n refundId: z.string().nullable(),\n /** The auto-renewal's subscription, for a renewal charge (0.31.0). */\n subscriptionId: z.string().nullable().default(null),\n }),\n /** Why staff refunded it, on record. */\n refundReason: z.string().nullable(),\n /**\n * The money was taken but what it bought could not be applied when it was\n * captured (they were a member already, the Premium time to upgrade had\n * run out, past the 3-year cap): refund it. Null when it applied. One of\n * `GRANT_FAILURE_VALUES` (0.18.0; a plain string before).\n */\n grantFailed: grantFailureSchema.nullable(),\n /** A chargeback was opened on it (cleared when it is won or closed). */\n disputedAt: z.iso.datetime().nullable(),\n /**\n * What refunds made outside Founder Circle (the Razorpay dashboard) have\n * already given back of this payment. A Refund here gives back the rest:\n * `total` less this. 0 when there were none.\n */\n refundedOutside: paiseSchema,\n /**\n * Payments captured on this order other than the one that settled it (a\n * late authorisation, a second Checkout attempt): each is refunded by\n * itself; `refunded: false` means that refund has not gone through yet and\n * the payment needs a person.\n */\n strayPayments: z.array(\n z.object({\n paymentId: z.string(),\n amount: paiseSchema,\n refunded: z.boolean(),\n at: z.iso.datetime(),\n }),\n ),\n /**\n * When the payer asked for a refund (0.13.0): their first \"Payments and\n * refunds\" ticket opened inside the refund window. An ask in time keeps the\n * payment refundable after the window ends. Null when they did not ask in\n * time, or it is not a paid payment.\n */\n refundAskedAt: z.iso.datetime().nullable(),\n viewer: z.object({\n /**\n * Paid, within the window (or asked for within it), not their own, and\n * the asker may refund.\n */\n canRefund: z.boolean(),\n }),\n});\nexport type StaffPaymentDetail = z.infer<typeof staffPaymentDetailSchema>;\n\nconst reasonSchema = z.string().trim().min(BILLING_REASON_MIN).max(BILLING_REASON_MAX);\n\n/** `POST /staff/payments/:orderId/refund`. The reason is on the audit record. */\nexport const refundPaymentBodySchema = z.object({ reason: reasonSchema });\nexport type RefundPaymentBody = z.infer<typeof refundPaymentBodySchema>;\n\n/**\n * `PUT /members/:memberId/membership`: grant (a partner, a press account) or\n * revoke (a fake or duplicate account holding a founding place). A paid one\n * is never revoked: refund its payment.\n */\nexport const setMembershipBodySchema = z.object({\n granted: z.boolean(),\n reason: reasonSchema,\n});\nexport type SetMembershipBody = z.infer<typeof setMembershipBodySchema>;\n\n// ─── Staff: coupons ──────────────────────────────────────────────────────────\n\n/** What a coupon is good for. A percent coupon names what it applies to. */\nexport const COUPON_TARGET_VALUES = ['membership', 'premium', 'business'] as const;\nexport const couponTargetSchema = z.enum(COUPON_TARGET_VALUES);\nexport type CouponTarget = z.infer<typeof couponTargetSchema>;\n\n/**\n * ⚠ Stored: append only.\n *\n * free_membership the membership at Rs 0; `founding` numbers its holders\n * (\"Founding member #N\"). ⚠ A NEW founding coupon is refused\n * (0.14.0, COUPON_FOUNDING_RETIRED): founding places come\n * from the launch waitlist alone. The field stays, because\n * stored coupons carry it.\n * percent_off a share off the listed price of what it applies to\n */\nexport const COUPON_KIND_VALUES = ['free_membership', 'percent_off'] as const;\nexport type CouponKind = (typeof COUPON_KIND_VALUES)[number];\n\nexport const couponBenefitSchema = z.discriminatedUnion('kind', [\n z.object({ kind: z.literal('free_membership'), founding: z.boolean() }),\n z.object({\n kind: z.literal('percent_off'),\n percent: z.number().int().min(COUPON_PERCENT_MIN).max(COUPON_PERCENT_MAX),\n appliesTo: z\n .array(couponTargetSchema)\n .min(1)\n .max(COUPON_TARGET_VALUES.length)\n .refine(eachOnce, {\n error: VALIDATION_MESSAGE.couponTargetsDuplicate,\n }),\n }),\n]);\nexport type CouponBenefit = z.infer<typeof couponBenefitSchema>;\n\nexport const couponSchema = z.object({\n id: objectIdSchema,\n code: z.string(),\n label: z.string(),\n benefit: couponBenefitSchema,\n /** Redemptions allowed in all; null is no cap. */\n max: z.number().int().positive().nullable(),\n /** Redemptions in force (a revoked founding place frees one). */\n used: z.number().int().nonnegative(),\n active: z.boolean(),\n validFrom: z.iso.datetime().nullable(),\n validUntil: z.iso.datetime().nullable(),\n createdAt: z.iso.datetime(),\n});\nexport type Coupon = z.infer<typeof couponSchema>;\n\n/** Never paged: coupons are few. Newest first. */\nexport const couponListSchema = z.object({ items: z.array(couponSchema) });\nexport type CouponList = z.infer<typeof couponListSchema>;\n\nexport const couponParamsSchema = z.object({ couponId: objectIdSchema });\nexport type CouponParams = z.infer<typeof couponParamsSchema>;\n\nconst windowValid = (body: { validFrom?: string | null; validUntil?: string | null }) =>\n !body.validFrom || !body.validUntil || Date.parse(body.validFrom) < Date.parse(body.validUntil);\n\nexport const createCouponBodySchema = z\n .object({\n code: couponCodeSchema,\n label: z.string().trim().min(COUPON_LABEL_MIN).max(COUPON_LABEL_MAX),\n benefit: couponBenefitSchema,\n max: z.number().int().positive().max(COUPON_USES_MAX).nullable(),\n validFrom: z.iso.datetime().nullable().optional(),\n validUntil: z.iso.datetime().nullable().optional(),\n })\n .refine(windowValid, { path: ['validUntil'], error: VALIDATION_MESSAGE.couponWindowInvalid });\nexport type CreateCouponBody = z.infer<typeof createCouponBodySchema>;\n\n/**\n * What may change on a live coupon. The code and the benefit never change: a\n * redemption is a record of what a code gave when it was used.\n */\nexport const updateCouponBodySchema = z\n .object({\n label: z.string().trim().min(COUPON_LABEL_MIN).max(COUPON_LABEL_MAX).optional(),\n active: z.boolean().optional(),\n max: z.number().int().positive().max(COUPON_USES_MAX).nullable().optional(),\n validFrom: z.iso.datetime().nullable().optional(),\n validUntil: z.iso.datetime().nullable().optional(),\n })\n .refine(windowValid, { path: ['validUntil'], error: VALIDATION_MESSAGE.couponWindowInvalid });\nexport type UpdateCouponBody = z.infer<typeof updateCouponBodySchema>;\n"]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* founder-schema: unfinished sign-ups, for staff (2026-12-06)
|
|
3
|
+
*
|
|
4
|
+
* GET /api/v1/members/signups ?q&limit&cursor signupPageSchema
|
|
5
|
+
*
|
|
6
|
+
* The people who started signing up and have not finished, newest change
|
|
7
|
+
* first, so staff can call someone who stopped at the payment (the user:
|
|
8
|
+
* "the manager, the super admin, and then the support agent and other
|
|
9
|
+
* platform roles should be able to see the users' details"). Every platform
|
|
10
|
+
* role reads it (`read Signup`), a member never.
|
|
11
|
+
*
|
|
12
|
+
* DATA KEPT TO WHAT A CALL NEEDS (DPDP): the name and the phone they typed
|
|
13
|
+
* into sign-up, the account's email, how far they got and whether they paid.
|
|
14
|
+
* Never their date of birth, gender or any other answer. Every page read is
|
|
15
|
+
* audited (`signups.viewed`: who looked and how many rows, never the search).
|
|
16
|
+
*
|
|
17
|
+
* SEARCH (`q`): anything with an `@` is a whole email address, matched
|
|
18
|
+
* exactly; digits are matched inside the phone as typed (spaces and dashes
|
|
19
|
+
* ignored); anything else is the start of any word of the name, in any case.
|
|
20
|
+
* Pageable, search or not.
|
|
21
|
+
*
|
|
22
|
+
* A deleted account is never listed; a suspended one is.
|
|
23
|
+
*
|
|
24
|
+
* @module founder-schema/domains/members/signups
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
/** The list's query. An emptied search box is "no search", not an error. */
|
|
28
|
+
export declare const signupListQuerySchema: z.ZodObject<{
|
|
29
|
+
limit: z.ZodPreprocess<z.ZodDefault<z.ZodCoercedNumber<unknown>>, unknown>;
|
|
30
|
+
cursor: z.ZodPreprocess<z.ZodOptional<z.ZodString>, unknown>;
|
|
31
|
+
q: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string | undefined, string>>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type SignupListQuery = z.infer<typeof signupListQuerySchema>;
|
|
34
|
+
export type SignupListQueryInput = z.input<typeof signupListQuerySchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Where their membership purchase stands, from their membership orders:
|
|
37
|
+
*
|
|
38
|
+
* none never started one
|
|
39
|
+
* open a checkout still open (they may be paying right now)
|
|
40
|
+
* failed a checkout that ended unpaid (it expired)
|
|
41
|
+
* paid one paid (or a free coupon), and not refunded
|
|
42
|
+
* refunded the last one was refunded, or is being, and none is paid
|
|
43
|
+
*/
|
|
44
|
+
export declare const SIGNUP_PAYMENT_VALUES: readonly ["none", "open", "failed", "paid", "refunded"];
|
|
45
|
+
export declare const signupPaymentSchema: z.ZodEnum<{
|
|
46
|
+
paid: "paid";
|
|
47
|
+
refunded: "refunded";
|
|
48
|
+
none: "none";
|
|
49
|
+
open: "open";
|
|
50
|
+
failed: "failed";
|
|
51
|
+
}>;
|
|
52
|
+
export type SignupPayment = z.infer<typeof signupPaymentSchema>;
|
|
53
|
+
/** One unfinished sign-up. */
|
|
54
|
+
export declare const signupRowSchema: z.ZodObject<{
|
|
55
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
56
|
+
userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
57
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
58
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
59
|
+
email: z.ZodString;
|
|
60
|
+
step: z.ZodEnum<{
|
|
61
|
+
location: "location";
|
|
62
|
+
business: "business";
|
|
63
|
+
membership: "membership";
|
|
64
|
+
goals: "goals";
|
|
65
|
+
basics: "basics";
|
|
66
|
+
interests: "interests";
|
|
67
|
+
photo: "photo";
|
|
68
|
+
guidelines: "guidelines";
|
|
69
|
+
}>;
|
|
70
|
+
needsMembership: z.ZodBoolean;
|
|
71
|
+
payment: z.ZodEnum<{
|
|
72
|
+
paid: "paid";
|
|
73
|
+
refunded: "refunded";
|
|
74
|
+
none: "none";
|
|
75
|
+
open: "open";
|
|
76
|
+
failed: "failed";
|
|
77
|
+
}>;
|
|
78
|
+
startedAt: z.ZodISODateTime;
|
|
79
|
+
lastChangedAt: z.ZodISODateTime;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type SignupRow = z.infer<typeof signupRowSchema>;
|
|
82
|
+
export declare const signupPageSchema: z.ZodObject<{
|
|
83
|
+
items: z.ZodArray<z.ZodObject<{
|
|
84
|
+
id: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
85
|
+
userId: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
86
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
87
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
88
|
+
email: z.ZodString;
|
|
89
|
+
step: z.ZodEnum<{
|
|
90
|
+
location: "location";
|
|
91
|
+
business: "business";
|
|
92
|
+
membership: "membership";
|
|
93
|
+
goals: "goals";
|
|
94
|
+
basics: "basics";
|
|
95
|
+
interests: "interests";
|
|
96
|
+
photo: "photo";
|
|
97
|
+
guidelines: "guidelines";
|
|
98
|
+
}>;
|
|
99
|
+
needsMembership: z.ZodBoolean;
|
|
100
|
+
payment: z.ZodEnum<{
|
|
101
|
+
paid: "paid";
|
|
102
|
+
refunded: "refunded";
|
|
103
|
+
none: "none";
|
|
104
|
+
open: "open";
|
|
105
|
+
failed: "failed";
|
|
106
|
+
}>;
|
|
107
|
+
startedAt: z.ZodISODateTime;
|
|
108
|
+
lastChangedAt: z.ZodISODateTime;
|
|
109
|
+
}, z.core.$strip>>;
|
|
110
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export type SignupPage = z.infer<typeof signupPageSchema>;
|
|
113
|
+
//# sourceMappingURL=signups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signups.d.ts","sourceRoot":"","sources":["../../../src/domains/members/signups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB;;;;iBAEhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,yDAA0D,CAAC;AAC7F,eAAO,MAAM,mBAAmB;;;;;;EAAgC,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,8BAA8B;AAC9B,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoB1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAmC,CAAC;AACjE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* founder-schema: unfinished sign-ups, for staff (2026-12-06)
|
|
3
|
+
*
|
|
4
|
+
* GET /api/v1/members/signups ?q&limit&cursor signupPageSchema
|
|
5
|
+
*
|
|
6
|
+
* The people who started signing up and have not finished, newest change
|
|
7
|
+
* first, so staff can call someone who stopped at the payment (the user:
|
|
8
|
+
* "the manager, the super admin, and then the support agent and other
|
|
9
|
+
* platform roles should be able to see the users' details"). Every platform
|
|
10
|
+
* role reads it (`read Signup`), a member never.
|
|
11
|
+
*
|
|
12
|
+
* DATA KEPT TO WHAT A CALL NEEDS (DPDP): the name and the phone they typed
|
|
13
|
+
* into sign-up, the account's email, how far they got and whether they paid.
|
|
14
|
+
* Never their date of birth, gender or any other answer. Every page read is
|
|
15
|
+
* audited (`signups.viewed`: who looked and how many rows, never the search).
|
|
16
|
+
*
|
|
17
|
+
* SEARCH (`q`): anything with an `@` is a whole email address, matched
|
|
18
|
+
* exactly; digits are matched inside the phone as typed (spaces and dashes
|
|
19
|
+
* ignored); anything else is the start of any word of the name, in any case.
|
|
20
|
+
* Pageable, search or not.
|
|
21
|
+
*
|
|
22
|
+
* A deleted account is never listed; a suspended one is.
|
|
23
|
+
*
|
|
24
|
+
* @module founder-schema/domains/members/signups
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
import { objectIdSchema, optionalTrimmedString, paginationQuerySchema } from '../../core/common.js';
|
|
28
|
+
import { MEMBER_SEARCH_MAX } from '../../core/limits.js';
|
|
29
|
+
import { paginatedSchema } from '../../core/responses.js';
|
|
30
|
+
import { ONBOARDING_STEP_KEYS } from '../onboarding/onboarding.js';
|
|
31
|
+
/** The list's query. An emptied search box is "no search", not an error. */
|
|
32
|
+
export const signupListQuerySchema = paginationQuerySchema.extend({
|
|
33
|
+
q: optionalTrimmedString(MEMBER_SEARCH_MAX),
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Where their membership purchase stands, from their membership orders:
|
|
37
|
+
*
|
|
38
|
+
* none never started one
|
|
39
|
+
* open a checkout still open (they may be paying right now)
|
|
40
|
+
* failed a checkout that ended unpaid (it expired)
|
|
41
|
+
* paid one paid (or a free coupon), and not refunded
|
|
42
|
+
* refunded the last one was refunded, or is being, and none is paid
|
|
43
|
+
*/
|
|
44
|
+
export const SIGNUP_PAYMENT_VALUES = ['none', 'open', 'failed', 'paid', 'refunded'];
|
|
45
|
+
export const signupPaymentSchema = z.enum(SIGNUP_PAYMENT_VALUES);
|
|
46
|
+
/** One unfinished sign-up. */
|
|
47
|
+
export const signupRowSchema = z.object({
|
|
48
|
+
/** The sign-up's own id (its progress row). */
|
|
49
|
+
id: objectIdSchema,
|
|
50
|
+
/** The account's id. */
|
|
51
|
+
userId: objectIdSchema,
|
|
52
|
+
/** As typed into the basics; null when not saved yet. */
|
|
53
|
+
fullName: z.string().nullable(),
|
|
54
|
+
/** As typed into the basics (spaces and all); null when not saved yet. */
|
|
55
|
+
phone: z.string().nullable(),
|
|
56
|
+
/** The account's email (the sign-in's own). */
|
|
57
|
+
email: z.string(),
|
|
58
|
+
/** The FURTHEST step reached, in today's list (an older cursor translated by name). */
|
|
59
|
+
step: z.enum(ONBOARDING_STEP_KEYS),
|
|
60
|
+
/** Whether they must still buy the membership to go on (the paid step). */
|
|
61
|
+
needsMembership: z.boolean(),
|
|
62
|
+
payment: signupPaymentSchema,
|
|
63
|
+
/** When they started signing up. */
|
|
64
|
+
startedAt: z.iso.datetime(),
|
|
65
|
+
/** When they last saved an answer: the list's order, newest first. */
|
|
66
|
+
lastChangedAt: z.iso.datetime(),
|
|
67
|
+
});
|
|
68
|
+
export const signupPageSchema = paginatedSchema(signupRowSchema);
|
|
69
|
+
//# sourceMappingURL=signups.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signups.js","sourceRoot":"","sources":["../../../src/domains/members/signups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,MAAM,CAAC;IAChE,CAAC,EAAE,qBAAqB,CAAC,iBAAiB,CAAC;CAC5C,CAAC,CAAC;AAIH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;AAC7F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAGjE,8BAA8B;AAC9B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,+CAA+C;IAC/C,EAAE,EAAE,cAAc;IAClB,wBAAwB;IACxB,MAAM,EAAE,cAAc;IACtB,yDAAyD;IACzD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,+CAA+C;IAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,uFAAuF;IACvF,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC;IAClC,2EAA2E;IAC3E,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,OAAO,EAAE,mBAAmB;IAC5B,oCAAoC;IACpC,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC3B,sEAAsE;IACtE,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC","sourcesContent":["/**\n * founder-schema: unfinished sign-ups, for staff (2026-12-06)\n *\n * GET /api/v1/members/signups ?q&limit&cursor signupPageSchema\n *\n * The people who started signing up and have not finished, newest change\n * first, so staff can call someone who stopped at the payment (the user:\n * \"the manager, the super admin, and then the support agent and other\n * platform roles should be able to see the users' details\"). Every platform\n * role reads it (`read Signup`), a member never.\n *\n * DATA KEPT TO WHAT A CALL NEEDS (DPDP): the name and the phone they typed\n * into sign-up, the account's email, how far they got and whether they paid.\n * Never their date of birth, gender or any other answer. Every page read is\n * audited (`signups.viewed`: who looked and how many rows, never the search).\n *\n * SEARCH (`q`): anything with an `@` is a whole email address, matched\n * exactly; digits are matched inside the phone as typed (spaces and dashes\n * ignored); anything else is the start of any word of the name, in any case.\n * Pageable, search or not.\n *\n * A deleted account is never listed; a suspended one is.\n *\n * @module founder-schema/domains/members/signups\n */\n\nimport { z } from 'zod';\nimport { objectIdSchema, optionalTrimmedString, paginationQuerySchema } from '../../core/common.js';\nimport { MEMBER_SEARCH_MAX } from '../../core/limits.js';\nimport { paginatedSchema } from '../../core/responses.js';\nimport { ONBOARDING_STEP_KEYS } from '../onboarding/onboarding.js';\n\n/** The list's query. An emptied search box is \"no search\", not an error. */\nexport const signupListQuerySchema = paginationQuerySchema.extend({\n q: optionalTrimmedString(MEMBER_SEARCH_MAX),\n});\nexport type SignupListQuery = z.infer<typeof signupListQuerySchema>;\nexport type SignupListQueryInput = z.input<typeof signupListQuerySchema>;\n\n/**\n * Where their membership purchase stands, from their membership orders:\n *\n * none never started one\n * open a checkout still open (they may be paying right now)\n * failed a checkout that ended unpaid (it expired)\n * paid one paid (or a free coupon), and not refunded\n * refunded the last one was refunded, or is being, and none is paid\n */\nexport const SIGNUP_PAYMENT_VALUES = ['none', 'open', 'failed', 'paid', 'refunded'] as const;\nexport const signupPaymentSchema = z.enum(SIGNUP_PAYMENT_VALUES);\nexport type SignupPayment = z.infer<typeof signupPaymentSchema>;\n\n/** One unfinished sign-up. */\nexport const signupRowSchema = z.object({\n /** The sign-up's own id (its progress row). */\n id: objectIdSchema,\n /** The account's id. */\n userId: objectIdSchema,\n /** As typed into the basics; null when not saved yet. */\n fullName: z.string().nullable(),\n /** As typed into the basics (spaces and all); null when not saved yet. */\n phone: z.string().nullable(),\n /** The account's email (the sign-in's own). */\n email: z.string(),\n /** The FURTHEST step reached, in today's list (an older cursor translated by name). */\n step: z.enum(ONBOARDING_STEP_KEYS),\n /** Whether they must still buy the membership to go on (the paid step). */\n needsMembership: z.boolean(),\n payment: signupPaymentSchema,\n /** When they started signing up. */\n startedAt: z.iso.datetime(),\n /** When they last saved an answer: the list's order, newest first. */\n lastChangedAt: z.iso.datetime(),\n});\nexport type SignupRow = z.infer<typeof signupRowSchema>;\n\nexport const signupPageSchema = paginatedSchema(signupRowSchema);\nexport type SignupPage = z.infer<typeof signupPageSchema>;\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* GET /api/v1/me/membership meMembershipSchema (signed in: what I hold, what I have used)
|
|
6
6
|
*
|
|
7
7
|
* THE USER'S RULING (2026-10-11): looking is free; taking part needs a
|
|
8
|
-
* MEMBERSHIP,
|
|
8
|
+
* MEMBERSHIP, once, for life (`MEMBERSHIP_PRICE_PAISE`; the first 100 free). On top,
|
|
9
9
|
* two PLANS: Premium (5 live products, 15 new people a month to message) and
|
|
10
10
|
* Business (unlimited products, 50 new people). Prices and plan contents come
|
|
11
11
|
* from the server, so a change needs no client release.
|
|
@@ -29,7 +29,7 @@ import { z } from 'zod';
|
|
|
29
29
|
* the user's rule of 2026-10-16). Before that, the founding
|
|
30
30
|
* coupon (`FIRST100`), which no longer exists on main.
|
|
31
31
|
* coupon another free-membership coupon
|
|
32
|
-
* paid
|
|
32
|
+
* paid the membership price, captured
|
|
33
33
|
* granted staff gave it (a partner, a press account), with a reason on record
|
|
34
34
|
* early_bird free for life, because the account was created before
|
|
35
35
|
* `EARLY_BIRD_UNTIL` (0.21.0, the user's launch offer of 2026-11-14:
|
|
@@ -75,13 +75,27 @@ export declare const planTierSchema: z.ZodEnum<{
|
|
|
75
75
|
export type PlanTier = z.infer<typeof planTierSchema>;
|
|
76
76
|
/** Which tier outranks which: Business above Premium. */
|
|
77
77
|
export declare const PLAN_TIER_RANK: Readonly<Record<PlanTier, number>>;
|
|
78
|
-
/**
|
|
79
|
-
|
|
78
|
+
/**
|
|
79
|
+
* One payment buys 1, 3, 6 or 12 calendar months (four terms: the user,
|
|
80
|
+
* 2026-11-30; a month or a year before). ⚠ Stored: append only, which is why the
|
|
81
|
+
* order here is not the length's: `PLAN_PERIODS_SHORTEST_FIRST` is.
|
|
82
|
+
*/
|
|
83
|
+
export declare const PLAN_PERIOD_VALUES: readonly ["month", "year", "quarter", "half_year"];
|
|
80
84
|
export declare const planPeriodSchema: z.ZodEnum<{
|
|
81
85
|
month: "month";
|
|
82
86
|
year: "year";
|
|
87
|
+
quarter: "quarter";
|
|
88
|
+
half_year: "half_year";
|
|
83
89
|
}>;
|
|
84
90
|
export type PlanPeriod = z.infer<typeof planPeriodSchema>;
|
|
91
|
+
/**
|
|
92
|
+
* How many calendar months each is: the ONE place a period becomes a number.
|
|
93
|
+
* Exhaustive by type, so a term added without its length does not compile.
|
|
94
|
+
* Never `period === 'year' ? 12 : 1`: that grants one month for any new term.
|
|
95
|
+
*/
|
|
96
|
+
export declare const PLAN_PERIOD_MONTHS: Readonly<Record<PlanPeriod, number>>;
|
|
97
|
+
/** The terms as every screen lists them. */
|
|
98
|
+
export declare const PLAN_PERIODS_SHORTEST_FIRST: readonly PlanPeriod[];
|
|
85
99
|
/** Integer paise, never negative. Rs 399 is 39900. */
|
|
86
100
|
export declare const paiseSchema: z.ZodNumber;
|
|
87
101
|
export type Paise = z.infer<typeof paiseSchema>;
|
|
@@ -136,8 +150,29 @@ export declare const planFeaturesSchema: z.ZodObject<{
|
|
|
136
150
|
}, z.core.$strip>;
|
|
137
151
|
}, z.core.$strip>;
|
|
138
152
|
export type PlanFeatures = z.infer<typeof planFeaturesSchema>;
|
|
139
|
-
/**
|
|
140
|
-
|
|
153
|
+
/**
|
|
154
|
+
* The membership: once, for life. Its FULL price (the user, 2026-12-06): Rs 2,999,
|
|
155
|
+
* charged from the end of the launch offer below. Before 2026-12-06: Rs 99.
|
|
156
|
+
*/
|
|
157
|
+
export declare const MEMBERSHIP_PRICE_PAISE = 299900;
|
|
158
|
+
/**
|
|
159
|
+
* The launch offer (the user, 2026-12-06): Rs 299 until `endsAt`, with the full
|
|
160
|
+
* price shown struck through and the end date said beside it. The end is REAL:
|
|
161
|
+
* from that instant the full price is charged, by itself (`membershipPriceAt`):
|
|
162
|
+
* a struck price never charged and a "limited time" that never ends would mislead
|
|
163
|
+
* (Consumer Protection Act 2019; CCPA dark-pattern guidelines 2023, "false
|
|
164
|
+
* urgency"). Moving the end is a schema release, and the Terms move with it.
|
|
165
|
+
*/
|
|
166
|
+
export declare const MEMBERSHIP_LAUNCH_OFFER: {
|
|
167
|
+
readonly pricePaise: 29900;
|
|
168
|
+
/** The first instant at the FULL price: 1 January 2027, 00:00 India time. */
|
|
169
|
+
readonly endsAt: "2027-01-01T00:00:00+05:30";
|
|
170
|
+
readonly label: "Launch offer";
|
|
171
|
+
};
|
|
172
|
+
/** Whether the launch offer still runs at `now`. */
|
|
173
|
+
export declare function membershipOfferRuns(now?: Date): boolean;
|
|
174
|
+
/** What the membership costs at `now`, in paise: the offer while it runs, else the full price. */
|
|
175
|
+
export declare function membershipPriceAt(now?: Date): number;
|
|
141
176
|
/** What a member with no plan may: 1 live product, no conversations with people they do not know. */
|
|
142
177
|
export declare const MEMBER_LIMIT_VALUES: PlanLimits;
|
|
143
178
|
/**
|
|
@@ -155,14 +190,20 @@ export declare const PLAN_SPECS: Readonly<Record<PlanTier, {
|
|
|
155
190
|
/** The number of days a member (no plan) is told "N people viewed your profile" over. */
|
|
156
191
|
export declare const MEMBER_PROFILE_VIEW_COUNT_DAYS = 30;
|
|
157
192
|
/**
|
|
158
|
-
* A
|
|
159
|
-
*
|
|
160
|
-
*
|
|
193
|
+
* A term later on India's calendar (`count` of them), the day clamped to the
|
|
194
|
+
* month's last: 31 January plus a month is 28 or 29 February. India has one
|
|
195
|
+
* offset all year, so its calendar is UTC's, shifted.
|
|
161
196
|
*/
|
|
162
197
|
export declare function addPlanPeriod(from: Date, period: PlanPeriod, count?: number): Date;
|
|
163
|
-
/**
|
|
198
|
+
/**
|
|
199
|
+
* What an upgrade costs for each whole term of Premium left: what that term
|
|
200
|
+
* costs on Business less what it costs on Premium, at today's prices. The one
|
|
201
|
+
* source of every upgrade price, and of the Terms' sentence.
|
|
202
|
+
*/
|
|
203
|
+
export declare const UPGRADE_PER: Readonly<Record<PlanPeriod, number>>;
|
|
204
|
+
/** ...each whole calendar year of it. */
|
|
164
205
|
export declare const UPGRADE_PER_YEAR: number;
|
|
165
|
-
/** ...
|
|
206
|
+
/** ...each whole calendar month of it (a 31-day month and February alike). */
|
|
166
207
|
export declare const UPGRADE_PER_MONTH: number;
|
|
167
208
|
/** The days left over are charged as this many to a month. */
|
|
168
209
|
export declare const UPGRADE_DAYS_PER_MONTH = 30;
|
|
@@ -170,11 +211,11 @@ export declare const UPGRADE_DAYS_PER_MONTH = 30;
|
|
|
170
211
|
export declare const UPGRADE_PER_DAY: number;
|
|
171
212
|
/**
|
|
172
213
|
* What an upgrade of `convertedMs` of Premium, from `now`, costs in paise (the
|
|
173
|
-
* user: "ask for the rest of the money, the difference")
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
214
|
+
* user: "ask for the rest of the money, the difference"): `upgradeCover` of its
|
|
215
|
+
* whole calendar months and the days left over. A part day counts as a day;
|
|
216
|
+
* rounded up to the rupee. What each part was BOUGHT at is not read, and not
|
|
217
|
+
* stored: refunds, stacking and Business put in front move time, and "today's
|
|
218
|
+
* prices for the time left" is one sentence a member can check.
|
|
178
219
|
*/
|
|
179
220
|
export declare function upgradePrice(convertedMs: number, now: Date): number;
|
|
180
221
|
/**
|
|
@@ -213,6 +254,8 @@ export declare const planOfferSchema: z.ZodObject<{
|
|
|
213
254
|
name: z.ZodString;
|
|
214
255
|
prices: z.ZodObject<{
|
|
215
256
|
month: z.ZodNumber;
|
|
257
|
+
quarter: z.ZodNumber;
|
|
258
|
+
half_year: z.ZodNumber;
|
|
216
259
|
year: z.ZodNumber;
|
|
217
260
|
}, z.core.$strip>;
|
|
218
261
|
limits: z.ZodObject<{
|
|
@@ -239,6 +282,9 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
239
282
|
currency: z.ZodLiteral<"INR">;
|
|
240
283
|
membership: z.ZodObject<{
|
|
241
284
|
price: z.ZodNumber;
|
|
285
|
+
listPrice: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
286
|
+
offer: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
287
|
+
offerEndsAt: z.ZodDefault<z.ZodNullable<z.ZodISODateTime>>;
|
|
242
288
|
limits: z.ZodObject<{
|
|
243
289
|
productsLive: z.ZodNullable<z.ZodNumber>;
|
|
244
290
|
newPeoplePerMonth: z.ZodNumber;
|
|
@@ -266,6 +312,8 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
266
312
|
name: z.ZodString;
|
|
267
313
|
prices: z.ZodObject<{
|
|
268
314
|
month: z.ZodNumber;
|
|
315
|
+
quarter: z.ZodNumber;
|
|
316
|
+
half_year: z.ZodNumber;
|
|
269
317
|
year: z.ZodNumber;
|
|
270
318
|
}, z.core.$strip>;
|
|
271
319
|
limits: z.ZodObject<{
|
|
@@ -291,6 +339,12 @@ export declare const planCatalogSchema: z.ZodObject<{
|
|
|
291
339
|
paymentsEnabled: z.ZodBoolean;
|
|
292
340
|
paymentsLiveAt: z.ZodDefault<z.ZodNullable<z.ZodISODateTime>>;
|
|
293
341
|
autoRenewEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
342
|
+
autoRenewPeriods: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
343
|
+
month: "month";
|
|
344
|
+
year: "year";
|
|
345
|
+
quarter: "quarter";
|
|
346
|
+
half_year: "half_year";
|
|
347
|
+
}>>>;
|
|
294
348
|
}, z.core.$strip>;
|
|
295
349
|
export type PlanCatalog = z.infer<typeof planCatalogSchema>;
|
|
296
350
|
/**
|
|
@@ -348,6 +402,8 @@ export declare const autoRenewalSchema: z.ZodObject<{
|
|
|
348
402
|
period: z.ZodEnum<{
|
|
349
403
|
month: "month";
|
|
350
404
|
year: "year";
|
|
405
|
+
quarter: "quarter";
|
|
406
|
+
half_year: "half_year";
|
|
351
407
|
}>;
|
|
352
408
|
amount: z.ZodNumber;
|
|
353
409
|
nextChargeAt: z.ZodNullable<z.ZodISODateTime>;
|
|
@@ -561,6 +617,8 @@ export declare const meMembershipSchema: z.ZodObject<{
|
|
|
561
617
|
period: z.ZodEnum<{
|
|
562
618
|
month: "month";
|
|
563
619
|
year: "year";
|
|
620
|
+
quarter: "quarter";
|
|
621
|
+
half_year: "half_year";
|
|
564
622
|
}>;
|
|
565
623
|
amount: z.ZodNumber;
|
|
566
624
|
nextChargeAt: z.ZodNullable<z.ZodISODateTime>;
|