@voyantjs/finance 0.2.0 → 0.3.1
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 +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/routes-public.d.ts +476 -0
- package/dist/routes-public.d.ts.map +1 -0
- package/dist/routes-public.js +56 -0
- package/dist/routes-shared.d.ts +12 -0
- package/dist/routes-shared.d.ts.map +1 -0
- package/dist/routes-shared.js +3 -0
- package/dist/routes.d.ts +207 -161
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +40 -1
- package/dist/schema.d.ts +17 -17
- package/dist/service-public.d.ts +250 -0
- package/dist/service-public.d.ts.map +1 -0
- package/dist/service-public.js +366 -0
- package/dist/service.d.ts +175 -181
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +52 -10
- package/dist/validation-billing.d.ts +478 -0
- package/dist/validation-billing.d.ts.map +1 -0
- package/dist/validation-billing.js +219 -0
- package/dist/validation-payments.d.ts +840 -0
- package/dist/validation-payments.d.ts.map +1 -0
- package/dist/validation-payments.js +301 -0
- package/dist/validation-public.d.ts +374 -0
- package/dist/validation-public.d.ts.map +1 -0
- package/dist/validation-public.js +166 -0
- package/dist/validation-shared.d.ts +159 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-shared.js +131 -0
- package/dist/validation.d.ts +4 -1315
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +4 -657
- package/package.json +13 -5
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -1,657 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"credit_card",
|
|
6
|
-
"debit_card",
|
|
7
|
-
"cash",
|
|
8
|
-
"cheque",
|
|
9
|
-
"wallet",
|
|
10
|
-
"direct_bill",
|
|
11
|
-
"voucher",
|
|
12
|
-
"other",
|
|
13
|
-
]);
|
|
14
|
-
const paymentStatusSchema = z.enum(["pending", "completed", "failed", "refunded"]);
|
|
15
|
-
const paymentSessionStatusSchema = z.enum([
|
|
16
|
-
"pending",
|
|
17
|
-
"requires_redirect",
|
|
18
|
-
"processing",
|
|
19
|
-
"authorized",
|
|
20
|
-
"paid",
|
|
21
|
-
"failed",
|
|
22
|
-
"cancelled",
|
|
23
|
-
"expired",
|
|
24
|
-
]);
|
|
25
|
-
const paymentSessionTargetTypeSchema = z.enum([
|
|
26
|
-
"booking",
|
|
27
|
-
"order",
|
|
28
|
-
"invoice",
|
|
29
|
-
"booking_payment_schedule",
|
|
30
|
-
"booking_guarantee",
|
|
31
|
-
"other",
|
|
32
|
-
]);
|
|
33
|
-
const paymentInstrumentTypeSchema = z.enum([
|
|
34
|
-
"credit_card",
|
|
35
|
-
"debit_card",
|
|
36
|
-
"bank_account",
|
|
37
|
-
"wallet",
|
|
38
|
-
"voucher",
|
|
39
|
-
"direct_bill",
|
|
40
|
-
"cash",
|
|
41
|
-
"other",
|
|
42
|
-
]);
|
|
43
|
-
const paymentInstrumentOwnerTypeSchema = z.enum([
|
|
44
|
-
"client",
|
|
45
|
-
"supplier",
|
|
46
|
-
"channel",
|
|
47
|
-
"agency",
|
|
48
|
-
"internal",
|
|
49
|
-
"other",
|
|
50
|
-
]);
|
|
51
|
-
const paymentInstrumentStatusSchema = z.enum([
|
|
52
|
-
"active",
|
|
53
|
-
"inactive",
|
|
54
|
-
"expired",
|
|
55
|
-
"revoked",
|
|
56
|
-
"failed_verification",
|
|
57
|
-
]);
|
|
58
|
-
const paymentAuthorizationStatusSchema = z.enum([
|
|
59
|
-
"pending",
|
|
60
|
-
"authorized",
|
|
61
|
-
"partially_captured",
|
|
62
|
-
"captured",
|
|
63
|
-
"voided",
|
|
64
|
-
"failed",
|
|
65
|
-
"expired",
|
|
66
|
-
]);
|
|
67
|
-
const paymentCaptureStatusSchema = z.enum(["pending", "completed", "failed", "refunded", "voided"]);
|
|
68
|
-
const captureModeSchema = z.enum(["automatic", "manual"]);
|
|
69
|
-
const creditNoteStatusSchema = z.enum(["draft", "issued", "applied"]);
|
|
70
|
-
const paymentScheduleTypeSchema = z.enum(["deposit", "installment", "balance", "hold", "other"]);
|
|
71
|
-
const paymentScheduleStatusSchema = z.enum([
|
|
72
|
-
"pending",
|
|
73
|
-
"due",
|
|
74
|
-
"paid",
|
|
75
|
-
"waived",
|
|
76
|
-
"cancelled",
|
|
77
|
-
"expired",
|
|
78
|
-
]);
|
|
79
|
-
const guaranteeTypeSchema = z.enum([
|
|
80
|
-
"deposit",
|
|
81
|
-
"credit_card",
|
|
82
|
-
"preauth",
|
|
83
|
-
"card_on_file",
|
|
84
|
-
"bank_transfer",
|
|
85
|
-
"voucher",
|
|
86
|
-
"agency_letter",
|
|
87
|
-
"other",
|
|
88
|
-
]);
|
|
89
|
-
const guaranteeStatusSchema = z.enum([
|
|
90
|
-
"pending",
|
|
91
|
-
"active",
|
|
92
|
-
"released",
|
|
93
|
-
"failed",
|
|
94
|
-
"cancelled",
|
|
95
|
-
"expired",
|
|
96
|
-
]);
|
|
97
|
-
const taxScopeSchema = z.enum(["included", "excluded", "withheld"]);
|
|
98
|
-
const commissionRecipientTypeSchema = z.enum([
|
|
99
|
-
"channel",
|
|
100
|
-
"affiliate",
|
|
101
|
-
"agency",
|
|
102
|
-
"agent",
|
|
103
|
-
"internal",
|
|
104
|
-
"supplier",
|
|
105
|
-
"other",
|
|
106
|
-
]);
|
|
107
|
-
const commissionModelSchema = z.enum(["percentage", "fixed", "markup", "net"]);
|
|
108
|
-
const commissionStatusSchema = z.enum(["pending", "accrued", "payable", "paid", "void"]);
|
|
109
|
-
const paginationSchema = z.object({
|
|
110
|
-
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
111
|
-
offset: z.coerce.number().int().min(0).default(0),
|
|
112
|
-
});
|
|
113
|
-
// ---------- payment instruments ----------
|
|
114
|
-
const paymentInstrumentCoreSchema = z.object({
|
|
115
|
-
ownerType: paymentInstrumentOwnerTypeSchema.default("client"),
|
|
116
|
-
personId: z.string().optional().nullable(),
|
|
117
|
-
organizationId: z.string().optional().nullable(),
|
|
118
|
-
supplierId: z.string().optional().nullable(),
|
|
119
|
-
channelId: z.string().optional().nullable(),
|
|
120
|
-
instrumentType: paymentInstrumentTypeSchema,
|
|
121
|
-
status: paymentInstrumentStatusSchema.default("active"),
|
|
122
|
-
label: z.string().min(1).max(255),
|
|
123
|
-
provider: z.string().max(255).optional().nullable(),
|
|
124
|
-
brand: z.string().max(100).optional().nullable(),
|
|
125
|
-
last4: z.string().max(4).optional().nullable(),
|
|
126
|
-
holderName: z.string().max(255).optional().nullable(),
|
|
127
|
-
expiryMonth: z.number().int().min(1).max(12).optional().nullable(),
|
|
128
|
-
expiryYear: z.number().int().min(2000).max(9999).optional().nullable(),
|
|
129
|
-
externalToken: z.string().max(255).optional().nullable(),
|
|
130
|
-
externalCustomerId: z.string().max(255).optional().nullable(),
|
|
131
|
-
billingEmail: z.string().email().optional().nullable(),
|
|
132
|
-
billingAddress: z.string().max(2000).optional().nullable(),
|
|
133
|
-
directBillReference: z.string().max(255).optional().nullable(),
|
|
134
|
-
notes: z.string().optional().nullable(),
|
|
135
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
136
|
-
});
|
|
137
|
-
export const insertPaymentInstrumentSchema = paymentInstrumentCoreSchema;
|
|
138
|
-
export const updatePaymentInstrumentSchema = paymentInstrumentCoreSchema.partial();
|
|
139
|
-
export const paymentInstrumentListQuerySchema = paginationSchema.extend({
|
|
140
|
-
ownerType: paymentInstrumentOwnerTypeSchema.optional(),
|
|
141
|
-
personId: z.string().optional(),
|
|
142
|
-
organizationId: z.string().optional(),
|
|
143
|
-
supplierId: z.string().optional(),
|
|
144
|
-
channelId: z.string().optional(),
|
|
145
|
-
status: paymentInstrumentStatusSchema.optional(),
|
|
146
|
-
instrumentType: paymentInstrumentTypeSchema.optional(),
|
|
147
|
-
search: z.string().optional(),
|
|
148
|
-
});
|
|
149
|
-
// ---------- payment sessions ----------
|
|
150
|
-
const paymentSessionCoreSchema = z.object({
|
|
151
|
-
targetType: paymentSessionTargetTypeSchema.default("other"),
|
|
152
|
-
targetId: z.string().optional().nullable(),
|
|
153
|
-
bookingId: z.string().optional().nullable(),
|
|
154
|
-
orderId: z.string().optional().nullable(),
|
|
155
|
-
invoiceId: z.string().optional().nullable(),
|
|
156
|
-
bookingPaymentScheduleId: z.string().optional().nullable(),
|
|
157
|
-
bookingGuaranteeId: z.string().optional().nullable(),
|
|
158
|
-
paymentInstrumentId: z.string().optional().nullable(),
|
|
159
|
-
paymentAuthorizationId: z.string().optional().nullable(),
|
|
160
|
-
paymentCaptureId: z.string().optional().nullable(),
|
|
161
|
-
paymentId: z.string().optional().nullable(),
|
|
162
|
-
status: paymentSessionStatusSchema.default("pending"),
|
|
163
|
-
provider: z.string().max(255).optional().nullable(),
|
|
164
|
-
providerSessionId: z.string().max(255).optional().nullable(),
|
|
165
|
-
providerPaymentId: z.string().max(255).optional().nullable(),
|
|
166
|
-
externalReference: z.string().max(255).optional().nullable(),
|
|
167
|
-
idempotencyKey: z.string().max(255).optional().nullable(),
|
|
168
|
-
clientReference: z.string().max(255).optional().nullable(),
|
|
169
|
-
currency: z.string().min(3).max(3),
|
|
170
|
-
amountCents: z.number().int().min(1),
|
|
171
|
-
paymentMethod: paymentMethodSchema.optional().nullable(),
|
|
172
|
-
payerPersonId: z.string().optional().nullable(),
|
|
173
|
-
payerOrganizationId: z.string().optional().nullable(),
|
|
174
|
-
payerEmail: z.string().email().optional().nullable(),
|
|
175
|
-
payerName: z.string().max(255).optional().nullable(),
|
|
176
|
-
redirectUrl: z.string().url().optional().nullable(),
|
|
177
|
-
returnUrl: z.string().url().optional().nullable(),
|
|
178
|
-
cancelUrl: z.string().url().optional().nullable(),
|
|
179
|
-
callbackUrl: z.string().url().optional().nullable(),
|
|
180
|
-
expiresAt: z.string().optional().nullable(),
|
|
181
|
-
completedAt: z.string().optional().nullable(),
|
|
182
|
-
failedAt: z.string().optional().nullable(),
|
|
183
|
-
cancelledAt: z.string().optional().nullable(),
|
|
184
|
-
expiredAt: z.string().optional().nullable(),
|
|
185
|
-
failureCode: z.string().max(255).optional().nullable(),
|
|
186
|
-
failureMessage: z.string().max(2000).optional().nullable(),
|
|
187
|
-
notes: z.string().optional().nullable(),
|
|
188
|
-
providerPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
189
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
190
|
-
});
|
|
191
|
-
export const insertPaymentSessionSchema = paymentSessionCoreSchema;
|
|
192
|
-
export const updatePaymentSessionSchema = paymentSessionCoreSchema.partial();
|
|
193
|
-
export const paymentSessionListQuerySchema = paginationSchema.extend({
|
|
194
|
-
bookingId: z.string().optional(),
|
|
195
|
-
orderId: z.string().optional(),
|
|
196
|
-
invoiceId: z.string().optional(),
|
|
197
|
-
bookingPaymentScheduleId: z.string().optional(),
|
|
198
|
-
bookingGuaranteeId: z.string().optional(),
|
|
199
|
-
targetType: paymentSessionTargetTypeSchema.optional(),
|
|
200
|
-
status: paymentSessionStatusSchema.optional(),
|
|
201
|
-
provider: z.string().optional(),
|
|
202
|
-
providerSessionId: z.string().optional(),
|
|
203
|
-
providerPaymentId: z.string().optional(),
|
|
204
|
-
externalReference: z.string().optional(),
|
|
205
|
-
clientReference: z.string().optional(),
|
|
206
|
-
idempotencyKey: z.string().optional(),
|
|
207
|
-
});
|
|
208
|
-
const paymentSessionProvisioningSchema = z.object({
|
|
209
|
-
provider: z.string().max(255).optional().nullable(),
|
|
210
|
-
paymentMethod: paymentMethodSchema.optional().nullable(),
|
|
211
|
-
payerPersonId: z.string().optional().nullable(),
|
|
212
|
-
payerOrganizationId: z.string().optional().nullable(),
|
|
213
|
-
payerEmail: z.string().email().optional().nullable(),
|
|
214
|
-
payerName: z.string().max(255).optional().nullable(),
|
|
215
|
-
externalReference: z.string().max(255).optional().nullable(),
|
|
216
|
-
idempotencyKey: z.string().max(255).optional().nullable(),
|
|
217
|
-
clientReference: z.string().max(255).optional().nullable(),
|
|
218
|
-
returnUrl: z.string().url().optional().nullable(),
|
|
219
|
-
cancelUrl: z.string().url().optional().nullable(),
|
|
220
|
-
callbackUrl: z.string().url().optional().nullable(),
|
|
221
|
-
expiresAt: z.string().optional().nullable(),
|
|
222
|
-
notes: z.string().optional().nullable(),
|
|
223
|
-
providerPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
224
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
225
|
-
});
|
|
226
|
-
export const createPaymentSessionFromScheduleSchema = paymentSessionProvisioningSchema;
|
|
227
|
-
export const createPaymentSessionFromGuaranteeSchema = paymentSessionProvisioningSchema;
|
|
228
|
-
export const createPaymentSessionFromInvoiceSchema = paymentSessionProvisioningSchema;
|
|
229
|
-
export const applyDefaultBookingPaymentPlanSchema = z.object({
|
|
230
|
-
depositMode: z.enum(["none", "percentage", "fixed_amount"]).default("percentage"),
|
|
231
|
-
depositValue: z.number().int().min(0).default(30),
|
|
232
|
-
depositDueDate: z.string().optional().nullable(),
|
|
233
|
-
balanceDueDaysBeforeStart: z.number().int().min(0).default(30),
|
|
234
|
-
clearExistingPending: z.boolean().default(true),
|
|
235
|
-
createGuarantee: z.boolean().default(false),
|
|
236
|
-
guaranteeType: guaranteeTypeSchema.default("deposit"),
|
|
237
|
-
notes: z.string().optional().nullable(),
|
|
238
|
-
});
|
|
239
|
-
export const markPaymentSessionRequiresRedirectSchema = z.object({
|
|
240
|
-
provider: z.string().max(255).optional().nullable(),
|
|
241
|
-
providerSessionId: z.string().max(255).optional().nullable(),
|
|
242
|
-
providerPaymentId: z.string().max(255).optional().nullable(),
|
|
243
|
-
externalReference: z.string().max(255).optional().nullable(),
|
|
244
|
-
redirectUrl: z.string().url(),
|
|
245
|
-
returnUrl: z.string().url().optional().nullable(),
|
|
246
|
-
cancelUrl: z.string().url().optional().nullable(),
|
|
247
|
-
callbackUrl: z.string().url().optional().nullable(),
|
|
248
|
-
expiresAt: z.string().optional().nullable(),
|
|
249
|
-
providerPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
250
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
251
|
-
notes: z.string().optional().nullable(),
|
|
252
|
-
});
|
|
253
|
-
export const completePaymentSessionSchema = z.object({
|
|
254
|
-
status: z.enum(["authorized", "paid"]).default("paid"),
|
|
255
|
-
providerSessionId: z.string().max(255).optional().nullable(),
|
|
256
|
-
providerPaymentId: z.string().max(255).optional().nullable(),
|
|
257
|
-
externalReference: z.string().max(255).optional().nullable(),
|
|
258
|
-
paymentMethod: paymentMethodSchema.optional().nullable(),
|
|
259
|
-
paymentInstrumentId: z.string().optional().nullable(),
|
|
260
|
-
captureMode: captureModeSchema.default("manual"),
|
|
261
|
-
externalAuthorizationId: z.string().max(255).optional().nullable(),
|
|
262
|
-
externalCaptureId: z.string().max(255).optional().nullable(),
|
|
263
|
-
approvalCode: z.string().max(255).optional().nullable(),
|
|
264
|
-
authorizedAt: z.string().optional().nullable(),
|
|
265
|
-
capturedAt: z.string().optional().nullable(),
|
|
266
|
-
settledAt: z.string().optional().nullable(),
|
|
267
|
-
paymentDate: z.string().optional().nullable(),
|
|
268
|
-
expiresAt: z.string().optional().nullable(),
|
|
269
|
-
referenceNumber: z.string().max(255).optional().nullable(),
|
|
270
|
-
notes: z.string().optional().nullable(),
|
|
271
|
-
providerPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
272
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
273
|
-
});
|
|
274
|
-
export const failPaymentSessionSchema = z.object({
|
|
275
|
-
providerSessionId: z.string().max(255).optional().nullable(),
|
|
276
|
-
providerPaymentId: z.string().max(255).optional().nullable(),
|
|
277
|
-
externalReference: z.string().max(255).optional().nullable(),
|
|
278
|
-
failureCode: z.string().max(255).optional().nullable(),
|
|
279
|
-
failureMessage: z.string().max(2000).optional().nullable(),
|
|
280
|
-
notes: z.string().optional().nullable(),
|
|
281
|
-
providerPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
282
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
283
|
-
});
|
|
284
|
-
export const cancelPaymentSessionSchema = z.object({
|
|
285
|
-
notes: z.string().optional().nullable(),
|
|
286
|
-
providerPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
287
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
288
|
-
cancelledAt: z.string().optional().nullable(),
|
|
289
|
-
});
|
|
290
|
-
export const expirePaymentSessionSchema = z.object({
|
|
291
|
-
notes: z.string().optional().nullable(),
|
|
292
|
-
providerPayload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
293
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
294
|
-
expiredAt: z.string().optional().nullable(),
|
|
295
|
-
});
|
|
296
|
-
// ---------- payment authorizations ----------
|
|
297
|
-
const paymentAuthorizationCoreSchema = z.object({
|
|
298
|
-
bookingId: z.string().optional().nullable(),
|
|
299
|
-
orderId: z.string().optional().nullable(),
|
|
300
|
-
invoiceId: z.string().optional().nullable(),
|
|
301
|
-
bookingGuaranteeId: z.string().optional().nullable(),
|
|
302
|
-
paymentInstrumentId: z.string().optional().nullable(),
|
|
303
|
-
status: paymentAuthorizationStatusSchema.default("pending"),
|
|
304
|
-
captureMode: captureModeSchema.default("manual"),
|
|
305
|
-
currency: z.string().min(3).max(3),
|
|
306
|
-
amountCents: z.number().int().min(0),
|
|
307
|
-
provider: z.string().max(255).optional().nullable(),
|
|
308
|
-
externalAuthorizationId: z.string().max(255).optional().nullable(),
|
|
309
|
-
approvalCode: z.string().max(255).optional().nullable(),
|
|
310
|
-
authorizedAt: z.string().optional().nullable(),
|
|
311
|
-
expiresAt: z.string().optional().nullable(),
|
|
312
|
-
voidedAt: z.string().optional().nullable(),
|
|
313
|
-
notes: z.string().optional().nullable(),
|
|
314
|
-
});
|
|
315
|
-
export const insertPaymentAuthorizationSchema = paymentAuthorizationCoreSchema;
|
|
316
|
-
export const updatePaymentAuthorizationSchema = paymentAuthorizationCoreSchema.partial();
|
|
317
|
-
export const paymentAuthorizationListQuerySchema = paginationSchema.extend({
|
|
318
|
-
bookingId: z.string().optional(),
|
|
319
|
-
orderId: z.string().optional(),
|
|
320
|
-
invoiceId: z.string().optional(),
|
|
321
|
-
bookingGuaranteeId: z.string().optional(),
|
|
322
|
-
paymentInstrumentId: z.string().optional(),
|
|
323
|
-
status: paymentAuthorizationStatusSchema.optional(),
|
|
324
|
-
});
|
|
325
|
-
// ---------- payment captures ----------
|
|
326
|
-
const paymentCaptureCoreSchema = z.object({
|
|
327
|
-
paymentAuthorizationId: z.string().optional().nullable(),
|
|
328
|
-
invoiceId: z.string().optional().nullable(),
|
|
329
|
-
status: paymentCaptureStatusSchema.default("pending"),
|
|
330
|
-
currency: z.string().min(3).max(3),
|
|
331
|
-
amountCents: z.number().int().min(0),
|
|
332
|
-
provider: z.string().max(255).optional().nullable(),
|
|
333
|
-
externalCaptureId: z.string().max(255).optional().nullable(),
|
|
334
|
-
capturedAt: z.string().optional().nullable(),
|
|
335
|
-
settledAt: z.string().optional().nullable(),
|
|
336
|
-
notes: z.string().optional().nullable(),
|
|
337
|
-
});
|
|
338
|
-
export const insertPaymentCaptureSchema = paymentCaptureCoreSchema;
|
|
339
|
-
export const updatePaymentCaptureSchema = paymentCaptureCoreSchema.partial();
|
|
340
|
-
export const paymentCaptureListQuerySchema = paginationSchema.extend({
|
|
341
|
-
paymentAuthorizationId: z.string().optional(),
|
|
342
|
-
invoiceId: z.string().optional(),
|
|
343
|
-
status: paymentCaptureStatusSchema.optional(),
|
|
344
|
-
});
|
|
345
|
-
// ---------- booking payment schedules ----------
|
|
346
|
-
const bookingPaymentScheduleCoreSchema = z.object({
|
|
347
|
-
bookingItemId: z.string().optional().nullable(),
|
|
348
|
-
scheduleType: paymentScheduleTypeSchema.default("balance"),
|
|
349
|
-
status: paymentScheduleStatusSchema.default("pending"),
|
|
350
|
-
dueDate: z.string().min(1),
|
|
351
|
-
currency: z.string().min(3).max(3),
|
|
352
|
-
amountCents: z.number().int().min(0),
|
|
353
|
-
notes: z.string().optional().nullable(),
|
|
354
|
-
});
|
|
355
|
-
export const insertBookingPaymentScheduleSchema = bookingPaymentScheduleCoreSchema;
|
|
356
|
-
export const updateBookingPaymentScheduleSchema = bookingPaymentScheduleCoreSchema.partial();
|
|
357
|
-
// ---------- booking guarantees ----------
|
|
358
|
-
const bookingGuaranteeCoreSchema = z.object({
|
|
359
|
-
bookingPaymentScheduleId: z.string().optional().nullable(),
|
|
360
|
-
bookingItemId: z.string().optional().nullable(),
|
|
361
|
-
guaranteeType: guaranteeTypeSchema,
|
|
362
|
-
status: guaranteeStatusSchema.default("pending"),
|
|
363
|
-
paymentInstrumentId: z.string().optional().nullable(),
|
|
364
|
-
paymentAuthorizationId: z.string().optional().nullable(),
|
|
365
|
-
currency: z.string().min(3).max(3).optional().nullable(),
|
|
366
|
-
amountCents: z.number().int().min(0).optional().nullable(),
|
|
367
|
-
provider: z.string().max(255).optional().nullable(),
|
|
368
|
-
referenceNumber: z.string().max(255).optional().nullable(),
|
|
369
|
-
guaranteedAt: z.string().optional().nullable(),
|
|
370
|
-
expiresAt: z.string().optional().nullable(),
|
|
371
|
-
releasedAt: z.string().optional().nullable(),
|
|
372
|
-
notes: z.string().optional().nullable(),
|
|
373
|
-
});
|
|
374
|
-
export const insertBookingGuaranteeSchema = bookingGuaranteeCoreSchema;
|
|
375
|
-
export const updateBookingGuaranteeSchema = bookingGuaranteeCoreSchema.partial();
|
|
376
|
-
// ---------- booking item tax lines ----------
|
|
377
|
-
const bookingItemTaxLineCoreSchema = z.object({
|
|
378
|
-
code: z.string().max(100).optional().nullable(),
|
|
379
|
-
name: z.string().min(1).max(255),
|
|
380
|
-
jurisdiction: z.string().max(255).optional().nullable(),
|
|
381
|
-
scope: taxScopeSchema.default("excluded"),
|
|
382
|
-
currency: z.string().min(3).max(3),
|
|
383
|
-
amountCents: z.number().int(),
|
|
384
|
-
rateBasisPoints: z.number().int().min(0).optional().nullable(),
|
|
385
|
-
includedInPrice: z.boolean().default(false),
|
|
386
|
-
remittanceParty: z.string().max(255).optional().nullable(),
|
|
387
|
-
sortOrder: z.number().int().min(0).default(0),
|
|
388
|
-
});
|
|
389
|
-
export const insertBookingItemTaxLineSchema = bookingItemTaxLineCoreSchema;
|
|
390
|
-
export const updateBookingItemTaxLineSchema = bookingItemTaxLineCoreSchema.partial();
|
|
391
|
-
// ---------- booking item commissions ----------
|
|
392
|
-
const bookingItemCommissionCoreSchema = z.object({
|
|
393
|
-
channelId: z.string().optional().nullable(),
|
|
394
|
-
recipientType: commissionRecipientTypeSchema,
|
|
395
|
-
commissionModel: commissionModelSchema.default("percentage"),
|
|
396
|
-
currency: z.string().min(3).max(3).optional().nullable(),
|
|
397
|
-
amountCents: z.number().int().optional().nullable(),
|
|
398
|
-
rateBasisPoints: z.number().int().min(0).optional().nullable(),
|
|
399
|
-
status: commissionStatusSchema.default("pending"),
|
|
400
|
-
payableAt: z.string().optional().nullable(),
|
|
401
|
-
paidAt: z.string().optional().nullable(),
|
|
402
|
-
notes: z.string().optional().nullable(),
|
|
403
|
-
});
|
|
404
|
-
export const insertBookingItemCommissionSchema = bookingItemCommissionCoreSchema;
|
|
405
|
-
export const updateBookingItemCommissionSchema = bookingItemCommissionCoreSchema.partial();
|
|
406
|
-
// ---------- invoices ----------
|
|
407
|
-
const invoiceCoreSchema = z.object({
|
|
408
|
-
invoiceNumber: z.string().min(1).max(50),
|
|
409
|
-
bookingId: z.string().min(1),
|
|
410
|
-
personId: z.string().optional().nullable(),
|
|
411
|
-
organizationId: z.string().optional().nullable(),
|
|
412
|
-
status: invoiceStatusSchema.default("draft"),
|
|
413
|
-
currency: z.string().min(3).max(3),
|
|
414
|
-
baseCurrency: z.string().min(3).max(3).optional().nullable(),
|
|
415
|
-
fxRateSetId: z.string().optional().nullable(),
|
|
416
|
-
subtotalCents: z.number().int().min(0).default(0),
|
|
417
|
-
baseSubtotalCents: z.number().int().min(0).optional().nullable(),
|
|
418
|
-
taxCents: z.number().int().min(0).default(0),
|
|
419
|
-
baseTaxCents: z.number().int().min(0).optional().nullable(),
|
|
420
|
-
totalCents: z.number().int().min(0).default(0),
|
|
421
|
-
baseTotalCents: z.number().int().min(0).optional().nullable(),
|
|
422
|
-
paidCents: z.number().int().min(0).default(0),
|
|
423
|
-
basePaidCents: z.number().int().min(0).optional().nullable(),
|
|
424
|
-
balanceDueCents: z.number().int().min(0).default(0),
|
|
425
|
-
baseBalanceDueCents: z.number().int().min(0).optional().nullable(),
|
|
426
|
-
commissionPercent: z.number().int().min(0).max(100).optional().nullable(),
|
|
427
|
-
commissionAmountCents: z.number().int().min(0).optional().nullable(),
|
|
428
|
-
issueDate: z.string().min(1),
|
|
429
|
-
dueDate: z.string().min(1),
|
|
430
|
-
notes: z.string().optional().nullable(),
|
|
431
|
-
});
|
|
432
|
-
export const insertInvoiceSchema = invoiceCoreSchema;
|
|
433
|
-
export const updateInvoiceSchema = invoiceCoreSchema.partial();
|
|
434
|
-
export const invoiceListQuerySchema = z.object({
|
|
435
|
-
status: invoiceStatusSchema.optional(),
|
|
436
|
-
bookingId: z.string().optional(),
|
|
437
|
-
search: z.string().optional(),
|
|
438
|
-
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
439
|
-
offset: z.coerce.number().int().min(0).default(0),
|
|
440
|
-
});
|
|
441
|
-
export const invoiceFromBookingSchema = z.object({
|
|
442
|
-
bookingId: z.string().min(1),
|
|
443
|
-
invoiceNumber: z.string().min(1).max(50),
|
|
444
|
-
issueDate: z.string().min(1),
|
|
445
|
-
dueDate: z.string().min(1),
|
|
446
|
-
notes: z.string().optional().nullable(),
|
|
447
|
-
});
|
|
448
|
-
// ---------- invoice line items ----------
|
|
449
|
-
const lineItemCoreSchema = z.object({
|
|
450
|
-
bookingItemId: z.string().optional().nullable(),
|
|
451
|
-
description: z.string().min(1).max(1000),
|
|
452
|
-
quantity: z.number().int().min(1).default(1),
|
|
453
|
-
unitPriceCents: z.number().int().min(0),
|
|
454
|
-
totalCents: z.number().int().min(0),
|
|
455
|
-
taxRate: z.number().int().min(0).optional().nullable(),
|
|
456
|
-
sortOrder: z.number().int().min(0).default(0),
|
|
457
|
-
});
|
|
458
|
-
export const insertInvoiceLineItemSchema = lineItemCoreSchema;
|
|
459
|
-
export const updateInvoiceLineItemSchema = lineItemCoreSchema.partial();
|
|
460
|
-
// ---------- payments ----------
|
|
461
|
-
const paymentCoreSchema = z.object({
|
|
462
|
-
amountCents: z.number().int().min(1),
|
|
463
|
-
currency: z.string().min(3).max(3),
|
|
464
|
-
baseCurrency: z.string().min(3).max(3).optional().nullable(),
|
|
465
|
-
baseAmountCents: z.number().int().min(0).optional().nullable(),
|
|
466
|
-
fxRateSetId: z.string().optional().nullable(),
|
|
467
|
-
paymentMethod: paymentMethodSchema,
|
|
468
|
-
paymentInstrumentId: z.string().optional().nullable(),
|
|
469
|
-
paymentAuthorizationId: z.string().optional().nullable(),
|
|
470
|
-
paymentCaptureId: z.string().optional().nullable(),
|
|
471
|
-
status: paymentStatusSchema.default("pending"),
|
|
472
|
-
referenceNumber: z.string().max(255).optional().nullable(),
|
|
473
|
-
paymentDate: z.string().min(1),
|
|
474
|
-
notes: z.string().optional().nullable(),
|
|
475
|
-
});
|
|
476
|
-
export const insertPaymentSchema = paymentCoreSchema;
|
|
477
|
-
export const updatePaymentSchema = paymentCoreSchema.partial();
|
|
478
|
-
// ---------- credit notes ----------
|
|
479
|
-
const creditNoteCoreSchema = z.object({
|
|
480
|
-
creditNoteNumber: z.string().min(1).max(50),
|
|
481
|
-
status: creditNoteStatusSchema.default("draft"),
|
|
482
|
-
amountCents: z.number().int().min(1),
|
|
483
|
-
currency: z.string().min(3).max(3),
|
|
484
|
-
baseCurrency: z.string().min(3).max(3).optional().nullable(),
|
|
485
|
-
baseAmountCents: z.number().int().min(0).optional().nullable(),
|
|
486
|
-
fxRateSetId: z.string().optional().nullable(),
|
|
487
|
-
reason: z.string().min(1).max(1000),
|
|
488
|
-
notes: z.string().optional().nullable(),
|
|
489
|
-
});
|
|
490
|
-
export const insertCreditNoteSchema = creditNoteCoreSchema;
|
|
491
|
-
export const updateCreditNoteSchema = creditNoteCoreSchema.partial();
|
|
492
|
-
// ---------- credit note line items ----------
|
|
493
|
-
const creditNoteLineItemCoreSchema = z.object({
|
|
494
|
-
description: z.string().min(1).max(1000),
|
|
495
|
-
quantity: z.number().int().min(1).default(1),
|
|
496
|
-
unitPriceCents: z.number().int().min(0),
|
|
497
|
-
totalCents: z.number().int().min(0),
|
|
498
|
-
sortOrder: z.number().int().min(0).default(0),
|
|
499
|
-
});
|
|
500
|
-
export const insertCreditNoteLineItemSchema = creditNoteLineItemCoreSchema;
|
|
501
|
-
export const updateCreditNoteLineItemSchema = creditNoteLineItemCoreSchema.partial();
|
|
502
|
-
// ---------- supplier payments ----------
|
|
503
|
-
const supplierPaymentCoreSchema = z.object({
|
|
504
|
-
bookingId: z.string().min(1),
|
|
505
|
-
supplierId: z.string().optional().nullable(),
|
|
506
|
-
bookingSupplierStatusId: z.string().optional().nullable(),
|
|
507
|
-
amountCents: z.number().int().min(1),
|
|
508
|
-
currency: z.string().min(3).max(3),
|
|
509
|
-
baseCurrency: z.string().min(3).max(3).optional().nullable(),
|
|
510
|
-
baseAmountCents: z.number().int().min(0).optional().nullable(),
|
|
511
|
-
fxRateSetId: z.string().optional().nullable(),
|
|
512
|
-
paymentMethod: paymentMethodSchema,
|
|
513
|
-
paymentInstrumentId: z.string().optional().nullable(),
|
|
514
|
-
status: paymentStatusSchema.default("pending"),
|
|
515
|
-
referenceNumber: z.string().max(255).optional().nullable(),
|
|
516
|
-
paymentDate: z.string().min(1),
|
|
517
|
-
notes: z.string().optional().nullable(),
|
|
518
|
-
});
|
|
519
|
-
export const insertSupplierPaymentSchema = supplierPaymentCoreSchema;
|
|
520
|
-
export const updateSupplierPaymentSchema = supplierPaymentCoreSchema.partial();
|
|
521
|
-
export const supplierPaymentListQuerySchema = z.object({
|
|
522
|
-
bookingId: z.string().optional(),
|
|
523
|
-
supplierId: z.string().optional(),
|
|
524
|
-
status: paymentStatusSchema.optional(),
|
|
525
|
-
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
526
|
-
offset: z.coerce.number().int().min(0).default(0),
|
|
527
|
-
});
|
|
528
|
-
// ---------- finance notes ----------
|
|
529
|
-
export const insertFinanceNoteSchema = z.object({
|
|
530
|
-
content: z.string().min(1).max(10000),
|
|
531
|
-
});
|
|
532
|
-
// ---------- reports ----------
|
|
533
|
-
export const revenueReportQuerySchema = z.object({
|
|
534
|
-
from: z.string().min(1),
|
|
535
|
-
to: z.string().min(1),
|
|
536
|
-
});
|
|
537
|
-
export const agingReportQuerySchema = z.object({
|
|
538
|
-
asOf: z.string().optional(),
|
|
539
|
-
});
|
|
540
|
-
export const profitabilityQuerySchema = z.object({
|
|
541
|
-
from: z.string().optional(),
|
|
542
|
-
to: z.string().optional(),
|
|
543
|
-
});
|
|
544
|
-
// ---------- invoice_number_series ----------
|
|
545
|
-
const invoiceNumberResetStrategySchema = z.enum(["never", "annual", "monthly"]);
|
|
546
|
-
const invoiceNumberSeriesScopeSchema = z.enum(["invoice", "proforma", "credit_note"]);
|
|
547
|
-
const invoiceNumberSeriesCoreSchema = z.object({
|
|
548
|
-
code: z.string().min(1).max(100),
|
|
549
|
-
name: z.string().min(1).max(255),
|
|
550
|
-
prefix: z.string().max(50).default(""),
|
|
551
|
-
separator: z.string().max(10).default(""),
|
|
552
|
-
padLength: z.number().int().min(0).max(20).default(4),
|
|
553
|
-
currentSequence: z.number().int().min(0).default(0),
|
|
554
|
-
resetStrategy: invoiceNumberResetStrategySchema.default("never"),
|
|
555
|
-
resetAt: z.string().optional().nullable(),
|
|
556
|
-
scope: invoiceNumberSeriesScopeSchema.default("invoice"),
|
|
557
|
-
active: z.boolean().default(true),
|
|
558
|
-
});
|
|
559
|
-
export const insertInvoiceNumberSeriesSchema = invoiceNumberSeriesCoreSchema;
|
|
560
|
-
export const updateInvoiceNumberSeriesSchema = invoiceNumberSeriesCoreSchema.partial();
|
|
561
|
-
export const invoiceNumberSeriesListQuerySchema = paginationSchema.extend({
|
|
562
|
-
scope: invoiceNumberSeriesScopeSchema.optional(),
|
|
563
|
-
active: z.coerce.boolean().optional(),
|
|
564
|
-
});
|
|
565
|
-
export const allocateInvoiceNumberInputSchema = z.object({
|
|
566
|
-
seriesId: z.string().min(1),
|
|
567
|
-
});
|
|
568
|
-
// ---------- invoice_templates ----------
|
|
569
|
-
const invoiceTemplateBodyFormatSchema = z.enum(["html", "markdown", "lexical_json"]);
|
|
570
|
-
const invoiceTemplateCoreSchema = z.object({
|
|
571
|
-
name: z.string().min(1).max(255),
|
|
572
|
-
slug: z
|
|
573
|
-
.string()
|
|
574
|
-
.min(1)
|
|
575
|
-
.max(100)
|
|
576
|
-
.regex(/^[a-z0-9-]+$/, "slug must be kebab-case"),
|
|
577
|
-
language: z.string().min(2).max(10).default("en"),
|
|
578
|
-
jurisdiction: z.string().max(10).optional().nullable(),
|
|
579
|
-
bodyFormat: invoiceTemplateBodyFormatSchema.default("html"),
|
|
580
|
-
body: z.string().min(1),
|
|
581
|
-
cssStyles: z.string().optional().nullable(),
|
|
582
|
-
isDefault: z.boolean().default(false),
|
|
583
|
-
active: z.boolean().default(true),
|
|
584
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
585
|
-
});
|
|
586
|
-
export const insertInvoiceTemplateSchema = invoiceTemplateCoreSchema;
|
|
587
|
-
export const updateInvoiceTemplateSchema = invoiceTemplateCoreSchema.partial();
|
|
588
|
-
export const invoiceTemplateListQuerySchema = paginationSchema.extend({
|
|
589
|
-
language: z.string().optional(),
|
|
590
|
-
jurisdiction: z.string().optional(),
|
|
591
|
-
active: z.coerce.boolean().optional(),
|
|
592
|
-
search: z.string().optional(),
|
|
593
|
-
});
|
|
594
|
-
// ---------- invoice_renditions ----------
|
|
595
|
-
const invoiceRenditionFormatSchema = z.enum(["html", "pdf", "xml", "json"]);
|
|
596
|
-
const invoiceRenditionStatusSchema = z.enum(["pending", "ready", "failed", "stale"]);
|
|
597
|
-
const invoiceRenditionCoreSchema = z.object({
|
|
598
|
-
templateId: z.string().optional().nullable(),
|
|
599
|
-
format: invoiceRenditionFormatSchema.default("pdf"),
|
|
600
|
-
status: invoiceRenditionStatusSchema.default("pending"),
|
|
601
|
-
storageKey: z.string().optional().nullable(),
|
|
602
|
-
fileSize: z.number().int().min(0).optional().nullable(),
|
|
603
|
-
checksum: z.string().optional().nullable(),
|
|
604
|
-
language: z.string().optional().nullable(),
|
|
605
|
-
errorMessage: z.string().optional().nullable(),
|
|
606
|
-
generatedAt: z.string().optional().nullable(),
|
|
607
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
608
|
-
});
|
|
609
|
-
export const insertInvoiceRenditionSchema = invoiceRenditionCoreSchema;
|
|
610
|
-
export const updateInvoiceRenditionSchema = invoiceRenditionCoreSchema.partial();
|
|
611
|
-
// ---------- tax_regimes ----------
|
|
612
|
-
const taxRegimeCodeSchema = z.enum([
|
|
613
|
-
"standard",
|
|
614
|
-
"reduced",
|
|
615
|
-
"exempt",
|
|
616
|
-
"reverse_charge",
|
|
617
|
-
"margin_scheme_art311",
|
|
618
|
-
"zero_rated",
|
|
619
|
-
"out_of_scope",
|
|
620
|
-
"other",
|
|
621
|
-
]);
|
|
622
|
-
const taxRegimeCoreSchema = z.object({
|
|
623
|
-
code: taxRegimeCodeSchema,
|
|
624
|
-
name: z.string().min(1).max(255),
|
|
625
|
-
jurisdiction: z.string().max(10).optional().nullable(),
|
|
626
|
-
ratePercent: z.number().int().min(0).max(10000).optional().nullable(),
|
|
627
|
-
description: z.string().max(2000).optional().nullable(),
|
|
628
|
-
legalReference: z.string().max(500).optional().nullable(),
|
|
629
|
-
active: z.boolean().default(true),
|
|
630
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
631
|
-
});
|
|
632
|
-
export const insertTaxRegimeSchema = taxRegimeCoreSchema;
|
|
633
|
-
export const updateTaxRegimeSchema = taxRegimeCoreSchema.partial();
|
|
634
|
-
export const taxRegimeListQuerySchema = paginationSchema.extend({
|
|
635
|
-
code: taxRegimeCodeSchema.optional(),
|
|
636
|
-
jurisdiction: z.string().optional(),
|
|
637
|
-
active: z.coerce.boolean().optional(),
|
|
638
|
-
});
|
|
639
|
-
// ---------- invoice_external_refs ----------
|
|
640
|
-
const invoiceExternalRefCoreSchema = z.object({
|
|
641
|
-
provider: z.string().min(1).max(100),
|
|
642
|
-
externalId: z.string().max(255).optional().nullable(),
|
|
643
|
-
externalNumber: z.string().max(255).optional().nullable(),
|
|
644
|
-
externalUrl: z.string().max(1000).optional().nullable(),
|
|
645
|
-
status: z.string().max(100).optional().nullable(),
|
|
646
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
647
|
-
syncedAt: z.string().optional().nullable(),
|
|
648
|
-
syncError: z.string().optional().nullable(),
|
|
649
|
-
});
|
|
650
|
-
export const insertInvoiceExternalRefSchema = invoiceExternalRefCoreSchema;
|
|
651
|
-
export const updateInvoiceExternalRefSchema = invoiceExternalRefCoreSchema.partial();
|
|
652
|
-
// ---------- render invoice input ----------
|
|
653
|
-
export const renderInvoiceInputSchema = z.object({
|
|
654
|
-
templateId: z.string().optional().nullable(),
|
|
655
|
-
format: invoiceRenditionFormatSchema.default("pdf"),
|
|
656
|
-
language: z.string().optional().nullable(),
|
|
657
|
-
});
|
|
1
|
+
export * from "./validation-billing.js";
|
|
2
|
+
export * from "./validation-payments.js";
|
|
3
|
+
export * from "./validation-public.js";
|
|
4
|
+
export * from "./validation-shared.js";
|