founder-schema 0.29.0 → 0.31.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/core/errors.d.ts +5 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +13 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/limits.d.ts +17 -0
- package/dist/core/limits.d.ts.map +1 -1
- package/dist/core/limits.js +17 -0
- package/dist/core/limits.js.map +1 -1
- package/dist/core/responses.d.ts +4 -0
- package/dist/core/responses.d.ts.map +1 -1
- package/dist/domains/billing/billing.d.ts +373 -11
- package/dist/domains/billing/billing.d.ts.map +1 -1
- package/dist/domains/billing/billing.js +168 -2
- package/dist/domains/billing/billing.js.map +1 -1
- package/dist/domains/billing/emails.d.ts +171 -0
- package/dist/domains/billing/emails.d.ts.map +1 -0
- package/dist/domains/billing/emails.js +121 -0
- package/dist/domains/billing/emails.js.map +1 -0
- package/dist/domains/billing/payment-method.d.ts +63 -0
- package/dist/domains/billing/payment-method.d.ts.map +1 -0
- package/dist/domains/billing/payment-method.js +57 -0
- package/dist/domains/billing/payment-method.js.map +1 -0
- package/dist/domains/feed/feed.d.ts +3 -1
- package/dist/domains/feed/feed.d.ts.map +1 -1
- package/dist/domains/feed/feed.js +2 -0
- package/dist/domains/feed/feed.js.map +1 -1
- package/dist/domains/membership/membership.d.ts +127 -0
- package/dist/domains/membership/membership.d.ts.map +1 -1
- package/dist/domains/membership/membership.js +87 -0
- package/dist/domains/membership/membership.js.map +1 -1
- package/dist/domains/moderation/moderation.d.ts +4 -0
- package/dist/domains/moderation/moderation.d.ts.map +1 -1
- package/dist/domains/moderation/moderation.js +1 -0
- package/dist/domains/moderation/moderation.js.map +1 -1
- package/dist/domains/notifications/notifications.d.ts +50 -2
- package/dist/domains/notifications/notifications.d.ts.map +1 -1
- package/dist/domains/notifications/notifications.js +42 -3
- package/dist/domains/notifications/notifications.js.map +1 -1
- package/dist/domains/products/product-comments.d.ts +144 -0
- package/dist/domains/products/product-comments.d.ts.map +1 -0
- package/dist/domains/products/product-comments.js +77 -0
- package/dist/domains/products/product-comments.js.map +1 -0
- package/dist/domains/products/products.d.ts +289 -0
- package/dist/domains/products/products.d.ts.map +1 -1
- package/dist/domains/products/products.js +17 -0
- package/dist/domains/products/products.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -17,6 +17,14 @@
|
|
|
17
17
|
* PATCH /api/v1/staff/coupons/:couponId updateCouponBodySchema -> couponSchema
|
|
18
18
|
* PUT /api/v1/members/:memberId/membership setMembershipBodySchema -> memberDetailSchema
|
|
19
19
|
*
|
|
20
|
+
* Auto-renewal (0.31.0, payments v2; founder-circle-backend docs/payments-v2-plan.md 3a):
|
|
21
|
+
* POST /api/v1/billing/auto-renewals startAutoRenewalBodySchema -> createOrderResponseSchema ('subscription')
|
|
22
|
+
* GET /api/v1/billing/auto-renewals/:autoRenewalId autoRenewalStateSchema (polled after authorising)
|
|
23
|
+
* POST /api/v1/billing/auto-renewals/:autoRenewalId/confirm confirmAutoRenewalBodySchema -> autoRenewalStateSchema
|
|
24
|
+
* POST /api/v1/billing/auto-renewals/:autoRenewalId/cancel -> autoRenewalStateSchema (off at the period's end)
|
|
25
|
+
* POST /api/v1/billing/auto-renewals/:autoRenewalId/payment-method -> paymentMethodUpdateSchema
|
|
26
|
+
* (a plan bought with `autoRenew: true` on POST /billing/orders answers 'subscription' too)
|
|
27
|
+
*
|
|
20
28
|
* THE ONE RULE: THE SERVER PRICES, THE CLIENT CHOOSES. A request names what it
|
|
21
29
|
* wants (an item) and maybe a coupon CODE; it never names an amount. Every
|
|
22
30
|
* amount here is the server's, in integer paise, GST included.
|
|
@@ -38,9 +46,10 @@ import { eachOnce, emptyStringToUndefined, objectIdSchema, paginationQuerySchema
|
|
|
38
46
|
import { BILLING_REASON_MAX, BILLING_REASON_MIN, COUPON_CODE_MAX, COUPON_CODE_MIN, COUPON_LABEL_MAX, COUPON_LABEL_MIN, COUPON_PERCENT_MAX, COUPON_PERCENT_MIN, COUPON_USES_MAX, INVOICE_NUMBER_MAX, RAZORPAY_ID_MAX, RAZORPAY_SIGNATURE_MAX, } from '../../core/limits.js';
|
|
39
47
|
import { paginatedSchema } from '../../core/responses.js';
|
|
40
48
|
import { VALIDATION_MESSAGE } from '../../core/validation.js';
|
|
41
|
-
import { paiseSchema, planPeriodSchema, planTierSchema } from '../membership/membership.js';
|
|
49
|
+
import { autoRenewalStatusSchema, paiseSchema, planPeriodSchema, planTierSchema, } from '../membership/membership.js';
|
|
42
50
|
import { personSchema } from '../people/person.js';
|
|
43
51
|
import { billingDetailsSchema, gstStateCodeSchema } from './gst.js';
|
|
52
|
+
import { paymentMethodSnapshotSchema } from './payment-method.js';
|
|
44
53
|
export { billingDetailsSchema, GST_RATE_PERCENT, GST_STATE_CODE_VALUES, GST_STATES, gstinChecksumValid, gstinSchema, gstStateCodeSchema, gstStateName, } from './gst.js';
|
|
45
54
|
// ─── What can be bought ──────────────────────────────────────────────────────
|
|
46
55
|
/** ⚠ Stored on every order: append only. */
|
|
@@ -78,11 +87,16 @@ export const taxSplitSchema = z.object({
|
|
|
78
87
|
igst: paiseSchema,
|
|
79
88
|
total: paiseSchema,
|
|
80
89
|
});
|
|
81
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* `POST /billing/quote`. The state is optional: without it, no tax split.
|
|
92
|
+
* `autoRenew` (0.31.0): price it as an auto-renewing plan, so the quote carries
|
|
93
|
+
* the terms the member must see before authorising (`quote.autoRenew`).
|
|
94
|
+
*/
|
|
82
95
|
export const quoteBodySchema = z.object({
|
|
83
96
|
item: purchaseItemSchema,
|
|
84
97
|
couponCode: couponCodeSchema.optional(),
|
|
85
98
|
stateCode: gstStateCodeSchema.optional(),
|
|
99
|
+
autoRenew: z.boolean().optional(),
|
|
86
100
|
});
|
|
87
101
|
/** What a plan or an upgrade would do to the plan, priced now. */
|
|
88
102
|
export const planEffectSchema = z.object({
|
|
@@ -109,6 +123,10 @@ export const appliedCouponSchema = z.object({ code: z.string(), label: z.string(
|
|
|
109
123
|
* PLAN_NOTHING_TO_UPGRADE an upgrade with no Premium time left
|
|
110
124
|
* PLAN_TERM_LIMIT past `PLAN_AHEAD_MAX_YEARS` of plan time
|
|
111
125
|
* PLAN_UPGRADE_INSTEAD Business bought while on Premium (that is an upgrade)
|
|
126
|
+
* AUTO_RENEW_STOPPED an auto-renewal's charge that landed after the
|
|
127
|
+
* auto-renewal was stopped at once (a refund, the
|
|
128
|
+
* membership ended, the account deleted) and the
|
|
129
|
+
* gateway's cancel had not taken yet (0.31.0)
|
|
112
130
|
* GRANT_REFUSED any other refusal of the grant: still recorded and
|
|
113
131
|
* refunded, never left captured for nothing (the
|
|
114
132
|
* server logs which one, to add it here)
|
|
@@ -124,8 +142,29 @@ export const GRANT_FAILURE_VALUES = [
|
|
|
124
142
|
'PLAN_TERM_LIMIT',
|
|
125
143
|
'PLAN_UPGRADE_INSTEAD',
|
|
126
144
|
'GRANT_REFUSED',
|
|
145
|
+
'AUTO_RENEW_STOPPED',
|
|
127
146
|
];
|
|
128
147
|
export const grantFailureSchema = z.enum(GRANT_FAILURE_VALUES);
|
|
148
|
+
/**
|
|
149
|
+
* What an auto-renewing plan will charge (0.31.0), for the disclosure next to
|
|
150
|
+
* Pay. India's 2023 dark-pattern guidelines: the member is told, before
|
|
151
|
+
* authorising, that it renews, how much, how often and from when, and that it
|
|
152
|
+
* can be turned off.
|
|
153
|
+
*
|
|
154
|
+
* chargesNow true: `amount` is taken now and buys the first period.
|
|
155
|
+
* false: time of this tier is already held, so nothing is
|
|
156
|
+
* taken now; the mandate is authorised and the first charge is
|
|
157
|
+
* on `firstChargeAt`, when that time ends.
|
|
158
|
+
* firstChargeAt now (chargesNow) or the end of the time held
|
|
159
|
+
* nextChargeAt the charge after the first: one `period` later, India's calendar
|
|
160
|
+
*/
|
|
161
|
+
export const autoRenewTermsSchema = z.object({
|
|
162
|
+
amount: paiseSchema,
|
|
163
|
+
period: planPeriodSchema,
|
|
164
|
+
chargesNow: z.boolean(),
|
|
165
|
+
firstChargeAt: z.iso.datetime(),
|
|
166
|
+
nextChargeAt: z.iso.datetime(),
|
|
167
|
+
});
|
|
129
168
|
export const quoteSchema = z.object({
|
|
130
169
|
item: purchaseItemSchema,
|
|
131
170
|
/** "Membership", "Premium, 1 month", "Upgrade to Business": the server's words. */
|
|
@@ -140,6 +179,16 @@ export const quoteSchema = z.object({
|
|
|
140
179
|
/** Null without a state. */
|
|
141
180
|
tax: taxSplitSchema.nullable(),
|
|
142
181
|
refundWindowDays: z.number().int().positive(),
|
|
182
|
+
/**
|
|
183
|
+
* The auto-renewing terms, when asked with `autoRenew: true` for a plan
|
|
184
|
+
* (0.31.0); null otherwise, and whenever auto-renew is not offered for this
|
|
185
|
+
* item (a coupon, an upgrade, the membership, auto-renew off on this
|
|
186
|
+
* server). A PREVIEW: it ignores whether another auto-renewal holds the
|
|
187
|
+
* slot, so "Switch to Premium at renewal" can show its terms while Business
|
|
188
|
+
* still renews; only `POST /billing/auto-renewals` (or the order) refuses on
|
|
189
|
+
* the slot.
|
|
190
|
+
*/
|
|
191
|
+
autoRenew: autoRenewTermsSchema.nullable().default(null),
|
|
143
192
|
});
|
|
144
193
|
// ─── Orders ──────────────────────────────────────────────────────────────────
|
|
145
194
|
/**
|
|
@@ -173,6 +222,14 @@ export const createOrderBodySchema = z.object({
|
|
|
173
222
|
item: purchaseItemSchema,
|
|
174
223
|
couponCode: couponCodeSchema.optional(),
|
|
175
224
|
billing: billingDetailsSchema.optional(),
|
|
225
|
+
/**
|
|
226
|
+
* Buy the plan as an AUTO-RENEWAL (0.31.0): consent, said explicitly on the
|
|
227
|
+
* wire (the web's switch is on by default, the user's ruling; the request
|
|
228
|
+
* still says it). Only for `item.kind: 'plan'`, without a coupon, while the
|
|
229
|
+
* catalog's `autoRenewEnabled`: otherwise `AUTO_RENEW_NOT_OFFERED`. The
|
|
230
|
+
* answer is then `status: 'subscription'`.
|
|
231
|
+
*/
|
|
232
|
+
autoRenew: z.boolean().optional(),
|
|
176
233
|
});
|
|
177
234
|
/**
|
|
178
235
|
* Either done (a free coupon granted at once) or a checkout to open. The
|
|
@@ -201,6 +258,33 @@ export const createOrderResponseSchema = z.discriminatedUnion('status', [
|
|
|
201
258
|
}),
|
|
202
259
|
}),
|
|
203
260
|
}),
|
|
261
|
+
/**
|
|
262
|
+
* An auto-renewal to authorise at Checkout (0.31.0): Razorpay Checkout is
|
|
263
|
+
* opened with `subscription_id`, never `order_id` or an amount. `orderId` is
|
|
264
|
+
* the first charge's order when one is taken now (`terms.chargesNow`): poll
|
|
265
|
+
* it as any order. With nothing taken now it is null: poll the
|
|
266
|
+
* auto-renewal instead. Its handler's answer goes to
|
|
267
|
+
* `POST /billing/auto-renewals/:autoRenewalId/confirm`.
|
|
268
|
+
*/
|
|
269
|
+
z.object({
|
|
270
|
+
status: z.literal('subscription'),
|
|
271
|
+
autoRenewalId: objectIdSchema,
|
|
272
|
+
orderId: objectIdSchema.nullable(),
|
|
273
|
+
/** Authorise before this, or it lapses (`expired`). */
|
|
274
|
+
expiresAt: z.iso.datetime(),
|
|
275
|
+
terms: autoRenewTermsSchema,
|
|
276
|
+
checkout: z.object({
|
|
277
|
+
keyId: z.string().min(1),
|
|
278
|
+
razorpaySubscriptionId: z.string().min(1),
|
|
279
|
+
name: z.string(),
|
|
280
|
+
description: z.string(),
|
|
281
|
+
prefill: z.object({
|
|
282
|
+
name: z.string(),
|
|
283
|
+
email: z.string(),
|
|
284
|
+
contact: z.string().optional(),
|
|
285
|
+
}),
|
|
286
|
+
}),
|
|
287
|
+
}),
|
|
204
288
|
]);
|
|
205
289
|
export const orderParamsSchema = z.object({ orderId: objectIdSchema });
|
|
206
290
|
/** What Razorpay Checkout's `handler` hands back, as it names it. */
|
|
@@ -209,6 +293,82 @@ export const confirmOrderBodySchema = z.object({
|
|
|
209
293
|
razorpayPaymentId: z.string().min(1).max(RAZORPAY_ID_MAX),
|
|
210
294
|
razorpaySignature: z.string().min(1).max(RAZORPAY_SIGNATURE_MAX),
|
|
211
295
|
});
|
|
296
|
+
// ─── Auto-renewals (0.31.0) ──────────────────────────────────────────────────
|
|
297
|
+
export const autoRenewalParamsSchema = z.object({ autoRenewalId: objectIdSchema });
|
|
298
|
+
/**
|
|
299
|
+
* `POST /billing/auto-renewals`: turn auto-renew ON for the plan time already
|
|
300
|
+
* held (Me > Plans, after turning it off, after an upgrade). Nothing is taken
|
|
301
|
+
* now; the first charge is when the time it follows ends (`terms.chargesNow`
|
|
302
|
+
* false):
|
|
303
|
+
*
|
|
304
|
+
* the tier's own time held it starts when that tier's time ends
|
|
305
|
+
* Premium while only Business is held (a DOWNGRADE, "switch to Premium at
|
|
306
|
+
* renewal") it starts when the Business time ends
|
|
307
|
+
*
|
|
308
|
+
* Refused (`AUTO_RENEW_NOT_OFFERED`) with no plan time held (buy the plan with
|
|
309
|
+
* `autoRenew` instead), for Business while only Premium is held (that is an
|
|
310
|
+
* upgrade), while another auto-renewal holds the slot (one whose stop is
|
|
311
|
+
* already requested does not), or while auto-renew is off on this server.
|
|
312
|
+
*
|
|
313
|
+
* `billing`: the place of supply every renewal's invoice needs. Without it the
|
|
314
|
+
* member's saved details are used; with neither, `VALIDATION_ERROR` on
|
|
315
|
+
* `billing.stateCode`, as for an order.
|
|
316
|
+
*/
|
|
317
|
+
export const startAutoRenewalBodySchema = z.object({
|
|
318
|
+
tier: planTierSchema,
|
|
319
|
+
period: planPeriodSchema,
|
|
320
|
+
billing: billingDetailsSchema.optional(),
|
|
321
|
+
});
|
|
322
|
+
/**
|
|
323
|
+
* What Razorpay Checkout's `handler` hands back for a subscription, as it
|
|
324
|
+
* names it. The server checks the signature over its OWN stored subscription
|
|
325
|
+
* id, never the one sent here: HMAC_SHA256(razorpay_payment_id + "|" +
|
|
326
|
+
* subscription_id, key secret).
|
|
327
|
+
*/
|
|
328
|
+
export const confirmAutoRenewalBodySchema = z.object({
|
|
329
|
+
razorpaySubscriptionId: z.string().min(1).max(RAZORPAY_ID_MAX),
|
|
330
|
+
razorpayPaymentId: z.string().min(1).max(RAZORPAY_ID_MAX),
|
|
331
|
+
razorpaySignature: z.string().min(1).max(RAZORPAY_SIGNATURE_MAX),
|
|
332
|
+
});
|
|
333
|
+
/** An auto-renewal as its member polls or changes it. */
|
|
334
|
+
export const autoRenewalStateSchema = z.object({
|
|
335
|
+
autoRenewalId: objectIdSchema,
|
|
336
|
+
status: autoRenewalStatusSchema,
|
|
337
|
+
tier: planTierSchema,
|
|
338
|
+
period: planPeriodSchema,
|
|
339
|
+
/** The first charge's order, when one was taken at authorisation: poll it for the grant. */
|
|
340
|
+
orderId: objectIdSchema.nullable(),
|
|
341
|
+
nextChargeAt: z.iso.datetime().nullable(),
|
|
342
|
+
cancelAtCycleEnd: z.boolean(),
|
|
343
|
+
});
|
|
344
|
+
/**
|
|
345
|
+
* `POST /billing/auto-renewals/:id/payment-method`: how the member updates the
|
|
346
|
+
* method a failed charge used. A card mandate opens Checkout to change the
|
|
347
|
+
* card (`subscription_card_change`); any other opens Razorpay's own page,
|
|
348
|
+
* where a UPI or eMandate can move to a card only (Razorpay's rule).
|
|
349
|
+
*/
|
|
350
|
+
export const paymentMethodUpdateSchema = z.discriminatedUnion('kind', [
|
|
351
|
+
z.object({
|
|
352
|
+
kind: z.literal('checkout'),
|
|
353
|
+
keyId: z.string().min(1),
|
|
354
|
+
razorpaySubscriptionId: z.string().min(1),
|
|
355
|
+
name: z.string(),
|
|
356
|
+
prefill: z.object({
|
|
357
|
+
name: z.string(),
|
|
358
|
+
email: z.string(),
|
|
359
|
+
contact: z.string().optional(),
|
|
360
|
+
}),
|
|
361
|
+
}),
|
|
362
|
+
z.object({ kind: z.literal('link'), url: z.url() }),
|
|
363
|
+
]);
|
|
364
|
+
/**
|
|
365
|
+
* Where an order came from (0.31.0). ⚠ Stored: append only.
|
|
366
|
+
*
|
|
367
|
+
* checkout the member bought it (or a free code granted it)
|
|
368
|
+
* renewal an auto-renewal's charge
|
|
369
|
+
*/
|
|
370
|
+
export const ORDER_SOURCE_VALUES = ['checkout', 'renewal'];
|
|
371
|
+
export const orderSourceSchema = z.enum(ORDER_SOURCE_VALUES);
|
|
212
372
|
/** An order as its buyer polls it. */
|
|
213
373
|
export const orderStateSchema = z.object({
|
|
214
374
|
orderId: objectIdSchema,
|
|
@@ -274,6 +434,10 @@ export const paymentSummarySchema = z.object({
|
|
|
274
434
|
invoiceNumber: z.string().nullable(),
|
|
275
435
|
/** Until when a refund may be asked for; null once refunded or for a free coupon. */
|
|
276
436
|
refundableUntil: z.iso.datetime().nullable(),
|
|
437
|
+
/** A purchase or an auto-renewal's charge (0.31.0): the history says "Renewal". */
|
|
438
|
+
source: orderSourceSchema.default('checkout'),
|
|
439
|
+
/** How it was paid (0.31.0); null for a free coupon and for payments from before 0.31.0. */
|
|
440
|
+
method: paymentMethodSnapshotSchema.nullable().default(null),
|
|
277
441
|
});
|
|
278
442
|
export const paymentPageSchema = paginatedSchema(paymentSummarySchema);
|
|
279
443
|
export const paymentDetailSchema = paymentSummarySchema.extend({
|
|
@@ -311,6 +475,8 @@ export const staffPaymentDetailSchema = paymentDetailSchema.extend({
|
|
|
311
475
|
orderId: z.string().nullable(),
|
|
312
476
|
paymentId: z.string().nullable(),
|
|
313
477
|
refundId: z.string().nullable(),
|
|
478
|
+
/** The auto-renewal's subscription, for a renewal charge (0.31.0). */
|
|
479
|
+
subscriptionId: z.string().nullable().default(null),
|
|
314
480
|
}),
|
|
315
481
|
/** Why staff refunded it, on record. */
|
|
316
482
|
refundReason: z.string().nullable(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../src/domains/billing/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,CAAC,EAAE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AC,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 * 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 { paiseSchema, planPeriodSchema, planTierSchema } from '../membership/membership.js';\nimport { personSchema } from '../people/person.js';\nimport { billingDetailsSchema, gstStateCodeSchema } from './gst.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 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/** `POST /billing/quote`. The state is optional: without it, no tax split. */\nexport const quoteBodySchema = z.object({\n item: purchaseItemSchema,\n couponCode: couponCodeSchema.optional(),\n stateCode: gstStateCodeSchema.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 * 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] as const;\nexport const grantFailureSchema = z.enum(GRANT_FAILURE_VALUES);\nexport type GrantFailure = z.infer<typeof grantFailureSchema>;\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});\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});\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]);\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/** 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});\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 }),\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/bill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AE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,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 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` for a plan\n * (0.31.0); null otherwise, and whenever auto-renew is not offered for this\n * item (a coupon, an upgrade, the membership, auto-renew off on this\n * server). A PREVIEW: it ignores whether another auto-renewal holds the\n * slot, so \"Switch to Premium at renewal\" can show its terms while Business\n * still renews; only `POST /billing/auto-renewals` (or the order) refuses on\n * 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"]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Founder Circle's payment emails (0.31.0, payments v2; founder-circle-backend
|
|
3
|
+
* docs/payments-v2-plan.md R13).
|
|
4
|
+
*
|
|
5
|
+
* THE CONTRACT BETWEEN TWO REPOS. The FC backend sends these through the central
|
|
6
|
+
* async-service, which renders a template of the SAME name with the SAME data
|
|
7
|
+
* keys. One list here, so the backend's sends (krish) and the templates (ram)
|
|
8
|
+
* cannot drift. They are FC's own: the shared `payment-success` and
|
|
9
|
+
* `refund-processed` carry another product's words and links (dating copy, a
|
|
10
|
+
* `/find-partner/me` button that is a 404 on Founder Circle), and Jansathi
|
|
11
|
+
* uses them in production, so they stay as they are.
|
|
12
|
+
*
|
|
13
|
+
* Every value is ready to print: the server formats the money ("Rs 999"), the
|
|
14
|
+
* dates (India's calendar, "27 Nov 2026") and the absolute links: every
|
|
15
|
+
* `paymentsUrl` is `${APP_BASE_URL}/me/payments`, every `plansUrl` is
|
|
16
|
+
* `${APP_BASE_URL}/me?tab=upgrade` (Me > Plans, where auto-renew is turned off
|
|
17
|
+
* and the payment method updated). `daysLeft` is a number and some keys may be
|
|
18
|
+
* null, as each schema says. A template
|
|
19
|
+
* computes nothing and holds no Founder Circle URL of its own. Transactional
|
|
20
|
+
* mail: no unsubscribe link, and nothing a member's settings could switch off.
|
|
21
|
+
*
|
|
22
|
+
* @module domains/billing/emails
|
|
23
|
+
*/
|
|
24
|
+
import { z } from 'zod';
|
|
25
|
+
/** The receipt, for a purchase or an auto-renewal's first charge. Links to the invoice. */
|
|
26
|
+
export declare const fcPaymentReceivedEmailSchema: z.ZodObject<{
|
|
27
|
+
firstName: z.ZodString;
|
|
28
|
+
title: z.ZodString;
|
|
29
|
+
amountText: z.ZodString;
|
|
30
|
+
invoiceNumber: z.ZodNullable<z.ZodString>;
|
|
31
|
+
paidOn: z.ZodString;
|
|
32
|
+
refundableUntil: z.ZodString;
|
|
33
|
+
paymentsUrl: z.ZodURL;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
/** A refund went through. */
|
|
36
|
+
export declare const fcRefundProcessedEmailSchema: z.ZodObject<{
|
|
37
|
+
firstName: z.ZodString;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
amountText: z.ZodString;
|
|
40
|
+
creditNoteNumber: z.ZodNullable<z.ZodString>;
|
|
41
|
+
paymentsUrl: z.ZodURL;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
/** A PREPAID plan ends in 7 days, then in 1 day: renew with a tap. */
|
|
44
|
+
export declare const fcPlanEndsSoonEmailSchema: z.ZodObject<{
|
|
45
|
+
firstName: z.ZodString;
|
|
46
|
+
planName: z.ZodString;
|
|
47
|
+
endsOn: z.ZodString;
|
|
48
|
+
daysLeft: z.ZodNumber;
|
|
49
|
+
plansUrl: z.ZodURL;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
/** A YEARLY auto-renewal charges in 7 days; turn it off before then to stop it. */
|
|
52
|
+
export declare const fcPlanRenewsSoonEmailSchema: z.ZodObject<{
|
|
53
|
+
firstName: z.ZodString;
|
|
54
|
+
planName: z.ZodString;
|
|
55
|
+
amountText: z.ZodString;
|
|
56
|
+
renewsOn: z.ZodString;
|
|
57
|
+
plansUrl: z.ZodURL;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
/** An auto-renewal charged: the plan runs on. Links to the invoice. */
|
|
60
|
+
export declare const fcRenewalDoneEmailSchema: z.ZodObject<{
|
|
61
|
+
firstName: z.ZodString;
|
|
62
|
+
planName: z.ZodString;
|
|
63
|
+
amountText: z.ZodString;
|
|
64
|
+
invoiceNumber: z.ZodNullable<z.ZodString>;
|
|
65
|
+
runsUntil: z.ZodString;
|
|
66
|
+
nextChargeOn: z.ZodNullable<z.ZodString>;
|
|
67
|
+
paymentsUrl: z.ZodURL;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
/** An auto-renewal's charge failed; the gateway retries for 3 days. Update the method. */
|
|
70
|
+
export declare const fcRenewalFailedEmailSchema: z.ZodObject<{
|
|
71
|
+
firstName: z.ZodString;
|
|
72
|
+
planName: z.ZodString;
|
|
73
|
+
amountText: z.ZodString;
|
|
74
|
+
endsOn: z.ZodString;
|
|
75
|
+
plansUrl: z.ZodURL;
|
|
76
|
+
}, z.core.$strip>;
|
|
77
|
+
/**
|
|
78
|
+
* Why an auto-renewal stopped (the email's wording):
|
|
79
|
+
*
|
|
80
|
+
* payment_failed every retry failed
|
|
81
|
+
* refunded a refund of its charge ended it
|
|
82
|
+
* membership_ended the membership was refunded or withdrawn
|
|
83
|
+
* turned_off the member turned it off (a confirmation)
|
|
84
|
+
*/
|
|
85
|
+
export declare const AUTO_RENEW_STOP_REASON_VALUES: readonly ["payment_failed", "refunded", "membership_ended", "turned_off"];
|
|
86
|
+
export declare const autoRenewStopReasonSchema: z.ZodEnum<{
|
|
87
|
+
refunded: "refunded";
|
|
88
|
+
payment_failed: "payment_failed";
|
|
89
|
+
membership_ended: "membership_ended";
|
|
90
|
+
turned_off: "turned_off";
|
|
91
|
+
}>;
|
|
92
|
+
export type AutoRenewStopReason = z.infer<typeof autoRenewStopReasonSchema>;
|
|
93
|
+
/** An auto-renewal stopped; the time already paid runs to `endsOn`. */
|
|
94
|
+
export declare const fcAutoRenewStoppedEmailSchema: z.ZodObject<{
|
|
95
|
+
firstName: z.ZodString;
|
|
96
|
+
planName: z.ZodString;
|
|
97
|
+
endsOn: z.ZodNullable<z.ZodString>;
|
|
98
|
+
reason: z.ZodEnum<{
|
|
99
|
+
refunded: "refunded";
|
|
100
|
+
payment_failed: "payment_failed";
|
|
101
|
+
membership_ended: "membership_ended";
|
|
102
|
+
turned_off: "turned_off";
|
|
103
|
+
}>;
|
|
104
|
+
plansUrl: z.ZodURL;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
/** Every FC payment email, by its async-service template name. Exhaustive by type. */
|
|
107
|
+
export declare const FC_EMAIL_DATA_SCHEMAS: {
|
|
108
|
+
readonly 'fc-payment-received': z.ZodObject<{
|
|
109
|
+
firstName: z.ZodString;
|
|
110
|
+
title: z.ZodString;
|
|
111
|
+
amountText: z.ZodString;
|
|
112
|
+
invoiceNumber: z.ZodNullable<z.ZodString>;
|
|
113
|
+
paidOn: z.ZodString;
|
|
114
|
+
refundableUntil: z.ZodString;
|
|
115
|
+
paymentsUrl: z.ZodURL;
|
|
116
|
+
}, z.core.$strip>;
|
|
117
|
+
readonly 'fc-refund-processed': z.ZodObject<{
|
|
118
|
+
firstName: z.ZodString;
|
|
119
|
+
title: z.ZodString;
|
|
120
|
+
amountText: z.ZodString;
|
|
121
|
+
creditNoteNumber: z.ZodNullable<z.ZodString>;
|
|
122
|
+
paymentsUrl: z.ZodURL;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
readonly 'fc-plan-ends-soon': z.ZodObject<{
|
|
125
|
+
firstName: z.ZodString;
|
|
126
|
+
planName: z.ZodString;
|
|
127
|
+
endsOn: z.ZodString;
|
|
128
|
+
daysLeft: z.ZodNumber;
|
|
129
|
+
plansUrl: z.ZodURL;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
readonly 'fc-plan-renews-soon': z.ZodObject<{
|
|
132
|
+
firstName: z.ZodString;
|
|
133
|
+
planName: z.ZodString;
|
|
134
|
+
amountText: z.ZodString;
|
|
135
|
+
renewsOn: z.ZodString;
|
|
136
|
+
plansUrl: z.ZodURL;
|
|
137
|
+
}, z.core.$strip>;
|
|
138
|
+
readonly 'fc-renewal-done': z.ZodObject<{
|
|
139
|
+
firstName: z.ZodString;
|
|
140
|
+
planName: z.ZodString;
|
|
141
|
+
amountText: z.ZodString;
|
|
142
|
+
invoiceNumber: z.ZodNullable<z.ZodString>;
|
|
143
|
+
runsUntil: z.ZodString;
|
|
144
|
+
nextChargeOn: z.ZodNullable<z.ZodString>;
|
|
145
|
+
paymentsUrl: z.ZodURL;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
readonly 'fc-renewal-failed': z.ZodObject<{
|
|
148
|
+
firstName: z.ZodString;
|
|
149
|
+
planName: z.ZodString;
|
|
150
|
+
amountText: z.ZodString;
|
|
151
|
+
endsOn: z.ZodString;
|
|
152
|
+
plansUrl: z.ZodURL;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
readonly 'fc-auto-renew-stopped': z.ZodObject<{
|
|
155
|
+
firstName: z.ZodString;
|
|
156
|
+
planName: z.ZodString;
|
|
157
|
+
endsOn: z.ZodNullable<z.ZodString>;
|
|
158
|
+
reason: z.ZodEnum<{
|
|
159
|
+
refunded: "refunded";
|
|
160
|
+
payment_failed: "payment_failed";
|
|
161
|
+
membership_ended: "membership_ended";
|
|
162
|
+
turned_off: "turned_off";
|
|
163
|
+
}>;
|
|
164
|
+
plansUrl: z.ZodURL;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
};
|
|
167
|
+
export type FcEmailTemplate = keyof typeof FC_EMAIL_DATA_SCHEMAS;
|
|
168
|
+
export declare const FC_EMAIL_TEMPLATE_VALUES: FcEmailTemplate[];
|
|
169
|
+
/** The data a template takes, by its name. */
|
|
170
|
+
export type FcEmailData<T extends FcEmailTemplate> = z.infer<(typeof FC_EMAIL_DATA_SCHEMAS)[T]>;
|
|
171
|
+
//# sourceMappingURL=emails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emails.d.ts","sourceRoot":"","sources":["../../../src/domains/billing/emails.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,2FAA2F;AAC3F,eAAO,MAAM,4BAA4B;;;;;;;;iBAYvC,CAAC;AAEH,6BAA6B;AAC7B,eAAO,MAAM,4BAA4B;;;;;;iBAMvC,CAAC;AAEH,sEAAsE;AACtE,eAAO,MAAM,yBAAyB;;;;;;iBAMpC,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,2BAA2B;;;;;;iBAMtC,CAAC;AAEH,uEAAuE;AACvE,eAAO,MAAM,wBAAwB;;;;;;;;iBAUnC,CAAC;AAEH,0FAA0F;AAC1F,eAAO,MAAM,0BAA0B;;;;;;iBAOrC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,2EAKhC,CAAC;AACX,eAAO,MAAM,yBAAyB;;;;;EAAwC,CAAC;AAC/E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,uEAAuE;AACvE,eAAO,MAAM,6BAA6B;;;;;;;;;;;iBAOxC,CAAC;AAEH,sFAAsF;AACtF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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