@voyant-travel/finance 0.199.0 → 0.201.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/checkout-routes.js +1 -1
- package/dist/checkout-service-plan.d.ts +6 -2
- package/dist/checkout-service.js +8 -20
- package/dist/checkout-validation.d.ts +15 -167
- package/dist/checkout-validation.js +12 -37
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +14 -14
package/dist/checkout-routes.js
CHANGED
|
@@ -121,7 +121,7 @@ function resolveCheckoutRouteRuntime(bindings, options, container) {
|
|
|
121
121
|
return buildCheckoutRouteRuntime(bindings, options);
|
|
122
122
|
}
|
|
123
123
|
function assertCheckoutRuntimeSupportsCollection(runtime, input) {
|
|
124
|
-
if (input.method === "card" && input.startProvider
|
|
124
|
+
if (input.method === "card" && input.startProvider) {
|
|
125
125
|
if (!runtime.selectedPaymentStarter) {
|
|
126
126
|
throw new CheckoutRouteRuntimeNotConfiguredError();
|
|
127
127
|
}
|
|
@@ -83,8 +83,12 @@ export interface CheckoutNotificationDelivery {
|
|
|
83
83
|
errorMessage: string | null;
|
|
84
84
|
}
|
|
85
85
|
export interface CheckoutNotificationDispatcher {
|
|
86
|
-
sendInvoiceNotification?: (db: PostgresJsDatabase, invoiceId: string, input: CheckoutInvoiceNotificationInput
|
|
87
|
-
|
|
86
|
+
sendInvoiceNotification?: (db: PostgresJsDatabase, invoiceId: string, input: CheckoutInvoiceNotificationInput, options?: {
|
|
87
|
+
paymentLinkBaseUrl?: string | null;
|
|
88
|
+
}) => Promise<CheckoutNotificationDelivery | null>;
|
|
89
|
+
sendPaymentSessionNotification?: (db: PostgresJsDatabase, paymentSessionId: string, input: CheckoutPaymentSessionNotificationInput, options?: {
|
|
90
|
+
paymentLinkBaseUrl?: string | null;
|
|
91
|
+
}) => Promise<CheckoutNotificationDelivery | null>;
|
|
88
92
|
}
|
|
89
93
|
export interface InitiatedCheckoutCollection {
|
|
90
94
|
plan: CheckoutCollectionPlan;
|
package/dist/checkout-service.js
CHANGED
|
@@ -196,19 +196,12 @@ export async function initiateCheckoutCollection(db, bookingId, input, options =
|
|
|
196
196
|
throw new Error("Provider start is only available for card collections");
|
|
197
197
|
}
|
|
198
198
|
// Resolve deployment-owned processor readiness before any checkout read
|
|
199
|
-
// that may materialize a default payment plan.
|
|
200
|
-
//
|
|
201
|
-
// self-hosted provider requests. A missing adapter is a zero-mutation
|
|
199
|
+
// that may materialize a default payment plan. Processor selection is
|
|
200
|
+
// exclusively deployment-owned. A missing adapter is a zero-mutation
|
|
202
201
|
// failure.
|
|
203
|
-
|
|
204
|
-
providerStarter =
|
|
205
|
-
runtime.selectedPaymentStarter ??
|
|
206
|
-
(requestedProvider ? runtime.paymentStarters?.[requestedProvider] : undefined) ??
|
|
207
|
-
null;
|
|
202
|
+
providerStarter = runtime.selectedPaymentStarter ?? null;
|
|
208
203
|
if (!providerStarter) {
|
|
209
|
-
throw new Error(
|
|
210
|
-
? `Payment provider "${requestedProvider}" is not configured`
|
|
211
|
-
: "No payment adapter is selected for card collection");
|
|
204
|
+
throw new Error("No payment adapter is selected for card collection");
|
|
212
205
|
}
|
|
213
206
|
}
|
|
214
207
|
const context = await loadBookingContext(db, bookingId);
|
|
@@ -230,7 +223,7 @@ export async function initiateCheckoutCollection(db, bookingId, input, options =
|
|
|
230
223
|
invoice = await createCollectionInvoice(db, context, plan, input.notes ?? null);
|
|
231
224
|
bankTransferInstructions = buildBankTransferInstructions(invoice, runtime.bankTransferDetails ?? null, input.notes ?? null);
|
|
232
225
|
if (runtime.notificationDispatcher?.sendInvoiceNotification && input.invoiceNotification) {
|
|
233
|
-
invoiceNotification = await runtime.notificationDispatcher.sendInvoiceNotification(db, invoice.id,
|
|
226
|
+
invoiceNotification = await runtime.notificationDispatcher.sendInvoiceNotification(db, invoice.id, input.invoiceNotification, { paymentLinkBaseUrl: runtime.publicCheckoutBaseUrl });
|
|
234
227
|
}
|
|
235
228
|
}
|
|
236
229
|
else if (plan.paymentSessionTarget === "invoice") {
|
|
@@ -245,12 +238,12 @@ export async function initiateCheckoutCollection(db, bookingId, input, options =
|
|
|
245
238
|
throw new Error("Failed to create payment session from invoice");
|
|
246
239
|
}
|
|
247
240
|
if (runtime.notificationDispatcher?.sendInvoiceNotification && input.invoiceNotification) {
|
|
248
|
-
invoiceNotification = await runtime.notificationDispatcher.sendInvoiceNotification(db, invoice.id,
|
|
241
|
+
invoiceNotification = await runtime.notificationDispatcher.sendInvoiceNotification(db, invoice.id, input.invoiceNotification, { paymentLinkBaseUrl: runtime.publicCheckoutBaseUrl });
|
|
249
242
|
}
|
|
250
243
|
if (runtime.notificationDispatcher?.sendPaymentSessionNotification &&
|
|
251
244
|
input.paymentSessionNotification) {
|
|
252
245
|
paymentSessionNotification =
|
|
253
|
-
await runtime.notificationDispatcher.sendPaymentSessionNotification(db, paymentSession.id,
|
|
246
|
+
await runtime.notificationDispatcher.sendPaymentSessionNotification(db, paymentSession.id, input.paymentSessionNotification, { paymentLinkBaseUrl: runtime.publicCheckoutBaseUrl });
|
|
254
247
|
}
|
|
255
248
|
}
|
|
256
249
|
else {
|
|
@@ -267,7 +260,7 @@ export async function initiateCheckoutCollection(db, bookingId, input, options =
|
|
|
267
260
|
if (runtime.notificationDispatcher?.sendPaymentSessionNotification &&
|
|
268
261
|
input.paymentSessionNotification) {
|
|
269
262
|
paymentSessionNotification =
|
|
270
|
-
await runtime.notificationDispatcher.sendPaymentSessionNotification(db, paymentSession.id,
|
|
263
|
+
await runtime.notificationDispatcher.sendPaymentSessionNotification(db, paymentSession.id, input.paymentSessionNotification, { paymentLinkBaseUrl: runtime.publicCheckoutBaseUrl });
|
|
271
264
|
}
|
|
272
265
|
}
|
|
273
266
|
if (input.startProvider) {
|
|
@@ -306,11 +299,6 @@ export async function initiateCheckoutCollection(db, bookingId, input, options =
|
|
|
306
299
|
providerStart,
|
|
307
300
|
};
|
|
308
301
|
}
|
|
309
|
-
function withPaymentLinkBaseUrl(input, publicCheckoutBaseUrl) {
|
|
310
|
-
if (input.paymentLinkBaseUrl || !publicCheckoutBaseUrl)
|
|
311
|
-
return input;
|
|
312
|
-
return { ...input, paymentLinkBaseUrl: publicCheckoutBaseUrl };
|
|
313
|
-
}
|
|
314
302
|
export async function bootstrapCheckoutCollection(db, input, options = {}, runtime = {}) {
|
|
315
303
|
const subject = resolveCheckoutSubject(input);
|
|
316
304
|
const initiated = await initiateCheckoutCollection(db, subject.bookingId, {
|
|
@@ -46,78 +46,20 @@ export declare const checkoutReminderTargetTypeSchema: z.ZodEnum<{
|
|
|
46
46
|
booking_cancelled_non_payment: "booking_cancelled_non_payment";
|
|
47
47
|
}>;
|
|
48
48
|
export declare const checkoutProviderStartInputSchema: z.ZodObject<{
|
|
49
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
50
49
|
payload: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
51
|
-
}, z.core.$
|
|
52
|
-
export declare const checkoutNotificationAttachmentSchema: z.ZodObject<{
|
|
53
|
-
filename: z.ZodString;
|
|
54
|
-
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
55
|
-
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
56
|
-
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
57
|
-
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
attachment: "attachment";
|
|
59
|
-
inline: "inline";
|
|
60
|
-
}>>>;
|
|
61
|
-
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
62
|
-
}, z.core.$strip>;
|
|
50
|
+
}, z.core.$strict>;
|
|
63
51
|
export declare const checkoutPaymentSessionNotificationSchema: z.ZodObject<{
|
|
52
|
+
idempotencyKey: z.ZodString;
|
|
64
53
|
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
65
54
|
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
66
|
-
channel: z.ZodDefault<z.ZodEnum<{
|
|
67
|
-
email: "email";
|
|
68
|
-
sms: "sms";
|
|
69
|
-
}>>;
|
|
70
|
-
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
71
|
-
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
72
|
-
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
73
|
-
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
74
|
-
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
75
|
-
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
76
|
-
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
-
filename: z.ZodString;
|
|
78
|
-
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
79
|
-
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
80
|
-
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
81
|
-
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
82
|
-
attachment: "attachment";
|
|
83
|
-
inline: "inline";
|
|
84
|
-
}>>>;
|
|
85
|
-
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
86
|
-
}, z.core.$strip>>>>;
|
|
87
|
-
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
88
|
-
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
89
55
|
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
90
|
-
|
|
91
|
-
}, z.core.$strip>;
|
|
56
|
+
}, z.core.$strict>;
|
|
92
57
|
export declare const checkoutInvoiceNotificationSchema: z.ZodObject<{
|
|
58
|
+
idempotencyKey: z.ZodString;
|
|
93
59
|
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
94
60
|
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
95
|
-
channel: z.ZodDefault<z.ZodEnum<{
|
|
96
|
-
email: "email";
|
|
97
|
-
sms: "sms";
|
|
98
|
-
}>>;
|
|
99
|
-
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
100
|
-
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
101
|
-
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
102
|
-
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
103
|
-
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
104
|
-
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
105
|
-
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
106
|
-
filename: z.ZodString;
|
|
107
|
-
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
108
|
-
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
109
|
-
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
110
|
-
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
111
|
-
attachment: "attachment";
|
|
112
|
-
inline: "inline";
|
|
113
|
-
}>>>;
|
|
114
|
-
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
115
|
-
}, z.core.$strip>>>>;
|
|
116
|
-
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
117
|
-
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
118
61
|
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
119
|
-
|
|
120
|
-
}, z.core.$strip>;
|
|
62
|
+
}, z.core.$strict>;
|
|
121
63
|
export declare const previewCheckoutCollectionSchema: z.ZodObject<{
|
|
122
64
|
method: z.ZodEnum<{
|
|
123
65
|
bank_transfer: "bank_transfer";
|
|
@@ -351,67 +293,20 @@ export declare const initiateCheckoutCollectionSchema: z.ZodObject<{
|
|
|
351
293
|
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
352
294
|
}, z.core.$strip>]>>;
|
|
353
295
|
paymentSessionNotification: z.ZodOptional<z.ZodObject<{
|
|
296
|
+
idempotencyKey: z.ZodString;
|
|
354
297
|
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
355
298
|
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
356
|
-
channel: z.ZodDefault<z.ZodEnum<{
|
|
357
|
-
email: "email";
|
|
358
|
-
sms: "sms";
|
|
359
|
-
}>>;
|
|
360
|
-
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
361
|
-
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
362
|
-
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
363
|
-
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
364
|
-
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
365
|
-
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
366
|
-
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
367
|
-
filename: z.ZodString;
|
|
368
|
-
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
369
|
-
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
370
|
-
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
371
|
-
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
372
|
-
attachment: "attachment";
|
|
373
|
-
inline: "inline";
|
|
374
|
-
}>>>;
|
|
375
|
-
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
376
|
-
}, z.core.$strip>>>>;
|
|
377
|
-
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
378
|
-
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
379
299
|
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
380
|
-
|
|
381
|
-
}, z.core.$strip>>;
|
|
300
|
+
}, z.core.$strict>>;
|
|
382
301
|
invoiceNotification: z.ZodOptional<z.ZodObject<{
|
|
302
|
+
idempotencyKey: z.ZodString;
|
|
383
303
|
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
384
304
|
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
385
|
-
channel: z.ZodDefault<z.ZodEnum<{
|
|
386
|
-
email: "email";
|
|
387
|
-
sms: "sms";
|
|
388
|
-
}>>;
|
|
389
|
-
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
390
|
-
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
391
|
-
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
392
|
-
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
393
|
-
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
394
|
-
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
395
|
-
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
396
|
-
filename: z.ZodString;
|
|
397
|
-
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
398
|
-
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
399
|
-
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
400
|
-
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
401
|
-
attachment: "attachment";
|
|
402
|
-
inline: "inline";
|
|
403
|
-
}>>>;
|
|
404
|
-
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
405
|
-
}, z.core.$strip>>>>;
|
|
406
|
-
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
407
|
-
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
408
305
|
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
409
|
-
|
|
410
|
-
}, z.core.$strip>>;
|
|
306
|
+
}, z.core.$strict>>;
|
|
411
307
|
startProvider: z.ZodOptional<z.ZodObject<{
|
|
412
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
413
308
|
payload: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
414
|
-
}, z.core.$
|
|
309
|
+
}, z.core.$strict>>;
|
|
415
310
|
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
416
311
|
}, z.core.$strip>;
|
|
417
312
|
export declare const bootstrapCheckoutCollectionSchema: z.ZodObject<{
|
|
@@ -605,67 +500,20 @@ export declare const bootstrapCheckoutCollectionSchema: z.ZodObject<{
|
|
|
605
500
|
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
606
501
|
}, z.core.$strip>]>>;
|
|
607
502
|
paymentSessionNotification: z.ZodOptional<z.ZodObject<{
|
|
503
|
+
idempotencyKey: z.ZodString;
|
|
608
504
|
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
609
505
|
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
610
|
-
channel: z.ZodDefault<z.ZodEnum<{
|
|
611
|
-
email: "email";
|
|
612
|
-
sms: "sms";
|
|
613
|
-
}>>;
|
|
614
|
-
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
615
|
-
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
616
|
-
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
617
|
-
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
618
|
-
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
619
|
-
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
620
|
-
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
621
|
-
filename: z.ZodString;
|
|
622
|
-
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
623
|
-
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
624
|
-
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
625
|
-
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
626
|
-
attachment: "attachment";
|
|
627
|
-
inline: "inline";
|
|
628
|
-
}>>>;
|
|
629
|
-
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
630
|
-
}, z.core.$strip>>>>;
|
|
631
|
-
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
632
|
-
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
633
506
|
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
634
|
-
|
|
635
|
-
}, z.core.$strip>>;
|
|
507
|
+
}, z.core.$strict>>;
|
|
636
508
|
invoiceNotification: z.ZodOptional<z.ZodObject<{
|
|
509
|
+
idempotencyKey: z.ZodString;
|
|
637
510
|
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
638
511
|
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
639
|
-
channel: z.ZodDefault<z.ZodEnum<{
|
|
640
|
-
email: "email";
|
|
641
|
-
sms: "sms";
|
|
642
|
-
}>>;
|
|
643
|
-
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
644
|
-
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
645
|
-
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
646
|
-
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
647
|
-
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
648
|
-
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
649
|
-
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
650
|
-
filename: z.ZodString;
|
|
651
|
-
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
652
|
-
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
653
|
-
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
654
|
-
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
655
|
-
attachment: "attachment";
|
|
656
|
-
inline: "inline";
|
|
657
|
-
}>>>;
|
|
658
|
-
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
659
|
-
}, z.core.$strip>>>>;
|
|
660
|
-
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
661
|
-
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
662
512
|
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
663
|
-
|
|
664
|
-
}, z.core.$strip>>;
|
|
513
|
+
}, z.core.$strict>>;
|
|
665
514
|
startProvider: z.ZodOptional<z.ZodObject<{
|
|
666
|
-
provider: z.ZodOptional<z.ZodString>;
|
|
667
515
|
payload: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
668
|
-
}, z.core.$
|
|
516
|
+
}, z.core.$strict>>;
|
|
669
517
|
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
670
518
|
bookingId: z.ZodOptional<z.ZodString>;
|
|
671
519
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
@@ -27,49 +27,24 @@ export const checkoutReminderTargetTypeSchema = z.enum([
|
|
|
27
27
|
"booking_cancelled_non_payment",
|
|
28
28
|
"invoice",
|
|
29
29
|
]);
|
|
30
|
-
export const checkoutProviderStartInputSchema = z
|
|
31
|
-
/**
|
|
32
|
-
* Legacy provider hint. Deployments with a selected PaymentAdapter ignore
|
|
33
|
-
* this value and always use their selected adapter. New clients should omit
|
|
34
|
-
* it so processor selection remains deployment-owned.
|
|
35
|
-
*/
|
|
36
|
-
provider: z.string().min(1).max(255).optional(),
|
|
37
|
-
payload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
38
|
-
});
|
|
39
|
-
export const checkoutNotificationAttachmentSchema = z
|
|
30
|
+
export const checkoutProviderStartInputSchema = z
|
|
40
31
|
.object({
|
|
41
|
-
|
|
42
|
-
contentBase64: z.string().min(1).optional().nullable(),
|
|
43
|
-
path: z.string().min(1).max(4000).optional().nullable(),
|
|
44
|
-
contentType: z.string().max(255).optional().nullable(),
|
|
45
|
-
disposition: z.enum(["attachment", "inline"]).optional().nullable(),
|
|
46
|
-
contentId: z.string().max(255).optional().nullable(),
|
|
32
|
+
payload: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
47
33
|
})
|
|
48
|
-
.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const checkoutNotificationRequestCoreSchema = z.object({
|
|
34
|
+
.strict();
|
|
35
|
+
const checkoutNotificationRequestCoreSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
idempotencyKey: z.string().trim().min(8).max(255),
|
|
53
38
|
templateId: z.string().optional().nullable(),
|
|
54
39
|
templateSlug: z.string().optional().nullable(),
|
|
55
|
-
channel: checkoutNotificationChannelSchema.default("email"),
|
|
56
|
-
provider: z.string().optional().nullable(),
|
|
57
|
-
to: z.string().min(1).optional().nullable(),
|
|
58
|
-
from: z.string().max(500).optional().nullable(),
|
|
59
|
-
subject: z.string().max(2000).optional().nullable(),
|
|
60
|
-
html: z.string().optional().nullable(),
|
|
61
|
-
text: z.string().optional().nullable(),
|
|
62
|
-
attachments: z.array(checkoutNotificationAttachmentSchema).optional().nullable(),
|
|
63
|
-
data: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
64
|
-
metadata: z.record(z.string(), z.unknown()).optional().nullable(),
|
|
65
40
|
scheduledFor: z.string().optional().nullable(),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
export const checkoutPaymentSessionNotificationSchema = checkoutNotificationRequestCoreSchema.refine((value) => Boolean(value.templateId || value.templateSlug
|
|
69
|
-
message: "templateId
|
|
41
|
+
})
|
|
42
|
+
.strict();
|
|
43
|
+
export const checkoutPaymentSessionNotificationSchema = checkoutNotificationRequestCoreSchema.refine((value) => Boolean(value.templateId || value.templateSlug), {
|
|
44
|
+
message: "templateId or templateSlug is required",
|
|
70
45
|
});
|
|
71
|
-
export const checkoutInvoiceNotificationSchema = checkoutNotificationRequestCoreSchema.refine((value) => Boolean(value.templateId || value.templateSlug
|
|
72
|
-
message: "templateId
|
|
46
|
+
export const checkoutInvoiceNotificationSchema = checkoutNotificationRequestCoreSchema.refine((value) => Boolean(value.templateId || value.templateSlug), {
|
|
47
|
+
message: "templateId or templateSlug is required",
|
|
73
48
|
});
|
|
74
49
|
const planOverrideSchema = applyDefaultBookingPaymentPlanSchema.partial();
|
|
75
50
|
const paginationSchema = z.object({
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { buildFinanceCheckoutRouteRuntime, CHECKOUT_ROUTE_RUNTIME_CONTAINER_KEY,
|
|
|
9
9
|
export type { BootstrappedCheckoutCollection, CheckoutBankTransferDetails, CheckoutCollectionPlan, CheckoutNotificationDelivery, CheckoutNotificationDispatcher, CheckoutPaymentStarter, CheckoutPaymentStarterContext, CheckoutPolicyOptions, CheckoutProviderStartResult, CheckoutRuntimeOptions, InitiatedCheckoutCollection, } from "./checkout-service.js";
|
|
10
10
|
export { bootstrapCheckoutCollection, initiateCheckoutCollection, previewCheckoutCollection, resolveDocumentType, resolvePaymentSessionTarget, } from "./checkout-service.js";
|
|
11
11
|
export type { BootstrapCheckoutCollectionInput, BootstrappedCheckoutCollectionRecord, CheckoutBankTransferInstructionsRecord, CheckoutInvoiceNotificationInput, CheckoutPaymentSessionNotificationInput, CheckoutProviderStartInput, CheckoutProviderStartResultRecord, CheckoutReminderRunListQuery, CheckoutReminderRunRecord, InitiateCheckoutCollectionInput, InitiatedCheckoutCollectionRecord, PreviewCheckoutCollectionInput, } from "./checkout-validation.js";
|
|
12
|
-
export { bootstrapCheckoutCollectionSchema, bootstrappedCheckoutCollectionSchema, checkoutBankTransferInstructionsSchema, checkoutCollectionIntentSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutInvoiceNotificationSchema,
|
|
12
|
+
export { bootstrapCheckoutCollectionSchema, bootstrappedCheckoutCollectionSchema, checkoutBankTransferInstructionsSchema, checkoutCollectionIntentSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutInvoiceNotificationSchema, checkoutNotificationChannelSchema, checkoutNotificationDeliverySchema, checkoutNotificationDeliveryStatusSchema, checkoutPaymentSessionNotificationSchema, checkoutPaymentSessionTargetSchema, checkoutProviderStartInputSchema, checkoutProviderStartResultSchema, checkoutReminderRunListQuerySchema, checkoutReminderRunListResponseSchema, checkoutReminderRunSchema, checkoutReminderRunStatusSchema, checkoutReminderTargetTypeSchema, initiateCheckoutCollectionSchema, initiatedCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./checkout-validation.js";
|
|
13
13
|
export { creditNoteLinkable, financeLinkable, invoiceLinkable, invoiceTemplateLinkable, supplierInvoiceLinkable, } from "./linkables.js";
|
|
14
14
|
export { type BookingCheckoutUrlSettings, type BuildBookingCheckoutUrlOptions, type BuildPaymentLinkUrlOptions, buildBookingCheckoutUrl, buildPaymentLinkUrl, } from "./payment-link.js";
|
|
15
15
|
export type { FinanceRoutes } from "./routes.js";
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { createFinanceRuntime } from "./runtime.js";
|
|
|
21
21
|
import { financeCheckoutPaymentStartersRuntimePort, financeHostRuntimePort, financeInvoiceSettlementPollerRuntimePort, financeNotificationsRuntimePort, } from "./runtime-port.js";
|
|
22
22
|
export { buildFinanceCheckoutRouteRuntime, CHECKOUT_ROUTE_RUNTIME_CONTAINER_KEY, createFinanceCheckoutAdminRoutes, createFinanceCheckoutRoutes, FINANCE_CHECKOUT_ROUTE_RUNTIME_CONTAINER_KEY, } from "./checkout-routes.js";
|
|
23
23
|
export { bootstrapCheckoutCollection, initiateCheckoutCollection, previewCheckoutCollection, resolveDocumentType, resolvePaymentSessionTarget, } from "./checkout-service.js";
|
|
24
|
-
export { bootstrapCheckoutCollectionSchema, bootstrappedCheckoutCollectionSchema, checkoutBankTransferInstructionsSchema, checkoutCollectionIntentSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutInvoiceNotificationSchema,
|
|
24
|
+
export { bootstrapCheckoutCollectionSchema, bootstrappedCheckoutCollectionSchema, checkoutBankTransferInstructionsSchema, checkoutCollectionIntentSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutInvoiceNotificationSchema, checkoutNotificationChannelSchema, checkoutNotificationDeliverySchema, checkoutNotificationDeliveryStatusSchema, checkoutPaymentSessionNotificationSchema, checkoutPaymentSessionTargetSchema, checkoutProviderStartInputSchema, checkoutProviderStartResultSchema, checkoutReminderRunListQuerySchema, checkoutReminderRunListResponseSchema, checkoutReminderRunSchema, checkoutReminderRunStatusSchema, checkoutReminderTargetTypeSchema, initiateCheckoutCollectionSchema, initiatedCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./checkout-validation.js";
|
|
25
25
|
export { creditNoteLinkable, financeLinkable, invoiceLinkable, invoiceTemplateLinkable, supplierInvoiceLinkable, } from "./linkables.js";
|
|
26
26
|
export { buildBookingCheckoutUrl, buildPaymentLinkUrl, } from "./payment-link.js";
|
|
27
27
|
export { createPublicFinanceRoutes, publicFinanceRoutes, } from "./routes-public.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyant-travel/finance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.201.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -156,24 +156,24 @@
|
|
|
156
156
|
"fflate": "^0.8.2",
|
|
157
157
|
"hono": "^4.12.27",
|
|
158
158
|
"zod": "^4.4.3",
|
|
159
|
-
"@voyant-travel/action-ledger": "^0.113.
|
|
160
|
-
"@voyant-travel/bookings": "^0.
|
|
161
|
-
"@voyant-travel/core": "^0.
|
|
162
|
-
"@voyant-travel/db": "^0.118.
|
|
159
|
+
"@voyant-travel/action-ledger": "^0.113.2",
|
|
160
|
+
"@voyant-travel/bookings": "^0.201.0",
|
|
161
|
+
"@voyant-travel/core": "^0.136.0",
|
|
162
|
+
"@voyant-travel/db": "^0.118.5",
|
|
163
163
|
"@voyant-travel/types": "^0.109.9",
|
|
164
|
-
"@voyant-travel/finance-contracts": "^0.107.
|
|
165
|
-
"@voyant-travel/
|
|
166
|
-
"@voyant-travel/
|
|
167
|
-
"@voyant-travel/public-document-delivery": "^0.4.
|
|
168
|
-
"@voyant-travel/reporting-contracts": "^0.3.
|
|
169
|
-
"@voyant-travel/
|
|
170
|
-
"@voyant-travel/
|
|
171
|
-
"@voyant-travel/
|
|
164
|
+
"@voyant-travel/finance-contracts": "^0.107.3",
|
|
165
|
+
"@voyant-travel/hono": "^0.134.5",
|
|
166
|
+
"@voyant-travel/payments": "^0.6.5",
|
|
167
|
+
"@voyant-travel/public-document-delivery": "^0.4.16",
|
|
168
|
+
"@voyant-travel/reporting-contracts": "^0.3.6",
|
|
169
|
+
"@voyant-travel/storage": "^0.114.0",
|
|
170
|
+
"@voyant-travel/utils": "^0.110.0",
|
|
171
|
+
"@voyant-travel/tools": "^0.5.0"
|
|
172
172
|
},
|
|
173
173
|
"devDependencies": {
|
|
174
174
|
"drizzle-kit": "^0.31.10",
|
|
175
175
|
"typescript": "^6.0.3",
|
|
176
|
-
"@voyant-travel/webhook-delivery": "^0.5.
|
|
176
|
+
"@voyant-travel/webhook-delivery": "^0.5.5",
|
|
177
177
|
"@voyant-travel/voyant-typescript-config": "^0.1.0"
|
|
178
178
|
},
|
|
179
179
|
"files": [
|