@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
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { createVoyantDataFxExchangeRateResolver, } from "./invoice-fx.js";
|
|
2
|
+
/** Compose Finance's main HTTP runtime from generic host and selected providers. */
|
|
3
|
+
export function createFinanceRuntime(host, notifications, checkoutPaymentStarters, invoiceSettlementPollerProviders = []) {
|
|
4
|
+
const { primitives } = host;
|
|
5
|
+
return {
|
|
6
|
+
resolveDocumentDownloadUrl: primitives.storage.downloadUrl,
|
|
7
|
+
resolveInvoiceExchangeRateResolver: (bindings) => createExchangeRateResolver(primitives, bindings),
|
|
8
|
+
invoiceSettlementPollers: aggregateFinanceInvoiceSettlementPollers(invoiceSettlementPollerProviders),
|
|
9
|
+
invoiceDueDateResolver: ({ issueDate, dueDate, bookingPaymentSchedule }) => bookingPaymentSchedule && dueDate < issueDate ? issueDate : dueDate,
|
|
10
|
+
resolveNotificationDispatcher: notifications.resolveNotificationDispatcher,
|
|
11
|
+
resolvePaymentStarters: (bindings) => checkoutPaymentStarters?.resolvePaymentStarters(bindings) ?? {},
|
|
12
|
+
resolveBankTransferDetails: (bindings) => resolveBankTransferDetails(primitives.env(bindings)),
|
|
13
|
+
resolvePublicCheckoutBaseUrl: (bindings) => resolvePublicCheckoutBaseUrl(primitives.env(bindings)),
|
|
14
|
+
listBookingReminderRuns: notifications.listBookingReminderRuns,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Compose Finance's payment schedule from statically selected domain providers. */
|
|
18
|
+
export function createFinanceBookingScheduleRuntime(host, settings, distribution, accommodations, cruises, inventory) {
|
|
19
|
+
const paymentPolicy = inventory.createPaymentPolicyRuntime({
|
|
20
|
+
resolveSupplierPolicy: distribution.resolveSupplierPolicy,
|
|
21
|
+
resolveSupplierPolicyById: distribution.resolveSupplierPolicyById,
|
|
22
|
+
resolveVerticalListingPolicy: async (db, bookingId) => (await cruises.resolveBookingPolicy(db, bookingId)) ??
|
|
23
|
+
accommodations.resolveBookingPolicy(db, bookingId),
|
|
24
|
+
resolveVerticalListingPolicyForEntity: async (db, context) => (await cruises.resolveEntityPolicy(db, context)) ??
|
|
25
|
+
accommodations.resolveEntityPolicy(db, context),
|
|
26
|
+
resolveVerticalSupplierPolicyForEntity: async (db, context) => {
|
|
27
|
+
const supplierId = await cruises.resolveSupplierId(db, context);
|
|
28
|
+
return supplierId ? distribution.resolveSupplierPolicyById(db, supplierId) : null;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
options: {
|
|
33
|
+
resolveDb: (context) => host.primitives.database.fromContext(context),
|
|
34
|
+
resolveOperatorDefaultPaymentPolicy: settings.resolveOperatorDefaultPaymentPolicy,
|
|
35
|
+
...paymentPolicy,
|
|
36
|
+
stampPolicySourceOnBooking: inventory.stampPolicySourceOnBooking,
|
|
37
|
+
readPolicySourceFromInternalNotes: inventory.readPolicySourceFromInternalNotes,
|
|
38
|
+
},
|
|
39
|
+
withDb: (bindings, operation) => host.primitives.database.transaction(bindings, (database) => operation(database)),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function createFinanceBookingTaxRuntime(settings) {
|
|
43
|
+
return {
|
|
44
|
+
resolveBookingTaxSettings: settings.resolveBookingTaxSettings,
|
|
45
|
+
updateBookingTaxSettings: settings.updateBookingTaxSettings,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function createExchangeRateResolver(primitives, bindings) {
|
|
49
|
+
const env = primitives.env(bindings);
|
|
50
|
+
const apiKey = nonEmpty(env.VOYANT_DATA_API_KEY) ??
|
|
51
|
+
(env.VOYANT_ADMIN_AUTH_MODE === "voyant-cloud"
|
|
52
|
+
? (nonEmpty(env.VOYANT_API_KEY) ?? nonEmpty(env.VOYANT_CLOUD_API_KEY))
|
|
53
|
+
: undefined);
|
|
54
|
+
if (!apiKey)
|
|
55
|
+
return undefined;
|
|
56
|
+
return createVoyantDataFxExchangeRateResolver({
|
|
57
|
+
apiKey,
|
|
58
|
+
baseUrl: nonEmpty(env.VOYANT_CLOUD_API_URL),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export function aggregateFinanceInvoiceSettlementPollers(providers) {
|
|
62
|
+
const pollers = {};
|
|
63
|
+
for (const provider of [...providers].sort((left, right) => left.provider < right.provider ? -1 : left.provider > right.provider ? 1 : 0)) {
|
|
64
|
+
if (Object.hasOwn(pollers, provider.provider)) {
|
|
65
|
+
throw new Error(`Finance invoice settlement poller provider "${provider.provider}" was selected more than once.`);
|
|
66
|
+
}
|
|
67
|
+
pollers[provider.provider] = provider.poller;
|
|
68
|
+
}
|
|
69
|
+
return Object.freeze(pollers);
|
|
70
|
+
}
|
|
71
|
+
function resolveBankTransferDetails(env) {
|
|
72
|
+
const beneficiary = stringValue(env.BANK_TRANSFER_BENEFICIARY);
|
|
73
|
+
const iban = stringValue(env.BANK_TRANSFER_IBAN);
|
|
74
|
+
if (!beneficiary || !iban)
|
|
75
|
+
return null;
|
|
76
|
+
return {
|
|
77
|
+
provider: "bank-transfer",
|
|
78
|
+
beneficiary,
|
|
79
|
+
iban,
|
|
80
|
+
bankName: stringValue(env.BANK_TRANSFER_BANK_NAME) ?? null,
|
|
81
|
+
notes: stringValue(env.BANK_TRANSFER_NOTES) ?? null,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function resolvePublicCheckoutBaseUrl(env) {
|
|
85
|
+
return (nonEmpty(env.PUBLIC_CHECKOUT_BASE_URL) ??
|
|
86
|
+
nonEmpty(env.DASH_BASE_URL) ??
|
|
87
|
+
nonEmpty(env.APP_URL)?.replace(/\/api\/?$/, "") ??
|
|
88
|
+
null);
|
|
89
|
+
}
|
|
90
|
+
function nonEmpty(value) {
|
|
91
|
+
if (typeof value !== "string")
|
|
92
|
+
return undefined;
|
|
93
|
+
const trimmed = value.trim();
|
|
94
|
+
return trimmed || undefined;
|
|
95
|
+
}
|
|
96
|
+
function stringValue(value) {
|
|
97
|
+
return typeof value === "string" ? value : undefined;
|
|
98
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BookingsExpireStaleHoldsWorkflowRuntime } from "@voyant-travel/bookings/workflow-runtime";
|
|
2
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
3
|
+
export interface FinanceStaleBookingHoldsRuntimeOptions {
|
|
4
|
+
resolveDb: () => PostgresJsDatabase | Promise<PostgresJsDatabase>;
|
|
5
|
+
userId?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Finance-owned effects required when Bookings expires stale holds. */
|
|
8
|
+
export declare function createFinanceStaleBookingHoldsRuntime(options: FinanceStaleBookingHoldsRuntimeOptions): BookingsExpireStaleHoldsWorkflowRuntime;
|
|
9
|
+
//# sourceMappingURL=stale-booking-holds-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-booking-holds-runtime.d.ts","sourceRoot":"","sources":["../src/stale-booking-holds-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,0CAA0C,CAAA;AAEvG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAKjE,MAAM,WAAW,sCAAsC;IACrD,SAAS,EAAE,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;IACjE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,wEAAwE;AACxE,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,sCAAsC,GAC9C,uCAAuC,CAyBzC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { and, eq, inArray } from "drizzle-orm";
|
|
2
|
+
import { closeTerminalBookingPaymentSchedules } from "./booking-lifecycle.js";
|
|
3
|
+
import { paymentSessions } from "./schema.js";
|
|
4
|
+
import { financeService } from "./service.js";
|
|
5
|
+
/** Finance-owned effects required when Bookings expires stale holds. */
|
|
6
|
+
export function createFinanceStaleBookingHoldsRuntime(options) {
|
|
7
|
+
return {
|
|
8
|
+
resolveDb: options.resolveDb,
|
|
9
|
+
resolveRuntime: () => ({
|
|
10
|
+
expirePaymentSessionsForBooking: async (db, bookingId) => {
|
|
11
|
+
const staleSessions = await db
|
|
12
|
+
.select({ id: paymentSessions.id })
|
|
13
|
+
.from(paymentSessions)
|
|
14
|
+
.where(and(eq(paymentSessions.bookingId, bookingId), inArray(paymentSessions.status, ["pending", "requires_redirect", "processing"])));
|
|
15
|
+
for (const session of staleSessions) {
|
|
16
|
+
await financeService.expirePaymentSession(db, session.id, {
|
|
17
|
+
notes: "Booking hold expired",
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
closePaymentSchedulesForBooking: closeTerminalBookingPaymentSchedules,
|
|
22
|
+
}),
|
|
23
|
+
userId: options.userId,
|
|
24
|
+
};
|
|
25
|
+
}
|
package/dist/voyant.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voyant.d.ts","sourceRoot":"","sources":["../src/voyant.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"voyant.d.ts","sourceRoot":"","sources":["../src/voyant.ts"],"names":[],"mappings":"AAkBA,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,uDAsS9B,CAAA;AAEF,eAAO,MAAM,6BAA6B,uDAsBxC,CAAA;AAEF,eAAO,MAAM,iCAAiC,uDAoB5C,CAAA;AAEF,eAAO,MAAM,kCAAkC,uDAsD7C,CAAA;AAEF,eAAe,mBAAmB,CAAA"}
|
package/dist/voyant.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineExtension, defineModule } from "@voyant-travel/core/project";
|
|
1
|
+
import { defineExtension, defineModule, requirePort } from "@voyant-travel/core/project";
|
|
2
|
+
import { financeAccommodationsPaymentPolicyRuntimePort, financeCheckoutPaymentStartersRuntimePort, financeCruisesPaymentPolicyRuntimePort, financeDistributionPaymentPolicyRuntimePort, financeHostRuntimePort, financeInventoryPaymentPolicyRuntimePort, financeInvoiceSettlementPollerRuntimePort, financeNotificationsRuntimePort, financeOperatorSettingsRuntimePort, } from "./runtime-port.js";
|
|
2
3
|
const financeAdminRuntime = {
|
|
3
4
|
entry: "@voyant-travel/finance-react/admin",
|
|
4
5
|
export: "createFinanceAdminExtension",
|
|
@@ -8,11 +9,23 @@ export const financeVoyantModule = defineModule({
|
|
|
8
9
|
id: "@voyant-travel/finance",
|
|
9
10
|
packageName: "@voyant-travel/finance",
|
|
10
11
|
localId: "finance",
|
|
12
|
+
runtime: { entry: "@voyant-travel/finance", export: "createFinanceVoyantRuntime" },
|
|
13
|
+
runtimePorts: [
|
|
14
|
+
requirePort(financeHostRuntimePort),
|
|
15
|
+
requirePort(financeNotificationsRuntimePort),
|
|
16
|
+
requirePort(financeCheckoutPaymentStartersRuntimePort, { optional: true }),
|
|
17
|
+
requirePort(financeInvoiceSettlementPollerRuntimePort, {
|
|
18
|
+
optional: true,
|
|
19
|
+
cardinality: "many",
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
provides: { capabilities: ["finance.payment-sessions"] },
|
|
11
23
|
api: [
|
|
12
24
|
{
|
|
13
25
|
id: "@voyant-travel/finance#api.admin",
|
|
14
26
|
surface: "admin",
|
|
15
27
|
mount: "finance",
|
|
28
|
+
openapi: { document: "finance" },
|
|
16
29
|
transactional: true,
|
|
17
30
|
runtime: {
|
|
18
31
|
entry: "@voyant-travel/finance",
|
|
@@ -23,6 +36,7 @@ export const financeVoyantModule = defineModule({
|
|
|
23
36
|
id: "@voyant-travel/finance#api.public",
|
|
24
37
|
surface: "public",
|
|
25
38
|
mount: "finance",
|
|
39
|
+
openapi: { document: "finance" },
|
|
26
40
|
anonymous: ["/bookings", "/collections", "/payment-sessions", "/accountant", "/vouchers"],
|
|
27
41
|
transactional: true,
|
|
28
42
|
runtime: {
|
|
@@ -62,44 +76,125 @@ export const financeVoyantModule = defineModule({
|
|
|
62
76
|
},
|
|
63
77
|
],
|
|
64
78
|
events: [
|
|
65
|
-
{
|
|
79
|
+
{
|
|
80
|
+
id: "@voyant-travel/finance#event.invoice.issued",
|
|
81
|
+
eventType: "invoice.issued",
|
|
82
|
+
version: "1.0.0",
|
|
83
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
84
|
+
visibility: "internal",
|
|
85
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
86
|
+
},
|
|
66
87
|
{
|
|
67
88
|
id: "@voyant-travel/finance#event.invoice.proforma.issued",
|
|
68
89
|
eventType: "invoice.proforma.issued",
|
|
90
|
+
version: "1.0.0",
|
|
91
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
92
|
+
visibility: "internal",
|
|
93
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
69
94
|
},
|
|
70
95
|
{
|
|
71
96
|
id: "@voyant-travel/finance#event.invoice.proforma.converted",
|
|
72
97
|
eventType: "invoice.proforma.converted",
|
|
98
|
+
version: "1.0.0",
|
|
99
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
100
|
+
visibility: "internal",
|
|
101
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "@voyant-travel/finance#event.invoice.voided",
|
|
105
|
+
eventType: "invoice.voided",
|
|
106
|
+
version: "1.0.0",
|
|
107
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
108
|
+
visibility: "internal",
|
|
109
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "@voyant-travel/finance#event.invoice.settled",
|
|
113
|
+
eventType: "invoice.settled",
|
|
114
|
+
version: "1.0.0",
|
|
115
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
116
|
+
visibility: "internal",
|
|
117
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "@voyant-travel/finance#event.invoice.rendered",
|
|
121
|
+
eventType: "invoice.rendered",
|
|
122
|
+
version: "1.0.0",
|
|
123
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
124
|
+
visibility: "internal",
|
|
125
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
73
126
|
},
|
|
74
|
-
{ id: "@voyant-travel/finance#event.invoice.voided", eventType: "invoice.voided" },
|
|
75
|
-
{ id: "@voyant-travel/finance#event.invoice.settled", eventType: "invoice.settled" },
|
|
76
|
-
{ id: "@voyant-travel/finance#event.invoice.rendered", eventType: "invoice.rendered" },
|
|
77
127
|
{
|
|
78
128
|
id: "@voyant-travel/finance#event.invoice.document.generated",
|
|
79
129
|
eventType: "invoice.document.generated",
|
|
130
|
+
version: "1.0.0",
|
|
131
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
132
|
+
visibility: "internal",
|
|
133
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
80
134
|
},
|
|
81
135
|
{
|
|
82
136
|
id: "@voyant-travel/finance#event.invoice.payment.recorded",
|
|
83
137
|
eventType: "invoice.payment.recorded",
|
|
138
|
+
version: "1.0.0",
|
|
139
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
140
|
+
visibility: "internal",
|
|
141
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "@voyant-travel/finance#event.payment.completed",
|
|
145
|
+
eventType: "payment.completed",
|
|
146
|
+
version: "1.0.0",
|
|
147
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
148
|
+
visibility: "internal",
|
|
149
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "@voyant-travel/finance#event.booking.created",
|
|
153
|
+
eventType: "booking.created",
|
|
154
|
+
version: "1.0.0",
|
|
155
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
156
|
+
visibility: "internal",
|
|
157
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "@voyant-travel/finance#event.booking.confirmed",
|
|
161
|
+
eventType: "booking.confirmed",
|
|
162
|
+
version: "1.0.0",
|
|
163
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
164
|
+
visibility: "internal",
|
|
165
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
84
166
|
},
|
|
85
|
-
{ id: "@voyant-travel/finance#event.payment.completed", eventType: "payment.completed" },
|
|
86
|
-
{ id: "@voyant-travel/finance#event.booking.created", eventType: "booking.created" },
|
|
87
|
-
{ id: "@voyant-travel/finance#event.booking.confirmed", eventType: "booking.confirmed" },
|
|
88
167
|
{
|
|
89
168
|
id: "@voyant-travel/finance#event.booking.dual-created",
|
|
90
169
|
eventType: "booking.dual-created",
|
|
170
|
+
version: "1.0.0",
|
|
171
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
172
|
+
visibility: "internal",
|
|
173
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
91
174
|
},
|
|
92
175
|
{
|
|
93
176
|
id: "@voyant-travel/finance#event.booking-create.rejected",
|
|
94
177
|
eventType: "booking_create.rejected",
|
|
178
|
+
version: "1.0.0",
|
|
179
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
180
|
+
visibility: "internal",
|
|
181
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
95
182
|
},
|
|
96
183
|
{
|
|
97
184
|
id: "@voyant-travel/finance#event.booking.contract-document.requested",
|
|
98
185
|
eventType: "booking.contract_document.requested",
|
|
186
|
+
version: "1.0.0",
|
|
187
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
188
|
+
visibility: "internal",
|
|
189
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
99
190
|
},
|
|
100
191
|
{
|
|
101
192
|
id: "@voyant-travel/finance#event.booking-payment-schedule.paid",
|
|
102
193
|
eventType: "booking_payment_schedule.paid",
|
|
194
|
+
version: "1.0.0",
|
|
195
|
+
payloadSchema: { type: "object", additionalProperties: true },
|
|
196
|
+
visibility: "internal",
|
|
197
|
+
audit: { sourceModule: "finance", category: "domain" },
|
|
103
198
|
},
|
|
104
199
|
],
|
|
105
200
|
setupMigrations: [
|
|
@@ -120,6 +215,11 @@ export const financeVoyantModule = defineModule({
|
|
|
120
215
|
resource: "finance",
|
|
121
216
|
actions: ["read", "write", "refund", "void"],
|
|
122
217
|
},
|
|
218
|
+
{
|
|
219
|
+
id: "@voyant-travel/finance#access.transactions",
|
|
220
|
+
resource: "transactions",
|
|
221
|
+
actions: ["read", "write"],
|
|
222
|
+
},
|
|
123
223
|
],
|
|
124
224
|
},
|
|
125
225
|
tools: [
|
|
@@ -128,21 +228,40 @@ export const financeVoyantModule = defineModule({
|
|
|
128
228
|
name: "list_invoices",
|
|
129
229
|
runtime: { entry: "@voyant-travel/finance/tools", export: "listInvoicesTool" },
|
|
130
230
|
requiredScopes: ["finance:read"],
|
|
231
|
+
context: ["finance"],
|
|
131
232
|
},
|
|
132
233
|
{
|
|
133
234
|
id: "@voyant-travel/finance#tool.get-invoice",
|
|
134
235
|
name: "get_invoice",
|
|
135
236
|
runtime: { entry: "@voyant-travel/finance/tools", export: "getInvoiceTool" },
|
|
136
237
|
requiredScopes: ["finance:read"],
|
|
238
|
+
context: ["finance"],
|
|
137
239
|
},
|
|
138
240
|
{
|
|
139
241
|
id: "@voyant-travel/finance#tool.void-invoice",
|
|
140
242
|
name: "void_invoice",
|
|
141
243
|
runtime: { entry: "@voyant-travel/finance/tools", export: "voidInvoiceTool" },
|
|
142
244
|
requiredScopes: ["finance:void"],
|
|
245
|
+
context: ["finance"],
|
|
143
246
|
},
|
|
144
247
|
],
|
|
145
248
|
admin: {
|
|
249
|
+
compositionOrder: 40,
|
|
250
|
+
runtime: {
|
|
251
|
+
entry: "@voyant-travel/finance-react/admin",
|
|
252
|
+
export: "createSelectedFinanceAdminExtension",
|
|
253
|
+
},
|
|
254
|
+
copy: [
|
|
255
|
+
{
|
|
256
|
+
id: "@voyant-travel/finance#admin.copy",
|
|
257
|
+
namespace: "finance.admin",
|
|
258
|
+
fallbackLocale: "en",
|
|
259
|
+
runtime: {
|
|
260
|
+
entry: "@voyant-travel/finance-react/i18n",
|
|
261
|
+
export: "financeUiMessageDefinitions",
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
],
|
|
146
265
|
routes: [
|
|
147
266
|
["index", "/finance"],
|
|
148
267
|
["invoices-index", "/finance/invoices"],
|
|
@@ -159,6 +278,7 @@ export const financeVoyantModule = defineModule({
|
|
|
159
278
|
runtime: financeAdminRuntime,
|
|
160
279
|
})),
|
|
161
280
|
contributions: [
|
|
281
|
+
["booking-payment-controller", "booking.details.payment-controller"],
|
|
162
282
|
["booking-invoices", "booking.details.invoices-tab"],
|
|
163
283
|
["booking-pending-payment-sessions", "booking.details.finance-start"],
|
|
164
284
|
["booking-payment-policy", "booking.details.finance-end"],
|
|
@@ -180,11 +300,14 @@ export const financeBookingTaxVoyantPlugin = defineExtension({
|
|
|
180
300
|
id: "@voyant-travel/finance#booking-tax-extension",
|
|
181
301
|
packageName: "@voyant-travel/finance",
|
|
182
302
|
localId: "finance.booking-tax-extension",
|
|
303
|
+
runtime: { entry: "@voyant-travel/finance", export: "createBookingTaxVoyantRuntime" },
|
|
304
|
+
runtimePorts: [requirePort(financeOperatorSettingsRuntimePort)],
|
|
183
305
|
api: [
|
|
184
306
|
{
|
|
185
307
|
id: "@voyant-travel/finance#booking-tax-extension.api",
|
|
186
308
|
surface: "admin",
|
|
187
309
|
mount: "bookings",
|
|
310
|
+
openapi: { document: "booking-tax" },
|
|
188
311
|
transactional: true,
|
|
189
312
|
runtime: {
|
|
190
313
|
entry: "@voyant-travel/finance",
|
|
@@ -205,6 +328,7 @@ export const financeBookingsCreateVoyantPlugin = defineExtension({
|
|
|
205
328
|
id: "@voyant-travel/finance#bookings-create-extension.api",
|
|
206
329
|
surface: "admin",
|
|
207
330
|
mount: "bookings",
|
|
331
|
+
openapi: { document: "bookings" },
|
|
208
332
|
transactional: true,
|
|
209
333
|
runtime: {
|
|
210
334
|
entry: "@voyant-travel/finance",
|
|
@@ -220,11 +344,24 @@ export const financeBookingScheduleVoyantPlugin = defineExtension({
|
|
|
220
344
|
id: "@voyant-travel/finance#booking-schedule-extension",
|
|
221
345
|
packageName: "@voyant-travel/finance",
|
|
222
346
|
localId: "finance.booking-schedule-extension",
|
|
347
|
+
runtime: {
|
|
348
|
+
entry: "@voyant-travel/finance",
|
|
349
|
+
export: "createBookingScheduleVoyantRuntime",
|
|
350
|
+
},
|
|
351
|
+
runtimePorts: [
|
|
352
|
+
requirePort(financeHostRuntimePort),
|
|
353
|
+
requirePort(financeOperatorSettingsRuntimePort),
|
|
354
|
+
requirePort(financeDistributionPaymentPolicyRuntimePort),
|
|
355
|
+
requirePort(financeAccommodationsPaymentPolicyRuntimePort),
|
|
356
|
+
requirePort(financeCruisesPaymentPolicyRuntimePort),
|
|
357
|
+
requirePort(financeInventoryPaymentPolicyRuntimePort),
|
|
358
|
+
],
|
|
223
359
|
api: [
|
|
224
360
|
{
|
|
225
361
|
id: "@voyant-travel/finance#booking-schedule-extension.api.admin",
|
|
226
362
|
surface: "admin",
|
|
227
363
|
mount: "bookings",
|
|
364
|
+
openapi: { document: "bookings" },
|
|
228
365
|
transactional: true,
|
|
229
366
|
runtime: {
|
|
230
367
|
entry: "@voyant-travel/finance",
|
|
@@ -235,6 +372,7 @@ export const financeBookingScheduleVoyantPlugin = defineExtension({
|
|
|
235
372
|
id: "@voyant-travel/finance#booking-schedule-extension.api.public",
|
|
236
373
|
surface: "public",
|
|
237
374
|
mount: "payment-policy",
|
|
375
|
+
openapi: { document: "bookings" },
|
|
238
376
|
anonymous: true,
|
|
239
377
|
runtime: {
|
|
240
378
|
entry: "@voyant-travel/finance",
|
|
@@ -242,6 +380,17 @@ export const financeBookingScheduleVoyantPlugin = defineExtension({
|
|
|
242
380
|
},
|
|
243
381
|
},
|
|
244
382
|
],
|
|
383
|
+
subscribers: [
|
|
384
|
+
{
|
|
385
|
+
id: "@voyant-travel/finance#subscriber.booking-schedule-confirmed",
|
|
386
|
+
eventType: "booking.confirmed",
|
|
387
|
+
source: "@voyant-travel/finance/booking-schedule-subscriber",
|
|
388
|
+
runtime: {
|
|
389
|
+
entry: "./booking-schedule-subscriber",
|
|
390
|
+
export: "bookingScheduleConfirmedSubscriber",
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
],
|
|
245
394
|
meta: {
|
|
246
395
|
ownership: "package",
|
|
247
396
|
},
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "Booking Tax API",
|
|
5
|
+
"version": "1.0.0"
|
|
6
|
+
},
|
|
7
|
+
"paths": {
|
|
8
|
+
"/v1/admin/bookings/tax-settings": {
|
|
9
|
+
"get": {
|
|
10
|
+
"summary": "Get booking tax settings",
|
|
11
|
+
"x-voyant-api-id": "@voyant-travel/finance#booking-tax-extension.api",
|
|
12
|
+
"responses": {
|
|
13
|
+
"200": {
|
|
14
|
+
"description": "The effective booking tax settings",
|
|
15
|
+
"content": {
|
|
16
|
+
"application/json": {
|
|
17
|
+
"schema": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"required": ["data"],
|
|
20
|
+
"properties": { "data": { "$ref": "#/components/schemas/BookingTaxSettings" } }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"patch": {
|
|
28
|
+
"summary": "Update booking tax settings",
|
|
29
|
+
"x-voyant-api-id": "@voyant-travel/finance#booking-tax-extension.api",
|
|
30
|
+
"requestBody": {
|
|
31
|
+
"required": true,
|
|
32
|
+
"content": {
|
|
33
|
+
"application/json": {
|
|
34
|
+
"schema": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"taxPriceMode": { "type": "string", "enum": ["inclusive", "exclusive"] },
|
|
38
|
+
"taxPolicyProfileId": { "type": ["string", "null"] }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"responses": {
|
|
45
|
+
"200": { "description": "The updated booking tax settings" },
|
|
46
|
+
"409": { "description": "This deployment does not support tax setting updates" }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"/v1/admin/bookings/tax-preview": {
|
|
51
|
+
"post": {
|
|
52
|
+
"summary": "Preview tax for a booking item subtotal",
|
|
53
|
+
"x-voyant-api-id": "@voyant-travel/finance#booking-tax-extension.api",
|
|
54
|
+
"requestBody": {
|
|
55
|
+
"required": true,
|
|
56
|
+
"content": {
|
|
57
|
+
"application/json": {
|
|
58
|
+
"schema": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"required": ["productId", "subtotalCents", "currency"],
|
|
61
|
+
"properties": {
|
|
62
|
+
"productId": { "type": "string", "minLength": 1 },
|
|
63
|
+
"subtotalCents": { "type": "integer", "minimum": 0 },
|
|
64
|
+
"currency": { "type": "string", "minLength": 3, "maxLength": 8 }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"responses": { "200": { "description": "The calculated tax preview" } }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"components": {
|
|
75
|
+
"schemas": {
|
|
76
|
+
"BookingTaxSettings": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"required": ["taxPriceMode", "taxPolicyProfileId"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"taxPriceMode": { "type": "string", "enum": ["inclusive", "exclusive"] },
|
|
81
|
+
"taxPolicyProfileId": { "type": ["string", "null"] }
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|