@voyantjs/finance 0.3.1 → 0.4.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/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -8
- package/dist/routes-documents.d.ts +159 -0
- package/dist/routes-documents.d.ts.map +1 -0
- package/dist/routes-documents.js +35 -0
- package/dist/routes-public.d.ts +41 -0
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +4 -0
- package/dist/routes-settlement.d.ts +63 -0
- package/dist/routes-settlement.d.ts.map +1 -0
- package/dist/routes-settlement.js +18 -0
- package/dist/service-documents.d.ts +67 -0
- package/dist/service-documents.d.ts.map +1 -0
- package/dist/service-documents.js +226 -0
- package/dist/service-public.d.ts +2 -1
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +53 -1
- package/dist/service-settlement.d.ts +36 -0
- package/dist/service-settlement.d.ts.map +1 -0
- package/dist/service-settlement.js +172 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +2 -57
- package/dist/validation-billing.d.ts +110 -0
- package/dist/validation-billing.d.ts.map +1 -1
- package/dist/validation-billing.js +54 -1
- package/dist/validation-public.d.ts +69 -0
- package/dist/validation-public.d.ts.map +1 -1
- package/dist/validation-public.js +17 -0
- package/package.json +7 -5
package/dist/service.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { bookingItems, bookings } from "@voyantjs/bookings/schema";
|
|
2
|
+
import { renderStructuredTemplate } from "@voyantjs/utils/template-renderer";
|
|
2
3
|
import { and, asc, desc, eq, gte, ilike, lte, or, sql } from "drizzle-orm";
|
|
3
4
|
import { bookingGuarantees, bookingItemCommissions, bookingItemTaxLines, bookingPaymentSchedules, creditNoteLineItems, creditNotes, financeNotes, invoiceExternalRefs, invoiceLineItems, invoiceNumberSeries, invoiceRenditions, invoices, invoiceTemplates, paymentAuthorizations, paymentCaptures, paymentInstruments, paymentSessions, payments, supplierPayments, taxRegimes, } from "./schema.js";
|
|
4
5
|
function toTimestamp(value) {
|
|
@@ -70,64 +71,8 @@ function formatNumber(prefix, separator, padLength, sequence) {
|
|
|
70
71
|
const padded = String(sequence).padStart(padLength, "0");
|
|
71
72
|
return `${prefix}${separator}${padded}`;
|
|
72
73
|
}
|
|
73
|
-
// ============================================================================
|
|
74
|
-
// Template rendering (mustache)
|
|
75
|
-
// ============================================================================
|
|
76
|
-
function resolveMustachePath(path, scope) {
|
|
77
|
-
const parts = path.match(/[^.[\]]+/g) ?? [];
|
|
78
|
-
let current = scope;
|
|
79
|
-
for (const part of parts) {
|
|
80
|
-
if (current == null || typeof current !== "object")
|
|
81
|
-
return undefined;
|
|
82
|
-
current = current[part];
|
|
83
|
-
}
|
|
84
|
-
return current;
|
|
85
|
-
}
|
|
86
|
-
function stringifyMustacheValue(value) {
|
|
87
|
-
if (value == null)
|
|
88
|
-
return "";
|
|
89
|
-
if (typeof value === "string")
|
|
90
|
-
return value;
|
|
91
|
-
if (typeof value === "number" || typeof value === "boolean")
|
|
92
|
-
return String(value);
|
|
93
|
-
return JSON.stringify(value);
|
|
94
|
-
}
|
|
95
|
-
function renderMustache(body, variables) {
|
|
96
|
-
return body.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (_match, path) => {
|
|
97
|
-
const value = resolveMustachePath(path.trim(), variables);
|
|
98
|
-
return stringifyMustacheValue(value);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
74
|
export function renderInvoiceBody(body, bodyFormat, variables) {
|
|
102
|
-
|
|
103
|
-
try {
|
|
104
|
-
const parsed = JSON.parse(body);
|
|
105
|
-
return JSON.stringify(renderLexicalNode(parsed, variables));
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
return renderMustache(body, variables);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return renderMustache(body, variables);
|
|
112
|
-
}
|
|
113
|
-
function renderLexicalNode(node, variables) {
|
|
114
|
-
if (node == null || typeof node !== "object")
|
|
115
|
-
return node;
|
|
116
|
-
if (Array.isArray(node)) {
|
|
117
|
-
return node.map((n) => renderLexicalNode(n, variables));
|
|
118
|
-
}
|
|
119
|
-
const obj = node;
|
|
120
|
-
const result = { ...obj };
|
|
121
|
-
if (typeof obj.text === "string") {
|
|
122
|
-
result.text = renderMustache(obj.text, variables);
|
|
123
|
-
}
|
|
124
|
-
if (obj.children) {
|
|
125
|
-
result.children = renderLexicalNode(obj.children, variables);
|
|
126
|
-
}
|
|
127
|
-
if (obj.root) {
|
|
128
|
-
result.root = renderLexicalNode(obj.root, variables);
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
75
|
+
return renderStructuredTemplate(body, bodyFormat, variables);
|
|
131
76
|
}
|
|
132
77
|
async function paginate(rowsQuery, countQuery, limit, offset) {
|
|
133
78
|
const [data, countResult] = await Promise.all([rowsQuery, countQuery]);
|
|
@@ -465,6 +465,67 @@ export declare const updateInvoiceExternalRefSchema: z.ZodObject<{
|
|
|
465
465
|
syncedAt: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
466
466
|
syncError: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
467
467
|
}, z.core.$strip>;
|
|
468
|
+
export declare const pollInvoiceSettlementInputSchema: z.ZodObject<{
|
|
469
|
+
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
470
|
+
reconcilePayment: z.ZodDefault<z.ZodBoolean>;
|
|
471
|
+
paymentMethod: z.ZodDefault<z.ZodEnum<{
|
|
472
|
+
other: "other";
|
|
473
|
+
voucher: "voucher";
|
|
474
|
+
wallet: "wallet";
|
|
475
|
+
bank_transfer: "bank_transfer";
|
|
476
|
+
credit_card: "credit_card";
|
|
477
|
+
debit_card: "debit_card";
|
|
478
|
+
cash: "cash";
|
|
479
|
+
cheque: "cheque";
|
|
480
|
+
direct_bill: "direct_bill";
|
|
481
|
+
}>>;
|
|
482
|
+
paymentDate: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
483
|
+
referenceNumber: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
484
|
+
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
485
|
+
}, z.core.$strip>;
|
|
486
|
+
export declare const polledInvoiceSettlementProviderResultSchema: z.ZodObject<{
|
|
487
|
+
provider: z.ZodString;
|
|
488
|
+
externalRefId: z.ZodString;
|
|
489
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
490
|
+
externalNumber: z.ZodNullable<z.ZodString>;
|
|
491
|
+
externalUrl: z.ZodNullable<z.ZodString>;
|
|
492
|
+
status: z.ZodNullable<z.ZodString>;
|
|
493
|
+
paidAmountCents: z.ZodNullable<z.ZodNumber>;
|
|
494
|
+
unpaidAmountCents: z.ZodNullable<z.ZodNumber>;
|
|
495
|
+
syncedAt: z.ZodNullable<z.ZodString>;
|
|
496
|
+
settledAt: z.ZodNullable<z.ZodString>;
|
|
497
|
+
createdPaymentId: z.ZodNullable<z.ZodString>;
|
|
498
|
+
newlyAppliedAmountCents: z.ZodNumber;
|
|
499
|
+
syncError: z.ZodNullable<z.ZodString>;
|
|
500
|
+
}, z.core.$strip>;
|
|
501
|
+
export declare const polledInvoiceSettlementResultSchema: z.ZodObject<{
|
|
502
|
+
invoiceId: z.ZodString;
|
|
503
|
+
invoiceStatus: z.ZodEnum<{
|
|
504
|
+
draft: "draft";
|
|
505
|
+
sent: "sent";
|
|
506
|
+
partially_paid: "partially_paid";
|
|
507
|
+
paid: "paid";
|
|
508
|
+
overdue: "overdue";
|
|
509
|
+
void: "void";
|
|
510
|
+
}>;
|
|
511
|
+
paidCents: z.ZodNumber;
|
|
512
|
+
balanceDueCents: z.ZodNumber;
|
|
513
|
+
results: z.ZodArray<z.ZodObject<{
|
|
514
|
+
provider: z.ZodString;
|
|
515
|
+
externalRefId: z.ZodString;
|
|
516
|
+
externalId: z.ZodNullable<z.ZodString>;
|
|
517
|
+
externalNumber: z.ZodNullable<z.ZodString>;
|
|
518
|
+
externalUrl: z.ZodNullable<z.ZodString>;
|
|
519
|
+
status: z.ZodNullable<z.ZodString>;
|
|
520
|
+
paidAmountCents: z.ZodNullable<z.ZodNumber>;
|
|
521
|
+
unpaidAmountCents: z.ZodNullable<z.ZodNumber>;
|
|
522
|
+
syncedAt: z.ZodNullable<z.ZodString>;
|
|
523
|
+
settledAt: z.ZodNullable<z.ZodString>;
|
|
524
|
+
createdPaymentId: z.ZodNullable<z.ZodString>;
|
|
525
|
+
newlyAppliedAmountCents: z.ZodNumber;
|
|
526
|
+
syncError: z.ZodNullable<z.ZodString>;
|
|
527
|
+
}, z.core.$strip>>;
|
|
528
|
+
}, z.core.$strip>;
|
|
468
529
|
export declare const renderInvoiceInputSchema: z.ZodObject<{
|
|
469
530
|
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
470
531
|
format: z.ZodDefault<z.ZodEnum<{
|
|
@@ -475,4 +536,53 @@ export declare const renderInvoiceInputSchema: z.ZodObject<{
|
|
|
475
536
|
}>>;
|
|
476
537
|
language: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
477
538
|
}, z.core.$strip>;
|
|
539
|
+
export declare const generateInvoiceDocumentInputSchema: z.ZodObject<{
|
|
540
|
+
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
541
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
542
|
+
json: "json";
|
|
543
|
+
pdf: "pdf";
|
|
544
|
+
html: "html";
|
|
545
|
+
xml: "xml";
|
|
546
|
+
}>>;
|
|
547
|
+
language: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
548
|
+
replaceExisting: z.ZodDefault<z.ZodBoolean>;
|
|
549
|
+
}, z.core.$strip>;
|
|
550
|
+
export declare const generatedInvoiceDocumentResultSchema: z.ZodObject<{
|
|
551
|
+
invoiceId: z.ZodString;
|
|
552
|
+
renderedBodyFormat: z.ZodEnum<{
|
|
553
|
+
html: "html";
|
|
554
|
+
markdown: "markdown";
|
|
555
|
+
lexical_json: "lexical_json";
|
|
556
|
+
}>;
|
|
557
|
+
renderedBody: z.ZodString;
|
|
558
|
+
rendition: z.ZodObject<{
|
|
559
|
+
id: z.ZodString;
|
|
560
|
+
invoiceId: z.ZodString;
|
|
561
|
+
templateId: z.ZodNullable<z.ZodString>;
|
|
562
|
+
format: z.ZodEnum<{
|
|
563
|
+
json: "json";
|
|
564
|
+
pdf: "pdf";
|
|
565
|
+
html: "html";
|
|
566
|
+
xml: "xml";
|
|
567
|
+
}>;
|
|
568
|
+
status: z.ZodEnum<{
|
|
569
|
+
pending: "pending";
|
|
570
|
+
failed: "failed";
|
|
571
|
+
ready: "ready";
|
|
572
|
+
stale: "stale";
|
|
573
|
+
}>;
|
|
574
|
+
storageKey: z.ZodNullable<z.ZodString>;
|
|
575
|
+
fileSize: z.ZodNullable<z.ZodNumber>;
|
|
576
|
+
checksum: z.ZodNullable<z.ZodString>;
|
|
577
|
+
language: z.ZodNullable<z.ZodString>;
|
|
578
|
+
errorMessage: z.ZodNullable<z.ZodString>;
|
|
579
|
+
generatedAt: z.ZodNullable<z.ZodString>;
|
|
580
|
+
metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
581
|
+
createdAt: z.ZodString;
|
|
582
|
+
}, z.core.$strip>;
|
|
583
|
+
}, z.core.$strip>;
|
|
584
|
+
export type GenerateInvoiceDocumentInput = z.infer<typeof generateInvoiceDocumentInputSchema>;
|
|
585
|
+
export type GeneratedInvoiceDocumentResult = z.infer<typeof generatedInvoiceDocumentResultSchema>;
|
|
586
|
+
export type PollInvoiceSettlementInput = z.infer<typeof pollInvoiceSettlementInputSchema>;
|
|
587
|
+
export type PolledInvoiceSettlementResult = z.infer<typeof polledInvoiceSettlementResultSchema>;
|
|
478
588
|
//# sourceMappingURL=validation-billing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-billing.d.ts","sourceRoot":"","sources":["../src/valid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CAAA;AAC7F,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAA;AACjG,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AACzF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { commissionModelSchema, commissionRecipientTypeSchema, commissionStatusSchema, creditNoteStatusSchema, invoiceStatusSchema, paginationSchema, taxScopeSchema, } from "./validation-shared.js";
|
|
2
|
+
import { commissionModelSchema, commissionRecipientTypeSchema, commissionStatusSchema, creditNoteStatusSchema, invoiceStatusSchema, paginationSchema, paymentMethodSchema, taxScopeSchema, } from "./validation-shared.js";
|
|
3
3
|
const bookingItemTaxLineCoreSchema = z.object({
|
|
4
4
|
code: z.string().max(100).optional().nullable(),
|
|
5
5
|
name: z.string().min(1).max(255),
|
|
@@ -212,8 +212,61 @@ const invoiceExternalRefCoreSchema = z.object({
|
|
|
212
212
|
});
|
|
213
213
|
export const insertInvoiceExternalRefSchema = invoiceExternalRefCoreSchema;
|
|
214
214
|
export const updateInvoiceExternalRefSchema = invoiceExternalRefCoreSchema.partial();
|
|
215
|
+
export const pollInvoiceSettlementInputSchema = z.object({
|
|
216
|
+
provider: z.string().min(1).max(100).optional().nullable(),
|
|
217
|
+
reconcilePayment: z.boolean().default(true),
|
|
218
|
+
paymentMethod: paymentMethodSchema.default("bank_transfer"),
|
|
219
|
+
paymentDate: z.string().optional().nullable(),
|
|
220
|
+
referenceNumber: z.string().max(255).optional().nullable(),
|
|
221
|
+
notes: z.string().optional().nullable(),
|
|
222
|
+
});
|
|
223
|
+
export const polledInvoiceSettlementProviderResultSchema = z.object({
|
|
224
|
+
provider: z.string(),
|
|
225
|
+
externalRefId: z.string(),
|
|
226
|
+
externalId: z.string().nullable(),
|
|
227
|
+
externalNumber: z.string().nullable(),
|
|
228
|
+
externalUrl: z.string().nullable(),
|
|
229
|
+
status: z.string().nullable(),
|
|
230
|
+
paidAmountCents: z.number().int().nullable(),
|
|
231
|
+
unpaidAmountCents: z.number().int().nullable(),
|
|
232
|
+
syncedAt: z.string().nullable(),
|
|
233
|
+
settledAt: z.string().nullable(),
|
|
234
|
+
createdPaymentId: z.string().nullable(),
|
|
235
|
+
newlyAppliedAmountCents: z.number().int(),
|
|
236
|
+
syncError: z.string().nullable(),
|
|
237
|
+
});
|
|
238
|
+
export const polledInvoiceSettlementResultSchema = z.object({
|
|
239
|
+
invoiceId: z.string(),
|
|
240
|
+
invoiceStatus: invoiceStatusSchema,
|
|
241
|
+
paidCents: z.number().int(),
|
|
242
|
+
balanceDueCents: z.number().int(),
|
|
243
|
+
results: z.array(polledInvoiceSettlementProviderResultSchema),
|
|
244
|
+
});
|
|
215
245
|
export const renderInvoiceInputSchema = z.object({
|
|
216
246
|
templateId: z.string().optional().nullable(),
|
|
217
247
|
format: invoiceRenditionFormatSchema.default("pdf"),
|
|
218
248
|
language: z.string().optional().nullable(),
|
|
219
249
|
});
|
|
250
|
+
export const generateInvoiceDocumentInputSchema = renderInvoiceInputSchema.extend({
|
|
251
|
+
replaceExisting: z.boolean().default(true),
|
|
252
|
+
});
|
|
253
|
+
export const generatedInvoiceDocumentResultSchema = z.object({
|
|
254
|
+
invoiceId: z.string(),
|
|
255
|
+
renderedBodyFormat: invoiceTemplateBodyFormatSchema,
|
|
256
|
+
renderedBody: z.string(),
|
|
257
|
+
rendition: z.object({
|
|
258
|
+
id: z.string(),
|
|
259
|
+
invoiceId: z.string(),
|
|
260
|
+
templateId: z.string().nullable(),
|
|
261
|
+
format: invoiceRenditionFormatSchema,
|
|
262
|
+
status: invoiceRenditionStatusSchema,
|
|
263
|
+
storageKey: z.string().nullable(),
|
|
264
|
+
fileSize: z.number().int().nullable(),
|
|
265
|
+
checksum: z.string().nullable(),
|
|
266
|
+
language: z.string().nullable(),
|
|
267
|
+
errorMessage: z.string().nullable(),
|
|
268
|
+
generatedAt: z.string().nullable(),
|
|
269
|
+
metadata: z.record(z.string(), z.unknown()).nullable(),
|
|
270
|
+
createdAt: z.string(),
|
|
271
|
+
}),
|
|
272
|
+
});
|
|
@@ -341,6 +341,73 @@ export declare const publicBookingFinanceDocumentsSchema: z.ZodObject<{
|
|
|
341
341
|
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
342
342
|
}, z.core.$strip>>;
|
|
343
343
|
}, z.core.$strip>;
|
|
344
|
+
export declare const publicFinanceBookingPaymentSchema: z.ZodObject<{
|
|
345
|
+
id: z.ZodString;
|
|
346
|
+
invoiceId: z.ZodString;
|
|
347
|
+
invoiceNumber: z.ZodString;
|
|
348
|
+
invoiceType: z.ZodEnum<{
|
|
349
|
+
invoice: "invoice";
|
|
350
|
+
proforma: "proforma";
|
|
351
|
+
credit_note: "credit_note";
|
|
352
|
+
}>;
|
|
353
|
+
status: z.ZodEnum<{
|
|
354
|
+
completed: "completed";
|
|
355
|
+
pending: "pending";
|
|
356
|
+
failed: "failed";
|
|
357
|
+
refunded: "refunded";
|
|
358
|
+
}>;
|
|
359
|
+
paymentMethod: z.ZodEnum<{
|
|
360
|
+
other: "other";
|
|
361
|
+
voucher: "voucher";
|
|
362
|
+
wallet: "wallet";
|
|
363
|
+
bank_transfer: "bank_transfer";
|
|
364
|
+
credit_card: "credit_card";
|
|
365
|
+
debit_card: "debit_card";
|
|
366
|
+
cash: "cash";
|
|
367
|
+
cheque: "cheque";
|
|
368
|
+
direct_bill: "direct_bill";
|
|
369
|
+
}>;
|
|
370
|
+
amountCents: z.ZodNumber;
|
|
371
|
+
currency: z.ZodString;
|
|
372
|
+
paymentDate: z.ZodString;
|
|
373
|
+
referenceNumber: z.ZodNullable<z.ZodString>;
|
|
374
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
375
|
+
}, z.core.$strip>;
|
|
376
|
+
export declare const publicBookingFinancePaymentsSchema: z.ZodObject<{
|
|
377
|
+
bookingId: z.ZodString;
|
|
378
|
+
payments: z.ZodArray<z.ZodObject<{
|
|
379
|
+
id: z.ZodString;
|
|
380
|
+
invoiceId: z.ZodString;
|
|
381
|
+
invoiceNumber: z.ZodString;
|
|
382
|
+
invoiceType: z.ZodEnum<{
|
|
383
|
+
invoice: "invoice";
|
|
384
|
+
proforma: "proforma";
|
|
385
|
+
credit_note: "credit_note";
|
|
386
|
+
}>;
|
|
387
|
+
status: z.ZodEnum<{
|
|
388
|
+
completed: "completed";
|
|
389
|
+
pending: "pending";
|
|
390
|
+
failed: "failed";
|
|
391
|
+
refunded: "refunded";
|
|
392
|
+
}>;
|
|
393
|
+
paymentMethod: z.ZodEnum<{
|
|
394
|
+
other: "other";
|
|
395
|
+
voucher: "voucher";
|
|
396
|
+
wallet: "wallet";
|
|
397
|
+
bank_transfer: "bank_transfer";
|
|
398
|
+
credit_card: "credit_card";
|
|
399
|
+
debit_card: "debit_card";
|
|
400
|
+
cash: "cash";
|
|
401
|
+
cheque: "cheque";
|
|
402
|
+
direct_bill: "direct_bill";
|
|
403
|
+
}>;
|
|
404
|
+
amountCents: z.ZodNumber;
|
|
405
|
+
currency: z.ZodString;
|
|
406
|
+
paymentDate: z.ZodString;
|
|
407
|
+
referenceNumber: z.ZodNullable<z.ZodString>;
|
|
408
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
409
|
+
}, z.core.$strip>>;
|
|
410
|
+
}, z.core.$strip>;
|
|
344
411
|
export declare const publicVoucherValidationSchema: z.ZodObject<{
|
|
345
412
|
valid: z.ZodBoolean;
|
|
346
413
|
reason: z.ZodNullable<z.ZodEnum<{
|
|
@@ -368,6 +435,8 @@ export type PublicBookingPaymentOptions = z.infer<typeof publicBookingPaymentOpt
|
|
|
368
435
|
export type PublicPaymentSession = z.infer<typeof publicPaymentSessionSchema>;
|
|
369
436
|
export type PublicFinanceBookingDocument = z.infer<typeof publicFinanceBookingDocumentSchema>;
|
|
370
437
|
export type PublicBookingFinanceDocuments = z.infer<typeof publicBookingFinanceDocumentsSchema>;
|
|
438
|
+
export type PublicFinanceBookingPayment = z.infer<typeof publicFinanceBookingPaymentSchema>;
|
|
439
|
+
export type PublicBookingFinancePayments = z.infer<typeof publicBookingFinancePaymentsSchema>;
|
|
371
440
|
export type PublicStartPaymentSessionInput = z.infer<typeof publicStartPaymentSessionSchema>;
|
|
372
441
|
export type PublicValidateVoucherInput = z.infer<typeof publicValidateVoucherSchema>;
|
|
373
442
|
export type PublicVoucherValidationResult = z.infer<typeof publicVoucherValidationSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-public.d.ts","sourceRoot":"","sources":["../src/validation-public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,eAAO,MAAM,8BAA8B;;;;EAAiD,CAAA;AAC5F,eAAO,MAAM,uCAAuC;;;;;;EAMlD,CAAA;AACF,eAAO,MAAM,iCAAiC;;;;;EAAyC,CAAA;AAEvF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;iBAM1C,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkB1C,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;iBAMtC,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWrC,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;iBAQ7C,CAAA;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;iBAWvC,CAAA;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW5C,CAAA;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC7F,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA;AAC/F,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAC3F,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC7F,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAC5F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AACpF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
|
|
@@ -138,6 +138,23 @@ export const publicBookingFinanceDocumentsSchema = z.object({
|
|
|
138
138
|
bookingId: z.string(),
|
|
139
139
|
documents: z.array(publicFinanceBookingDocumentSchema),
|
|
140
140
|
});
|
|
141
|
+
export const publicFinanceBookingPaymentSchema = z.object({
|
|
142
|
+
id: z.string(),
|
|
143
|
+
invoiceId: z.string(),
|
|
144
|
+
invoiceNumber: z.string(),
|
|
145
|
+
invoiceType: publicFinanceInvoiceTypeSchema,
|
|
146
|
+
status: z.enum(["pending", "completed", "failed", "refunded"]),
|
|
147
|
+
paymentMethod: paymentMethodSchema,
|
|
148
|
+
amountCents: z.number().int(),
|
|
149
|
+
currency: z.string(),
|
|
150
|
+
paymentDate: z.string(),
|
|
151
|
+
referenceNumber: z.string().nullable(),
|
|
152
|
+
notes: z.string().nullable(),
|
|
153
|
+
});
|
|
154
|
+
export const publicBookingFinancePaymentsSchema = z.object({
|
|
155
|
+
bookingId: z.string(),
|
|
156
|
+
payments: z.array(publicFinanceBookingPaymentSchema),
|
|
157
|
+
});
|
|
141
158
|
export const publicVoucherValidationSchema = z.object({
|
|
142
159
|
valid: z.boolean(),
|
|
143
160
|
reason: z
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/finance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -33,10 +33,12 @@
|
|
|
33
33
|
"drizzle-orm": "^0.45.2",
|
|
34
34
|
"hono": "^4.12.10",
|
|
35
35
|
"zod": "^4.3.6",
|
|
36
|
-
"@voyantjs/bookings": "0.
|
|
37
|
-
"@voyantjs/core": "0.
|
|
38
|
-
"@voyantjs/db": "0.
|
|
39
|
-
"@voyantjs/hono": "0.
|
|
36
|
+
"@voyantjs/bookings": "0.4.0",
|
|
37
|
+
"@voyantjs/core": "0.4.0",
|
|
38
|
+
"@voyantjs/db": "0.4.0",
|
|
39
|
+
"@voyantjs/hono": "0.4.0",
|
|
40
|
+
"@voyantjs/utils": "0.4.0",
|
|
41
|
+
"@voyantjs/voyant-storage": "0.4.0"
|
|
40
42
|
},
|
|
41
43
|
"devDependencies": {
|
|
42
44
|
"typescript": "^6.0.2",
|