placementt-core 1.400.1236 → 1.400.1237
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/lib/callables/billing.d.ts +190 -0
- package/lib/callables/billing.js +30 -0
- package/lib/callables/billing.js.map +1 -1
- package/lib/callables/registry.d.ts +364 -0
- package/lib/invoicing.d.ts +24 -0
- package/lib/invoicing.js +22 -1
- package/lib/invoicing.js.map +1 -1
- package/lib/invoicing.test.js +23 -0
- package/lib/invoicing.test.js.map +1 -1
- package/lib/pricing.d.ts +22 -1
- package/lib/pricing.js +43 -0
- package/lib/pricing.js.map +1 -1
- package/lib/pricing.test.js +25 -0
- package/lib/pricing.test.js.map +1 -1
- package/package.json +1 -1
- package/src/callables/billing.ts +30 -0
- package/src/invoicing.test.ts +28 -1
- package/src/invoicing.ts +33 -1
- package/src/pricing.test.ts +30 -0
- package/src/pricing.ts +59 -1
|
@@ -262,6 +262,196 @@ export declare const billingCallables: {
|
|
|
262
262
|
invoiceNumber?: string | undefined;
|
|
263
263
|
}>;
|
|
264
264
|
};
|
|
265
|
+
/** Create the invoice in Xero as a DRAFT (or update the draft already there)
|
|
266
|
+
* and email it to the calling admin exactly as the customer would get it,
|
|
267
|
+
* PDF attached, to check before approving. */
|
|
268
|
+
"billing-sendInvoiceDraft": {
|
|
269
|
+
request: z.ZodObject<{
|
|
270
|
+
oId: z.ZodString;
|
|
271
|
+
draft: z.ZodObject<{
|
|
272
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
273
|
+
key: z.ZodOptional<z.ZodEnum<["base", "wexY10", "wexY12", "events", "destinations", "hubBase", "hubSchools", "adjustment"]>>;
|
|
274
|
+
description: z.ZodString;
|
|
275
|
+
quantity: z.ZodNumber;
|
|
276
|
+
unitAmount: z.ZodNumber;
|
|
277
|
+
discount: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
278
|
+
type: z.ZodEnum<["percent", "amount"]>;
|
|
279
|
+
value: z.ZodNumber;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
type: "percent" | "amount";
|
|
282
|
+
value: number;
|
|
283
|
+
}, {
|
|
284
|
+
type: "percent" | "amount";
|
|
285
|
+
value: number;
|
|
286
|
+
}>>>, {
|
|
287
|
+
type: "percent" | "amount";
|
|
288
|
+
value: number;
|
|
289
|
+
} | undefined, {
|
|
290
|
+
type: "percent" | "amount";
|
|
291
|
+
value: number;
|
|
292
|
+
} | null | undefined>;
|
|
293
|
+
}, "strip", z.ZodTypeAny, {
|
|
294
|
+
description: string;
|
|
295
|
+
quantity: number;
|
|
296
|
+
unitAmount: number;
|
|
297
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
298
|
+
discount?: {
|
|
299
|
+
type: "percent" | "amount";
|
|
300
|
+
value: number;
|
|
301
|
+
} | undefined;
|
|
302
|
+
}, {
|
|
303
|
+
description: string;
|
|
304
|
+
quantity: number;
|
|
305
|
+
unitAmount: number;
|
|
306
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
307
|
+
discount?: {
|
|
308
|
+
type: "percent" | "amount";
|
|
309
|
+
value: number;
|
|
310
|
+
} | null | undefined;
|
|
311
|
+
}>, "many">;
|
|
312
|
+
discount: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
313
|
+
type: z.ZodEnum<["percent", "amount"]>;
|
|
314
|
+
value: z.ZodNumber;
|
|
315
|
+
}, "strip", z.ZodTypeAny, {
|
|
316
|
+
type: "percent" | "amount";
|
|
317
|
+
value: number;
|
|
318
|
+
}, {
|
|
319
|
+
type: "percent" | "amount";
|
|
320
|
+
value: number;
|
|
321
|
+
}>>>, {
|
|
322
|
+
type: "percent" | "amount";
|
|
323
|
+
value: number;
|
|
324
|
+
} | undefined, {
|
|
325
|
+
type: "percent" | "amount";
|
|
326
|
+
value: number;
|
|
327
|
+
} | null | undefined>;
|
|
328
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
329
|
+
date: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
330
|
+
dueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
lines: {
|
|
333
|
+
description: string;
|
|
334
|
+
quantity: number;
|
|
335
|
+
unitAmount: number;
|
|
336
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
337
|
+
discount?: {
|
|
338
|
+
type: "percent" | "amount";
|
|
339
|
+
value: number;
|
|
340
|
+
} | undefined;
|
|
341
|
+
}[];
|
|
342
|
+
date?: string | undefined;
|
|
343
|
+
discount?: {
|
|
344
|
+
type: "percent" | "amount";
|
|
345
|
+
value: number;
|
|
346
|
+
} | undefined;
|
|
347
|
+
dueDate?: string | undefined;
|
|
348
|
+
reference?: string | undefined;
|
|
349
|
+
}, {
|
|
350
|
+
lines: {
|
|
351
|
+
description: string;
|
|
352
|
+
quantity: number;
|
|
353
|
+
unitAmount: number;
|
|
354
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
355
|
+
discount?: {
|
|
356
|
+
type: "percent" | "amount";
|
|
357
|
+
value: number;
|
|
358
|
+
} | null | undefined;
|
|
359
|
+
}[];
|
|
360
|
+
date?: string | null | undefined;
|
|
361
|
+
discount?: {
|
|
362
|
+
type: "percent" | "amount";
|
|
363
|
+
value: number;
|
|
364
|
+
} | null | undefined;
|
|
365
|
+
dueDate?: string | null | undefined;
|
|
366
|
+
reference?: string | undefined;
|
|
367
|
+
}>;
|
|
368
|
+
/** An existing DRAFT to replace rather than starting another. */
|
|
369
|
+
invoiceId: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
370
|
+
}, "strip", z.ZodTypeAny, {
|
|
371
|
+
oId: string;
|
|
372
|
+
draft: {
|
|
373
|
+
lines: {
|
|
374
|
+
description: string;
|
|
375
|
+
quantity: number;
|
|
376
|
+
unitAmount: number;
|
|
377
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
378
|
+
discount?: {
|
|
379
|
+
type: "percent" | "amount";
|
|
380
|
+
value: number;
|
|
381
|
+
} | undefined;
|
|
382
|
+
}[];
|
|
383
|
+
date?: string | undefined;
|
|
384
|
+
discount?: {
|
|
385
|
+
type: "percent" | "amount";
|
|
386
|
+
value: number;
|
|
387
|
+
} | undefined;
|
|
388
|
+
dueDate?: string | undefined;
|
|
389
|
+
reference?: string | undefined;
|
|
390
|
+
};
|
|
391
|
+
invoiceId?: string | undefined;
|
|
392
|
+
}, {
|
|
393
|
+
oId: string;
|
|
394
|
+
draft: {
|
|
395
|
+
lines: {
|
|
396
|
+
description: string;
|
|
397
|
+
quantity: number;
|
|
398
|
+
unitAmount: number;
|
|
399
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
400
|
+
discount?: {
|
|
401
|
+
type: "percent" | "amount";
|
|
402
|
+
value: number;
|
|
403
|
+
} | null | undefined;
|
|
404
|
+
}[];
|
|
405
|
+
date?: string | null | undefined;
|
|
406
|
+
discount?: {
|
|
407
|
+
type: "percent" | "amount";
|
|
408
|
+
value: number;
|
|
409
|
+
} | null | undefined;
|
|
410
|
+
dueDate?: string | null | undefined;
|
|
411
|
+
reference?: string | undefined;
|
|
412
|
+
};
|
|
413
|
+
invoiceId?: string | null | undefined;
|
|
414
|
+
}>;
|
|
415
|
+
response: z.ZodObject<{
|
|
416
|
+
invoiceId: z.ZodString;
|
|
417
|
+
url: z.ZodString;
|
|
418
|
+
/** Inc VAT, as Xero calculated it. */
|
|
419
|
+
total: z.ZodNumber;
|
|
420
|
+
/** Where the check copy went. */
|
|
421
|
+
sentTo: z.ZodString;
|
|
422
|
+
}, "strip", z.ZodTypeAny, {
|
|
423
|
+
total: number;
|
|
424
|
+
url: string;
|
|
425
|
+
invoiceId: string;
|
|
426
|
+
sentTo: string;
|
|
427
|
+
}, {
|
|
428
|
+
total: number;
|
|
429
|
+
url: string;
|
|
430
|
+
invoiceId: string;
|
|
431
|
+
sentTo: string;
|
|
432
|
+
}>;
|
|
433
|
+
};
|
|
434
|
+
/** Approve a DRAFT in Xero and email it to the customer's finance contact
|
|
435
|
+
* (or the account's admin), PDF attached, then mark it sent in Xero. */
|
|
436
|
+
"billing-approveAndSendInvoice": {
|
|
437
|
+
request: z.ZodObject<{
|
|
438
|
+
invoiceId: z.ZodString;
|
|
439
|
+
}, "strip", z.ZodTypeAny, {
|
|
440
|
+
invoiceId: string;
|
|
441
|
+
}, {
|
|
442
|
+
invoiceId: string;
|
|
443
|
+
}>;
|
|
444
|
+
response: z.ZodObject<{
|
|
445
|
+
invoiceNumber: z.ZodOptional<z.ZodString>;
|
|
446
|
+
sentTo: z.ZodString;
|
|
447
|
+
}, "strip", z.ZodTypeAny, {
|
|
448
|
+
sentTo: string;
|
|
449
|
+
invoiceNumber?: string | undefined;
|
|
450
|
+
}, {
|
|
451
|
+
sentTo: string;
|
|
452
|
+
invoiceNumber?: string | undefined;
|
|
453
|
+
}>;
|
|
454
|
+
};
|
|
265
455
|
/** Pull invoice statuses from Xero into `invoices`. One institute, or every
|
|
266
456
|
* invoice changed since the last sync when no oId is given. */
|
|
267
457
|
"billing-syncXeroInvoices": {
|
package/lib/callables/billing.js
CHANGED
|
@@ -48,6 +48,36 @@ exports.billingCallables = {
|
|
|
48
48
|
total: zod_1.z.number(),
|
|
49
49
|
}),
|
|
50
50
|
},
|
|
51
|
+
/** Create the invoice in Xero as a DRAFT (or update the draft already there)
|
|
52
|
+
* and email it to the calling admin exactly as the customer would get it,
|
|
53
|
+
* PDF attached, to check before approving. */
|
|
54
|
+
"billing-sendInvoiceDraft": {
|
|
55
|
+
request: zod_1.z.object({
|
|
56
|
+
oId: zod_1.z.string(),
|
|
57
|
+
draft: exports.invoiceDraftSchema,
|
|
58
|
+
/** An existing DRAFT to replace rather than starting another. */
|
|
59
|
+
invoiceId: (0, types_1.optionalField)(zod_1.z.string()),
|
|
60
|
+
}),
|
|
61
|
+
response: zod_1.z.object({
|
|
62
|
+
invoiceId: zod_1.z.string(),
|
|
63
|
+
url: zod_1.z.string(),
|
|
64
|
+
/** Inc VAT, as Xero calculated it. */
|
|
65
|
+
total: zod_1.z.number(),
|
|
66
|
+
/** Where the check copy went. */
|
|
67
|
+
sentTo: zod_1.z.string(),
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
/** Approve a DRAFT in Xero and email it to the customer's finance contact
|
|
71
|
+
* (or the account's admin), PDF attached, then mark it sent in Xero. */
|
|
72
|
+
"billing-approveAndSendInvoice": {
|
|
73
|
+
request: zod_1.z.object({
|
|
74
|
+
invoiceId: zod_1.z.string(),
|
|
75
|
+
}),
|
|
76
|
+
response: zod_1.z.object({
|
|
77
|
+
invoiceNumber: zod_1.z.string().optional(),
|
|
78
|
+
sentTo: zod_1.z.string(),
|
|
79
|
+
}),
|
|
80
|
+
},
|
|
51
81
|
/** Pull invoice statuses from Xero into `invoices`. One institute, or every
|
|
52
82
|
* invoice changed since the last sync when no oId is given. */
|
|
53
83
|
"billing-syncXeroInvoices": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/callables/billing.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AACtB,mCAAqD;AAErD;;;;;;GAMG;AAEH,MAAM,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnC,KAAK,EAAE,OAAC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,CAAC;YACd,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;YACf,KAAK,EAAE,0BAAkB;YACzB,iEAAiE;YACjE,SAAS,EAAE,IAAA,qBAAa,EAAC,OAAC,CAAC,MAAM,EAAE,CAAC;SACvC,CAAC;QACF,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;YACrB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;YACf,sCAAsC;YACtC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,iCAAiC;YACjC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;SACrB,CAAC;KACL;IACD;4EACwE;IACxE,+BAA+B,EAAE;QAC7B,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;YACd,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;SACxB,CAAC;QACF,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACpC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;SACrB,CAAC;KACL;IACD;mEAC+D;IAC/D,0BAA0B,EAAE;QACxB,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;YACd,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC7B,CAAC;QACF,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;SACrB,CAAC;KACL;CACoB,CAAC"}
|
|
@@ -2268,6 +2268,188 @@ export declare const allCallables: {
|
|
|
2268
2268
|
invoiceNumber?: string | undefined;
|
|
2269
2269
|
}>;
|
|
2270
2270
|
};
|
|
2271
|
+
"billing-sendInvoiceDraft": {
|
|
2272
|
+
request: z.ZodObject<{
|
|
2273
|
+
oId: z.ZodString;
|
|
2274
|
+
draft: z.ZodObject<{
|
|
2275
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
2276
|
+
key: z.ZodOptional<z.ZodEnum<["base", "wexY10", "wexY12", "events", "destinations", "hubBase", "hubSchools", "adjustment"]>>;
|
|
2277
|
+
description: z.ZodString;
|
|
2278
|
+
quantity: z.ZodNumber;
|
|
2279
|
+
unitAmount: z.ZodNumber;
|
|
2280
|
+
discount: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2281
|
+
type: z.ZodEnum<["percent", "amount"]>;
|
|
2282
|
+
value: z.ZodNumber;
|
|
2283
|
+
}, "strip", z.ZodTypeAny, {
|
|
2284
|
+
type: "percent" | "amount";
|
|
2285
|
+
value: number;
|
|
2286
|
+
}, {
|
|
2287
|
+
type: "percent" | "amount";
|
|
2288
|
+
value: number;
|
|
2289
|
+
}>>>, {
|
|
2290
|
+
type: "percent" | "amount";
|
|
2291
|
+
value: number;
|
|
2292
|
+
} | undefined, {
|
|
2293
|
+
type: "percent" | "amount";
|
|
2294
|
+
value: number;
|
|
2295
|
+
} | null | undefined>;
|
|
2296
|
+
}, "strip", z.ZodTypeAny, {
|
|
2297
|
+
description: string;
|
|
2298
|
+
quantity: number;
|
|
2299
|
+
unitAmount: number;
|
|
2300
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
2301
|
+
discount?: {
|
|
2302
|
+
type: "percent" | "amount";
|
|
2303
|
+
value: number;
|
|
2304
|
+
} | undefined;
|
|
2305
|
+
}, {
|
|
2306
|
+
description: string;
|
|
2307
|
+
quantity: number;
|
|
2308
|
+
unitAmount: number;
|
|
2309
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
2310
|
+
discount?: {
|
|
2311
|
+
type: "percent" | "amount";
|
|
2312
|
+
value: number;
|
|
2313
|
+
} | null | undefined;
|
|
2314
|
+
}>, "many">;
|
|
2315
|
+
discount: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
2316
|
+
type: z.ZodEnum<["percent", "amount"]>;
|
|
2317
|
+
value: z.ZodNumber;
|
|
2318
|
+
}, "strip", z.ZodTypeAny, {
|
|
2319
|
+
type: "percent" | "amount";
|
|
2320
|
+
value: number;
|
|
2321
|
+
}, {
|
|
2322
|
+
type: "percent" | "amount";
|
|
2323
|
+
value: number;
|
|
2324
|
+
}>>>, {
|
|
2325
|
+
type: "percent" | "amount";
|
|
2326
|
+
value: number;
|
|
2327
|
+
} | undefined, {
|
|
2328
|
+
type: "percent" | "amount";
|
|
2329
|
+
value: number;
|
|
2330
|
+
} | null | undefined>;
|
|
2331
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
2332
|
+
date: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
2333
|
+
dueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
2334
|
+
}, "strip", z.ZodTypeAny, {
|
|
2335
|
+
lines: {
|
|
2336
|
+
description: string;
|
|
2337
|
+
quantity: number;
|
|
2338
|
+
unitAmount: number;
|
|
2339
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
2340
|
+
discount?: {
|
|
2341
|
+
type: "percent" | "amount";
|
|
2342
|
+
value: number;
|
|
2343
|
+
} | undefined;
|
|
2344
|
+
}[];
|
|
2345
|
+
date?: string | undefined;
|
|
2346
|
+
discount?: {
|
|
2347
|
+
type: "percent" | "amount";
|
|
2348
|
+
value: number;
|
|
2349
|
+
} | undefined;
|
|
2350
|
+
dueDate?: string | undefined;
|
|
2351
|
+
reference?: string | undefined;
|
|
2352
|
+
}, {
|
|
2353
|
+
lines: {
|
|
2354
|
+
description: string;
|
|
2355
|
+
quantity: number;
|
|
2356
|
+
unitAmount: number;
|
|
2357
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
2358
|
+
discount?: {
|
|
2359
|
+
type: "percent" | "amount";
|
|
2360
|
+
value: number;
|
|
2361
|
+
} | null | undefined;
|
|
2362
|
+
}[];
|
|
2363
|
+
date?: string | null | undefined;
|
|
2364
|
+
discount?: {
|
|
2365
|
+
type: "percent" | "amount";
|
|
2366
|
+
value: number;
|
|
2367
|
+
} | null | undefined;
|
|
2368
|
+
dueDate?: string | null | undefined;
|
|
2369
|
+
reference?: string | undefined;
|
|
2370
|
+
}>;
|
|
2371
|
+
invoiceId: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
2372
|
+
}, "strip", z.ZodTypeAny, {
|
|
2373
|
+
oId: string;
|
|
2374
|
+
draft: {
|
|
2375
|
+
lines: {
|
|
2376
|
+
description: string;
|
|
2377
|
+
quantity: number;
|
|
2378
|
+
unitAmount: number;
|
|
2379
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
2380
|
+
discount?: {
|
|
2381
|
+
type: "percent" | "amount";
|
|
2382
|
+
value: number;
|
|
2383
|
+
} | undefined;
|
|
2384
|
+
}[];
|
|
2385
|
+
date?: string | undefined;
|
|
2386
|
+
discount?: {
|
|
2387
|
+
type: "percent" | "amount";
|
|
2388
|
+
value: number;
|
|
2389
|
+
} | undefined;
|
|
2390
|
+
dueDate?: string | undefined;
|
|
2391
|
+
reference?: string | undefined;
|
|
2392
|
+
};
|
|
2393
|
+
invoiceId?: string | undefined;
|
|
2394
|
+
}, {
|
|
2395
|
+
oId: string;
|
|
2396
|
+
draft: {
|
|
2397
|
+
lines: {
|
|
2398
|
+
description: string;
|
|
2399
|
+
quantity: number;
|
|
2400
|
+
unitAmount: number;
|
|
2401
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
2402
|
+
discount?: {
|
|
2403
|
+
type: "percent" | "amount";
|
|
2404
|
+
value: number;
|
|
2405
|
+
} | null | undefined;
|
|
2406
|
+
}[];
|
|
2407
|
+
date?: string | null | undefined;
|
|
2408
|
+
discount?: {
|
|
2409
|
+
type: "percent" | "amount";
|
|
2410
|
+
value: number;
|
|
2411
|
+
} | null | undefined;
|
|
2412
|
+
dueDate?: string | null | undefined;
|
|
2413
|
+
reference?: string | undefined;
|
|
2414
|
+
};
|
|
2415
|
+
invoiceId?: string | null | undefined;
|
|
2416
|
+
}>;
|
|
2417
|
+
response: z.ZodObject<{
|
|
2418
|
+
invoiceId: z.ZodString;
|
|
2419
|
+
url: z.ZodString;
|
|
2420
|
+
total: z.ZodNumber;
|
|
2421
|
+
sentTo: z.ZodString;
|
|
2422
|
+
}, "strip", z.ZodTypeAny, {
|
|
2423
|
+
total: number;
|
|
2424
|
+
url: string;
|
|
2425
|
+
invoiceId: string;
|
|
2426
|
+
sentTo: string;
|
|
2427
|
+
}, {
|
|
2428
|
+
total: number;
|
|
2429
|
+
url: string;
|
|
2430
|
+
invoiceId: string;
|
|
2431
|
+
sentTo: string;
|
|
2432
|
+
}>;
|
|
2433
|
+
};
|
|
2434
|
+
"billing-approveAndSendInvoice": {
|
|
2435
|
+
request: z.ZodObject<{
|
|
2436
|
+
invoiceId: z.ZodString;
|
|
2437
|
+
}, "strip", z.ZodTypeAny, {
|
|
2438
|
+
invoiceId: string;
|
|
2439
|
+
}, {
|
|
2440
|
+
invoiceId: string;
|
|
2441
|
+
}>;
|
|
2442
|
+
response: z.ZodObject<{
|
|
2443
|
+
invoiceNumber: z.ZodOptional<z.ZodString>;
|
|
2444
|
+
sentTo: z.ZodString;
|
|
2445
|
+
}, "strip", z.ZodTypeAny, {
|
|
2446
|
+
sentTo: string;
|
|
2447
|
+
invoiceNumber?: string | undefined;
|
|
2448
|
+
}, {
|
|
2449
|
+
sentTo: string;
|
|
2450
|
+
invoiceNumber?: string | undefined;
|
|
2451
|
+
}>;
|
|
2452
|
+
};
|
|
2271
2453
|
"billing-syncXeroInvoices": {
|
|
2272
2454
|
request: z.ZodObject<{
|
|
2273
2455
|
oId: z.ZodOptional<z.ZodString>;
|
|
@@ -5367,6 +5549,188 @@ export declare const callableGroups: {
|
|
|
5367
5549
|
invoiceNumber?: string | undefined;
|
|
5368
5550
|
}>;
|
|
5369
5551
|
};
|
|
5552
|
+
"billing-sendInvoiceDraft": {
|
|
5553
|
+
request: z.ZodObject<{
|
|
5554
|
+
oId: z.ZodString;
|
|
5555
|
+
draft: z.ZodObject<{
|
|
5556
|
+
lines: z.ZodArray<z.ZodObject<{
|
|
5557
|
+
key: z.ZodOptional<z.ZodEnum<["base", "wexY10", "wexY12", "events", "destinations", "hubBase", "hubSchools", "adjustment"]>>;
|
|
5558
|
+
description: z.ZodString;
|
|
5559
|
+
quantity: z.ZodNumber;
|
|
5560
|
+
unitAmount: z.ZodNumber;
|
|
5561
|
+
discount: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
5562
|
+
type: z.ZodEnum<["percent", "amount"]>;
|
|
5563
|
+
value: z.ZodNumber;
|
|
5564
|
+
}, "strip", z.ZodTypeAny, {
|
|
5565
|
+
type: "percent" | "amount";
|
|
5566
|
+
value: number;
|
|
5567
|
+
}, {
|
|
5568
|
+
type: "percent" | "amount";
|
|
5569
|
+
value: number;
|
|
5570
|
+
}>>>, {
|
|
5571
|
+
type: "percent" | "amount";
|
|
5572
|
+
value: number;
|
|
5573
|
+
} | undefined, {
|
|
5574
|
+
type: "percent" | "amount";
|
|
5575
|
+
value: number;
|
|
5576
|
+
} | null | undefined>;
|
|
5577
|
+
}, "strip", z.ZodTypeAny, {
|
|
5578
|
+
description: string;
|
|
5579
|
+
quantity: number;
|
|
5580
|
+
unitAmount: number;
|
|
5581
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
5582
|
+
discount?: {
|
|
5583
|
+
type: "percent" | "amount";
|
|
5584
|
+
value: number;
|
|
5585
|
+
} | undefined;
|
|
5586
|
+
}, {
|
|
5587
|
+
description: string;
|
|
5588
|
+
quantity: number;
|
|
5589
|
+
unitAmount: number;
|
|
5590
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
5591
|
+
discount?: {
|
|
5592
|
+
type: "percent" | "amount";
|
|
5593
|
+
value: number;
|
|
5594
|
+
} | null | undefined;
|
|
5595
|
+
}>, "many">;
|
|
5596
|
+
discount: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
5597
|
+
type: z.ZodEnum<["percent", "amount"]>;
|
|
5598
|
+
value: z.ZodNumber;
|
|
5599
|
+
}, "strip", z.ZodTypeAny, {
|
|
5600
|
+
type: "percent" | "amount";
|
|
5601
|
+
value: number;
|
|
5602
|
+
}, {
|
|
5603
|
+
type: "percent" | "amount";
|
|
5604
|
+
value: number;
|
|
5605
|
+
}>>>, {
|
|
5606
|
+
type: "percent" | "amount";
|
|
5607
|
+
value: number;
|
|
5608
|
+
} | undefined, {
|
|
5609
|
+
type: "percent" | "amount";
|
|
5610
|
+
value: number;
|
|
5611
|
+
} | null | undefined>;
|
|
5612
|
+
reference: z.ZodOptional<z.ZodString>;
|
|
5613
|
+
date: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
5614
|
+
dueDate: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
5615
|
+
}, "strip", z.ZodTypeAny, {
|
|
5616
|
+
lines: {
|
|
5617
|
+
description: string;
|
|
5618
|
+
quantity: number;
|
|
5619
|
+
unitAmount: number;
|
|
5620
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
5621
|
+
discount?: {
|
|
5622
|
+
type: "percent" | "amount";
|
|
5623
|
+
value: number;
|
|
5624
|
+
} | undefined;
|
|
5625
|
+
}[];
|
|
5626
|
+
date?: string | undefined;
|
|
5627
|
+
discount?: {
|
|
5628
|
+
type: "percent" | "amount";
|
|
5629
|
+
value: number;
|
|
5630
|
+
} | undefined;
|
|
5631
|
+
dueDate?: string | undefined;
|
|
5632
|
+
reference?: string | undefined;
|
|
5633
|
+
}, {
|
|
5634
|
+
lines: {
|
|
5635
|
+
description: string;
|
|
5636
|
+
quantity: number;
|
|
5637
|
+
unitAmount: number;
|
|
5638
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
5639
|
+
discount?: {
|
|
5640
|
+
type: "percent" | "amount";
|
|
5641
|
+
value: number;
|
|
5642
|
+
} | null | undefined;
|
|
5643
|
+
}[];
|
|
5644
|
+
date?: string | null | undefined;
|
|
5645
|
+
discount?: {
|
|
5646
|
+
type: "percent" | "amount";
|
|
5647
|
+
value: number;
|
|
5648
|
+
} | null | undefined;
|
|
5649
|
+
dueDate?: string | null | undefined;
|
|
5650
|
+
reference?: string | undefined;
|
|
5651
|
+
}>;
|
|
5652
|
+
invoiceId: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | undefined, string | null | undefined>;
|
|
5653
|
+
}, "strip", z.ZodTypeAny, {
|
|
5654
|
+
oId: string;
|
|
5655
|
+
draft: {
|
|
5656
|
+
lines: {
|
|
5657
|
+
description: string;
|
|
5658
|
+
quantity: number;
|
|
5659
|
+
unitAmount: number;
|
|
5660
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
5661
|
+
discount?: {
|
|
5662
|
+
type: "percent" | "amount";
|
|
5663
|
+
value: number;
|
|
5664
|
+
} | undefined;
|
|
5665
|
+
}[];
|
|
5666
|
+
date?: string | undefined;
|
|
5667
|
+
discount?: {
|
|
5668
|
+
type: "percent" | "amount";
|
|
5669
|
+
value: number;
|
|
5670
|
+
} | undefined;
|
|
5671
|
+
dueDate?: string | undefined;
|
|
5672
|
+
reference?: string | undefined;
|
|
5673
|
+
};
|
|
5674
|
+
invoiceId?: string | undefined;
|
|
5675
|
+
}, {
|
|
5676
|
+
oId: string;
|
|
5677
|
+
draft: {
|
|
5678
|
+
lines: {
|
|
5679
|
+
description: string;
|
|
5680
|
+
quantity: number;
|
|
5681
|
+
unitAmount: number;
|
|
5682
|
+
key?: "base" | "events" | "destinations" | "wexY10" | "wexY12" | "hubBase" | "hubSchools" | "adjustment" | undefined;
|
|
5683
|
+
discount?: {
|
|
5684
|
+
type: "percent" | "amount";
|
|
5685
|
+
value: number;
|
|
5686
|
+
} | null | undefined;
|
|
5687
|
+
}[];
|
|
5688
|
+
date?: string | null | undefined;
|
|
5689
|
+
discount?: {
|
|
5690
|
+
type: "percent" | "amount";
|
|
5691
|
+
value: number;
|
|
5692
|
+
} | null | undefined;
|
|
5693
|
+
dueDate?: string | null | undefined;
|
|
5694
|
+
reference?: string | undefined;
|
|
5695
|
+
};
|
|
5696
|
+
invoiceId?: string | null | undefined;
|
|
5697
|
+
}>;
|
|
5698
|
+
response: z.ZodObject<{
|
|
5699
|
+
invoiceId: z.ZodString;
|
|
5700
|
+
url: z.ZodString;
|
|
5701
|
+
total: z.ZodNumber;
|
|
5702
|
+
sentTo: z.ZodString;
|
|
5703
|
+
}, "strip", z.ZodTypeAny, {
|
|
5704
|
+
total: number;
|
|
5705
|
+
url: string;
|
|
5706
|
+
invoiceId: string;
|
|
5707
|
+
sentTo: string;
|
|
5708
|
+
}, {
|
|
5709
|
+
total: number;
|
|
5710
|
+
url: string;
|
|
5711
|
+
invoiceId: string;
|
|
5712
|
+
sentTo: string;
|
|
5713
|
+
}>;
|
|
5714
|
+
};
|
|
5715
|
+
"billing-approveAndSendInvoice": {
|
|
5716
|
+
request: z.ZodObject<{
|
|
5717
|
+
invoiceId: z.ZodString;
|
|
5718
|
+
}, "strip", z.ZodTypeAny, {
|
|
5719
|
+
invoiceId: string;
|
|
5720
|
+
}, {
|
|
5721
|
+
invoiceId: string;
|
|
5722
|
+
}>;
|
|
5723
|
+
response: z.ZodObject<{
|
|
5724
|
+
invoiceNumber: z.ZodOptional<z.ZodString>;
|
|
5725
|
+
sentTo: z.ZodString;
|
|
5726
|
+
}, "strip", z.ZodTypeAny, {
|
|
5727
|
+
sentTo: string;
|
|
5728
|
+
invoiceNumber?: string | undefined;
|
|
5729
|
+
}, {
|
|
5730
|
+
sentTo: string;
|
|
5731
|
+
invoiceNumber?: string | undefined;
|
|
5732
|
+
}>;
|
|
5733
|
+
};
|
|
5370
5734
|
"billing-syncXeroInvoices": {
|
|
5371
5735
|
request: z.ZodObject<{
|
|
5372
5736
|
oId: z.ZodOptional<z.ZodString>;
|
package/lib/invoicing.d.ts
CHANGED
|
@@ -170,6 +170,14 @@ export type InvoiceRecord = {
|
|
|
170
170
|
draft?: InvoiceDraft;
|
|
171
171
|
/** Admin uid, when created from the admin panel. */
|
|
172
172
|
createdBy?: string;
|
|
173
|
+
/** The latest draft emailed to an admin to check, before it went to the customer. */
|
|
174
|
+
draftSentTo?: string;
|
|
175
|
+
/** ISO timestamp. */
|
|
176
|
+
draftSentAt?: string;
|
|
177
|
+
/** Who the approved invoice was emailed to, by us rather than by Xero. */
|
|
178
|
+
sentTo?: string;
|
|
179
|
+
/** ISO timestamp. */
|
|
180
|
+
sentAt?: string;
|
|
173
181
|
/** ISO timestamps. */
|
|
174
182
|
createdAt: string;
|
|
175
183
|
updatedAt: string;
|
|
@@ -180,3 +188,19 @@ export type InvoiceRecord = {
|
|
|
180
188
|
export declare const CUSTOMER_VISIBLE_INVOICE_STATUSES: XeroInvoiceStatus[];
|
|
181
189
|
/** Where the sync keeps its high-water mark. */
|
|
182
190
|
export declare const BILLING_SYNC_PATH: string[];
|
|
191
|
+
/**
|
|
192
|
+
* Whether a work experience cohort ran in the academic year before `today`'s,
|
|
193
|
+
* which is the year a returning school's unplaced students are counted from.
|
|
194
|
+
*
|
|
195
|
+
* Cohorts made by the recurring set-up carry their academic year ("2025/26");
|
|
196
|
+
* older ones are placed by when their placements ended.
|
|
197
|
+
*
|
|
198
|
+
* @param {object} cohort the cohort's year and placement dates.
|
|
199
|
+
* @param {Date} [today] the invoice date. Now when absent.
|
|
200
|
+
* @return {boolean} true for last year's cohorts.
|
|
201
|
+
*/
|
|
202
|
+
export declare function isLastYearCohort(cohort: {
|
|
203
|
+
academicYear?: string;
|
|
204
|
+
endPlacements?: string;
|
|
205
|
+
startPlacements?: string;
|
|
206
|
+
}, today?: Date): boolean;
|