@voyantjs/checkout 0.4.2 → 0.4.3
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 +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/routes.d.ts +261 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +27 -7
- package/dist/service.d.ts +8 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +65 -0
- package/dist/validation.d.ts +379 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +17 -0
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { checkoutModule, createCheckoutAdminRoutes, createCheckoutHonoModule, createCheckoutRoutes, } from "./routes.js";
|
|
2
|
-
export type { CheckoutBankTransferDetails, CheckoutCollectionPlan, CheckoutPaymentStarter, CheckoutPolicyOptions, CheckoutProviderStartResult, CheckoutReminderRunList, CheckoutReminderRunSummary, CheckoutRuntimeOptions, InitiatedCheckoutCollection, } from "./service.js";
|
|
3
|
-
export { initiateCheckoutCollection, listBookingReminderRuns, previewCheckoutCollection, resolvePaymentSessionTarget, } from "./service.js";
|
|
4
|
-
export type { CheckoutBankTransferInstructionsRecord, CheckoutCollectionPlanRecord, CheckoutProviderStartInput, CheckoutProviderStartResultRecord, CheckoutReminderRunListQuery, CheckoutReminderRunRecord, InitiateCheckoutCollectionInput, InitiatedCheckoutCollectionRecord, PreviewCheckoutCollectionInput, } from "./validation.js";
|
|
5
|
-
export { checkoutBankTransferInstructionsSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutNotificationDeliverySchema, checkoutPaymentSessionTargetSchema, checkoutProviderStartInputSchema, checkoutProviderStartResultSchema, checkoutReminderRunListQuerySchema, checkoutReminderRunListResponseSchema, checkoutReminderRunSchema, initiateCheckoutCollectionSchema, initiatedCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./validation.js";
|
|
2
|
+
export type { BootstrappedCheckoutCollection, CheckoutBankTransferDetails, CheckoutCollectionPlan, CheckoutPaymentStarter, CheckoutPolicyOptions, CheckoutProviderStartResult, CheckoutReminderRunList, CheckoutReminderRunSummary, CheckoutRuntimeOptions, InitiatedCheckoutCollection, } from "./service.js";
|
|
3
|
+
export { bootstrapCheckoutCollection, initiateCheckoutCollection, listBookingReminderRuns, previewCheckoutCollection, resolvePaymentSessionTarget, } from "./service.js";
|
|
4
|
+
export type { BootstrapCheckoutCollectionInput, BootstrappedCheckoutCollectionRecord, CheckoutBankTransferInstructionsRecord, CheckoutCollectionPlanRecord, CheckoutProviderStartInput, CheckoutProviderStartResultRecord, CheckoutReminderRunListQuery, CheckoutReminderRunRecord, InitiateCheckoutCollectionInput, InitiatedCheckoutCollectionRecord, PreviewCheckoutCollectionInput, } from "./validation.js";
|
|
5
|
+
export { bootstrapCheckoutCollectionSchema, bootstrappedCheckoutCollectionSchema, checkoutBankTransferInstructionsSchema, checkoutCollectionIntentSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutNotificationDeliverySchema, checkoutPaymentSessionTargetSchema, checkoutProviderStartInputSchema, checkoutProviderStartResultSchema, checkoutReminderRunListQuerySchema, checkoutReminderRunListResponseSchema, checkoutReminderRunSchema, initiateCheckoutCollectionSchema, initiatedCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./validation.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,sCAAsC,EACtC,4BAA4B,EAC5B,0BAA0B,EAC1B,iCAAiC,EACjC,4BAA4B,EAC5B,yBAAyB,EACzB,+BAA+B,EAC/B,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,sCAAsC,EACtC,+BAA+B,EAC/B,8BAA8B,EAC9B,4BAA4B,EAC5B,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,kCAAkC,EAClC,kCAAkC,EAClC,gCAAgC,EAChC,iCAAiC,EACjC,kCAAkC,EAClC,qCAAqC,EACrC,yBAAyB,EACzB,gCAAgC,EAChC,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,8BAA8B,EAC9B,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,gCAAgC,EAChC,oCAAoC,EACpC,sCAAsC,EACtC,4BAA4B,EAC5B,0BAA0B,EAC1B,iCAAiC,EACjC,4BAA4B,EAC5B,yBAAyB,EACzB,+BAA+B,EAC/B,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iCAAiC,EACjC,oCAAoC,EACpC,sCAAsC,EACtC,8BAA8B,EAC9B,+BAA+B,EAC/B,8BAA8B,EAC9B,4BAA4B,EAC5B,gCAAgC,EAChC,6BAA6B,EAC7B,iCAAiC,EACjC,kCAAkC,EAClC,kCAAkC,EAClC,gCAAgC,EAChC,iCAAiC,EACjC,kCAAkC,EAClC,qCAAqC,EACrC,yBAAyB,EACzB,gCAAgC,EAChC,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { checkoutModule, createCheckoutAdminRoutes, createCheckoutHonoModule, createCheckoutRoutes, } from "./routes.js";
|
|
2
|
-
export { initiateCheckoutCollection, listBookingReminderRuns, previewCheckoutCollection, resolvePaymentSessionTarget, } from "./service.js";
|
|
3
|
-
export { checkoutBankTransferInstructionsSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutNotificationDeliverySchema, checkoutPaymentSessionTargetSchema, checkoutProviderStartInputSchema, checkoutProviderStartResultSchema, checkoutReminderRunListQuerySchema, checkoutReminderRunListResponseSchema, checkoutReminderRunSchema, initiateCheckoutCollectionSchema, initiatedCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./validation.js";
|
|
2
|
+
export { bootstrapCheckoutCollection, initiateCheckoutCollection, listBookingReminderRuns, previewCheckoutCollection, resolvePaymentSessionTarget, } from "./service.js";
|
|
3
|
+
export { bootstrapCheckoutCollectionSchema, bootstrappedCheckoutCollectionSchema, checkoutBankTransferInstructionsSchema, checkoutCollectionIntentSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutNotificationDeliverySchema, checkoutPaymentSessionTargetSchema, checkoutProviderStartInputSchema, checkoutProviderStartResultSchema, checkoutReminderRunListQuerySchema, checkoutReminderRunListResponseSchema, checkoutReminderRunSchema, initiateCheckoutCollectionSchema, initiatedCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./validation.js";
|
package/dist/routes.d.ts
CHANGED
|
@@ -380,7 +380,267 @@ export declare function createCheckoutRoutes(options?: {
|
|
|
380
380
|
status: 409;
|
|
381
381
|
};
|
|
382
382
|
};
|
|
383
|
-
}
|
|
383
|
+
} & {
|
|
384
|
+
"/v1/checkout/collections/bootstrap": {
|
|
385
|
+
$post: {
|
|
386
|
+
input: {};
|
|
387
|
+
output: {
|
|
388
|
+
error: string;
|
|
389
|
+
};
|
|
390
|
+
outputFormat: "json";
|
|
391
|
+
status: 404;
|
|
392
|
+
} | {
|
|
393
|
+
input: {};
|
|
394
|
+
output: {
|
|
395
|
+
data: {
|
|
396
|
+
bookingId: string;
|
|
397
|
+
sessionId: string;
|
|
398
|
+
sourceType: "booking" | "session";
|
|
399
|
+
intent: "deposit" | "balance" | "custom";
|
|
400
|
+
plan: {
|
|
401
|
+
bookingId: string;
|
|
402
|
+
method: "card" | "bank_transfer";
|
|
403
|
+
stage: "initial" | "reminder" | "manual";
|
|
404
|
+
paymentSessionTarget: "schedule" | "invoice" | null;
|
|
405
|
+
documentType: "proforma" | "invoice" | null;
|
|
406
|
+
willCreateDefaultPaymentPlan: boolean;
|
|
407
|
+
selectedSchedule: {
|
|
408
|
+
id: string;
|
|
409
|
+
status: "expired" | "cancelled" | "pending" | "paid" | "due" | "waived";
|
|
410
|
+
createdAt: string;
|
|
411
|
+
updatedAt: string;
|
|
412
|
+
bookingId: string;
|
|
413
|
+
notes: string | null;
|
|
414
|
+
bookingItemId: string | null;
|
|
415
|
+
currency: string;
|
|
416
|
+
dueDate: string;
|
|
417
|
+
scheduleType: "other" | "deposit" | "installment" | "balance" | "hold";
|
|
418
|
+
amountCents: number;
|
|
419
|
+
} | null;
|
|
420
|
+
selectedInvoice: {
|
|
421
|
+
id: string;
|
|
422
|
+
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
423
|
+
personId: string | null;
|
|
424
|
+
organizationId: string | null;
|
|
425
|
+
baseCurrency: string | null;
|
|
426
|
+
createdAt: string;
|
|
427
|
+
updatedAt: string;
|
|
428
|
+
bookingId: string;
|
|
429
|
+
notes: string | null;
|
|
430
|
+
invoiceNumber: string;
|
|
431
|
+
invoiceType: "invoice" | "proforma" | "credit_note";
|
|
432
|
+
seriesId: string | null;
|
|
433
|
+
sequence: number | null;
|
|
434
|
+
templateId: string | null;
|
|
435
|
+
taxRegimeId: string | null;
|
|
436
|
+
language: string | null;
|
|
437
|
+
currency: string;
|
|
438
|
+
fxRateSetId: string | null;
|
|
439
|
+
subtotalCents: number;
|
|
440
|
+
baseSubtotalCents: number | null;
|
|
441
|
+
taxCents: number;
|
|
442
|
+
baseTaxCents: number | null;
|
|
443
|
+
totalCents: number;
|
|
444
|
+
baseTotalCents: number | null;
|
|
445
|
+
paidCents: number;
|
|
446
|
+
basePaidCents: number | null;
|
|
447
|
+
balanceDueCents: number;
|
|
448
|
+
baseBalanceDueCents: number | null;
|
|
449
|
+
commissionPercent: number | null;
|
|
450
|
+
commissionAmountCents: number | null;
|
|
451
|
+
issueDate: string;
|
|
452
|
+
dueDate: string;
|
|
453
|
+
} | null;
|
|
454
|
+
amountCents: number;
|
|
455
|
+
currency: string;
|
|
456
|
+
recommendedAction: "create_bank_transfer_document" | "create_payment_session" | "create_invoice_then_payment_session" | "none";
|
|
457
|
+
};
|
|
458
|
+
invoice: {
|
|
459
|
+
id: string;
|
|
460
|
+
status: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
461
|
+
personId: string | null;
|
|
462
|
+
organizationId: string | null;
|
|
463
|
+
baseCurrency: string | null;
|
|
464
|
+
createdAt: string;
|
|
465
|
+
updatedAt: string;
|
|
466
|
+
bookingId: string;
|
|
467
|
+
notes: string | null;
|
|
468
|
+
invoiceNumber: string;
|
|
469
|
+
invoiceType: "invoice" | "proforma" | "credit_note";
|
|
470
|
+
seriesId: string | null;
|
|
471
|
+
sequence: number | null;
|
|
472
|
+
templateId: string | null;
|
|
473
|
+
taxRegimeId: string | null;
|
|
474
|
+
language: string | null;
|
|
475
|
+
currency: string;
|
|
476
|
+
fxRateSetId: string | null;
|
|
477
|
+
subtotalCents: number;
|
|
478
|
+
baseSubtotalCents: number | null;
|
|
479
|
+
taxCents: number;
|
|
480
|
+
baseTaxCents: number | null;
|
|
481
|
+
totalCents: number;
|
|
482
|
+
baseTotalCents: number | null;
|
|
483
|
+
paidCents: number;
|
|
484
|
+
basePaidCents: number | null;
|
|
485
|
+
balanceDueCents: number;
|
|
486
|
+
baseBalanceDueCents: number | null;
|
|
487
|
+
commissionPercent: number | null;
|
|
488
|
+
commissionAmountCents: number | null;
|
|
489
|
+
issueDate: string;
|
|
490
|
+
dueDate: string;
|
|
491
|
+
} | null;
|
|
492
|
+
paymentSession: {
|
|
493
|
+
id: string;
|
|
494
|
+
status: "expired" | "cancelled" | "pending" | "failed" | "paid" | "requires_redirect" | "processing" | "authorized";
|
|
495
|
+
expiredAt: string | null;
|
|
496
|
+
cancelledAt: string | null;
|
|
497
|
+
completedAt: string | null;
|
|
498
|
+
createdAt: string;
|
|
499
|
+
updatedAt: string;
|
|
500
|
+
bookingId: string | null;
|
|
501
|
+
notes: string | null;
|
|
502
|
+
metadata: {
|
|
503
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
504
|
+
} | null;
|
|
505
|
+
expiresAt: string | null;
|
|
506
|
+
provider: string | null;
|
|
507
|
+
targetType: "other" | "booking" | "order" | "invoice" | "booking_payment_schedule" | "booking_guarantee";
|
|
508
|
+
targetId: string | null;
|
|
509
|
+
orderId: string | null;
|
|
510
|
+
currency: string;
|
|
511
|
+
invoiceId: string | null;
|
|
512
|
+
amountCents: number;
|
|
513
|
+
bookingPaymentScheduleId: string | null;
|
|
514
|
+
paymentInstrumentId: string | null;
|
|
515
|
+
bookingGuaranteeId: string | null;
|
|
516
|
+
paymentAuthorizationId: string | null;
|
|
517
|
+
paymentCaptureId: string | null;
|
|
518
|
+
paymentMethod: "other" | "voucher" | "wallet" | "bank_transfer" | "credit_card" | "debit_card" | "cash" | "cheque" | "direct_bill" | null;
|
|
519
|
+
paymentId: string | null;
|
|
520
|
+
providerSessionId: string | null;
|
|
521
|
+
providerPaymentId: string | null;
|
|
522
|
+
externalReference: string | null;
|
|
523
|
+
idempotencyKey: string | null;
|
|
524
|
+
clientReference: string | null;
|
|
525
|
+
payerPersonId: string | null;
|
|
526
|
+
payerOrganizationId: string | null;
|
|
527
|
+
payerEmail: string | null;
|
|
528
|
+
payerName: string | null;
|
|
529
|
+
redirectUrl: string | null;
|
|
530
|
+
returnUrl: string | null;
|
|
531
|
+
cancelUrl: string | null;
|
|
532
|
+
callbackUrl: string | null;
|
|
533
|
+
failedAt: string | null;
|
|
534
|
+
failureCode: string | null;
|
|
535
|
+
failureMessage: string | null;
|
|
536
|
+
providerPayload: {
|
|
537
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
538
|
+
} | null;
|
|
539
|
+
} | null;
|
|
540
|
+
invoiceNotification: {
|
|
541
|
+
id: string;
|
|
542
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
543
|
+
personId: string | null;
|
|
544
|
+
organizationId: string | null;
|
|
545
|
+
createdAt: string;
|
|
546
|
+
updatedAt: string;
|
|
547
|
+
bookingId: string | null;
|
|
548
|
+
metadata: {
|
|
549
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
550
|
+
} | null;
|
|
551
|
+
channel: "email" | "sms";
|
|
552
|
+
provider: string;
|
|
553
|
+
targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
|
|
554
|
+
targetId: string | null;
|
|
555
|
+
templateId: string | null;
|
|
556
|
+
invoiceId: string | null;
|
|
557
|
+
failedAt: string | null;
|
|
558
|
+
errorMessage: string | null;
|
|
559
|
+
subject: string | null;
|
|
560
|
+
sentAt: string | null;
|
|
561
|
+
fromAddress: string | null;
|
|
562
|
+
templateSlug: string | null;
|
|
563
|
+
paymentSessionId: string | null;
|
|
564
|
+
providerMessageId: string | null;
|
|
565
|
+
toAddress: string;
|
|
566
|
+
htmlBody: string | null;
|
|
567
|
+
textBody: string | null;
|
|
568
|
+
payloadData: {
|
|
569
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
570
|
+
} | null;
|
|
571
|
+
scheduledFor: string | null;
|
|
572
|
+
} | null;
|
|
573
|
+
paymentSessionNotification: {
|
|
574
|
+
id: string;
|
|
575
|
+
status: "cancelled" | "pending" | "failed" | "sent";
|
|
576
|
+
personId: string | null;
|
|
577
|
+
organizationId: string | null;
|
|
578
|
+
createdAt: string;
|
|
579
|
+
updatedAt: string;
|
|
580
|
+
bookingId: string | null;
|
|
581
|
+
metadata: {
|
|
582
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
583
|
+
} | null;
|
|
584
|
+
channel: "email" | "sms";
|
|
585
|
+
provider: string;
|
|
586
|
+
targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
|
|
587
|
+
targetId: string | null;
|
|
588
|
+
templateId: string | null;
|
|
589
|
+
invoiceId: string | null;
|
|
590
|
+
failedAt: string | null;
|
|
591
|
+
errorMessage: string | null;
|
|
592
|
+
subject: string | null;
|
|
593
|
+
sentAt: string | null;
|
|
594
|
+
fromAddress: string | null;
|
|
595
|
+
templateSlug: string | null;
|
|
596
|
+
paymentSessionId: string | null;
|
|
597
|
+
providerMessageId: string | null;
|
|
598
|
+
toAddress: string;
|
|
599
|
+
htmlBody: string | null;
|
|
600
|
+
textBody: string | null;
|
|
601
|
+
payloadData: {
|
|
602
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
603
|
+
} | null;
|
|
604
|
+
scheduledFor: string | null;
|
|
605
|
+
} | null;
|
|
606
|
+
bankTransferInstructions: {
|
|
607
|
+
provider: string | null;
|
|
608
|
+
invoiceId: string;
|
|
609
|
+
invoiceNumber: string;
|
|
610
|
+
documentType: "invoice" | "proforma";
|
|
611
|
+
amountCents: number;
|
|
612
|
+
currency: string;
|
|
613
|
+
dueDate: string | null;
|
|
614
|
+
beneficiary: string;
|
|
615
|
+
iban: string;
|
|
616
|
+
bankName: string | null;
|
|
617
|
+
notes: string | null;
|
|
618
|
+
} | null;
|
|
619
|
+
providerStart: {
|
|
620
|
+
provider: string;
|
|
621
|
+
paymentSessionId: string;
|
|
622
|
+
redirectUrl: string | null;
|
|
623
|
+
externalReference: string | null;
|
|
624
|
+
providerSessionId: string | null;
|
|
625
|
+
providerPaymentId: string | null;
|
|
626
|
+
response: {
|
|
627
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
628
|
+
} | null;
|
|
629
|
+
} | null;
|
|
630
|
+
};
|
|
631
|
+
};
|
|
632
|
+
outputFormat: "json";
|
|
633
|
+
status: 201;
|
|
634
|
+
} | {
|
|
635
|
+
input: {};
|
|
636
|
+
output: {
|
|
637
|
+
error: string;
|
|
638
|
+
};
|
|
639
|
+
outputFormat: "json";
|
|
640
|
+
status: 409;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
}, "/", "/v1/checkout/collections/bootstrap">;
|
|
384
644
|
export declare function createCheckoutAdminRoutes(): import("hono/hono-base").HonoBase<Env, {
|
|
385
645
|
"/bookings/:bookingId/reminder-runs": {
|
|
386
646
|
$get: {
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAI3B,MAAM,cAAc,CAAA;AAQrB,KAAK,GAAG,GAAG;IACT,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,wBAAgB,oBAAoB,CAClC,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,qBAAqB,CAAA;IAC9B,SAAS,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAC/C,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAC7F,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAA;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U,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,GACnD,UAAU,CAMZ"}
|
package/dist/routes.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { createNotificationService } from "@voyantjs/notifications";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import { initiateCheckoutCollection, listBookingReminderRuns, previewCheckoutCollection, } from "./service.js";
|
|
4
|
-
import { checkoutReminderRunListQuerySchema, initiateCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./validation.js";
|
|
3
|
+
import { bootstrapCheckoutCollection, initiateCheckoutCollection, listBookingReminderRuns, previewCheckoutCollection, } from "./service.js";
|
|
4
|
+
import { bootstrapCheckoutCollectionSchema, checkoutReminderRunListQuerySchema, initiateCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./validation.js";
|
|
5
5
|
export function createCheckoutRoutes(options = {}) {
|
|
6
|
+
function createCheckoutRuntime(bindings) {
|
|
7
|
+
return {
|
|
8
|
+
bindings,
|
|
9
|
+
paymentStarters: options.resolvePaymentStarters?.(bindings) ?? options.paymentStarters ?? {},
|
|
10
|
+
bankTransferDetails: options.resolveBankTransferDetails?.(bindings) ?? options.bankTransferDetails ?? null,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
6
13
|
return new Hono()
|
|
7
14
|
.post("/v1/checkout/bookings/:bookingId/collection-plan", async (c) => {
|
|
8
15
|
try {
|
|
@@ -20,11 +27,7 @@ export function createCheckoutRoutes(options = {}) {
|
|
|
20
27
|
.post("/v1/checkout/bookings/:bookingId/initiate-collection", async (c) => {
|
|
21
28
|
try {
|
|
22
29
|
const dispatcher = createNotificationService(options.resolveProviders?.(c.env) ?? options.providers ?? []);
|
|
23
|
-
const result = await initiateCheckoutCollection(c.get("db"), c.req.param("bookingId"), initiateCheckoutCollectionSchema.parse(await c.req.json()), options.policy, dispatcher,
|
|
24
|
-
bindings: c.env,
|
|
25
|
-
paymentStarters: options.resolvePaymentStarters?.(c.env) ?? options.paymentStarters ?? {},
|
|
26
|
-
bankTransferDetails: options.resolveBankTransferDetails?.(c.env) ?? options.bankTransferDetails ?? null,
|
|
27
|
-
});
|
|
30
|
+
const result = await initiateCheckoutCollection(c.get("db"), c.req.param("bookingId"), initiateCheckoutCollectionSchema.parse(await c.req.json()), options.policy, dispatcher, createCheckoutRuntime(c.env));
|
|
28
31
|
if (!result) {
|
|
29
32
|
return c.json({ error: "Booking not found" }, 404);
|
|
30
33
|
}
|
|
@@ -37,6 +40,23 @@ export function createCheckoutRoutes(options = {}) {
|
|
|
37
40
|
}
|
|
38
41
|
return c.json({ error: message }, 409);
|
|
39
42
|
}
|
|
43
|
+
})
|
|
44
|
+
.post("/v1/checkout/collections/bootstrap", async (c) => {
|
|
45
|
+
try {
|
|
46
|
+
const dispatcher = createNotificationService(options.resolveProviders?.(c.env) ?? options.providers ?? []);
|
|
47
|
+
const result = await bootstrapCheckoutCollection(c.get("db"), bootstrapCheckoutCollectionSchema.parse(await c.req.json()), options.policy, dispatcher, createCheckoutRuntime(c.env));
|
|
48
|
+
if (!result) {
|
|
49
|
+
return c.json({ error: "Booking session not found" }, 404);
|
|
50
|
+
}
|
|
51
|
+
return c.json({ data: result }, 201);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const message = error instanceof Error ? error.message : "Failed to bootstrap checkout collection";
|
|
55
|
+
if (message.includes("Booking not found")) {
|
|
56
|
+
return c.json({ error: message }, 404);
|
|
57
|
+
}
|
|
58
|
+
return c.json({ error: message }, 409);
|
|
59
|
+
}
|
|
40
60
|
});
|
|
41
61
|
}
|
|
42
62
|
export function createCheckoutAdminRoutes() {
|
package/dist/service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bookingPaymentSchedules, invoices, type PaymentSession } from "@voyantjs/finance";
|
|
2
2
|
import type { NotificationDelivery, NotificationService } from "@voyantjs/notifications";
|
|
3
3
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
4
|
-
import type { CheckoutBankTransferInstructionsRecord, CheckoutProviderStartInput, CheckoutReminderRunListQuery, InitiateCheckoutCollectionInput, PreviewCheckoutCollectionInput } from "./validation.js";
|
|
4
|
+
import type { BootstrapCheckoutCollectionInput, CheckoutBankTransferInstructionsRecord, CheckoutProviderStartInput, CheckoutReminderRunListQuery, InitiateCheckoutCollectionInput, PreviewCheckoutCollectionInput } from "./validation.js";
|
|
5
5
|
export interface CheckoutPolicyOptions {
|
|
6
6
|
defaultCardCollectionTarget?: "schedule" | "invoice";
|
|
7
7
|
defaultReminderCardCollectionTarget?: "schedule" | "invoice";
|
|
@@ -66,6 +66,12 @@ export interface InitiatedCheckoutCollection {
|
|
|
66
66
|
bankTransferInstructions: CheckoutBankTransferInstructionsRecord | null;
|
|
67
67
|
providerStart: CheckoutProviderStartResult | null;
|
|
68
68
|
}
|
|
69
|
+
export interface BootstrappedCheckoutCollection extends InitiatedCheckoutCollection {
|
|
70
|
+
bookingId: string;
|
|
71
|
+
sessionId: string;
|
|
72
|
+
sourceType: "booking" | "session";
|
|
73
|
+
intent: "deposit" | "balance" | "custom";
|
|
74
|
+
}
|
|
69
75
|
export interface CheckoutRuntimeOptions {
|
|
70
76
|
bindings?: Record<string, unknown>;
|
|
71
77
|
bankTransferDetails?: CheckoutBankTransferDetails | null;
|
|
@@ -101,5 +107,6 @@ export interface CheckoutReminderRunList {
|
|
|
101
107
|
export declare function resolvePaymentSessionTarget(method: "card" | "bank_transfer", stage: "initial" | "reminder" | "manual", override: "schedule" | "invoice" | undefined, options: CheckoutPolicyOptions): "invoice" | "schedule";
|
|
102
108
|
export declare function previewCheckoutCollection(db: PostgresJsDatabase, bookingId: string, input: PreviewCheckoutCollectionInput, options?: CheckoutPolicyOptions): Promise<CheckoutCollectionPlan | null>;
|
|
103
109
|
export declare function initiateCheckoutCollection(db: PostgresJsDatabase, bookingId: string, input: InitiateCheckoutCollectionInput, options?: CheckoutPolicyOptions, dispatcher?: NotificationService, runtime?: CheckoutRuntimeOptions): Promise<InitiatedCheckoutCollection | null>;
|
|
110
|
+
export declare function bootstrapCheckoutCollection(db: PostgresJsDatabase, input: BootstrapCheckoutCollectionInput, options?: CheckoutPolicyOptions, dispatcher?: NotificationService, runtime?: CheckoutRuntimeOptions): Promise<BootstrappedCheckoutCollection | null>;
|
|
104
111
|
export declare function listBookingReminderRuns(db: PostgresJsDatabase, bookingId: string, query: CheckoutReminderRunListQuery): Promise<CheckoutReminderRunList>;
|
|
105
112
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EAIvB,QAAQ,EACR,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAQxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,KAAK,EACV,sCAAsC,EACtC,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC/B,MAAM,iBAAiB,CAAA;AAExB,MAAM,WAAW,qBAAqB;IACpC,2BAA2B,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IACpD,mCAAmC,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAC5D,+BAA+B,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IACxD,kBAAkB,CAAC,EAAE;QACnB,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,cAAc,CAAA;QACnD,YAAY,EAAE,MAAM,CAAA;QACpB,yBAAyB,EAAE,MAAM,CAAA;QACjC,oBAAoB,EAAE,OAAO,CAAA;QAC7B,eAAe,EAAE,OAAO,CAAA;QACxB,aAAa,EACT,SAAS,GACT,aAAa,GACb,SAAS,GACT,cAAc,GACd,eAAe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CAAgC,EACvC,OAAO,GAAE,qBAA0B,EACnC,UAAU,CAAC,EAAE,mBAAmB,EAChC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,8BAA8B,GAAG,IAAI,CAAC,CAoChD;AAED,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,uBAAuB,CAAC,CAwElC"}
|
package/dist/service.js
CHANGED
|
@@ -61,6 +61,43 @@ function normalizeExactAmountCents(amountCents) {
|
|
|
61
61
|
? Math.round(amountCents)
|
|
62
62
|
: null;
|
|
63
63
|
}
|
|
64
|
+
function resolveCheckoutIntent(input) {
|
|
65
|
+
if ("intent" in input && input.intent) {
|
|
66
|
+
return input.intent;
|
|
67
|
+
}
|
|
68
|
+
if (typeof input.amountCents === "number" &&
|
|
69
|
+
Number.isFinite(input.amountCents) &&
|
|
70
|
+
input.amountCents > 0) {
|
|
71
|
+
return "custom";
|
|
72
|
+
}
|
|
73
|
+
if (input.stage === "initial") {
|
|
74
|
+
return "deposit";
|
|
75
|
+
}
|
|
76
|
+
if (input.stage === "reminder") {
|
|
77
|
+
return "balance";
|
|
78
|
+
}
|
|
79
|
+
return "custom";
|
|
80
|
+
}
|
|
81
|
+
function resolveCheckoutSubject(input) {
|
|
82
|
+
if (input.bookingId && input.sessionId && input.bookingId !== input.sessionId) {
|
|
83
|
+
throw new Error("bookingId and sessionId must refer to the same booking session");
|
|
84
|
+
}
|
|
85
|
+
if (input.bookingId) {
|
|
86
|
+
return {
|
|
87
|
+
bookingId: input.bookingId,
|
|
88
|
+
sessionId: input.sessionId ?? input.bookingId,
|
|
89
|
+
sourceType: "booking",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (input.sessionId) {
|
|
93
|
+
return {
|
|
94
|
+
bookingId: input.sessionId,
|
|
95
|
+
sessionId: input.sessionId,
|
|
96
|
+
sourceType: "session",
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
throw new Error("Provide a bookingId or sessionId");
|
|
100
|
+
}
|
|
64
101
|
function toInvoiceDueDateTime(value) {
|
|
65
102
|
return value ? `${value}T00:00:00.000Z` : null;
|
|
66
103
|
}
|
|
@@ -363,6 +400,34 @@ export async function initiateCheckoutCollection(db, bookingId, input, options =
|
|
|
363
400
|
providerStart,
|
|
364
401
|
};
|
|
365
402
|
}
|
|
403
|
+
export async function bootstrapCheckoutCollection(db, input, options = {}, dispatcher, runtime = {}) {
|
|
404
|
+
const subject = resolveCheckoutSubject(input);
|
|
405
|
+
const initiated = await initiateCheckoutCollection(db, subject.bookingId, {
|
|
406
|
+
method: input.method,
|
|
407
|
+
stage: input.stage,
|
|
408
|
+
scheduleId: input.scheduleId,
|
|
409
|
+
invoiceId: input.invoiceId,
|
|
410
|
+
amountCents: input.amountCents,
|
|
411
|
+
ensureDefaultPaymentPlan: input.ensureDefaultPaymentPlan,
|
|
412
|
+
paymentSessionTarget: input.paymentSessionTarget,
|
|
413
|
+
paymentPlan: input.paymentPlan,
|
|
414
|
+
paymentSession: input.paymentSession,
|
|
415
|
+
paymentSessionNotification: input.paymentSessionNotification,
|
|
416
|
+
invoiceNotification: input.invoiceNotification,
|
|
417
|
+
startProvider: input.startProvider,
|
|
418
|
+
notes: input.notes,
|
|
419
|
+
}, options, dispatcher, runtime);
|
|
420
|
+
if (!initiated) {
|
|
421
|
+
return null;
|
|
422
|
+
}
|
|
423
|
+
return {
|
|
424
|
+
bookingId: subject.bookingId,
|
|
425
|
+
sessionId: subject.sessionId,
|
|
426
|
+
sourceType: subject.sourceType,
|
|
427
|
+
intent: resolveCheckoutIntent(input),
|
|
428
|
+
...initiated,
|
|
429
|
+
};
|
|
430
|
+
}
|
|
366
431
|
export async function listBookingReminderRuns(db, bookingId, query) {
|
|
367
432
|
const where = and(eq(notificationReminderRuns.bookingId, bookingId), ...(query.status ? [eq(notificationReminderRuns.status, query.status)] : []));
|
|
368
433
|
const [rows, countResult] = await Promise.all([
|
package/dist/validation.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export declare const checkoutCollectionStageSchema: z.ZodEnum<{
|
|
|
8
8
|
initial: "initial";
|
|
9
9
|
reminder: "reminder";
|
|
10
10
|
}>;
|
|
11
|
+
export declare const checkoutCollectionIntentSchema: z.ZodEnum<{
|
|
12
|
+
custom: "custom";
|
|
13
|
+
deposit: "deposit";
|
|
14
|
+
balance: "balance";
|
|
15
|
+
}>;
|
|
11
16
|
export declare const checkoutPaymentSessionTargetSchema: z.ZodEnum<{
|
|
12
17
|
invoice: "invoice";
|
|
13
18
|
schedule: "schedule";
|
|
@@ -220,6 +225,171 @@ export declare const initiateCheckoutCollectionSchema: z.ZodObject<{
|
|
|
220
225
|
}, z.core.$strip>>;
|
|
221
226
|
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
222
227
|
}, z.core.$strip>;
|
|
228
|
+
export declare const bootstrapCheckoutCollectionSchema: z.ZodObject<{
|
|
229
|
+
method: z.ZodEnum<{
|
|
230
|
+
bank_transfer: "bank_transfer";
|
|
231
|
+
card: "card";
|
|
232
|
+
}>;
|
|
233
|
+
stage: z.ZodDefault<z.ZodEnum<{
|
|
234
|
+
manual: "manual";
|
|
235
|
+
initial: "initial";
|
|
236
|
+
reminder: "reminder";
|
|
237
|
+
}>>;
|
|
238
|
+
scheduleId: z.ZodOptional<z.ZodString>;
|
|
239
|
+
invoiceId: z.ZodOptional<z.ZodString>;
|
|
240
|
+
amountCents: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
ensureDefaultPaymentPlan: z.ZodDefault<z.ZodBoolean>;
|
|
242
|
+
paymentSessionTarget: z.ZodOptional<z.ZodEnum<{
|
|
243
|
+
invoice: "invoice";
|
|
244
|
+
schedule: "schedule";
|
|
245
|
+
}>>;
|
|
246
|
+
paymentPlan: z.ZodOptional<z.ZodObject<{
|
|
247
|
+
depositMode: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
248
|
+
percentage: "percentage";
|
|
249
|
+
none: "none";
|
|
250
|
+
fixed_amount: "fixed_amount";
|
|
251
|
+
}>>>;
|
|
252
|
+
depositValue: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
253
|
+
depositDueDate: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
254
|
+
balanceDueDaysBeforeStart: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
255
|
+
clearExistingPending: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
256
|
+
createGuarantee: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
257
|
+
guaranteeType: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
|
|
258
|
+
other: "other";
|
|
259
|
+
voucher: "voucher";
|
|
260
|
+
bank_transfer: "bank_transfer";
|
|
261
|
+
credit_card: "credit_card";
|
|
262
|
+
deposit: "deposit";
|
|
263
|
+
preauth: "preauth";
|
|
264
|
+
card_on_file: "card_on_file";
|
|
265
|
+
agency_letter: "agency_letter";
|
|
266
|
+
}>>>;
|
|
267
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
paymentSession: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
270
|
+
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
271
|
+
paymentMethod: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
272
|
+
other: "other";
|
|
273
|
+
voucher: "voucher";
|
|
274
|
+
wallet: "wallet";
|
|
275
|
+
bank_transfer: "bank_transfer";
|
|
276
|
+
credit_card: "credit_card";
|
|
277
|
+
debit_card: "debit_card";
|
|
278
|
+
cash: "cash";
|
|
279
|
+
cheque: "cheque";
|
|
280
|
+
direct_bill: "direct_bill";
|
|
281
|
+
}>>>;
|
|
282
|
+
payerPersonId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
283
|
+
payerOrganizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
284
|
+
payerEmail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
285
|
+
payerName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
286
|
+
externalReference: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
287
|
+
idempotencyKey: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
288
|
+
clientReference: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
289
|
+
returnUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
290
|
+
cancelUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
291
|
+
callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
292
|
+
expiresAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
293
|
+
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
294
|
+
providerPayload: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
295
|
+
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
296
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
297
|
+
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
298
|
+
paymentMethod: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
299
|
+
other: "other";
|
|
300
|
+
voucher: "voucher";
|
|
301
|
+
wallet: "wallet";
|
|
302
|
+
bank_transfer: "bank_transfer";
|
|
303
|
+
credit_card: "credit_card";
|
|
304
|
+
debit_card: "debit_card";
|
|
305
|
+
cash: "cash";
|
|
306
|
+
cheque: "cheque";
|
|
307
|
+
direct_bill: "direct_bill";
|
|
308
|
+
}>>>;
|
|
309
|
+
payerPersonId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
310
|
+
payerOrganizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
311
|
+
payerEmail: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
312
|
+
payerName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
313
|
+
externalReference: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
314
|
+
idempotencyKey: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
315
|
+
clientReference: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
316
|
+
returnUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
317
|
+
cancelUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
318
|
+
callbackUrl: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
319
|
+
expiresAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
320
|
+
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
321
|
+
providerPayload: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
322
|
+
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
323
|
+
}, z.core.$strip>]>>;
|
|
324
|
+
paymentSessionNotification: z.ZodOptional<z.ZodObject<{
|
|
325
|
+
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
326
|
+
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
327
|
+
channel: z.ZodDefault<z.ZodEnum<{
|
|
328
|
+
email: "email";
|
|
329
|
+
sms: "sms";
|
|
330
|
+
}>>;
|
|
331
|
+
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
332
|
+
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
333
|
+
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
334
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
335
|
+
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
336
|
+
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
337
|
+
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
338
|
+
filename: z.ZodString;
|
|
339
|
+
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
340
|
+
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
341
|
+
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
342
|
+
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
343
|
+
attachment: "attachment";
|
|
344
|
+
inline: "inline";
|
|
345
|
+
}>>>;
|
|
346
|
+
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
347
|
+
}, z.core.$strip>>>>;
|
|
348
|
+
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
349
|
+
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
350
|
+
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
351
|
+
}, z.core.$strip>>;
|
|
352
|
+
invoiceNotification: z.ZodOptional<z.ZodObject<{
|
|
353
|
+
templateId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
354
|
+
templateSlug: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
355
|
+
channel: z.ZodDefault<z.ZodEnum<{
|
|
356
|
+
email: "email";
|
|
357
|
+
sms: "sms";
|
|
358
|
+
}>>;
|
|
359
|
+
provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
360
|
+
to: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
361
|
+
from: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
362
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
363
|
+
html: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
364
|
+
text: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
365
|
+
attachments: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
366
|
+
filename: z.ZodString;
|
|
367
|
+
contentBase64: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
368
|
+
path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
369
|
+
contentType: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
370
|
+
disposition: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
371
|
+
attachment: "attachment";
|
|
372
|
+
inline: "inline";
|
|
373
|
+
}>>>;
|
|
374
|
+
contentId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
375
|
+
}, z.core.$strip>>>>;
|
|
376
|
+
data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
377
|
+
metadata: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
378
|
+
scheduledFor: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
379
|
+
}, z.core.$strip>>;
|
|
380
|
+
startProvider: z.ZodOptional<z.ZodObject<{
|
|
381
|
+
provider: z.ZodString;
|
|
382
|
+
payload: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
383
|
+
}, z.core.$strip>>;
|
|
384
|
+
notes: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
385
|
+
bookingId: z.ZodOptional<z.ZodString>;
|
|
386
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
387
|
+
intent: z.ZodOptional<z.ZodEnum<{
|
|
388
|
+
custom: "custom";
|
|
389
|
+
deposit: "deposit";
|
|
390
|
+
balance: "balance";
|
|
391
|
+
}>>;
|
|
392
|
+
}, z.core.$strip>;
|
|
223
393
|
export declare const checkoutCollectionScheduleSchema: z.ZodObject<{
|
|
224
394
|
id: z.ZodString;
|
|
225
395
|
bookingId: z.ZodString;
|
|
@@ -548,6 +718,213 @@ export declare const initiatedCheckoutCollectionSchema: z.ZodObject<{
|
|
|
548
718
|
response: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
549
719
|
}, z.core.$strip>>;
|
|
550
720
|
}, z.core.$strip>;
|
|
721
|
+
export declare const bootstrappedCheckoutCollectionSchema: z.ZodObject<{
|
|
722
|
+
plan: z.ZodObject<{
|
|
723
|
+
bookingId: z.ZodString;
|
|
724
|
+
method: z.ZodEnum<{
|
|
725
|
+
bank_transfer: "bank_transfer";
|
|
726
|
+
card: "card";
|
|
727
|
+
}>;
|
|
728
|
+
stage: z.ZodEnum<{
|
|
729
|
+
manual: "manual";
|
|
730
|
+
initial: "initial";
|
|
731
|
+
reminder: "reminder";
|
|
732
|
+
}>;
|
|
733
|
+
paymentSessionTarget: z.ZodNullable<z.ZodEnum<{
|
|
734
|
+
invoice: "invoice";
|
|
735
|
+
schedule: "schedule";
|
|
736
|
+
}>>;
|
|
737
|
+
documentType: z.ZodNullable<z.ZodEnum<{
|
|
738
|
+
invoice: "invoice";
|
|
739
|
+
proforma: "proforma";
|
|
740
|
+
}>>;
|
|
741
|
+
willCreateDefaultPaymentPlan: z.ZodBoolean;
|
|
742
|
+
selectedSchedule: z.ZodNullable<z.ZodObject<{
|
|
743
|
+
id: z.ZodString;
|
|
744
|
+
bookingId: z.ZodString;
|
|
745
|
+
bookingItemId: z.ZodNullable<z.ZodString>;
|
|
746
|
+
scheduleType: z.ZodString;
|
|
747
|
+
status: z.ZodString;
|
|
748
|
+
dueDate: z.ZodString;
|
|
749
|
+
currency: z.ZodString;
|
|
750
|
+
amountCents: z.ZodNumber;
|
|
751
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
752
|
+
}, z.core.$strip>>;
|
|
753
|
+
selectedInvoice: z.ZodNullable<z.ZodObject<{
|
|
754
|
+
id: z.ZodString;
|
|
755
|
+
invoiceNumber: z.ZodString;
|
|
756
|
+
invoiceType: z.ZodString;
|
|
757
|
+
bookingId: z.ZodString;
|
|
758
|
+
personId: z.ZodNullable<z.ZodString>;
|
|
759
|
+
organizationId: z.ZodNullable<z.ZodString>;
|
|
760
|
+
status: z.ZodString;
|
|
761
|
+
currency: z.ZodString;
|
|
762
|
+
totalCents: z.ZodNumber;
|
|
763
|
+
paidCents: z.ZodNumber;
|
|
764
|
+
balanceDueCents: z.ZodNumber;
|
|
765
|
+
issueDate: z.ZodString;
|
|
766
|
+
dueDate: z.ZodString;
|
|
767
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
768
|
+
createdAt: z.ZodString;
|
|
769
|
+
updatedAt: z.ZodString;
|
|
770
|
+
}, z.core.$strip>>;
|
|
771
|
+
amountCents: z.ZodNumber;
|
|
772
|
+
currency: z.ZodString;
|
|
773
|
+
recommendedAction: z.ZodEnum<{
|
|
774
|
+
none: "none";
|
|
775
|
+
create_bank_transfer_document: "create_bank_transfer_document";
|
|
776
|
+
create_payment_session: "create_payment_session";
|
|
777
|
+
create_invoice_then_payment_session: "create_invoice_then_payment_session";
|
|
778
|
+
}>;
|
|
779
|
+
}, z.core.$strip>;
|
|
780
|
+
invoice: z.ZodNullable<z.ZodObject<{
|
|
781
|
+
id: z.ZodString;
|
|
782
|
+
invoiceNumber: z.ZodString;
|
|
783
|
+
invoiceType: z.ZodString;
|
|
784
|
+
bookingId: z.ZodString;
|
|
785
|
+
personId: z.ZodNullable<z.ZodString>;
|
|
786
|
+
organizationId: z.ZodNullable<z.ZodString>;
|
|
787
|
+
status: z.ZodString;
|
|
788
|
+
currency: z.ZodString;
|
|
789
|
+
totalCents: z.ZodNumber;
|
|
790
|
+
paidCents: z.ZodNumber;
|
|
791
|
+
balanceDueCents: z.ZodNumber;
|
|
792
|
+
issueDate: z.ZodString;
|
|
793
|
+
dueDate: z.ZodString;
|
|
794
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
795
|
+
createdAt: z.ZodString;
|
|
796
|
+
updatedAt: z.ZodString;
|
|
797
|
+
}, z.core.$strip>>;
|
|
798
|
+
paymentSession: z.ZodNullable<z.ZodObject<{
|
|
799
|
+
id: z.ZodString;
|
|
800
|
+
targetType: z.ZodEnum<{
|
|
801
|
+
other: "other";
|
|
802
|
+
booking: "booking";
|
|
803
|
+
order: "order";
|
|
804
|
+
invoice: "invoice";
|
|
805
|
+
booking_payment_schedule: "booking_payment_schedule";
|
|
806
|
+
booking_guarantee: "booking_guarantee";
|
|
807
|
+
}>;
|
|
808
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
809
|
+
bookingId: z.ZodNullable<z.ZodString>;
|
|
810
|
+
invoiceId: z.ZodNullable<z.ZodString>;
|
|
811
|
+
bookingPaymentScheduleId: z.ZodNullable<z.ZodString>;
|
|
812
|
+
bookingGuaranteeId: z.ZodNullable<z.ZodString>;
|
|
813
|
+
status: z.ZodEnum<{
|
|
814
|
+
expired: "expired";
|
|
815
|
+
cancelled: "cancelled";
|
|
816
|
+
pending: "pending";
|
|
817
|
+
failed: "failed";
|
|
818
|
+
paid: "paid";
|
|
819
|
+
requires_redirect: "requires_redirect";
|
|
820
|
+
processing: "processing";
|
|
821
|
+
authorized: "authorized";
|
|
822
|
+
}>;
|
|
823
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
824
|
+
providerSessionId: z.ZodNullable<z.ZodString>;
|
|
825
|
+
providerPaymentId: z.ZodNullable<z.ZodString>;
|
|
826
|
+
externalReference: z.ZodNullable<z.ZodString>;
|
|
827
|
+
clientReference: z.ZodNullable<z.ZodString>;
|
|
828
|
+
currency: z.ZodString;
|
|
829
|
+
amountCents: z.ZodNumber;
|
|
830
|
+
paymentMethod: z.ZodNullable<z.ZodEnum<{
|
|
831
|
+
other: "other";
|
|
832
|
+
voucher: "voucher";
|
|
833
|
+
wallet: "wallet";
|
|
834
|
+
bank_transfer: "bank_transfer";
|
|
835
|
+
credit_card: "credit_card";
|
|
836
|
+
debit_card: "debit_card";
|
|
837
|
+
cash: "cash";
|
|
838
|
+
cheque: "cheque";
|
|
839
|
+
direct_bill: "direct_bill";
|
|
840
|
+
}>>;
|
|
841
|
+
payerEmail: z.ZodNullable<z.ZodString>;
|
|
842
|
+
payerName: z.ZodNullable<z.ZodString>;
|
|
843
|
+
redirectUrl: z.ZodNullable<z.ZodString>;
|
|
844
|
+
returnUrl: z.ZodNullable<z.ZodString>;
|
|
845
|
+
cancelUrl: z.ZodNullable<z.ZodString>;
|
|
846
|
+
expiresAt: z.ZodNullable<z.ZodString>;
|
|
847
|
+
completedAt: z.ZodNullable<z.ZodString>;
|
|
848
|
+
failureCode: z.ZodNullable<z.ZodString>;
|
|
849
|
+
failureMessage: z.ZodNullable<z.ZodString>;
|
|
850
|
+
}, z.core.$strip>>;
|
|
851
|
+
invoiceNotification: z.ZodNullable<z.ZodObject<{
|
|
852
|
+
id: z.ZodString;
|
|
853
|
+
templateSlug: z.ZodNullable<z.ZodString>;
|
|
854
|
+
channel: z.ZodEnum<{
|
|
855
|
+
email: "email";
|
|
856
|
+
sms: "sms";
|
|
857
|
+
}>;
|
|
858
|
+
provider: z.ZodString;
|
|
859
|
+
status: z.ZodEnum<{
|
|
860
|
+
cancelled: "cancelled";
|
|
861
|
+
pending: "pending";
|
|
862
|
+
failed: "failed";
|
|
863
|
+
sent: "sent";
|
|
864
|
+
}>;
|
|
865
|
+
toAddress: z.ZodString;
|
|
866
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
867
|
+
sentAt: z.ZodNullable<z.ZodString>;
|
|
868
|
+
failedAt: z.ZodNullable<z.ZodString>;
|
|
869
|
+
errorMessage: z.ZodNullable<z.ZodString>;
|
|
870
|
+
}, z.core.$strip>>;
|
|
871
|
+
paymentSessionNotification: z.ZodNullable<z.ZodObject<{
|
|
872
|
+
id: z.ZodString;
|
|
873
|
+
templateSlug: z.ZodNullable<z.ZodString>;
|
|
874
|
+
channel: z.ZodEnum<{
|
|
875
|
+
email: "email";
|
|
876
|
+
sms: "sms";
|
|
877
|
+
}>;
|
|
878
|
+
provider: z.ZodString;
|
|
879
|
+
status: z.ZodEnum<{
|
|
880
|
+
cancelled: "cancelled";
|
|
881
|
+
pending: "pending";
|
|
882
|
+
failed: "failed";
|
|
883
|
+
sent: "sent";
|
|
884
|
+
}>;
|
|
885
|
+
toAddress: z.ZodString;
|
|
886
|
+
subject: z.ZodNullable<z.ZodString>;
|
|
887
|
+
sentAt: z.ZodNullable<z.ZodString>;
|
|
888
|
+
failedAt: z.ZodNullable<z.ZodString>;
|
|
889
|
+
errorMessage: z.ZodNullable<z.ZodString>;
|
|
890
|
+
}, z.core.$strip>>;
|
|
891
|
+
bankTransferInstructions: z.ZodNullable<z.ZodObject<{
|
|
892
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
893
|
+
invoiceId: z.ZodString;
|
|
894
|
+
invoiceNumber: z.ZodString;
|
|
895
|
+
documentType: z.ZodEnum<{
|
|
896
|
+
invoice: "invoice";
|
|
897
|
+
proforma: "proforma";
|
|
898
|
+
}>;
|
|
899
|
+
amountCents: z.ZodNumber;
|
|
900
|
+
currency: z.ZodString;
|
|
901
|
+
dueDate: z.ZodNullable<z.ZodString>;
|
|
902
|
+
beneficiary: z.ZodString;
|
|
903
|
+
iban: z.ZodString;
|
|
904
|
+
bankName: z.ZodNullable<z.ZodString>;
|
|
905
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
906
|
+
}, z.core.$strip>>;
|
|
907
|
+
providerStart: z.ZodNullable<z.ZodObject<{
|
|
908
|
+
provider: z.ZodString;
|
|
909
|
+
paymentSessionId: z.ZodString;
|
|
910
|
+
redirectUrl: z.ZodNullable<z.ZodString>;
|
|
911
|
+
externalReference: z.ZodNullable<z.ZodString>;
|
|
912
|
+
providerSessionId: z.ZodNullable<z.ZodString>;
|
|
913
|
+
providerPaymentId: z.ZodNullable<z.ZodString>;
|
|
914
|
+
response: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
915
|
+
}, z.core.$strip>>;
|
|
916
|
+
bookingId: z.ZodString;
|
|
917
|
+
sessionId: z.ZodString;
|
|
918
|
+
sourceType: z.ZodEnum<{
|
|
919
|
+
session: "session";
|
|
920
|
+
booking: "booking";
|
|
921
|
+
}>;
|
|
922
|
+
intent: z.ZodEnum<{
|
|
923
|
+
custom: "custom";
|
|
924
|
+
deposit: "deposit";
|
|
925
|
+
balance: "balance";
|
|
926
|
+
}>;
|
|
927
|
+
}, z.core.$strip>;
|
|
551
928
|
export declare const checkoutReminderRunListQuerySchema: z.ZodObject<{
|
|
552
929
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
553
930
|
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
@@ -639,8 +1016,10 @@ export declare const checkoutReminderRunListResponseSchema: z.ZodObject<{
|
|
|
639
1016
|
}, z.core.$strip>;
|
|
640
1017
|
export type PreviewCheckoutCollectionInput = z.infer<typeof previewCheckoutCollectionSchema>;
|
|
641
1018
|
export type InitiateCheckoutCollectionInput = z.infer<typeof initiateCheckoutCollectionSchema>;
|
|
1019
|
+
export type BootstrapCheckoutCollectionInput = z.infer<typeof bootstrapCheckoutCollectionSchema>;
|
|
642
1020
|
export type CheckoutCollectionPlanRecord = z.infer<typeof checkoutCollectionPlanSchema>;
|
|
643
1021
|
export type InitiatedCheckoutCollectionRecord = z.infer<typeof initiatedCheckoutCollectionSchema>;
|
|
1022
|
+
export type BootstrappedCheckoutCollectionRecord = z.infer<typeof bootstrappedCheckoutCollectionSchema>;
|
|
644
1023
|
export type CheckoutProviderStartInput = z.infer<typeof checkoutProviderStartInputSchema>;
|
|
645
1024
|
export type CheckoutBankTransferInstructionsRecord = z.infer<typeof checkoutBankTransferInstructionsSchema>;
|
|
646
1025
|
export type CheckoutProviderStartResultRecord = z.infer<typeof checkoutProviderStartResultSchema>;
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,8BA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AsC,CAC9C,CAAA;AACD,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AACjG,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC7F,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
|
package/dist/validation.js
CHANGED
|
@@ -3,6 +3,7 @@ import { notificationChannelSchema, notificationDeliveryStatusSchema, notificati
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
export const checkoutCollectionMethodSchema = z.enum(["card", "bank_transfer"]);
|
|
5
5
|
export const checkoutCollectionStageSchema = z.enum(["initial", "reminder", "manual"]);
|
|
6
|
+
export const checkoutCollectionIntentSchema = z.enum(["deposit", "balance", "custom"]);
|
|
6
7
|
export const checkoutPaymentSessionTargetSchema = z.enum(["schedule", "invoice"]);
|
|
7
8
|
export const checkoutInvoiceDocumentTypeSchema = z.enum(["proforma", "invoice"]);
|
|
8
9
|
export const checkoutProviderStartInputSchema = z.object({
|
|
@@ -33,6 +34,16 @@ export const initiateCheckoutCollectionSchema = previewCheckoutCollectionSchema.
|
|
|
33
34
|
startProvider: checkoutProviderStartInputSchema.optional(),
|
|
34
35
|
notes: z.string().optional().nullable(),
|
|
35
36
|
});
|
|
37
|
+
export const bootstrapCheckoutCollectionSchema = initiateCheckoutCollectionSchema
|
|
38
|
+
.extend({
|
|
39
|
+
bookingId: z.string().min(1).optional(),
|
|
40
|
+
sessionId: z.string().min(1).optional(),
|
|
41
|
+
intent: checkoutCollectionIntentSchema.optional(),
|
|
42
|
+
})
|
|
43
|
+
.refine((value) => Boolean(value.bookingId || value.sessionId), {
|
|
44
|
+
message: "Provide a bookingId or sessionId",
|
|
45
|
+
path: ["bookingId"],
|
|
46
|
+
});
|
|
36
47
|
export const checkoutCollectionScheduleSchema = z.object({
|
|
37
48
|
id: z.string(),
|
|
38
49
|
bookingId: z.string(),
|
|
@@ -123,6 +134,12 @@ export const initiatedCheckoutCollectionSchema = z.object({
|
|
|
123
134
|
bankTransferInstructions: checkoutBankTransferInstructionsSchema.nullable(),
|
|
124
135
|
providerStart: checkoutProviderStartResultSchema.nullable(),
|
|
125
136
|
});
|
|
137
|
+
export const bootstrappedCheckoutCollectionSchema = initiatedCheckoutCollectionSchema.extend({
|
|
138
|
+
bookingId: z.string(),
|
|
139
|
+
sessionId: z.string(),
|
|
140
|
+
sourceType: z.enum(["booking", "session"]),
|
|
141
|
+
intent: checkoutCollectionIntentSchema,
|
|
142
|
+
});
|
|
126
143
|
export const checkoutReminderRunListQuerySchema = paginationSchema.extend({
|
|
127
144
|
status: notificationReminderRunStatusSchema.optional(),
|
|
128
145
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/checkout",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"drizzle-orm": "^0.45.2",
|
|
26
26
|
"hono": "^4.12.10",
|
|
27
27
|
"zod": "^4.3.6",
|
|
28
|
-
"@voyantjs/bookings": "0.4.
|
|
29
|
-
"@voyantjs/core": "0.4.
|
|
30
|
-
"@voyantjs/finance": "0.4.
|
|
31
|
-
"@voyantjs/hono": "0.4.
|
|
32
|
-
"@voyantjs/notifications": "0.4.
|
|
28
|
+
"@voyantjs/bookings": "0.4.3",
|
|
29
|
+
"@voyantjs/core": "0.4.3",
|
|
30
|
+
"@voyantjs/finance": "0.4.3",
|
|
31
|
+
"@voyantjs/hono": "0.4.3",
|
|
32
|
+
"@voyantjs/notifications": "0.4.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^6.0.2",
|