@voyant-travel/finance 0.119.5
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/LICENSE +201 -0
- package/README.md +192 -0
- package/dist/action-ledger-drift.d.ts +29 -0
- package/dist/action-ledger-drift.d.ts.map +1 -0
- package/dist/action-ledger-drift.js +166 -0
- package/dist/booking-tax.d.ts +124 -0
- package/dist/booking-tax.d.ts.map +1 -0
- package/dist/booking-tax.js +264 -0
- package/dist/checkout-routes.d.ts +1154 -0
- package/dist/checkout-routes.d.ts.map +1 -0
- package/dist/checkout-routes.js +116 -0
- package/dist/checkout-service-plan.d.ts +137 -0
- package/dist/checkout-service-plan.d.ts.map +1 -0
- package/dist/checkout-service-plan.js +119 -0
- package/dist/checkout-service.d.ts +9 -0
- package/dist/checkout-service.d.ts.map +1 -0
- package/dist/checkout-service.js +324 -0
- package/dist/checkout-validation.d.ts +1682 -0
- package/dist/checkout-validation.d.ts.map +1 -0
- package/dist/checkout-validation.js +228 -0
- package/dist/document-download.d.ts +3 -0
- package/dist/document-download.d.ts.map +1 -0
- package/dist/document-download.js +1 -0
- package/dist/fx-money.d.ts +17 -0
- package/dist/fx-money.d.ts.map +1 -0
- package/dist/fx-money.js +194 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/invoice-fx.d.ts +134 -0
- package/dist/invoice-fx.d.ts.map +1 -0
- package/dist/invoice-fx.js +240 -0
- package/dist/invoice-number-errors.d.ts +2 -0
- package/dist/invoice-number-errors.d.ts.map +1 -0
- package/dist/invoice-number-errors.js +58 -0
- package/dist/markets-ref.d.ts +149 -0
- package/dist/markets-ref.d.ts.map +1 -0
- package/dist/markets-ref.js +17 -0
- package/dist/payment-link.d.ts +23 -0
- package/dist/payment-link.d.ts.map +1 -0
- package/dist/payment-link.js +30 -0
- package/dist/payment-policy.d.ts +113 -0
- package/dist/payment-policy.d.ts.map +1 -0
- package/dist/payment-policy.js +193 -0
- package/dist/route-runtime.d.ts +22 -0
- package/dist/route-runtime.d.ts.map +1 -0
- package/dist/route-runtime.js +18 -0
- package/dist/routes-action-ledger.d.ts +181 -0
- package/dist/routes-action-ledger.d.ts.map +1 -0
- package/dist/routes-action-ledger.js +142 -0
- package/dist/routes-booking-billing.d.ts +852 -0
- package/dist/routes-booking-billing.d.ts.map +1 -0
- package/dist/routes-booking-billing.js +223 -0
- package/dist/routes-booking-create.d.ts +3 -0
- package/dist/routes-booking-create.d.ts.map +1 -0
- package/dist/routes-booking-create.js +194 -0
- package/dist/routes-booking-reads.d.ts +46 -0
- package/dist/routes-booking-reads.d.ts.map +1 -0
- package/dist/routes-booking-reads.js +20 -0
- package/dist/routes-documents.d.ts +195 -0
- package/dist/routes-documents.d.ts.map +1 -0
- package/dist/routes-documents.js +93 -0
- package/dist/routes-invoice-core.d.ts +794 -0
- package/dist/routes-invoice-core.d.ts.map +1 -0
- package/dist/routes-invoice-core.js +238 -0
- package/dist/routes-invoice-documents.d.ts +401 -0
- package/dist/routes-invoice-documents.d.ts.map +1 -0
- package/dist/routes-invoice-documents.js +91 -0
- package/dist/routes-invoice-issue.d.ts +384 -0
- package/dist/routes-invoice-issue.d.ts.map +1 -0
- package/dist/routes-invoice-issue.js +208 -0
- package/dist/routes-payment-processing.d.ts +1193 -0
- package/dist/routes-payment-processing.d.ts.map +1 -0
- package/dist/routes-payment-processing.js +238 -0
- package/dist/routes-payments.d.ts +309 -0
- package/dist/routes-payments.d.ts.map +1 -0
- package/dist/routes-payments.js +94 -0
- package/dist/routes-public.d.ts +1948 -0
- package/dist/routes-public.d.ts.map +1 -0
- package/dist/routes-public.js +275 -0
- package/dist/routes-reference-data.d.ts +977 -0
- package/dist/routes-reference-data.d.ts.map +1 -0
- package/dist/routes-reference-data.js +191 -0
- package/dist/routes-reports.d.ts +344 -0
- package/dist/routes-reports.d.ts.map +1 -0
- package/dist/routes-reports.js +93 -0
- package/dist/routes-runtime.d.ts +71 -0
- package/dist/routes-runtime.d.ts.map +1 -0
- package/dist/routes-runtime.js +59 -0
- package/dist/routes-settlement.d.ts +67 -0
- package/dist/routes-settlement.d.ts.map +1 -0
- package/dist/routes-settlement.js +23 -0
- package/dist/routes-shared.d.ts +35 -0
- package/dist/routes-shared.d.ts.map +1 -0
- package/dist/routes-shared.js +10 -0
- package/dist/routes-supplier-invoices.d.ts +778 -0
- package/dist/routes-supplier-invoices.d.ts.map +1 -0
- package/dist/routes-supplier-invoices.js +159 -0
- package/dist/routes-vouchers.d.ts +228 -0
- package/dist/routes-vouchers.d.ts.map +1 -0
- package/dist/routes-vouchers.js +54 -0
- package/dist/routes.d.ts +5577 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +44 -0
- package/dist/schema/booking-billing.d.ts +1006 -0
- package/dist/schema/booking-billing.d.ts.map +1 -0
- package/dist/schema/booking-billing.js +106 -0
- package/dist/schema/enums.d.ts +48 -0
- package/dist/schema/enums.d.ts.map +1 -0
- package/dist/schema/enums.js +237 -0
- package/dist/schema/invoice-documents.d.ts +1245 -0
- package/dist/schema/invoice-documents.d.ts.map +1 -0
- package/dist/schema/invoice-documents.js +140 -0
- package/dist/schema/payment-instruments.d.ts +418 -0
- package/dist/schema/payment-instruments.d.ts.map +1 -0
- package/dist/schema/payment-instruments.js +45 -0
- package/dist/schema/payment-processing.d.ts +563 -0
- package/dist/schema/payment-processing.d.ts.map +1 -0
- package/dist/schema/payment-processing.js +65 -0
- package/dist/schema/payment-sessions.d.ts +728 -0
- package/dist/schema/payment-sessions.d.ts.map +1 -0
- package/dist/schema/payment-sessions.js +79 -0
- package/dist/schema/receivables.d.ts +1474 -0
- package/dist/schema/receivables.d.ts.map +1 -0
- package/dist/schema/receivables.js +179 -0
- package/dist/schema/relations.d.ts +82 -0
- package/dist/schema/relations.d.ts.map +1 -0
- package/dist/schema/relations.js +144 -0
- package/dist/schema/supplier-invoices.d.ts +1619 -0
- package/dist/schema/supplier-invoices.d.ts.map +1 -0
- package/dist/schema/supplier-invoices.js +228 -0
- package/dist/schema/tax.d.ts +712 -0
- package/dist/schema/tax.d.ts.map +1 -0
- package/dist/schema/tax.js +98 -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 +12 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +11 -0
- package/dist/service-accountant-shares.d.ts +106 -0
- package/dist/service-accountant-shares.d.ts.map +1 -0
- package/dist/service-accountant-shares.js +331 -0
- package/dist/service-action-ledger-accounting.d.ts +104 -0
- package/dist/service-action-ledger-accounting.d.ts.map +1 -0
- package/dist/service-action-ledger-accounting.js +386 -0
- package/dist/service-action-ledger-booking-payments.d.ts +48 -0
- package/dist/service-action-ledger-booking-payments.d.ts.map +1 -0
- package/dist/service-action-ledger-booking-payments.js +178 -0
- package/dist/service-action-ledger-bookings.d.ts +44 -0
- package/dist/service-action-ledger-bookings.d.ts.map +1 -0
- package/dist/service-action-ledger-bookings.js +81 -0
- package/dist/service-action-ledger-payment-authorizations.d.ts +48 -0
- package/dist/service-action-ledger-payment-authorizations.d.ts.map +1 -0
- package/dist/service-action-ledger-payment-authorizations.js +209 -0
- package/dist/service-action-ledger-payment-sessions.d.ts +83 -0
- package/dist/service-action-ledger-payment-sessions.d.ts.map +1 -0
- package/dist/service-action-ledger-payment-sessions.js +294 -0
- package/dist/service-action-ledger-supplier-invoices.d.ts +27 -0
- package/dist/service-action-ledger-supplier-invoices.d.ts.map +1 -0
- package/dist/service-action-ledger-supplier-invoices.js +111 -0
- package/dist/service-action-ledger-supplier-payments.d.ts +21 -0
- package/dist/service-action-ledger-supplier-payments.d.ts.map +1 -0
- package/dist/service-action-ledger-supplier-payments.js +97 -0
- package/dist/service-action-ledger.d.ts +7 -0
- package/dist/service-action-ledger.d.ts.map +1 -0
- package/dist/service-action-ledger.js +6 -0
- package/dist/service-aggregates.d.ts +96 -0
- package/dist/service-aggregates.d.ts.map +1 -0
- package/dist/service-aggregates.js +294 -0
- package/dist/service-booking-billing.d.ts +2322 -0
- package/dist/service-booking-billing.d.ts.map +1 -0
- package/dist/service-booking-billing.js +8 -0
- package/dist/service-booking-create.d.ts +410 -0
- package/dist/service-booking-create.d.ts.map +1 -0
- package/dist/service-booking-create.js +1256 -0
- package/dist/service-booking-guarantees.d.ts +725 -0
- package/dist/service-booking-guarantees.d.ts.map +1 -0
- package/dist/service-booking-guarantees.js +153 -0
- package/dist/service-booking-item-billing.d.ts +1062 -0
- package/dist/service-booking-item-billing.d.ts.map +1 -0
- package/dist/service-booking-item-billing.js +77 -0
- package/dist/service-booking-payment-schedules.d.ts +557 -0
- package/dist/service-booking-payment-schedules.d.ts.map +1 -0
- package/dist/service-booking-payment-schedules.js +372 -0
- package/dist/service-bookings-dual-create.d.ts +308 -0
- package/dist/service-bookings-dual-create.d.ts.map +1 -0
- package/dist/service-bookings-dual-create.js +131 -0
- package/dist/service-boundary-sql.d.ts +6 -0
- package/dist/service-boundary-sql.d.ts.map +1 -0
- package/dist/service-boundary-sql.js +15 -0
- package/dist/service-cost-categories.d.ts +26 -0
- package/dist/service-cost-categories.d.ts.map +1 -0
- package/dist/service-cost-categories.js +76 -0
- package/dist/service-documents.d.ts +80 -0
- package/dist/service-documents.d.ts.map +1 -0
- package/dist/service-documents.js +228 -0
- package/dist/service-invoice-artifacts.d.ts +246 -0
- package/dist/service-invoice-artifacts.d.ts.map +1 -0
- package/dist/service-invoice-artifacts.js +277 -0
- package/dist/service-invoice-core.d.ts +405 -0
- package/dist/service-invoice-core.d.ts.map +1 -0
- package/dist/service-invoice-core.js +290 -0
- package/dist/service-invoice-credit-notes.d.ts +973 -0
- package/dist/service-invoice-credit-notes.d.ts.map +1 -0
- package/dist/service-invoice-credit-notes.js +142 -0
- package/dist/service-invoice-from-booking.d.ts +41 -0
- package/dist/service-invoice-from-booking.d.ts.map +1 -0
- package/dist/service-invoice-from-booking.js +267 -0
- package/dist/service-invoice-line-items.d.ts +432 -0
- package/dist/service-invoice-line-items.d.ts.map +1 -0
- package/dist/service-invoice-line-items.js +102 -0
- package/dist/service-invoice-numbering.d.ts +227 -0
- package/dist/service-invoice-numbering.d.ts.map +1 -0
- package/dist/service-invoice-numbering.js +260 -0
- package/dist/service-invoice-payments.d.ts +673 -0
- package/dist/service-invoice-payments.d.ts.map +1 -0
- package/dist/service-invoice-payments.js +398 -0
- package/dist/service-invoices.d.ts +2501 -0
- package/dist/service-invoices.d.ts.map +1 -0
- package/dist/service-invoices.js +12 -0
- package/dist/service-issue.d.ts +207 -0
- package/dist/service-issue.d.ts.map +1 -0
- package/dist/service-issue.js +431 -0
- package/dist/service-payment-authorizations.d.ts +164 -0
- package/dist/service-payment-authorizations.d.ts.map +1 -0
- package/dist/service-payment-authorizations.js +227 -0
- package/dist/service-payment-instruments.d.ts +116 -0
- package/dist/service-payment-instruments.d.ts.map +1 -0
- package/dist/service-payment-instruments.js +99 -0
- package/dist/service-payment-processing.d.ts +676 -0
- package/dist/service-payment-processing.d.ts.map +1 -0
- package/dist/service-payment-processing.js +10 -0
- package/dist/service-payment-session-completion.d.ts +48 -0
- package/dist/service-payment-session-completion.d.ts.map +1 -0
- package/dist/service-payment-session-completion.js +238 -0
- package/dist/service-payment-sessions.d.ts +361 -0
- package/dist/service-payment-sessions.d.ts.map +1 -0
- package/dist/service-payment-sessions.js +280 -0
- package/dist/service-profitability.d.ts +114 -0
- package/dist/service-profitability.d.ts.map +1 -0
- package/dist/service-profitability.js +794 -0
- package/dist/service-public.d.ts +553 -0
- package/dist/service-public.d.ts.map +1 -0
- package/dist/service-public.js +583 -0
- package/dist/service-reference-data.d.ts +272 -0
- package/dist/service-reference-data.d.ts.map +1 -0
- package/dist/service-reference-data.js +280 -0
- package/dist/service-rendition-wait.d.ts +38 -0
- package/dist/service-rendition-wait.d.ts.map +1 -0
- package/dist/service-rendition-wait.js +67 -0
- package/dist/service-reports.d.ts +37 -0
- package/dist/service-reports.d.ts.map +1 -0
- package/dist/service-reports.js +62 -0
- package/dist/service-settlement.d.ts +46 -0
- package/dist/service-settlement.d.ts.map +1 -0
- package/dist/service-settlement.js +185 -0
- package/dist/service-shared.d.ts +541 -0
- package/dist/service-shared.d.ts.map +1 -0
- package/dist/service-shared.js +764 -0
- package/dist/service-supplier-invoices.d.ts +871 -0
- package/dist/service-supplier-invoices.d.ts.map +1 -0
- package/dist/service-supplier-invoices.js +744 -0
- package/dist/service-supplier-payments.d.ts +69 -0
- package/dist/service-supplier-payments.d.ts.map +1 -0
- package/dist/service-supplier-payments.js +136 -0
- package/dist/service-vouchers-migration.d.ts +44 -0
- package/dist/service-vouchers-migration.d.ts.map +1 -0
- package/dist/service-vouchers-migration.js +148 -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 +6490 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +29 -0
- package/dist/validation-billing.d.ts +2 -0
- package/dist/validation-billing.d.ts.map +1 -0
- package/dist/validation-billing.js +1 -0
- package/dist/validation-payments.d.ts +2 -0
- package/dist/validation-payments.d.ts.map +1 -0
- package/dist/validation-payments.js +1 -0
- package/dist/validation-public.d.ts +2 -0
- package/dist/validation-public.d.ts.map +1 -0
- package/dist/validation-public.js +1 -0
- package/dist/validation-shared.d.ts +2 -0
- package/dist/validation-shared.d.ts.map +1 -0
- package/dist/validation-shared.js +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 +2 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +1 -0
- package/package.json +121 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { type ActionLedgerEntry } from "@voyant-travel/action-ledger";
|
|
2
|
+
import { type ActionLedgerTargetTimelinePage } from "@voyant-travel/action-ledger/timeline";
|
|
3
|
+
import type { z } from "zod";
|
|
4
|
+
import type { Env } from "./routes-shared.js";
|
|
5
|
+
export type FinanceActionLedgerListResponse = ActionLedgerTargetTimelinePage;
|
|
6
|
+
declare function buildFinanceActionLedgerPage({ entries, limit, }: {
|
|
7
|
+
entries: ActionLedgerEntry[];
|
|
8
|
+
limit: number;
|
|
9
|
+
}): ActionLedgerTargetTimelinePage;
|
|
10
|
+
declare function getPaymentSessionLedgerTarget(session: {
|
|
11
|
+
id: string;
|
|
12
|
+
bookingId: string | null;
|
|
13
|
+
invoiceId: string | null;
|
|
14
|
+
orderId: string | null;
|
|
15
|
+
targetType: string;
|
|
16
|
+
targetId: string | null;
|
|
17
|
+
}): {
|
|
18
|
+
type: string;
|
|
19
|
+
id: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const financeActionLedgerRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
22
|
+
"/invoices/:id/action-ledger": {
|
|
23
|
+
$get: {
|
|
24
|
+
input: {
|
|
25
|
+
param: {
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
output: {
|
|
30
|
+
error: string;
|
|
31
|
+
};
|
|
32
|
+
outputFormat: "json";
|
|
33
|
+
status: 404;
|
|
34
|
+
} | {
|
|
35
|
+
input: {
|
|
36
|
+
param: {
|
|
37
|
+
id: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
output: {
|
|
41
|
+
data: {
|
|
42
|
+
id: string;
|
|
43
|
+
idempotencyKey: string | null;
|
|
44
|
+
status: "failed" | "cancelled" | "expired" | "approved" | "requested" | "awaiting_approval" | "denied" | "succeeded" | "reversed" | "compensated" | "superseded";
|
|
45
|
+
targetType: string;
|
|
46
|
+
targetId: string;
|
|
47
|
+
sessionId: string | null;
|
|
48
|
+
organizationId: string | null;
|
|
49
|
+
principalSubtype: string | null;
|
|
50
|
+
callerType: string | null;
|
|
51
|
+
apiTokenId: string | null;
|
|
52
|
+
workflowRunId: string | null;
|
|
53
|
+
workflowStepId: string | null;
|
|
54
|
+
actionName: string;
|
|
55
|
+
actionVersion: string;
|
|
56
|
+
actionKind: "execute" | "reverse" | "delete" | "read" | "create" | "update" | "approve" | "reject" | "compensate" | "duplicate";
|
|
57
|
+
evaluatedRisk: "low" | "medium" | "high" | "critical";
|
|
58
|
+
actorType: string | null;
|
|
59
|
+
principalType: "agent" | "api_key" | "workflow" | "user" | "system";
|
|
60
|
+
principalId: string;
|
|
61
|
+
internalRequest: boolean;
|
|
62
|
+
delegatedByPrincipalType: "agent" | "api_key" | "workflow" | "user" | "system" | null;
|
|
63
|
+
delegatedByPrincipalId: string | null;
|
|
64
|
+
delegationId: string | null;
|
|
65
|
+
routeOrToolName: string | null;
|
|
66
|
+
correlationId: string | null;
|
|
67
|
+
causationActionId: string | null;
|
|
68
|
+
idempotencyScope: string | null;
|
|
69
|
+
idempotencyFingerprint: string | null;
|
|
70
|
+
capabilityId: string | null;
|
|
71
|
+
capabilityVersion: string | null;
|
|
72
|
+
authorizationSource: string | null;
|
|
73
|
+
approvalId: string | null;
|
|
74
|
+
amendsActionId: string | null;
|
|
75
|
+
occurredAt: string;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
mutationSummary: string | null;
|
|
78
|
+
}[];
|
|
79
|
+
pageInfo: {
|
|
80
|
+
nextCursor: {
|
|
81
|
+
occurredAt: string;
|
|
82
|
+
id: string;
|
|
83
|
+
} | null;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
outputFormat: "json";
|
|
87
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
} & {
|
|
91
|
+
"/payment-sessions/:id/action-ledger": {
|
|
92
|
+
$get: {
|
|
93
|
+
input: {
|
|
94
|
+
param: {
|
|
95
|
+
id: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
output: {
|
|
99
|
+
data: {
|
|
100
|
+
id: string;
|
|
101
|
+
idempotencyKey: string | null;
|
|
102
|
+
status: "failed" | "cancelled" | "expired" | "approved" | "requested" | "awaiting_approval" | "denied" | "succeeded" | "reversed" | "compensated" | "superseded";
|
|
103
|
+
targetType: string;
|
|
104
|
+
targetId: string;
|
|
105
|
+
sessionId: string | null;
|
|
106
|
+
organizationId: string | null;
|
|
107
|
+
principalSubtype: string | null;
|
|
108
|
+
callerType: string | null;
|
|
109
|
+
apiTokenId: string | null;
|
|
110
|
+
workflowRunId: string | null;
|
|
111
|
+
workflowStepId: string | null;
|
|
112
|
+
actionName: string;
|
|
113
|
+
actionVersion: string;
|
|
114
|
+
actionKind: "execute" | "reverse" | "delete" | "read" | "create" | "update" | "approve" | "reject" | "compensate" | "duplicate";
|
|
115
|
+
evaluatedRisk: "low" | "medium" | "high" | "critical";
|
|
116
|
+
actorType: string | null;
|
|
117
|
+
principalType: "agent" | "api_key" | "workflow" | "user" | "system";
|
|
118
|
+
principalId: string;
|
|
119
|
+
internalRequest: boolean;
|
|
120
|
+
delegatedByPrincipalType: "agent" | "api_key" | "workflow" | "user" | "system" | null;
|
|
121
|
+
delegatedByPrincipalId: string | null;
|
|
122
|
+
delegationId: string | null;
|
|
123
|
+
routeOrToolName: string | null;
|
|
124
|
+
correlationId: string | null;
|
|
125
|
+
causationActionId: string | null;
|
|
126
|
+
idempotencyScope: string | null;
|
|
127
|
+
idempotencyFingerprint: string | null;
|
|
128
|
+
capabilityId: string | null;
|
|
129
|
+
capabilityVersion: string | null;
|
|
130
|
+
authorizationSource: string | null;
|
|
131
|
+
approvalId: string | null;
|
|
132
|
+
amendsActionId: string | null;
|
|
133
|
+
occurredAt: string;
|
|
134
|
+
createdAt: string;
|
|
135
|
+
mutationSummary: string | null;
|
|
136
|
+
}[];
|
|
137
|
+
pageInfo: {
|
|
138
|
+
nextCursor: {
|
|
139
|
+
occurredAt: string;
|
|
140
|
+
id: string;
|
|
141
|
+
} | null;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
outputFormat: "json";
|
|
145
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
146
|
+
} | {
|
|
147
|
+
input: {
|
|
148
|
+
param: {
|
|
149
|
+
id: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
output: {
|
|
153
|
+
error: string;
|
|
154
|
+
};
|
|
155
|
+
outputFormat: "json";
|
|
156
|
+
status: 404;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
}, "/", "/payment-sessions/:id/action-ledger">;
|
|
160
|
+
export type FinanceActionLedgerRoutes = typeof financeActionLedgerRoutes;
|
|
161
|
+
export declare const __test__: {
|
|
162
|
+
buildFinanceActionLedgerPage: typeof buildFinanceActionLedgerPage;
|
|
163
|
+
financeActionLedgerQuerySchema: z.ZodPipe<z.ZodObject<{
|
|
164
|
+
cursorOccurredAt: z.ZodOptional<z.ZodString>;
|
|
165
|
+
cursorId: z.ZodOptional<z.ZodString>;
|
|
166
|
+
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
167
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
168
|
+
cursor: {
|
|
169
|
+
occurredAt: string;
|
|
170
|
+
id: string;
|
|
171
|
+
} | undefined;
|
|
172
|
+
limit?: number | undefined;
|
|
173
|
+
}, {
|
|
174
|
+
cursorOccurredAt?: string | undefined;
|
|
175
|
+
cursorId?: string | undefined;
|
|
176
|
+
limit?: number | undefined;
|
|
177
|
+
}>>;
|
|
178
|
+
getPaymentSessionLedgerTarget: typeof getPaymentSessionLedgerTarget;
|
|
179
|
+
};
|
|
180
|
+
export {};
|
|
181
|
+
//# sourceMappingURL=routes-action-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-action-ledger.d.ts","sourceRoot":"","sources":["../src/routes-action-ledger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,8BAA8B,CAAA;AAC1F,OAAO,EACL,KAAK,8BAA8B,EAGpC,MAAM,uCAAuC,CAAA;AAI9C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAA;AA+C7C,MAAM,MAAM,+BAA+B,GAAG,8BAA8B,CAAA;AAE5E,iBAAS,4BAA4B,CAAC,EACpC,OAAO,EACP,KAAK,GACN,EAAE;IACD,OAAO,EAAE,iBAAiB,EAAE,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;CACd,kCAEA;AAED,iBAAS,6BAA6B,CAAC,OAAO,EAAE;IAC9C,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;;;EAQA;AA+GD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAEuC,CAAA;AAE7E,MAAM,MAAM,yBAAyB,GAAG,OAAO,yBAAyB,CAAA;AAExE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;CAIpB,CAAA"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { actionLedgerService } from "@voyant-travel/action-ledger";
|
|
2
|
+
import { actionLedgerTargetTimelineQuerySchema, buildActionLedgerTargetTimelinePage, } from "@voyant-travel/action-ledger/timeline";
|
|
3
|
+
import { parseQuery } from "@voyant-travel/hono";
|
|
4
|
+
import { Hono } from "hono";
|
|
5
|
+
import { financeService } from "./service.js";
|
|
6
|
+
const FINANCE_INVOICE_LEDGER_ACTION_NAMES = [
|
|
7
|
+
"finance.invoice.issue_from_booking",
|
|
8
|
+
"finance.invoice.update",
|
|
9
|
+
"finance.invoice.delete",
|
|
10
|
+
"finance.invoice_line_item.create",
|
|
11
|
+
"finance.invoice_line_item.update",
|
|
12
|
+
"finance.invoice_line_item.delete",
|
|
13
|
+
"finance.credit_note.create",
|
|
14
|
+
"finance.credit_note.update",
|
|
15
|
+
"finance.credit_note_line_item.create",
|
|
16
|
+
"finance.payment.record",
|
|
17
|
+
"finance.payment_session.create",
|
|
18
|
+
"finance.payment_session.complete",
|
|
19
|
+
"finance.payment_session.update",
|
|
20
|
+
"finance.payment_session.requires_redirect",
|
|
21
|
+
"finance.payment_session.fail",
|
|
22
|
+
"finance.payment_session.cancel",
|
|
23
|
+
"finance.payment_session.expire",
|
|
24
|
+
"finance.payment_authorization.create",
|
|
25
|
+
"finance.payment_authorization.update",
|
|
26
|
+
"finance.payment_authorization.delete",
|
|
27
|
+
"finance.payment_capture.create",
|
|
28
|
+
"finance.payment_capture.update",
|
|
29
|
+
"finance.payment_capture.delete",
|
|
30
|
+
];
|
|
31
|
+
const FINANCE_PAYMENT_SESSION_LEDGER_ACTION_NAMES = [
|
|
32
|
+
"finance.payment_session.create",
|
|
33
|
+
"finance.payment_session.complete",
|
|
34
|
+
"finance.payment_session.update",
|
|
35
|
+
"finance.payment_session.requires_redirect",
|
|
36
|
+
"finance.payment_session.fail",
|
|
37
|
+
"finance.payment_session.cancel",
|
|
38
|
+
"finance.payment_session.expire",
|
|
39
|
+
];
|
|
40
|
+
const financeActionLedgerQuerySchema = actionLedgerTargetTimelineQuerySchema;
|
|
41
|
+
function buildFinanceActionLedgerPage({ entries, limit, }) {
|
|
42
|
+
return buildActionLedgerTargetTimelinePage({ entries, limit });
|
|
43
|
+
}
|
|
44
|
+
function getPaymentSessionLedgerTarget(session) {
|
|
45
|
+
if (session.bookingId)
|
|
46
|
+
return { type: "booking", id: session.bookingId };
|
|
47
|
+
if (session.invoiceId)
|
|
48
|
+
return { type: "invoice", id: session.invoiceId };
|
|
49
|
+
if (session.orderId)
|
|
50
|
+
return { type: "order", id: session.orderId };
|
|
51
|
+
if (session.targetId && session.targetType !== "other") {
|
|
52
|
+
return { type: session.targetType, id: session.targetId };
|
|
53
|
+
}
|
|
54
|
+
return { type: "payment_session", id: session.id };
|
|
55
|
+
}
|
|
56
|
+
function dedupeFinanceActionLedgerSources(sources) {
|
|
57
|
+
const sourcesByKey = new Map();
|
|
58
|
+
for (const source of sources) {
|
|
59
|
+
const key = `${source.targetType}:${source.targetId}:${source.actionNames.join(",")}`;
|
|
60
|
+
sourcesByKey.set(key, source);
|
|
61
|
+
}
|
|
62
|
+
return [...sourcesByKey.values()];
|
|
63
|
+
}
|
|
64
|
+
async function listFinanceActionLedgerPage(c, sources, query) {
|
|
65
|
+
const limit = query.limit ?? 50;
|
|
66
|
+
const queryLimit = limit + 1;
|
|
67
|
+
const sourceQueries = dedupeFinanceActionLedgerSources(sources).flatMap((source) => source.actionNames.map((actionName) => ({
|
|
68
|
+
targetType: source.targetType,
|
|
69
|
+
targetId: source.targetId,
|
|
70
|
+
actionName,
|
|
71
|
+
})));
|
|
72
|
+
const results = await Promise.all(sourceQueries.map((source) => actionLedgerService.listEntries(c.get("db"), {
|
|
73
|
+
...source,
|
|
74
|
+
cursor: query.cursor,
|
|
75
|
+
limit: queryLimit,
|
|
76
|
+
})));
|
|
77
|
+
const page = buildFinanceActionLedgerPage({
|
|
78
|
+
entries: results.flatMap((result) => result.entries),
|
|
79
|
+
limit,
|
|
80
|
+
});
|
|
81
|
+
const details = await Promise.all(page.data.map((entry) => actionLedgerService.getEntry(c.get("db"), entry.id)));
|
|
82
|
+
const summariesByActionId = new Map(details.flatMap((detail) => detail ? [[detail.entry.id, detail.mutationDetail?.summary ?? null]] : []));
|
|
83
|
+
return c.json(buildActionLedgerTargetTimelinePage({
|
|
84
|
+
entries: results.flatMap((result) => result.entries),
|
|
85
|
+
limit,
|
|
86
|
+
mutationSummariesByActionId: summariesByActionId,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
async function listInvoiceActionLedger(c) {
|
|
90
|
+
const invoiceId = c.req.param("id");
|
|
91
|
+
if (!invoiceId)
|
|
92
|
+
return c.json({ error: "Invoice not found" }, 404);
|
|
93
|
+
const invoice = await financeService.getInvoiceById(c.get("db"), invoiceId);
|
|
94
|
+
if (!invoice)
|
|
95
|
+
return c.json({ error: "Invoice not found" }, 404);
|
|
96
|
+
const query = parseQuery(c, financeActionLedgerQuerySchema);
|
|
97
|
+
const sources = [
|
|
98
|
+
{
|
|
99
|
+
targetType: "invoice",
|
|
100
|
+
targetId: invoice.id,
|
|
101
|
+
actionNames: FINANCE_INVOICE_LEDGER_ACTION_NAMES,
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
if (invoice.bookingId) {
|
|
105
|
+
sources.push({
|
|
106
|
+
targetType: "booking",
|
|
107
|
+
targetId: invoice.bookingId,
|
|
108
|
+
actionNames: FINANCE_INVOICE_LEDGER_ACTION_NAMES,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return listFinanceActionLedgerPage(c, sources, query);
|
|
112
|
+
}
|
|
113
|
+
async function listPaymentSessionActionLedger(c) {
|
|
114
|
+
const paymentSessionId = c.req.param("id");
|
|
115
|
+
if (!paymentSessionId)
|
|
116
|
+
return c.json({ error: "Payment session not found" }, 404);
|
|
117
|
+
const session = await financeService.getPaymentSessionById(c.get("db"), paymentSessionId);
|
|
118
|
+
if (!session)
|
|
119
|
+
return c.json({ error: "Payment session not found" }, 404);
|
|
120
|
+
const target = getPaymentSessionLedgerTarget(session);
|
|
121
|
+
const query = parseQuery(c, financeActionLedgerQuerySchema);
|
|
122
|
+
return listFinanceActionLedgerPage(c, [
|
|
123
|
+
{
|
|
124
|
+
targetType: target.type,
|
|
125
|
+
targetId: target.id,
|
|
126
|
+
actionNames: FINANCE_PAYMENT_SESSION_LEDGER_ACTION_NAMES,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
targetType: "payment_session",
|
|
130
|
+
targetId: session.id,
|
|
131
|
+
actionNames: FINANCE_PAYMENT_SESSION_LEDGER_ACTION_NAMES,
|
|
132
|
+
},
|
|
133
|
+
], query);
|
|
134
|
+
}
|
|
135
|
+
export const financeActionLedgerRoutes = new Hono()
|
|
136
|
+
.get("/invoices/:id/action-ledger", listInvoiceActionLedger)
|
|
137
|
+
.get("/payment-sessions/:id/action-ledger", listPaymentSessionActionLedger);
|
|
138
|
+
export const __test__ = {
|
|
139
|
+
buildFinanceActionLedgerPage,
|
|
140
|
+
financeActionLedgerQuerySchema,
|
|
141
|
+
getPaymentSessionLedgerTarget,
|
|
142
|
+
};
|