@voyant-travel/finance 0.151.3 → 0.152.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/booking-lifecycle.d.ts +13 -0
- package/dist/booking-lifecycle.d.ts.map +1 -0
- package/dist/booking-lifecycle.js +64 -0
- package/dist/booking-schedule/subscriber-runtime.d.ts +20 -0
- package/dist/booking-schedule/subscriber-runtime.d.ts.map +1 -0
- package/dist/booking-schedule/subscriber-runtime.js +39 -0
- package/dist/booking-tax.d.ts +31 -21
- package/dist/booking-tax.d.ts.map +1 -1
- package/dist/booking-tax.js +84 -13
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -7
- package/dist/mcp-runtime.d.ts +3 -0
- package/dist/mcp-runtime.d.ts.map +1 -0
- package/dist/mcp-runtime.js +16 -0
- package/dist/payment-schedule/routes.d.ts +1 -0
- package/dist/payment-schedule/routes.d.ts.map +1 -1
- package/dist/payment-schedule/routes.js +32 -0
- package/dist/routes-action-ledger.d.ts +19 -19
- package/dist/routes-booking-billing.d.ts +30 -30
- package/dist/routes-booking-create.d.ts.map +1 -1
- package/dist/routes-booking-create.js +2 -0
- package/dist/routes-booking-reads.d.ts +11 -11
- package/dist/routes-invoice-core.d.ts +11 -11
- package/dist/routes-public.d.ts +24 -24
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +12 -0
- package/dist/routes-reference-data.d.ts +15 -15
- package/dist/routes-reports.d.ts +11 -11
- package/dist/routes-settlement.d.ts +11 -11
- package/dist/routes-supplier-invoices.d.ts +20 -20
- package/dist/routes.d.ts +78 -78
- package/dist/runtime-contributor.d.ts +7 -0
- package/dist/runtime-contributor.d.ts.map +1 -0
- package/dist/runtime-contributor.js +17 -0
- package/dist/runtime-port.d.ts +70 -0
- package/dist/runtime-port.d.ts.map +1 -0
- package/dist/runtime-port.js +47 -0
- package/dist/runtime.d.ts +10 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +98 -0
- package/dist/stale-booking-holds-runtime.d.ts +9 -0
- package/dist/stale-booking-holds-runtime.d.ts.map +1 -0
- package/dist/stale-booking-holds-runtime.js +25 -0
- package/dist/voyant.d.ts.map +1 -1
- package/dist/voyant.js +157 -8
- package/openapi/admin/booking-tax.json +86 -0
- package/openapi/admin/finance.json +36583 -0
- package/openapi/storefront/finance.json +3678 -0
- package/package.json +45 -17
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BookingFinancialLifecycle } from "@voyant-travel/bookings";
|
|
2
|
+
export interface BookingCancellationSettlementInput {
|
|
3
|
+
bookingId: string;
|
|
4
|
+
bookingNumber: string;
|
|
5
|
+
previousStatus: "draft" | "on_hold" | "awaiting_payment" | "confirmed" | "in_progress";
|
|
6
|
+
reason: string | null;
|
|
7
|
+
actorId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const financeBookingLifecycle: BookingFinancialLifecycle;
|
|
10
|
+
export declare function closeTerminalBookingPaymentSchedules(db: Parameters<BookingFinancialLifecycle["closePaymentSchedulesForBooking"]>[0], bookingId: string, status: "cancelled" | "expired"): Promise<void>;
|
|
11
|
+
export declare function recordPaidBookingCancellationSettlement(db: Parameters<BookingFinancialLifecycle["recordCancellationFinancialSettlement"]>[0], input: BookingCancellationSettlementInput): Promise<Record<string, unknown> | null>;
|
|
12
|
+
export declare function buildPaidBookingCancellationSettlementNote(input: BookingCancellationSettlementInput): string;
|
|
13
|
+
//# sourceMappingURL=booking-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-lifecycle.d.ts","sourceRoot":"","sources":["../src/booking-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAKxE,MAAM,WAAW,kCAAkC;IACjD,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,OAAO,GAAG,SAAS,GAAG,kBAAkB,GAAG,WAAW,GAAG,aAAa,CAAA;IACtF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,CAAA;CAChB;AAUD,eAAO,MAAM,uBAAuB,EAAE,yBAGrC,CAAA;AAED,wBAAsB,oCAAoC,CACxD,EAAE,EAAE,UAAU,CAAC,yBAAyB,CAAC,iCAAiC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/E,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAsB,uCAAuC,CAC3D,EAAE,EAAE,UAAU,CAAC,yBAAyB,CAAC,uCAAuC,CAAC,CAAC,CAAC,CAAC,CAAC,EACrF,KAAK,EAAE,kCAAkC,GACxC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CA2CzC;AAED,wBAAgB,0CAA0C,CACxD,KAAK,EAAE,kCAAkC,GACxC,MAAM,CAOR"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { and, eq, gt, inArray, ne } from "drizzle-orm";
|
|
2
|
+
import { bookingPaymentSchedules, financeNotes, invoices } from "./schema.js";
|
|
3
|
+
export const financeBookingLifecycle = {
|
|
4
|
+
closePaymentSchedulesForBooking: closeTerminalBookingPaymentSchedules,
|
|
5
|
+
recordCancellationFinancialSettlement: recordPaidBookingCancellationSettlement,
|
|
6
|
+
};
|
|
7
|
+
export async function closeTerminalBookingPaymentSchedules(db, bookingId, status) {
|
|
8
|
+
await db
|
|
9
|
+
.update(bookingPaymentSchedules)
|
|
10
|
+
.set({ status, updatedAt: new Date() })
|
|
11
|
+
.where(and(eq(bookingPaymentSchedules.bookingId, bookingId), inArray(bookingPaymentSchedules.status, ["pending", "due"])));
|
|
12
|
+
}
|
|
13
|
+
export async function recordPaidBookingCancellationSettlement(db, input) {
|
|
14
|
+
const paidInvoices = (await db
|
|
15
|
+
.select({
|
|
16
|
+
id: invoices.id,
|
|
17
|
+
invoiceNumber: invoices.invoiceNumber,
|
|
18
|
+
currency: invoices.currency,
|
|
19
|
+
paidCents: invoices.paidCents,
|
|
20
|
+
status: invoices.status,
|
|
21
|
+
})
|
|
22
|
+
.from(invoices)
|
|
23
|
+
.where(and(eq(invoices.bookingId, input.bookingId), gt(invoices.paidCents, 0), ne(invoices.status, "void"))));
|
|
24
|
+
if (paidInvoices.length === 0)
|
|
25
|
+
return null;
|
|
26
|
+
const noteIds = [];
|
|
27
|
+
const content = buildPaidBookingCancellationSettlementNote(input);
|
|
28
|
+
for (const invoice of paidInvoices) {
|
|
29
|
+
const [note] = await db
|
|
30
|
+
.insert(financeNotes)
|
|
31
|
+
.values({
|
|
32
|
+
invoiceId: invoice.id,
|
|
33
|
+
authorId: input.actorId,
|
|
34
|
+
content: `${content}\n\nInvoice paid amount: ${invoice.paidCents} ${invoice.currency} cents.`,
|
|
35
|
+
})
|
|
36
|
+
.returning({ id: financeNotes.id });
|
|
37
|
+
if (note?.id)
|
|
38
|
+
noteIds.push(note.id);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
status: "action_required",
|
|
42
|
+
kind: "paid_booking_cancellation",
|
|
43
|
+
invoiceIds: paidInvoices.map((invoice) => invoice.id),
|
|
44
|
+
invoiceNumbers: paidInvoices.map((invoice) => invoice.invoiceNumber),
|
|
45
|
+
financeNoteIds: noteIds,
|
|
46
|
+
paidByCurrency: summarizePaidByCurrency(paidInvoices),
|
|
47
|
+
message: "Paid booking cancelled; review refund, credit-note, or no-refund settlement.",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function buildPaidBookingCancellationSettlementNote(input) {
|
|
51
|
+
const parts = [
|
|
52
|
+
`Booking ${input.bookingNumber} was cancelled from ${input.previousStatus}.`,
|
|
53
|
+
"The customer-facing invoice remains paid until an operator records a refund, credit note, or no-refund decision.",
|
|
54
|
+
];
|
|
55
|
+
if (input.reason)
|
|
56
|
+
parts.push(`Cancellation reason: ${input.reason}`);
|
|
57
|
+
return parts.join("\n");
|
|
58
|
+
}
|
|
59
|
+
function summarizePaidByCurrency(rows) {
|
|
60
|
+
const totals = {};
|
|
61
|
+
for (const row of rows)
|
|
62
|
+
totals[row.currency] = (totals[row.currency] ?? 0) + row.paidCents;
|
|
63
|
+
return totals;
|
|
64
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SubscriberRuntimeDescriptor } from "@voyant-travel/core";
|
|
2
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
3
|
+
import { type BookingScheduleRoutesOptions, generatePaymentScheduleForBooking } from "../payment-schedule/routes.js";
|
|
4
|
+
import { settleCoveredBookingPaymentSchedules } from "../service-shared.js";
|
|
5
|
+
export declare const FINANCE_BOOKING_SCHEDULE_SUBSCRIBER_ID = "@voyant-travel/finance#subscriber.booking-schedule-confirmed";
|
|
6
|
+
export declare const BOOKING_SCHEDULE_SUBSCRIBER_RUNTIME_KEY = "finance.bookingScheduleSubscriberRuntime";
|
|
7
|
+
export interface BookingScheduleSubscriberRuntime {
|
|
8
|
+
resolveRoutesOptions(bindings: unknown): BookingScheduleRoutesOptions | Promise<BookingScheduleRoutesOptions>;
|
|
9
|
+
/** Resolve the deployment database and retain ownership of its lifecycle. */
|
|
10
|
+
withDb<T>(bindings: unknown, operation: (db: PostgresJsDatabase) => Promise<T>): Promise<T>;
|
|
11
|
+
}
|
|
12
|
+
export interface BookingScheduleSubscriberDependencies {
|
|
13
|
+
generateSchedule?: typeof generatePaymentScheduleForBooking;
|
|
14
|
+
settleCoveredSchedules?: typeof settleCoveredBookingPaymentSchedules;
|
|
15
|
+
logger?: Pick<Console, "error">;
|
|
16
|
+
}
|
|
17
|
+
/** Build the package-owned descriptor resolved by selected-graph lowering. */
|
|
18
|
+
export declare function createBookingScheduleSubscriberRuntime(dependencies?: BookingScheduleSubscriberDependencies): SubscriberRuntimeDescriptor;
|
|
19
|
+
export declare const bookingScheduleConfirmedSubscriber: SubscriberRuntimeDescriptor;
|
|
20
|
+
//# sourceMappingURL=subscriber-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriber-runtime.d.ts","sourceRoot":"","sources":["../../src/booking-schedule/subscriber-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AACvF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EACL,KAAK,4BAA4B,EACjC,iCAAiC,EAClC,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAA;AAE3E,eAAO,MAAM,sCAAsC,iEACa,CAAA;AAChE,eAAO,MAAM,uCAAuC,6CAA6C,CAAA;AAEjG,MAAM,WAAW,gCAAgC;IAC/C,oBAAoB,CAClB,QAAQ,EAAE,OAAO,GAChB,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAA;IACvE,6EAA6E;IAC7E,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;CAC5F;AAED,MAAM,WAAW,qCAAqC;IACpD,gBAAgB,CAAC,EAAE,OAAO,iCAAiC,CAAA;IAC3D,sBAAsB,CAAC,EAAE,OAAO,oCAAoC,CAAA;IACpE,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;CAChC;AAQD,8EAA8E;AAC9E,wBAAgB,sCAAsC,CACpD,YAAY,GAAE,qCAA0C,GACvD,2BAA2B,CA2B7B;AAeD,eAAO,MAAM,kCAAkC,6BAA2C,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { generatePaymentScheduleForBooking, } from "../payment-schedule/routes.js";
|
|
2
|
+
import { settleCoveredBookingPaymentSchedules } from "../service-shared.js";
|
|
3
|
+
export const FINANCE_BOOKING_SCHEDULE_SUBSCRIBER_ID = "@voyant-travel/finance#subscriber.booking-schedule-confirmed";
|
|
4
|
+
export const BOOKING_SCHEDULE_SUBSCRIBER_RUNTIME_KEY = "finance.bookingScheduleSubscriberRuntime";
|
|
5
|
+
/** Build the package-owned descriptor resolved by selected-graph lowering. */
|
|
6
|
+
export function createBookingScheduleSubscriberRuntime(dependencies = {}) {
|
|
7
|
+
const generateSchedule = dependencies.generateSchedule ?? generatePaymentScheduleForBooking;
|
|
8
|
+
const settleCoveredSchedules = dependencies.settleCoveredSchedules ?? settleCoveredBookingPaymentSchedules;
|
|
9
|
+
const logger = dependencies.logger ?? console;
|
|
10
|
+
return {
|
|
11
|
+
id: FINANCE_BOOKING_SCHEDULE_SUBSCRIBER_ID,
|
|
12
|
+
eventType: "booking.confirmed",
|
|
13
|
+
register: ({ bindings, container, eventBus }) => {
|
|
14
|
+
eventBus.subscribe("booking.confirmed", async ({ data }) => {
|
|
15
|
+
try {
|
|
16
|
+
const runtime = resolveBookingScheduleSubscriberRuntime(container);
|
|
17
|
+
const routesOptions = await runtime.resolveRoutesOptions(bindings);
|
|
18
|
+
await runtime.withDb(bindings, async (db) => {
|
|
19
|
+
await generateSchedule(db, data.bookingId, routesOptions);
|
|
20
|
+
await settleCoveredSchedules(db, data.bookingId);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
logger.error("[booking-schedule] failed to generate schedule", {
|
|
25
|
+
bookingId: data.bookingId,
|
|
26
|
+
error: error instanceof Error ? error.message : String(error),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function resolveBookingScheduleSubscriberRuntime(container) {
|
|
34
|
+
if (!container.has(BOOKING_SCHEDULE_SUBSCRIBER_RUNTIME_KEY)) {
|
|
35
|
+
throw new Error(`Booking-schedule subscriber runtime is not registered at "${BOOKING_SCHEDULE_SUBSCRIBER_RUNTIME_KEY}".`);
|
|
36
|
+
}
|
|
37
|
+
return container.resolve(BOOKING_SCHEDULE_SUBSCRIBER_RUNTIME_KEY);
|
|
38
|
+
}
|
|
39
|
+
export const bookingScheduleConfirmedSubscriber = createBookingScheduleSubscriberRuntime();
|
package/dist/booking-tax.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
1
2
|
import type { HonoExtension } from "@voyant-travel/hono/module";
|
|
2
3
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
3
4
|
import type { Hono } from "hono";
|
|
@@ -51,7 +52,7 @@ export declare function computeBookingItemTaxLine(taxRate: ResolvedBookingSellTa
|
|
|
51
52
|
} | null;
|
|
52
53
|
export declare function loadProductTaxFacts(db: PostgresJsDatabase, productId: string): Promise<ProductTaxFacts>;
|
|
53
54
|
export declare function matchesTaxPolicyCondition(condition: TaxPolicyCondition | null | undefined, facts: ProductTaxFacts): boolean;
|
|
54
|
-
export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions):
|
|
55
|
+
export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions): OpenAPIHono<{
|
|
55
56
|
Variables: {
|
|
56
57
|
db: PostgresJsDatabase;
|
|
57
58
|
};
|
|
@@ -61,45 +62,53 @@ export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions)
|
|
|
61
62
|
input: {};
|
|
62
63
|
output: {
|
|
63
64
|
data: {
|
|
64
|
-
taxPriceMode
|
|
65
|
-
taxPolicyProfileId
|
|
65
|
+
taxPriceMode: "inclusive" | "exclusive";
|
|
66
|
+
taxPolicyProfileId: string | null;
|
|
66
67
|
};
|
|
67
68
|
};
|
|
68
69
|
outputFormat: "json";
|
|
69
|
-
status:
|
|
70
|
+
status: 200;
|
|
70
71
|
};
|
|
71
72
|
};
|
|
72
73
|
} & {
|
|
73
74
|
"/tax-settings": {
|
|
74
75
|
$patch: {
|
|
75
|
-
input: {
|
|
76
|
+
input: {
|
|
77
|
+
json: {
|
|
78
|
+
taxPriceMode?: "inclusive" | "exclusive" | undefined;
|
|
79
|
+
taxPolicyProfileId?: string | null | undefined;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
output: {};
|
|
83
|
+
outputFormat: string;
|
|
84
|
+
status: 409;
|
|
85
|
+
} | {
|
|
86
|
+
input: {
|
|
87
|
+
json: {
|
|
88
|
+
taxPriceMode?: "inclusive" | "exclusive" | undefined;
|
|
89
|
+
taxPolicyProfileId?: string | null | undefined;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
76
92
|
output: {
|
|
77
93
|
data: {
|
|
78
|
-
taxPriceMode
|
|
79
|
-
taxPolicyProfileId
|
|
94
|
+
taxPriceMode: "inclusive" | "exclusive";
|
|
95
|
+
taxPolicyProfileId: string | null;
|
|
80
96
|
};
|
|
81
97
|
};
|
|
82
98
|
outputFormat: "json";
|
|
83
|
-
status:
|
|
99
|
+
status: 200;
|
|
84
100
|
};
|
|
85
101
|
};
|
|
86
102
|
} & {
|
|
87
103
|
"/tax-preview": {
|
|
88
104
|
$post: {
|
|
89
|
-
input: {
|
|
90
|
-
|
|
91
|
-
|
|
105
|
+
input: {
|
|
106
|
+
json: {
|
|
107
|
+
productId: string;
|
|
92
108
|
subtotalCents: number;
|
|
93
|
-
taxCents: number;
|
|
94
|
-
totalCents: number;
|
|
95
109
|
currency: string;
|
|
96
|
-
taxRate: null;
|
|
97
110
|
};
|
|
98
111
|
};
|
|
99
|
-
outputFormat: "json";
|
|
100
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
101
|
-
} | {
|
|
102
|
-
input: {};
|
|
103
112
|
output: {
|
|
104
113
|
data: {
|
|
105
114
|
subtotalCents: number;
|
|
@@ -111,14 +120,15 @@ export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions)
|
|
|
111
120
|
label: string;
|
|
112
121
|
rateBasisPoints: number;
|
|
113
122
|
priceMode: "inclusive" | "exclusive";
|
|
114
|
-
};
|
|
123
|
+
} | null;
|
|
115
124
|
};
|
|
116
125
|
};
|
|
117
126
|
outputFormat: "json";
|
|
118
|
-
status:
|
|
127
|
+
status: 200;
|
|
119
128
|
};
|
|
120
129
|
};
|
|
121
|
-
}, "/"
|
|
130
|
+
}, "/">;
|
|
122
131
|
export declare function mountBookingTaxRoutes(hono: Hono, options?: BookingTaxRouteOptions): void;
|
|
123
132
|
export declare function createBookingTaxHonoExtension(options?: BookingTaxRouteOptions): HonoExtension;
|
|
133
|
+
export declare const createBookingTaxVoyantRuntime: import("@voyant-travel/core/project").VoyantGraphRuntimeFactory<HonoExtension>;
|
|
124
134
|
//# sourceMappingURL=booking-tax.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"booking-tax.d.ts","sourceRoot":"","sources":["../src/booking-tax.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"booking-tax.d.ts","sourceRoot":"","sources":["../src/booking-tax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAK,MAAM,mBAAmB,CAAA;AAI/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAOhC,MAAM,MAAM,eAAe,GAAG;IAC5B,gBAAgB,EAAE,OAAO,CAAA;IACzB,sBAAsB,EAAE,MAAM,EAAE,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,WAAW,GAAG,WAAW,CAAA;CACrC,CAAA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,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAoC5C;AAiBD,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAAG,IAAI,EAC1C,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,SAAI;;;;;;;;;SAmBd;AAED,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC,CAgC1B;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,EAChD,KAAK,EAAE,eAAe,GACrB,OAAO,CAeT;AA6FD,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,sBAA2B;eAE5D;QACT,EAAE,EAAE,kBAAkB,CAAA;KACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqFJ;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAE5F;AAED,wBAAgB,6BAA6B,CAAC,OAAO,GAAE,sBAA2B,GAAG,aAAa,CAUjG;AAED,eAAO,MAAM,6BAA6B,gFAIxC,CAAA"}
|
package/dist/booking-tax.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
|
2
|
+
import { defineGraphRuntimeFactory } from "@voyant-travel/core/project";
|
|
3
|
+
import { ApiHttpError, openApiValidationHook, stampOpenApiRegistryApiId } from "@voyant-travel/hono";
|
|
2
4
|
import { and, asc, eq, sql } from "drizzle-orm";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
+
import { createFinanceBookingTaxRuntime } from "./runtime.js";
|
|
6
|
+
import { financeOperatorSettingsRuntimePort } from "./runtime-port.js";
|
|
5
7
|
import { taxClasses, taxPolicyProfiles, taxPolicyRules, taxRegimes } from "./schema.js";
|
|
6
8
|
import { executeBoundaryRows } from "./service-boundary-sql.js";
|
|
7
9
|
const taxPreviewBodySchema = z.object({
|
|
@@ -13,6 +15,71 @@ const bookingTaxSettingsPatchSchema = z.object({
|
|
|
13
15
|
taxPriceMode: z.enum(["inclusive", "exclusive"]).optional(),
|
|
14
16
|
taxPolicyProfileId: z.string().min(1).nullable().optional(),
|
|
15
17
|
});
|
|
18
|
+
const bookingTaxSettingsResponseSchema = z.object({
|
|
19
|
+
data: z.object({
|
|
20
|
+
taxPriceMode: z.enum(["inclusive", "exclusive"]),
|
|
21
|
+
taxPolicyProfileId: z.string().nullable(),
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
const bookingTaxPreviewResponseSchema = z.object({
|
|
25
|
+
data: z.object({
|
|
26
|
+
subtotalCents: z.number().int().nonnegative(),
|
|
27
|
+
taxCents: z.number().int().nonnegative(),
|
|
28
|
+
totalCents: z.number().int().nonnegative(),
|
|
29
|
+
currency: z.string(),
|
|
30
|
+
taxRate: z
|
|
31
|
+
.object({
|
|
32
|
+
code: z.string(),
|
|
33
|
+
label: z.string(),
|
|
34
|
+
rateBasisPoints: z.number().int(),
|
|
35
|
+
priceMode: z.enum(["inclusive", "exclusive"]),
|
|
36
|
+
})
|
|
37
|
+
.nullable(),
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
const getBookingTaxSettingsRoute = createRoute({
|
|
41
|
+
method: "get",
|
|
42
|
+
path: "/tax-settings",
|
|
43
|
+
responses: {
|
|
44
|
+
200: {
|
|
45
|
+
description: "The effective booking tax settings",
|
|
46
|
+
content: { "application/json": { schema: bookingTaxSettingsResponseSchema } },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
const updateBookingTaxSettingsRoute = createRoute({
|
|
51
|
+
method: "patch",
|
|
52
|
+
path: "/tax-settings",
|
|
53
|
+
request: {
|
|
54
|
+
body: {
|
|
55
|
+
required: true,
|
|
56
|
+
content: { "application/json": { schema: bookingTaxSettingsPatchSchema } },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
responses: {
|
|
60
|
+
200: {
|
|
61
|
+
description: "The updated booking tax settings",
|
|
62
|
+
content: { "application/json": { schema: bookingTaxSettingsResponseSchema } },
|
|
63
|
+
},
|
|
64
|
+
409: { description: "This deployment does not support tax setting updates" },
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const previewBookingTaxRoute = createRoute({
|
|
68
|
+
method: "post",
|
|
69
|
+
path: "/tax-preview",
|
|
70
|
+
request: {
|
|
71
|
+
body: {
|
|
72
|
+
required: true,
|
|
73
|
+
content: { "application/json": { schema: taxPreviewBodySchema } },
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
responses: {
|
|
77
|
+
200: {
|
|
78
|
+
description: "The calculated tax preview",
|
|
79
|
+
content: { "application/json": { schema: bookingTaxPreviewResponseSchema } },
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
16
83
|
export async function resolveBookingSellTaxRate(db, args, options = {}) {
|
|
17
84
|
const resolvedSettings = options.settings !== undefined
|
|
18
85
|
? options.settings
|
|
@@ -188,13 +255,13 @@ async function resolveProductTaxClassRate(db, productId, priceMode) {
|
|
|
188
255
|
return resolved ? { ...resolved, priceMode } : null;
|
|
189
256
|
}
|
|
190
257
|
export function createBookingTaxRoutes(options = {}) {
|
|
191
|
-
|
|
192
|
-
.
|
|
258
|
+
const routes = new OpenAPIHono({ defaultHook: openApiValidationHook })
|
|
259
|
+
.openapi(getBookingTaxSettingsRoute, async (c) => {
|
|
193
260
|
return c.json({
|
|
194
261
|
data: await resolveBookingTaxSettingsOrDefault(c.get("db"), options),
|
|
195
|
-
});
|
|
262
|
+
}, 200);
|
|
196
263
|
})
|
|
197
|
-
.
|
|
264
|
+
.openapi(updateBookingTaxSettingsRoute, async (c) => {
|
|
198
265
|
if (!options.updateBookingTaxSettings) {
|
|
199
266
|
throw new ApiHttpError("Booking tax settings updates are not configured", {
|
|
200
267
|
status: 409,
|
|
@@ -202,7 +269,7 @@ export function createBookingTaxRoutes(options = {}) {
|
|
|
202
269
|
});
|
|
203
270
|
}
|
|
204
271
|
const current = await resolveBookingTaxSettingsOrDefault(c.get("db"), options);
|
|
205
|
-
const patch =
|
|
272
|
+
const patch = c.req.valid("json");
|
|
206
273
|
const next = await options.updateBookingTaxSettings(c.get("db"), {
|
|
207
274
|
taxPriceMode: patch.taxPriceMode ?? current.taxPriceMode,
|
|
208
275
|
taxPolicyProfileId: patch.taxPolicyProfileId === undefined
|
|
@@ -211,10 +278,10 @@ export function createBookingTaxRoutes(options = {}) {
|
|
|
211
278
|
});
|
|
212
279
|
return c.json({
|
|
213
280
|
data: await resolveBookingTaxSettingsOrDefault(c.get("db"), { settings: next }),
|
|
214
|
-
});
|
|
281
|
+
}, 200);
|
|
215
282
|
})
|
|
216
|
-
.
|
|
217
|
-
const body =
|
|
283
|
+
.openapi(previewBookingTaxRoute, async (c) => {
|
|
284
|
+
const body = c.req.valid("json");
|
|
218
285
|
const taxRate = await resolveBookingSellTaxRate(c.get("db"), { productId: body.productId }, options);
|
|
219
286
|
const taxLine = computeBookingItemTaxLine(taxRate, body.subtotalCents, body.currency);
|
|
220
287
|
if (!taxRate || !taxLine) {
|
|
@@ -226,7 +293,7 @@ export function createBookingTaxRoutes(options = {}) {
|
|
|
226
293
|
currency: body.currency,
|
|
227
294
|
taxRate: null,
|
|
228
295
|
},
|
|
229
|
-
});
|
|
296
|
+
}, 200);
|
|
230
297
|
}
|
|
231
298
|
const inclusive = taxLine.includedInPrice;
|
|
232
299
|
const displaySubtotal = inclusive
|
|
@@ -246,8 +313,9 @@ export function createBookingTaxRoutes(options = {}) {
|
|
|
246
313
|
priceMode: taxRate.priceMode,
|
|
247
314
|
},
|
|
248
315
|
},
|
|
249
|
-
});
|
|
316
|
+
}, 200);
|
|
250
317
|
});
|
|
318
|
+
return stampOpenApiRegistryApiId(routes, "@voyant-travel/finance#booking-tax-extension.api");
|
|
251
319
|
}
|
|
252
320
|
export function mountBookingTaxRoutes(hono, options = {}) {
|
|
253
321
|
hono.route("/v1/admin/bookings", createBookingTaxRoutes(options));
|
|
@@ -262,3 +330,6 @@ export function createBookingTaxHonoExtension(options = {}) {
|
|
|
262
330
|
adminRoutes: createBookingTaxRoutes(options),
|
|
263
331
|
};
|
|
264
332
|
}
|
|
333
|
+
export const createBookingTaxVoyantRuntime = defineGraphRuntimeFactory(async ({ getPort }) => {
|
|
334
|
+
return createBookingTaxHonoExtension(createFinanceBookingTaxRuntime(await getPort(financeOperatorSettingsRuntimePort)));
|
|
335
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,9 @@ export interface FinanceHonoModuleOptions extends FinanceRuntimeOptions, PublicF
|
|
|
22
22
|
}
|
|
23
23
|
export declare function createFinanceHonoModule(options?: FinanceHonoModuleOptions): HonoModule;
|
|
24
24
|
export declare const financeHonoModule: HonoModule;
|
|
25
|
-
export
|
|
25
|
+
export declare const createFinanceVoyantRuntime: import("@voyant-travel/core/project").VoyantGraphRuntimeFactory<HonoModule>;
|
|
26
|
+
export { type BookingCancellationSettlementInput, buildPaidBookingCancellationSettlementNote, closeTerminalBookingPaymentSchedules, financeBookingLifecycle, recordPaidBookingCancellationSettlement, } from "./booking-lifecycle.js";
|
|
27
|
+
export { type BookingTaxRouteOptions, type BookingTaxSettings, computeBookingItemTaxLine, createBookingTaxHonoExtension, createBookingTaxRoutes, createBookingTaxVoyantRuntime, loadProductTaxFacts, matchesTaxPolicyCondition, mountBookingTaxRoutes, type ProductTaxFacts, type ResolveBookingSellTaxRateOptions, type ResolveBookingTaxSettings, type ResolvedBookingSellTaxRate, resolveBookingSellTaxRate, type TaxPolicyCondition, type UpdateBookingTaxSettings, } from "./booking-tax.js";
|
|
26
28
|
export type { CardPaymentBilling, CardPaymentStartArgs, CardPaymentStarter, CardPaymentStartResult, } from "./card-payment.js";
|
|
27
29
|
export { type DocumentDownloadEnvelope, type DocumentDownloadResolution, type DocumentDownloadResolver, resolveStoredDocumentDownload, type StoredDocumentReference, } from "./document-download.js";
|
|
28
30
|
export { createInvoiceFxHonoExtension, createInvoiceFxRoutes, createVoyantDataFxExchangeRateResolver, type InvoiceExchangeRateResolution, type InvoiceFxContext, type InvoiceFxOptions, type InvoiceFxRouteOptions, type InvoiceFxSettings, mountInvoiceFxRoutes, type ResolvedInvoiceFxSettings, type ResolveInvoiceExchangeRate, type ResolveInvoiceExchangeRateInput, type ResolveInvoiceFxSettings, resolveInvoiceFxContext, resolveInvoiceFxSettingsOrDefault, type UpdateInvoiceFxSettings, type VoyantDataFxResolverOptions, } from "./invoice-fx.js";
|
|
@@ -30,11 +32,13 @@ export { type CreateOrderPaymentSessionsOptions, createOrderPaymentSessions, typ
|
|
|
30
32
|
export type { ComputedScheduleEntry, ComputeScheduleInput, DepositKind, DepositRule, PaymentPolicy, PaymentPolicyCascadeLayers, PaymentPolicySource, PaymentScheduleEntryType, ResolvedPaymentPolicy, } from "./payment-policy.js";
|
|
31
33
|
export { computePaymentSchedule, isPaymentPolicyEmpty, noDepositPolicy, normalizePaymentPolicy, policyShouldRequireFullPayment, resolveEffectivePaymentPolicy, } from "./payment-policy.js";
|
|
32
34
|
export { createPaymentPolicyCascade, type PaymentPolicyCascade, type PaymentPolicyCascadeOptions, type PaymentPolicyCascadeReaders, readPolicySourceFromInternalNotes, stampPolicySourceOnBooking, } from "./payment-policy-cascade.js";
|
|
33
|
-
export { type BookingScheduleRoutesOptions, createBookingScheduleAdminRoutes, createBookingScheduleHonoExtension, createPaymentPolicyPublicRoutes, generatePaymentScheduleForBooking, type PaymentPolicyEntityContext, } from "./payment-schedule/routes.js";
|
|
35
|
+
export { type BookingScheduleRoutesOptions, createBookingScheduleAdminRoutes, createBookingScheduleHonoExtension, createBookingScheduleVoyantRuntime, createPaymentPolicyPublicRoutes, generatePaymentScheduleForBooking, type PaymentPolicyEntityContext, } from "./payment-schedule/routes.js";
|
|
34
36
|
export { buildFinanceRouteRuntime, FINANCE_ROUTE_RUNTIME_CONTAINER_KEY, type FinanceRouteRuntime, type FinanceRuntimeOptions, } from "./route-runtime.js";
|
|
35
37
|
export { bookingsCreateExtension } from "./routes-booking-create.js";
|
|
36
38
|
export { createFinanceAdminDocumentRoutes, type FinanceDocumentRouteOptions, } from "./routes-documents.js";
|
|
37
39
|
export { createFinanceAdminSettlementRoutes, type FinanceSettlementRouteOptions, type InvoiceSettlementPoller, } from "./routes-settlement.js";
|
|
40
|
+
export { aggregateFinanceInvoiceSettlementPollers } from "./runtime.js";
|
|
41
|
+
export { type FinanceInvoiceSettlementPollerProvider, financeAccommodationsPaymentPolicyRuntimePort, financeCheckoutPaymentStartersRuntimePort, financeCruisesPaymentPolicyRuntimePort, financeDistributionPaymentPolicyRuntimePort, financeHostRuntimePort, financeInventoryPaymentPolicyRuntimePort, financeInvoiceSettlementPollerRuntimePort, financeNotificationsRuntimePort, financeOperatorSettingsRuntimePort, } from "./runtime-port.js";
|
|
38
42
|
export type { BookingGuarantee, BookingItemCommission, BookingItemTaxLine, BookingPaymentSchedule, CreditNote, CreditNoteLineItem, FinanceNote, Invoice, InvoiceAttachment, InvoiceExternalRef, InvoiceLineItem, InvoiceNumberSeries, InvoiceRendition, InvoiceTemplate, NewBookingGuarantee, NewBookingItemCommission, NewBookingItemTaxLine, NewBookingPaymentSchedule, NewCreditNote, NewCreditNoteLineItem, NewFinanceNote, NewInvoice, NewInvoiceAttachment, NewInvoiceExternalRef, NewInvoiceLineItem, NewInvoiceNumberSeries, NewInvoiceRendition, NewInvoiceTemplate, NewPayment, NewPaymentAuthorization, NewPaymentCapture, NewPaymentInstrument, NewPaymentSession, NewSupplierCostAllocation, NewSupplierInvoice, NewSupplierInvoiceAttachment, NewSupplierInvoiceLine, NewSupplierPayment, NewTaxClass, NewTaxRegime, NewVoucher, NewVoucherRedemption, Payment, PaymentAuthorization, PaymentCapture, PaymentInstrument, PaymentSession, SupplierCostAllocation, SupplierInvoice, SupplierInvoiceAttachment, SupplierInvoiceLine, SupplierPayment, TaxClass, TaxRegime, Voucher, VoucherRedemption, } from "./schema.js";
|
|
39
43
|
export { apServiceTypeEnum, bookingGuarantees, bookingItemCommissions, bookingItemTaxLines, bookingPaymentSchedules, costAllocationSplitMethodEnum, costAllocationTargetTypeEnum, creditNoteLineItems, creditNotes, financeNotes, invoiceAttachments, invoiceExternalRefs, invoiceLineItems, invoiceNumberSeries, invoiceRenditions, invoices, invoiceTemplates, paymentAuthorizations, paymentCaptures, paymentInstruments, paymentSessions, payments, supplierCostAllocations, supplierInvoiceAttachments, supplierInvoiceLines, supplierInvoiceStatusEnum, supplierInvoices, supplierPayments, taxClasses, taxPolicyProfiles, taxPolicyRules, taxRegimes, voucherRedemptions, voucherSourceTypeEnum, voucherStatusEnum, vouchers, } from "./schema.js";
|
|
40
44
|
export type { BindInvoiceRenditionInput, BookingPaymentSchedulePaidEvent, CreateInvoiceFromBookingInput, InvoiceFromBookingData, InvoiceLineDescriptionResolver, InvoiceLineDescriptionResolverInput, InvoicePaymentRecordedEvent, InvoiceRenderedEvent, InvoiceVoidedEvent, PaymentCompletedEvent, PaymentScheduleLineDescriptionFormat, ResolvedInvoiceLine, UnifiedPaymentRow, } from "./service.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAE,KAAK,sBAAsB,EAA0B,MAAM,kBAAkB,CAAA;AACtF,OAAO,EAEL,KAAK,qBAAqB,EAI3B,MAAM,sBAAsB,CAAA;AAG7B,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"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
// agent-quality: file-size exception -- owner: finance; existing module stays co-located until a dedicated split preserves behavior and tests.
|
|
2
2
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
3
|
+
import { registerBookingFinancialLifecycle } from "@voyant-travel/bookings";
|
|
4
|
+
import { defineGraphRuntimeFactory } from "@voyant-travel/core/project";
|
|
5
|
+
import { stampOpenApiRegistryApiId } from "@voyant-travel/hono";
|
|
6
|
+
import { financeBookingLifecycle } from "./booking-lifecycle.js";
|
|
3
7
|
import { createBookingTaxRoutes } from "./booking-tax.js";
|
|
4
8
|
import { buildFinanceCheckoutRouteRuntime, createFinanceCheckoutAdminRoutes, createFinanceCheckoutRoutes, FINANCE_CHECKOUT_ROUTE_RUNTIME_CONTAINER_KEY, } from "./checkout-routes.js";
|
|
5
9
|
import { createInvoiceFxRoutes } from "./invoice-fx.js";
|
|
@@ -11,6 +15,8 @@ import { createFinanceAdminDocumentRoutes } from "./routes-documents.js";
|
|
|
11
15
|
import { createPublicFinanceRoutes } from "./routes-public.js";
|
|
12
16
|
import { createFinanceAdminSettlementRoutes } from "./routes-settlement.js";
|
|
13
17
|
import { supplierInvoiceRoutes } from "./routes-supplier-invoices.js";
|
|
18
|
+
import { createFinanceRuntime } from "./runtime.js";
|
|
19
|
+
import { financeCheckoutPaymentStartersRuntimePort, financeHostRuntimePort, financeInvoiceSettlementPollerRuntimePort, financeNotificationsRuntimePort, } from "./runtime-port.js";
|
|
14
20
|
export { buildFinanceCheckoutRouteRuntime, CHECKOUT_ROUTE_RUNTIME_CONTAINER_KEY, createFinanceCheckoutAdminRoutes, createFinanceCheckoutRoutes, FINANCE_CHECKOUT_ROUTE_RUNTIME_CONTAINER_KEY, } from "./checkout-routes.js";
|
|
15
21
|
export { bootstrapCheckoutCollection, initiateCheckoutCollection, previewCheckoutCollection, resolveDocumentType, resolvePaymentSessionTarget, } from "./checkout-service.js";
|
|
16
22
|
export { bootstrapCheckoutCollectionSchema, bootstrappedCheckoutCollectionSchema, checkoutBankTransferInstructionsSchema, checkoutCollectionIntentSchema, checkoutCollectionInvoiceSchema, checkoutCollectionMethodSchema, checkoutCollectionPlanSchema, checkoutCollectionScheduleSchema, checkoutCollectionStageSchema, checkoutInvoiceDocumentTypeSchema, checkoutInvoiceNotificationSchema, checkoutNotificationAttachmentSchema, checkoutNotificationChannelSchema, checkoutNotificationDeliverySchema, checkoutNotificationDeliveryStatusSchema, checkoutPaymentSessionNotificationSchema, checkoutPaymentSessionTargetSchema, checkoutProviderStartInputSchema, checkoutProviderStartResultSchema, checkoutReminderRunListQuerySchema, checkoutReminderRunListResponseSchema, checkoutReminderRunSchema, checkoutReminderRunStatusSchema, checkoutReminderTargetTypeSchema, initiateCheckoutCollectionSchema, initiatedCheckoutCollectionSchema, previewCheckoutCollectionSchema, } from "./checkout-validation.js";
|
|
@@ -25,15 +31,14 @@ export const financeModule = {
|
|
|
25
31
|
requiresTransactionalDb: true,
|
|
26
32
|
};
|
|
27
33
|
export function createFinanceHonoModule(options = {}) {
|
|
28
|
-
const adminRoutes = new OpenAPIHono()
|
|
34
|
+
const adminRoutes = stampOpenApiRegistryApiId(new OpenAPIHono()
|
|
29
35
|
.route("/", financeRoutes)
|
|
30
36
|
.route("/", createFinanceCheckoutAdminRoutes(options))
|
|
31
37
|
.route("/", financeActionLedgerRoutes)
|
|
32
38
|
.route("/", supplierInvoiceRoutes)
|
|
33
39
|
.route("/", createInvoiceFxRoutes(options))
|
|
34
40
|
.route("/", createFinanceAdminDocumentRoutes(options))
|
|
35
|
-
.route("/", createFinanceAdminSettlementRoutes(options))
|
|
36
|
-
.route("/", createBookingTaxRoutes(options));
|
|
41
|
+
.route("/", createFinanceAdminSettlementRoutes(options)), "@voyant-travel/finance#api.admin").route("/", createBookingTaxRoutes(options));
|
|
37
42
|
const module = {
|
|
38
43
|
...financeModule,
|
|
39
44
|
bootstrap: ({ bindings, container, eventBus }) => {
|
|
@@ -49,9 +54,9 @@ export function createFinanceHonoModule(options = {}) {
|
|
|
49
54
|
container.register(FINANCE_CHECKOUT_ROUTE_RUNTIME_CONTAINER_KEY, buildFinanceCheckoutRouteRuntime(bindings, options));
|
|
50
55
|
},
|
|
51
56
|
};
|
|
52
|
-
const publicRoutes = new OpenAPIHono()
|
|
57
|
+
const publicRoutes = stampOpenApiRegistryApiId(new OpenAPIHono()
|
|
53
58
|
.route("/", createPublicFinanceRoutes(options))
|
|
54
|
-
.route("/", createFinanceCheckoutRoutes(options));
|
|
59
|
+
.route("/", createFinanceCheckoutRoutes(options)), "@voyant-travel/finance#api.public");
|
|
55
60
|
return {
|
|
56
61
|
module,
|
|
57
62
|
adminRoutes,
|
|
@@ -59,17 +64,42 @@ export function createFinanceHonoModule(options = {}) {
|
|
|
59
64
|
};
|
|
60
65
|
}
|
|
61
66
|
export const financeHonoModule = createFinanceHonoModule();
|
|
62
|
-
export
|
|
67
|
+
export const createFinanceVoyantRuntime = defineGraphRuntimeFactory(async ({ api, getPort, getPorts, hasPort }) => {
|
|
68
|
+
const configured = createFinanceHonoModule(createFinanceRuntime(await getPort(financeHostRuntimePort), await getPort(financeNotificationsRuntimePort), hasPort(financeCheckoutPaymentStartersRuntimePort)
|
|
69
|
+
? await getPort(financeCheckoutPaymentStartersRuntimePort)
|
|
70
|
+
: undefined, await getPorts(financeInvoiceSettlementPollerRuntimePort)));
|
|
71
|
+
const bootstrap = configured.module.bootstrap;
|
|
72
|
+
const selected = {
|
|
73
|
+
module: {
|
|
74
|
+
...configured.module,
|
|
75
|
+
bootstrap: async (context) => {
|
|
76
|
+
registerBookingFinancialLifecycle(context.container, financeBookingLifecycle);
|
|
77
|
+
await bootstrap?.(context);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
if (api.some(({ surface }) => surface === "admin") && configured.adminRoutes) {
|
|
82
|
+
selected.adminRoutes = configured.adminRoutes;
|
|
83
|
+
}
|
|
84
|
+
if (api.some(({ surface }) => surface === "public") && configured.publicRoutes) {
|
|
85
|
+
selected.publicRoutes = configured.publicRoutes;
|
|
86
|
+
}
|
|
87
|
+
return selected;
|
|
88
|
+
});
|
|
89
|
+
export { buildPaidBookingCancellationSettlementNote, closeTerminalBookingPaymentSchedules, financeBookingLifecycle, recordPaidBookingCancellationSettlement, } from "./booking-lifecycle.js";
|
|
90
|
+
export { computeBookingItemTaxLine, createBookingTaxHonoExtension, createBookingTaxRoutes, createBookingTaxVoyantRuntime, loadProductTaxFacts, matchesTaxPolicyCondition, mountBookingTaxRoutes, resolveBookingSellTaxRate, } from "./booking-tax.js";
|
|
63
91
|
export { resolveStoredDocumentDownload, } from "./document-download.js";
|
|
64
92
|
export { createInvoiceFxHonoExtension, createInvoiceFxRoutes, createVoyantDataFxExchangeRateResolver, mountInvoiceFxRoutes, resolveInvoiceFxContext, resolveInvoiceFxSettingsOrDefault, } from "./invoice-fx.js";
|
|
65
93
|
export { createOrderPaymentSessions, } from "./order-payment-sessions.js";
|
|
66
94
|
export { computePaymentSchedule, isPaymentPolicyEmpty, noDepositPolicy, normalizePaymentPolicy, policyShouldRequireFullPayment, resolveEffectivePaymentPolicy, } from "./payment-policy.js";
|
|
67
95
|
export { createPaymentPolicyCascade, readPolicySourceFromInternalNotes, stampPolicySourceOnBooking, } from "./payment-policy-cascade.js";
|
|
68
|
-
export { createBookingScheduleAdminRoutes, createBookingScheduleHonoExtension, createPaymentPolicyPublicRoutes, generatePaymentScheduleForBooking, } from "./payment-schedule/routes.js";
|
|
96
|
+
export { createBookingScheduleAdminRoutes, createBookingScheduleHonoExtension, createBookingScheduleVoyantRuntime, createPaymentPolicyPublicRoutes, generatePaymentScheduleForBooking, } from "./payment-schedule/routes.js";
|
|
69
97
|
export { buildFinanceRouteRuntime, FINANCE_ROUTE_RUNTIME_CONTAINER_KEY, } from "./route-runtime.js";
|
|
70
98
|
export { bookingsCreateExtension } from "./routes-booking-create.js";
|
|
71
99
|
export { createFinanceAdminDocumentRoutes, } from "./routes-documents.js";
|
|
72
100
|
export { createFinanceAdminSettlementRoutes, } from "./routes-settlement.js";
|
|
101
|
+
export { aggregateFinanceInvoiceSettlementPollers } from "./runtime.js";
|
|
102
|
+
export { financeAccommodationsPaymentPolicyRuntimePort, financeCheckoutPaymentStartersRuntimePort, financeCruisesPaymentPolicyRuntimePort, financeDistributionPaymentPolicyRuntimePort, financeHostRuntimePort, financeInventoryPaymentPolicyRuntimePort, financeInvoiceSettlementPollerRuntimePort, financeNotificationsRuntimePort, financeOperatorSettingsRuntimePort, } from "./runtime-port.js";
|
|
73
103
|
export { apServiceTypeEnum, bookingGuarantees, bookingItemCommissions, bookingItemTaxLines, bookingPaymentSchedules, costAllocationSplitMethodEnum, costAllocationTargetTypeEnum, creditNoteLineItems, creditNotes, financeNotes, invoiceAttachments, invoiceExternalRefs, invoiceLineItems, invoiceNumberSeries, invoiceRenditions, invoices, invoiceTemplates, paymentAuthorizations, paymentCaptures, paymentInstruments, paymentSessions, payments, supplierCostAllocations, supplierInvoiceAttachments, supplierInvoiceLines, supplierInvoiceStatusEnum, supplierInvoices, supplierPayments, taxClasses, taxPolicyProfiles, taxPolicyRules, taxRegimes, voucherRedemptions, voucherSourceTypeEnum, voucherStatusEnum, vouchers, } from "./schema.js";
|
|
74
104
|
export { financeService, InvoiceLineItemsPersistenceError, InvoiceNumberAllocationError, InvoiceNumberConflictError, renderInvoiceBody, } from "./service.js";
|
|
75
105
|
export { bookingCreateSchema, createBooking, } from "./service-booking-create.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-runtime.d.ts","sourceRoot":"","sources":["../src/mcp-runtime.ts"],"names":[],"mappings":"AAGA,cAAc,YAAY,CAAA;AAE1B,eAAO,MAAM,6BAA6B,wDAcxC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineToolContextContribution } from "@voyant-travel/tools";
|
|
2
|
+
import { financeService } from "./service.js";
|
|
3
|
+
export * from "./tools.js";
|
|
4
|
+
export const voyantToolContextContribution = defineToolContextContribution({
|
|
5
|
+
context: ["finance"],
|
|
6
|
+
contribute: ({ context }) => {
|
|
7
|
+
const db = context.db;
|
|
8
|
+
return {
|
|
9
|
+
finance: {
|
|
10
|
+
listInvoices: (query) => financeService.listInvoices(db, query),
|
|
11
|
+
getInvoiceById: (id) => financeService.getInvoiceById(db, id),
|
|
12
|
+
voidInvoice: (id, input) => financeService.voidInvoice(db, id, input),
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -156,4 +156,5 @@ export declare function createPaymentPolicyPublicRoutes(options: BookingSchedule
|
|
|
156
156
|
}, "/">;
|
|
157
157
|
/** Package-owned extension descriptor; deployments inject the policy cascade readers. */
|
|
158
158
|
export declare function createBookingScheduleHonoExtension(options: BookingScheduleRoutesOptions): HonoExtension;
|
|
159
|
+
export declare const createBookingScheduleVoyantRuntime: import("@voyant-travel/core/project").VoyantGraphRuntimeFactory<HonoExtension>;
|
|
159
160
|
//# sourceMappingURL=routes.d.ts.map
|