@voyant-travel/finance 0.166.0 → 0.168.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/README.md +23 -9
- package/dist/action-ledger-drift.d.ts.map +1 -0
- package/dist/booking-lifecycle.d.ts.map +1 -0
- package/dist/booking-schedule/subscriber-runtime.d.ts.map +1 -0
- package/dist/booking-tax.d.ts +36 -28
- package/dist/booking-tax.d.ts.map +1 -0
- package/dist/booking-tax.js +49 -25
- package/dist/card-payment.d.ts.map +1 -0
- package/dist/checkout-routes.d.ts +294 -294
- package/dist/checkout-routes.d.ts.map +1 -0
- package/dist/checkout-service-plan.d.ts +2 -2
- package/dist/checkout-service-plan.d.ts.map +1 -0
- package/dist/checkout-service.d.ts.map +1 -0
- package/dist/checkout-validation.d.ts.map +1 -0
- package/dist/document-download.d.ts.map +1 -0
- package/dist/fx-money.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -3
- package/dist/invoice-fx.d.ts.map +1 -0
- package/dist/invoice-number-errors.d.ts.map +1 -0
- package/dist/linkables.d.ts.map +1 -0
- package/dist/markets-ref.d.ts.map +1 -0
- package/dist/mcp-runtime.d.ts.map +1 -0
- package/dist/order-payment-sessions.d.ts.map +1 -0
- package/dist/payment-adapter-events.d.ts +3 -3
- package/dist/payment-link.d.ts.map +1 -0
- package/dist/payment-policy-cascade.d.ts.map +1 -0
- package/dist/payment-policy.d.ts.map +1 -0
- package/dist/payment-schedule/routes.d.ts +2 -2
- package/dist/payment-schedule/routes.d.ts.map +1 -0
- package/dist/payment-schedule/routes.js +2 -4
- package/dist/proforma-conversion-runtime.d.ts +17 -14
- package/dist/proforma-conversion-runtime.js +19 -15
- package/dist/route-runtime.d.ts.map +1 -0
- package/dist/routes-action-ledger.d.ts +25 -25
- package/dist/routes-action-ledger.d.ts.map +1 -0
- package/dist/routes-booking-billing.d.ts +95 -95
- package/dist/routes-booking-billing.d.ts.map +1 -0
- package/dist/routes-booking-create.d.ts.map +1 -0
- package/dist/routes-booking-reads.d.ts +13 -13
- package/dist/routes-booking-reads.d.ts.map +1 -0
- package/dist/routes-documents.d.ts +11 -11
- package/dist/routes-documents.d.ts.map +1 -0
- package/dist/routes-invoice-core.d.ts +87 -87
- package/dist/routes-invoice-core.d.ts.map +1 -0
- package/dist/routes-invoice-documents.d.ts +16 -16
- package/dist/routes-invoice-documents.d.ts.map +1 -0
- package/dist/routes-invoice-issue.d.ts.map +1 -0
- package/dist/routes-invoice-schemas.d.ts +20 -20
- package/dist/routes-invoice-schemas.d.ts.map +1 -0
- package/dist/routes-payment-processing.d.ts +152 -152
- package/dist/routes-payment-processing.d.ts.map +1 -0
- package/dist/routes-payment-schemas.d.ts +17 -17
- package/dist/routes-payment-schemas.d.ts.map +1 -0
- package/dist/routes-payments.d.ts +64 -64
- package/dist/routes-payments.d.ts.map +1 -0
- package/dist/routes-public-accountant.d.ts +19 -19
- package/dist/routes-public.d.ts +102 -102
- package/dist/routes-public.d.ts.map +1 -0
- package/dist/routes-reference-data.d.ts +33 -33
- package/dist/routes-reference-data.d.ts.map +1 -0
- package/dist/routes-reports.d.ts +11 -11
- package/dist/routes-reports.d.ts.map +1 -0
- package/dist/routes-runtime.d.ts +1 -1
- package/dist/routes-runtime.d.ts.map +1 -0
- package/dist/routes-settlement.d.ts +12 -12
- package/dist/routes-settlement.d.ts.map +1 -0
- package/dist/routes-shared.d.ts.map +1 -0
- package/dist/routes-supplier-invoices.d.ts +75 -75
- package/dist/routes-supplier-invoices.d.ts.map +1 -0
- package/dist/routes-travel-credits.d.ts +4 -4
- package/dist/routes-vouchers.d.ts +401 -0
- package/dist/routes-vouchers.d.ts.map +1 -0
- package/dist/routes-vouchers.js +176 -0
- package/dist/routes.d.ts +477 -477
- package/dist/routes.d.ts.map +1 -0
- package/dist/runtime-contributor.d.ts.map +1 -0
- package/dist/runtime-port.d.ts +20 -24
- package/dist/runtime-port.d.ts.map +1 -0
- package/dist/runtime-port.js +10 -11
- package/dist/runtime.d.ts.map +1 -0
- package/dist/schema/booking-billing.d.ts +5 -5
- package/dist/schema/booking-billing.d.ts.map +1 -0
- package/dist/schema/enums.d.ts.map +1 -0
- package/dist/schema/invoice-documents.d.ts +1 -1
- package/dist/schema/invoice-documents.d.ts.map +1 -0
- package/dist/schema/payment-instruments.d.ts +1 -1
- package/dist/schema/payment-instruments.d.ts.map +1 -0
- package/dist/schema/payment-processing.d.ts +3 -3
- package/dist/schema/payment-processing.d.ts.map +1 -0
- package/dist/schema/payment-sessions.d.ts +3 -3
- package/dist/schema/payment-sessions.d.ts.map +1 -0
- package/dist/schema/receivables.d.ts +3 -3
- package/dist/schema/receivables.d.ts.map +1 -0
- package/dist/schema/relations.d.ts.map +1 -0
- package/dist/schema/supplier-invoices.d.ts +5 -5
- package/dist/schema/supplier-invoices.d.ts.map +1 -0
- package/dist/schema/tax.d.ts +1 -1
- package/dist/schema/tax.d.ts.map +1 -0
- package/dist/schema/vouchers.d.ts +444 -0
- package/dist/schema/vouchers.d.ts.map +1 -0
- package/dist/schema/vouchers.js +64 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/service-accountant-shares.d.ts.map +1 -0
- package/dist/service-action-ledger-accounting.d.ts.map +1 -0
- package/dist/service-action-ledger-booking-payments.d.ts.map +1 -0
- package/dist/service-action-ledger-bookings.d.ts.map +1 -0
- package/dist/service-action-ledger-payment-authorizations.d.ts.map +1 -0
- package/dist/service-action-ledger-payment-sessions.d.ts.map +1 -0
- package/dist/service-action-ledger-supplier-invoices.d.ts.map +1 -0
- package/dist/service-action-ledger-supplier-payments.d.ts.map +1 -0
- package/dist/service-action-ledger.d.ts.map +1 -0
- package/dist/service-aggregates.d.ts.map +1 -0
- package/dist/service-booking-billing.d.ts +111 -111
- package/dist/service-booking-billing.d.ts.map +1 -0
- package/dist/service-booking-create.d.ts +11 -11
- package/dist/service-booking-create.d.ts.map +1 -0
- package/dist/service-booking-guarantees.d.ts +34 -34
- package/dist/service-booking-guarantees.d.ts.map +1 -0
- package/dist/service-booking-item-billing.d.ts +21 -21
- package/dist/service-booking-item-billing.d.ts.map +1 -0
- package/dist/service-booking-payment-schedules.d.ts +56 -56
- package/dist/service-booking-payment-schedules.d.ts.map +1 -0
- package/dist/service-bookings-dual-create.d.ts +22 -22
- package/dist/service-bookings-dual-create.d.ts.map +1 -0
- package/dist/service-boundary-sql.d.ts.map +1 -0
- package/dist/service-cost-categories.d.ts.map +1 -0
- package/dist/service-documents.d.ts.map +1 -0
- package/dist/service-invoice-artifacts.d.ts +24 -24
- package/dist/service-invoice-artifacts.d.ts.map +1 -0
- package/dist/service-invoice-core.d.ts +28 -28
- package/dist/service-invoice-core.d.ts.map +1 -0
- package/dist/service-invoice-credit-notes.d.ts +10 -10
- package/dist/service-invoice-credit-notes.d.ts.map +1 -0
- package/dist/service-invoice-from-booking.d.ts +19 -19
- package/dist/service-invoice-from-booking.d.ts.map +1 -0
- package/dist/service-invoice-line-items.d.ts +10 -10
- package/dist/service-invoice-line-items.d.ts.map +1 -0
- package/dist/service-invoice-numbering.d.ts +28 -28
- package/dist/service-invoice-numbering.d.ts.map +1 -0
- package/dist/service-invoice-payments.d.ts +20 -20
- package/dist/service-invoice-payments.d.ts.map +1 -0
- package/dist/service-invoices.d.ts +87 -87
- package/dist/service-invoices.d.ts.map +1 -0
- package/dist/service-issue.d.ts +38 -38
- package/dist/service-issue.d.ts.map +1 -0
- package/dist/service-payment-authorizations.d.ts +26 -26
- package/dist/service-payment-authorizations.d.ts.map +1 -0
- package/dist/service-payment-instruments.d.ts +10 -10
- package/dist/service-payment-instruments.d.ts.map +1 -0
- package/dist/service-payment-processing.d.ts +77 -77
- package/dist/service-payment-processing.d.ts.map +1 -0
- package/dist/service-payment-session-completion.d.ts +3 -3
- package/dist/service-payment-session-completion.d.ts.map +1 -0
- package/dist/service-payment-sessions.d.ts +38 -38
- package/dist/service-payment-sessions.d.ts.map +1 -0
- package/dist/service-profitability.d.ts.map +1 -0
- package/dist/service-public.d.ts +16 -16
- package/dist/service-public.d.ts.map +1 -0
- package/dist/service-reference-data.d.ts +23 -23
- package/dist/service-reference-data.d.ts.map +1 -0
- package/dist/service-rendition-wait.d.ts +1 -1
- package/dist/service-rendition-wait.d.ts.map +1 -0
- package/dist/service-reports.d.ts.map +1 -0
- package/dist/service-settlement.d.ts.map +1 -0
- package/dist/service-shared.d.ts +4 -4
- package/dist/service-shared.d.ts.map +1 -0
- package/dist/service-supplier-invoices.d.ts +20 -20
- package/dist/service-supplier-invoices.d.ts.map +1 -0
- package/dist/service-supplier-payments.d.ts +16 -16
- package/dist/service-supplier-payments.d.ts.map +1 -0
- package/dist/service-travel-credits.d.ts +10 -10
- package/dist/service-vouchers-migration.d.ts +51 -0
- package/dist/service-vouchers-migration.d.ts.map +1 -0
- package/dist/service-vouchers-migration.js +154 -0
- package/dist/service-vouchers.d.ts +157 -0
- package/dist/service-vouchers.d.ts.map +1 -0
- package/dist/service-vouchers.js +191 -0
- package/dist/service.d.ts +376 -376
- package/dist/service.d.ts.map +1 -0
- package/dist/stale-booking-holds-runtime.d.ts.map +1 -0
- package/dist/tools.d.ts +21 -21
- package/dist/tools.d.ts.map +1 -0
- package/dist/validation-billing.d.ts.map +1 -0
- package/dist/validation-payments.d.ts.map +1 -0
- package/dist/validation-public.d.ts.map +1 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-vouchers.d.ts +2 -0
- package/dist/validation-vouchers.d.ts.map +1 -0
- package/dist/validation-vouchers.js +1 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/voyant.d.ts +2 -1
- package/dist/voyant.d.ts.map +1 -0
- package/dist/voyant.js +43 -7
- package/openapi/admin/booking-tax-preview.json +33 -0
- package/openapi/admin/{booking-tax.json → booking-tax-settings.json} +7 -32
- package/package.json +205 -170
- package/LICENSE +0 -201
package/README.md
CHANGED
|
@@ -114,14 +114,19 @@ Mounted Finance routes include:
|
|
|
114
114
|
## Booking Tax Preview
|
|
115
115
|
|
|
116
116
|
Booking creation UIs can show the same tax line that booking finalization will
|
|
117
|
-
persist by mounting the booking-tax
|
|
117
|
+
persist by mounting the booking-tax extensions. The surface is split in two:
|
|
118
|
+
tax **settings** live on the finance admin surface, and tax **preview** lives on
|
|
119
|
+
the bookings admin surface:
|
|
118
120
|
|
|
119
121
|
```typescript
|
|
120
|
-
import {
|
|
122
|
+
import {
|
|
123
|
+
createBookingTaxSettingsApiExtension,
|
|
124
|
+
createBookingTaxPreviewApiExtension,
|
|
125
|
+
} from "@voyant-travel/finance/booking-tax"
|
|
121
126
|
|
|
122
127
|
createApp({
|
|
123
128
|
extensions: [
|
|
124
|
-
|
|
129
|
+
createBookingTaxSettingsApiExtension({
|
|
125
130
|
resolveBookingTaxSettings: async (db) => {
|
|
126
131
|
const settings = await getTaxSettings(db)
|
|
127
132
|
return {
|
|
@@ -129,6 +134,10 @@ createApp({
|
|
|
129
134
|
taxPolicyProfileId: settings?.taxPolicyProfileId ?? null,
|
|
130
135
|
}
|
|
131
136
|
},
|
|
137
|
+
updateBookingTaxSettings: async (db, next) => saveTaxSettings(db, next),
|
|
138
|
+
}),
|
|
139
|
+
createBookingTaxPreviewApiExtension({
|
|
140
|
+
resolveBookingTaxSettings: async (db) => getTaxSettings(db),
|
|
132
141
|
}),
|
|
133
142
|
],
|
|
134
143
|
})
|
|
@@ -139,16 +148,21 @@ settings table, KV, environment configuration, or any other deployment-owned
|
|
|
139
148
|
store, while `@voyant-travel/finance` owns the tax policy rule walker, tax-regime
|
|
140
149
|
lookup, product tax-class fallback, and inclusive/exclusive math.
|
|
141
150
|
|
|
142
|
-
Templates that already mount custom routes can call
|
|
143
|
-
|
|
151
|
+
Templates that already mount custom routes can call
|
|
152
|
+
`mountBookingTaxSettingsRoutes(...)` / `mountBookingTaxPreviewRoutes(...)` from
|
|
153
|
+
the same entrypoint instead of using the API extensions.
|
|
144
154
|
|
|
145
|
-
Mounting
|
|
155
|
+
Mounting these routes registers:
|
|
146
156
|
|
|
147
|
-
- `GET /v1/admin/
|
|
148
|
-
- `PATCH /v1/admin/
|
|
157
|
+
- `GET /v1/admin/finance/tax-settings`
|
|
158
|
+
- `PATCH /v1/admin/finance/tax-settings` when `updateBookingTaxSettings` is supplied
|
|
149
159
|
- `POST /v1/admin/bookings/tax-preview`
|
|
150
160
|
|
|
151
|
-
|
|
161
|
+
Tax settings sit on the finance admin surface (alongside tax regimes, policy
|
|
162
|
+
rules, and invoice-fx) so the managed runtime's per-unit, prefix-first-match
|
|
163
|
+
admin dispatch does not let the bookings `GET /{id}` route swallow
|
|
164
|
+
`/tax-settings`. The preview endpoint is consumed by
|
|
165
|
+
`@voyant-travel/bookings-react` tax-preview
|
|
152
166
|
hooks. Consumers that use the booking-create dialog without mounting the route
|
|
153
167
|
will silently lose tax rows in the dialog summary because the client treats a
|
|
154
168
|
missing preview as "no tax to show".
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-ledger-drift.d.ts","sourceRoot":"","sources":["../src/action-ledger-drift.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,aAAa,CAAA;AAmB5D,MAAM,MAAM,6BAA6B,GAAG,SAAS,GAAG,SAAS,GAAG,iBAAiB,CAAA;AAErF,MAAM,WAAW,kCAAkC;IACjD,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,6BAA6B,CAAA;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,MAAM,WAAW,mCAAmC;IAClD,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,2BAA2B,EAAE,CAAA;CACpC;AAED,UAAU,gCAA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YAAY,GAAE,qCAA0C,GACvD,2BAA2B,CA2B7B;AAeD,eAAO,MAAM,kCAAkC,6BAA2C,CAAA"}
|
package/dist/booking-tax.d.ts
CHANGED
|
@@ -13,25 +13,17 @@ export type ResolvedBookingSellTaxRate = {
|
|
|
13
13
|
priceMode: "inclusive" | "exclusive";
|
|
14
14
|
};
|
|
15
15
|
export type InvoicingMode = "direct" | "proforma-first";
|
|
16
|
-
/**
|
|
17
|
-
* Official FX reference-rate source. `ecb` (default) covers most EU
|
|
18
|
-
* operators; `bnr` is the National Bank of Romania. A setting, not
|
|
19
|
-
* per-country code — new jurisdictions add values here, not modules.
|
|
20
|
-
*/
|
|
21
|
-
export type FxReferenceSource = "ecb" | "bnr";
|
|
22
16
|
export type BookingTaxSettings = {
|
|
23
17
|
taxPriceMode?: "inclusive" | "exclusive" | null;
|
|
24
18
|
taxPolicyProfileId?: string | null;
|
|
25
19
|
/**
|
|
26
|
-
* Operator invoicing mode
|
|
27
|
-
*
|
|
28
|
-
* to a fiscal invoice on full settlement
|
|
20
|
+
* Operator invoicing mode for the deferred bank-transfer path.
|
|
21
|
+
* `proforma-first` issues a proforma at order placement and converts it
|
|
22
|
+
* to a fiscal invoice on full settlement; `direct` issues the fiscal
|
|
23
|
+
* invoice at order placement. Card payments always invoice directly and
|
|
24
|
+
* never consult this. Absent/null → `proforma-first`.
|
|
29
25
|
*/
|
|
30
26
|
invoicingMode?: InvoicingMode | null;
|
|
31
|
-
/**
|
|
32
|
-
* Operator's official FX reference-rate source. Absent/null → `ecb`.
|
|
33
|
-
*/
|
|
34
|
-
fxReferenceSource?: FxReferenceSource | null;
|
|
35
27
|
};
|
|
36
28
|
export type ResolveBookingTaxSettings = (db: PostgresJsDatabase) => BookingTaxSettings | null | undefined | Promise<BookingTaxSettings | null | undefined>;
|
|
37
29
|
export type UpdateBookingTaxSettings = (db: PostgresJsDatabase, settings: BookingTaxSettings) => BookingTaxSettings | null | undefined | Promise<BookingTaxSettings | null | undefined>;
|
|
@@ -57,12 +49,6 @@ export declare function resolveBookingSellTaxRate(db: PostgresJsDatabase, args:
|
|
|
57
49
|
productId?: string | null;
|
|
58
50
|
facts?: Partial<ProductTaxFacts>;
|
|
59
51
|
}, options?: ResolveBookingSellTaxRateOptions): Promise<ResolvedBookingSellTaxRate | null>;
|
|
60
|
-
/**
|
|
61
|
-
* Resolve just the operator invoicing mode, defaulting to `direct`
|
|
62
|
-
* when no settings row exists. Shared by the proforma-conversion
|
|
63
|
-
* subscriber so it never converts unless the operator opted in.
|
|
64
|
-
*/
|
|
65
|
-
export declare function resolveInvoicingModeOrDefault(db: PostgresJsDatabase, options?: ResolveBookingSellTaxRateOptions): Promise<InvoicingMode>;
|
|
66
52
|
export declare function computeBookingItemTaxLine(taxRate: ResolvedBookingSellTaxRate | null, amountCents: number, currency: string, sortOrder?: number): {
|
|
67
53
|
code: string;
|
|
68
54
|
name: string;
|
|
@@ -75,7 +61,16 @@ export declare function computeBookingItemTaxLine(taxRate: ResolvedBookingSellTa
|
|
|
75
61
|
} | null;
|
|
76
62
|
export declare function loadProductTaxFacts(db: PostgresJsDatabase, productId: string): Promise<ProductTaxFacts>;
|
|
77
63
|
export declare function matchesTaxPolicyCondition(condition: TaxPolicyCondition | null | undefined, facts: ProductTaxFacts): boolean;
|
|
78
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Booking tax **settings** routes: `GET`/`PATCH /tax-settings`.
|
|
66
|
+
*
|
|
67
|
+
* Mounted on the finance admin surface (`/v1/admin/finance/tax-settings`)
|
|
68
|
+
* so it lands alongside the other finance-owned settings (tax regimes,
|
|
69
|
+
* tax-policy-rules, invoice-fx) rather than under `/v1/admin/bookings`,
|
|
70
|
+
* where the bookings package's `GET /{id}` route would otherwise capture
|
|
71
|
+
* `/tax-settings` under the managed runtime's prefix-first-match dispatch.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createBookingTaxSettingsRoutes(options?: BookingTaxRouteOptions): OpenAPIHono<{
|
|
79
74
|
Variables: {
|
|
80
75
|
db: PostgresJsDatabase;
|
|
81
76
|
};
|
|
@@ -88,7 +83,6 @@ export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions)
|
|
|
88
83
|
taxPriceMode: "inclusive" | "exclusive";
|
|
89
84
|
taxPolicyProfileId: string | null;
|
|
90
85
|
invoicingMode: "direct" | "proforma-first";
|
|
91
|
-
fxReferenceSource: "ecb" | "bnr";
|
|
92
86
|
};
|
|
93
87
|
};
|
|
94
88
|
outputFormat: "json";
|
|
@@ -103,7 +97,6 @@ export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions)
|
|
|
103
97
|
taxPriceMode?: "inclusive" | "exclusive" | undefined;
|
|
104
98
|
taxPolicyProfileId?: string | null | undefined;
|
|
105
99
|
invoicingMode?: "direct" | "proforma-first" | undefined;
|
|
106
|
-
fxReferenceSource?: "ecb" | "bnr" | undefined;
|
|
107
100
|
};
|
|
108
101
|
};
|
|
109
102
|
output: {};
|
|
@@ -115,7 +108,6 @@ export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions)
|
|
|
115
108
|
taxPriceMode?: "inclusive" | "exclusive" | undefined;
|
|
116
109
|
taxPolicyProfileId?: string | null | undefined;
|
|
117
110
|
invoicingMode?: "direct" | "proforma-first" | undefined;
|
|
118
|
-
fxReferenceSource?: "ecb" | "bnr" | undefined;
|
|
119
111
|
};
|
|
120
112
|
};
|
|
121
113
|
output: {
|
|
@@ -123,14 +115,25 @@ export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions)
|
|
|
123
115
|
taxPriceMode: "inclusive" | "exclusive";
|
|
124
116
|
taxPolicyProfileId: string | null;
|
|
125
117
|
invoicingMode: "direct" | "proforma-first";
|
|
126
|
-
fxReferenceSource: "ecb" | "bnr";
|
|
127
118
|
};
|
|
128
119
|
};
|
|
129
120
|
outputFormat: "json";
|
|
130
121
|
status: 200;
|
|
131
122
|
};
|
|
132
123
|
};
|
|
133
|
-
}
|
|
124
|
+
}, "/">;
|
|
125
|
+
/**
|
|
126
|
+
* Booking tax **preview** route: `POST /tax-preview`.
|
|
127
|
+
*
|
|
128
|
+
* Stays on the bookings admin surface (`/v1/admin/bookings/tax-preview`);
|
|
129
|
+
* `POST` does not collide with bookings' `GET /{id}`, and
|
|
130
|
+
* `@voyant-travel/bookings-react` consumes it there.
|
|
131
|
+
*/
|
|
132
|
+
export declare function createBookingTaxPreviewRoutes(options?: BookingTaxRouteOptions): OpenAPIHono<{
|
|
133
|
+
Variables: {
|
|
134
|
+
db: PostgresJsDatabase;
|
|
135
|
+
};
|
|
136
|
+
}, {
|
|
134
137
|
"/tax-preview": {
|
|
135
138
|
$post: {
|
|
136
139
|
input: {
|
|
@@ -159,6 +162,11 @@ export declare function createBookingTaxRoutes(options?: BookingTaxRouteOptions)
|
|
|
159
162
|
};
|
|
160
163
|
};
|
|
161
164
|
}, "/">;
|
|
162
|
-
|
|
163
|
-
export declare function
|
|
164
|
-
|
|
165
|
+
/** Mount the tax-settings routes under the finance admin surface. */
|
|
166
|
+
export declare function mountBookingTaxSettingsRoutes(hono: Hono, options?: BookingTaxRouteOptions): void;
|
|
167
|
+
/** Mount the tax-preview route under the bookings admin surface. */
|
|
168
|
+
export declare function mountBookingTaxPreviewRoutes(hono: Hono, options?: BookingTaxRouteOptions): void;
|
|
169
|
+
export declare function createBookingTaxSettingsApiExtension(options?: BookingTaxRouteOptions): ApiExtension;
|
|
170
|
+
export declare function createBookingTaxPreviewApiExtension(options?: BookingTaxRouteOptions): ApiExtension;
|
|
171
|
+
export declare const createBookingTaxSettingsVoyantRuntime: import("@voyant-travel/core/project").VoyantGraphRuntimeFactory<ApiExtension>;
|
|
172
|
+
export declare const createBookingTaxPreviewVoyantRuntime: import("@voyant-travel/core/project").VoyantGraphRuntimeFactory<ApiExtension>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking-tax.d.ts","sourceRoot":"","sources":["../src/booking-tax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAK,M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AG,aAAa,CAUjG;AAED,eAAO,MAAM,6BAA6B,gFAIxC,CAAA"}
|
package/dist/booking-tax.js
CHANGED
|
@@ -15,14 +15,12 @@ const bookingTaxSettingsPatchSchema = z.object({
|
|
|
15
15
|
taxPriceMode: z.enum(["inclusive", "exclusive"]).optional(),
|
|
16
16
|
taxPolicyProfileId: z.string().min(1).nullable().optional(),
|
|
17
17
|
invoicingMode: z.enum(["direct", "proforma-first"]).optional(),
|
|
18
|
-
fxReferenceSource: z.enum(["ecb", "bnr"]).optional(),
|
|
19
18
|
});
|
|
20
19
|
const bookingTaxSettingsResponseSchema = z.object({
|
|
21
20
|
data: z.object({
|
|
22
21
|
taxPriceMode: z.enum(["inclusive", "exclusive"]),
|
|
23
22
|
taxPolicyProfileId: z.string().nullable(),
|
|
24
23
|
invoicingMode: z.enum(["direct", "proforma-first"]),
|
|
25
|
-
fxReferenceSource: z.enum(["ecb", "bnr"]),
|
|
26
24
|
}),
|
|
27
25
|
});
|
|
28
26
|
const bookingTaxPreviewResponseSchema = z.object({
|
|
@@ -117,19 +115,9 @@ async function resolveBookingTaxSettingsOrDefault(db, options = {}) {
|
|
|
117
115
|
return {
|
|
118
116
|
taxPriceMode: settings?.taxPriceMode === "exclusive" ? "exclusive" : "inclusive",
|
|
119
117
|
taxPolicyProfileId: settings?.taxPolicyProfileId ?? null,
|
|
120
|
-
invoicingMode: settings?.invoicingMode === "
|
|
121
|
-
fxReferenceSource: settings?.fxReferenceSource === "bnr" ? "bnr" : "ecb",
|
|
118
|
+
invoicingMode: settings?.invoicingMode === "direct" ? "direct" : "proforma-first",
|
|
122
119
|
};
|
|
123
120
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Resolve just the operator invoicing mode, defaulting to `direct`
|
|
126
|
-
* when no settings row exists. Shared by the proforma-conversion
|
|
127
|
-
* subscriber so it never converts unless the operator opted in.
|
|
128
|
-
*/
|
|
129
|
-
export async function resolveInvoicingModeOrDefault(db, options = {}) {
|
|
130
|
-
const settings = await resolveBookingTaxSettingsOrDefault(db, options);
|
|
131
|
-
return settings.invoicingMode;
|
|
132
|
-
}
|
|
133
121
|
export function computeBookingItemTaxLine(taxRate, amountCents, currency, sortOrder = 0) {
|
|
134
122
|
if (!taxRate || taxRate.rate <= 0 || amountCents <= 0)
|
|
135
123
|
return null;
|
|
@@ -269,7 +257,16 @@ async function resolveProductTaxClassRate(db, productId, priceMode) {
|
|
|
269
257
|
const resolved = await loadResolvedTaxRegime(db, klass.defaultRegimeId, klass.code);
|
|
270
258
|
return resolved ? { ...resolved, priceMode } : null;
|
|
271
259
|
}
|
|
272
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Booking tax **settings** routes: `GET`/`PATCH /tax-settings`.
|
|
262
|
+
*
|
|
263
|
+
* Mounted on the finance admin surface (`/v1/admin/finance/tax-settings`)
|
|
264
|
+
* so it lands alongside the other finance-owned settings (tax regimes,
|
|
265
|
+
* tax-policy-rules, invoice-fx) rather than under `/v1/admin/bookings`,
|
|
266
|
+
* where the bookings package's `GET /{id}` route would otherwise capture
|
|
267
|
+
* `/tax-settings` under the managed runtime's prefix-first-match dispatch.
|
|
268
|
+
*/
|
|
269
|
+
export function createBookingTaxSettingsRoutes(options = {}) {
|
|
273
270
|
const routes = new OpenAPIHono({ defaultHook: openApiValidationHook })
|
|
274
271
|
.openapi(getBookingTaxSettingsRoute, async (c) => {
|
|
275
272
|
return c.json({
|
|
@@ -291,13 +288,22 @@ export function createBookingTaxRoutes(options = {}) {
|
|
|
291
288
|
? current.taxPolicyProfileId
|
|
292
289
|
: patch.taxPolicyProfileId,
|
|
293
290
|
invoicingMode: patch.invoicingMode ?? current.invoicingMode,
|
|
294
|
-
fxReferenceSource: patch.fxReferenceSource ?? current.fxReferenceSource,
|
|
295
291
|
});
|
|
296
292
|
return c.json({
|
|
297
293
|
data: await resolveBookingTaxSettingsOrDefault(c.get("db"), { settings: next }),
|
|
298
294
|
}, 200);
|
|
299
|
-
})
|
|
300
|
-
|
|
295
|
+
});
|
|
296
|
+
return stampOpenApiRegistryApiId(routes, "@voyant-travel/finance#booking-tax-settings-extension.api");
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Booking tax **preview** route: `POST /tax-preview`.
|
|
300
|
+
*
|
|
301
|
+
* Stays on the bookings admin surface (`/v1/admin/bookings/tax-preview`);
|
|
302
|
+
* `POST` does not collide with bookings' `GET /{id}`, and
|
|
303
|
+
* `@voyant-travel/bookings-react` consumes it there.
|
|
304
|
+
*/
|
|
305
|
+
export function createBookingTaxPreviewRoutes(options = {}) {
|
|
306
|
+
const routes = new OpenAPIHono({ defaultHook: openApiValidationHook }).openapi(previewBookingTaxRoute, async (c) => {
|
|
301
307
|
const body = c.req.valid("json");
|
|
302
308
|
const taxRate = await resolveBookingSellTaxRate(c.get("db"), { productId: body.productId }, options);
|
|
303
309
|
const taxLine = computeBookingItemTaxLine(taxRate, body.subtotalCents, body.currency);
|
|
@@ -332,21 +338,39 @@ export function createBookingTaxRoutes(options = {}) {
|
|
|
332
338
|
},
|
|
333
339
|
}, 200);
|
|
334
340
|
});
|
|
335
|
-
return stampOpenApiRegistryApiId(routes, "@voyant-travel/finance#booking-tax-extension.api");
|
|
341
|
+
return stampOpenApiRegistryApiId(routes, "@voyant-travel/finance#booking-tax-preview-extension.api");
|
|
342
|
+
}
|
|
343
|
+
/** Mount the tax-settings routes under the finance admin surface. */
|
|
344
|
+
export function mountBookingTaxSettingsRoutes(hono, options = {}) {
|
|
345
|
+
hono.route("/v1/admin/finance", createBookingTaxSettingsRoutes(options));
|
|
336
346
|
}
|
|
337
|
-
|
|
338
|
-
|
|
347
|
+
/** Mount the tax-preview route under the bookings admin surface. */
|
|
348
|
+
export function mountBookingTaxPreviewRoutes(hono, options = {}) {
|
|
349
|
+
hono.route("/v1/admin/bookings", createBookingTaxPreviewRoutes(options));
|
|
339
350
|
}
|
|
340
|
-
export function
|
|
351
|
+
export function createBookingTaxSettingsApiExtension(options = {}) {
|
|
341
352
|
const extension = {
|
|
342
|
-
name: "booking-tax",
|
|
353
|
+
name: "booking-tax-settings",
|
|
354
|
+
module: "finance",
|
|
355
|
+
};
|
|
356
|
+
return {
|
|
357
|
+
extension,
|
|
358
|
+
adminRoutes: createBookingTaxSettingsRoutes(options),
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
export function createBookingTaxPreviewApiExtension(options = {}) {
|
|
362
|
+
const extension = {
|
|
363
|
+
name: "booking-tax-preview",
|
|
343
364
|
module: "bookings",
|
|
344
365
|
};
|
|
345
366
|
return {
|
|
346
367
|
extension,
|
|
347
|
-
adminRoutes:
|
|
368
|
+
adminRoutes: createBookingTaxPreviewRoutes(options),
|
|
348
369
|
};
|
|
349
370
|
}
|
|
350
|
-
export const
|
|
351
|
-
return
|
|
371
|
+
export const createBookingTaxSettingsVoyantRuntime = defineGraphRuntimeFactory(async ({ getPort }) => {
|
|
372
|
+
return createBookingTaxSettingsApiExtension(createFinanceBookingTaxRuntime(await getPort(financeOperatorSettingsRuntimePort)));
|
|
373
|
+
});
|
|
374
|
+
export const createBookingTaxPreviewVoyantRuntime = defineGraphRuntimeFactory(async ({ getPort }) => {
|
|
375
|
+
return createBookingTaxPreviewApiExtension(createFinanceBookingTaxRuntime(await getPort(financeOperatorSettingsRuntimePort)));
|
|
352
376
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-payment.d.ts","sourceRoot":"","sources":["../src/card-payment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,iFAAiF;AACjF,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,kBAAkB,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,kBAAkB,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,oBAAoB,KACvB,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAA"}
|