@voyantjs/finance 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/routes-documents.d.ts +3 -0
- package/dist/routes-documents.d.ts.map +1 -1
- package/dist/routes-documents.js +5 -2
- package/dist/routes-public.d.ts +49 -11
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +5 -1
- package/dist/routes-settlement.d.ts +3 -0
- package/dist/routes-settlement.d.ts.map +1 -1
- package/dist/routes-settlement.js +4 -0
- package/dist/service-documents.d.ts +14 -1
- package/dist/service-documents.d.ts.map +1 -1
- package/dist/service-documents.js +11 -2
- package/dist/service-public.d.ts +2 -1
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +61 -26
- package/dist/service-settlement.d.ts +10 -0
- package/dist/service-settlement.d.ts.map +1 -1
- package/dist/service-settlement.js +10 -0
- package/dist/validation-public.d.ts +48 -0
- package/dist/validation-public.d.ts.map +1 -1
- package/dist/validation-public.js +6 -0
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -25,12 +25,12 @@ export type { BookingGuarantee, BookingItemCommission, BookingItemTaxLine, Booki
|
|
|
25
25
|
export { bookingGuarantees, bookingItemCommissions, bookingItemTaxLines, bookingPaymentSchedules, creditNoteLineItems, creditNotes, financeNotes, invoiceExternalRefs, invoiceLineItems, invoiceNumberSeries, invoiceRenditions, invoices, invoiceTemplates, paymentAuthorizations, paymentCaptures, paymentInstruments, paymentSessions, payments, supplierPayments, taxRegimes, } from "./schema.js";
|
|
26
26
|
export type { InvoiceFromBookingData } from "./service.js";
|
|
27
27
|
export { financeService, renderInvoiceBody } from "./service.js";
|
|
28
|
-
export type { GeneratedInvoiceDocumentRecord, GeneratedInvoiceRenditionArtifact, InvoiceDocumentGeneratorContext, InvoiceDocumentRuntimeOptions, StorageBackedInvoiceDocumentGeneratorOptions, StorageBackedInvoiceDocumentSerializer, StorageBackedInvoiceDocumentUpload, } from "./service-documents.js";
|
|
28
|
+
export type { GeneratedInvoiceDocumentRecord, GeneratedInvoiceRenditionArtifact, InvoiceDocumentGeneratedEvent, InvoiceDocumentGeneratorContext, InvoiceDocumentRuntimeOptions, StorageBackedInvoiceDocumentGeneratorOptions, StorageBackedInvoiceDocumentSerializer, StorageBackedInvoiceDocumentUpload, } from "./service-documents.js";
|
|
29
29
|
export { createPdfInvoiceDocumentGenerator, createStorageBackedInvoiceDocumentGenerator, defaultPdfInvoiceDocumentSerializer, defaultStorageBackedInvoiceDocumentSerializer, financeDocumentsService, } from "./service-documents.js";
|
|
30
|
-
export type { FinanceSettlementRuntimeOptions, InvoiceSettlementPollerContext, InvoiceSettlementPollerResult, } from "./service-settlement.js";
|
|
30
|
+
export type { FinanceSettlementRuntimeOptions, InvoiceSettledEvent, InvoiceSettlementPollerContext, InvoiceSettlementPollerResult, } from "./service-settlement.js";
|
|
31
31
|
export { financeSettlementService } from "./service-settlement.js";
|
|
32
32
|
export type { GeneratedInvoiceDocumentResult, GenerateInvoiceDocumentInput, PolledInvoiceSettlementResult, PollInvoiceSettlementInput, } from "./validation.js";
|
|
33
33
|
export { agingReportQuerySchema, allocateInvoiceNumberInputSchema, applyDefaultBookingPaymentPlanSchema, cancelPaymentSessionSchema, completePaymentSessionSchema, createPaymentSessionFromGuaranteeSchema, createPaymentSessionFromInvoiceSchema, createPaymentSessionFromScheduleSchema, expirePaymentSessionSchema, failPaymentSessionSchema, generatedInvoiceDocumentResultSchema, generateInvoiceDocumentInputSchema, insertBookingGuaranteeSchema, insertBookingItemCommissionSchema, insertBookingItemTaxLineSchema, insertBookingPaymentScheduleSchema, insertCreditNoteLineItemSchema, insertCreditNoteSchema, insertFinanceNoteSchema, insertInvoiceExternalRefSchema, insertInvoiceLineItemSchema, insertInvoiceNumberSeriesSchema, insertInvoiceRenditionSchema, insertInvoiceSchema, insertInvoiceTemplateSchema, insertPaymentAuthorizationSchema, insertPaymentCaptureSchema, insertPaymentInstrumentSchema, insertPaymentSchema, insertPaymentSessionSchema, insertSupplierPaymentSchema, insertTaxRegimeSchema, invoiceFromBookingSchema, invoiceListQuerySchema, invoiceNumberSeriesListQuerySchema, invoiceTemplateListQuerySchema, markPaymentSessionRequiresRedirectSchema, paymentAuthorizationListQuerySchema, paymentCaptureListQuerySchema, paymentInstrumentListQuerySchema, paymentSessionListQuerySchema, polledInvoiceSettlementProviderResultSchema, polledInvoiceSettlementResultSchema, pollInvoiceSettlementInputSchema, profitabilityQuerySchema, renderInvoiceInputSchema, revenueReportQuerySchema, supplierPaymentListQuerySchema, taxRegimeListQuerySchema, updateBookingGuaranteeSchema, updateBookingItemCommissionSchema, updateBookingItemTaxLineSchema, updateBookingPaymentScheduleSchema, updateCreditNoteLineItemSchema, updateCreditNoteSchema, updateInvoiceExternalRefSchema, updateInvoiceLineItemSchema, updateInvoiceNumberSeriesSchema, updateInvoiceRenditionSchema, updateInvoiceSchema, updateInvoiceTemplateSchema, updatePaymentAuthorizationSchema, updatePaymentCaptureSchema, updatePaymentInstrumentSchema, updatePaymentSchema, updatePaymentSessionSchema, updateSupplierPaymentSchema, updateTaxRegimeSchema, } from "./validation.js";
|
|
34
|
-
export type { PublicBookingFinanceDocuments, PublicBookingFinancePayments, PublicBookingPaymentOptions, PublicFinanceBookingDocument, PublicFinanceBookingPayment, PublicPaymentOptionsQuery, PublicPaymentSession, PublicStartPaymentSessionInput, PublicValidateVoucherInput, PublicVoucherValidationResult, } from "./validation-public.js";
|
|
35
|
-
export { publicBookingFinanceDocumentsSchema, publicBookingFinancePaymentsSchema, publicBookingPaymentOptionsSchema, publicFinanceBookingDocumentSchema, publicFinanceBookingPaymentSchema, publicFinanceDocumentAvailabilitySchema, publicFinanceDocumentFormatSchema, publicFinanceInvoiceTypeSchema, publicPaymentOptionsQuerySchema, publicPaymentSessionSchema, publicStartPaymentSessionSchema, publicValidateVoucherSchema, publicVoucherValidationSchema, } from "./validation-public.js";
|
|
34
|
+
export type { PublicBookingFinanceDocuments, PublicBookingFinancePayments, PublicBookingPaymentOptions, PublicFinanceBookingDocument, PublicFinanceBookingPayment, PublicFinanceDocumentLookup, PublicFinanceDocumentLookupQuery, PublicPaymentOptionsQuery, PublicPaymentSession, PublicStartPaymentSessionInput, PublicValidateVoucherInput, PublicVoucherValidationResult, } from "./validation-public.js";
|
|
35
|
+
export { publicBookingFinanceDocumentsSchema, publicBookingFinancePaymentsSchema, publicBookingPaymentOptionsSchema, publicFinanceBookingDocumentSchema, publicFinanceBookingPaymentSchema, publicFinanceDocumentAvailabilitySchema, publicFinanceDocumentFormatSchema, publicFinanceDocumentLookupQuerySchema, publicFinanceDocumentLookupSchema, publicFinanceInvoiceTypeSchema, publicPaymentOptionsQuerySchema, publicPaymentSessionSchema, publicStartPaymentSessionSchema, publicValidateVoucherSchema, publicVoucherValidationSchema, } from "./validation-public.js";
|
|
36
36
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAIvD,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,wBAAwB,CAAA;AAE/B,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D,eAAO,MAAM,eAAe,EAAE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B,CAAA;AAC/B,OAAO,EACL,mCAAmC,EACnC,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EAClC,iCAAiC,EACjC,uCAAuC,EACvC,iCAAiC,EACjC,sCAAsC,EACtC,iCAAiC,EACjC,8BAA8B,EAC9B,+BAA+B,EAC/B,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,wBAAwB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -52,4 +52,4 @@ export { financeService, renderInvoiceBody } from "./service.js";
|
|
|
52
52
|
export { createPdfInvoiceDocumentGenerator, createStorageBackedInvoiceDocumentGenerator, defaultPdfInvoiceDocumentSerializer, defaultStorageBackedInvoiceDocumentSerializer, financeDocumentsService, } from "./service-documents.js";
|
|
53
53
|
export { financeSettlementService } from "./service-settlement.js";
|
|
54
54
|
export { agingReportQuerySchema, allocateInvoiceNumberInputSchema, applyDefaultBookingPaymentPlanSchema, cancelPaymentSessionSchema, completePaymentSessionSchema, createPaymentSessionFromGuaranteeSchema, createPaymentSessionFromInvoiceSchema, createPaymentSessionFromScheduleSchema, expirePaymentSessionSchema, failPaymentSessionSchema, generatedInvoiceDocumentResultSchema, generateInvoiceDocumentInputSchema, insertBookingGuaranteeSchema, insertBookingItemCommissionSchema, insertBookingItemTaxLineSchema, insertBookingPaymentScheduleSchema, insertCreditNoteLineItemSchema, insertCreditNoteSchema, insertFinanceNoteSchema, insertInvoiceExternalRefSchema, insertInvoiceLineItemSchema, insertInvoiceNumberSeriesSchema, insertInvoiceRenditionSchema, insertInvoiceSchema, insertInvoiceTemplateSchema, insertPaymentAuthorizationSchema, insertPaymentCaptureSchema, insertPaymentInstrumentSchema, insertPaymentSchema, insertPaymentSessionSchema, insertSupplierPaymentSchema, insertTaxRegimeSchema, invoiceFromBookingSchema, invoiceListQuerySchema, invoiceNumberSeriesListQuerySchema, invoiceTemplateListQuerySchema, markPaymentSessionRequiresRedirectSchema, paymentAuthorizationListQuerySchema, paymentCaptureListQuerySchema, paymentInstrumentListQuerySchema, paymentSessionListQuerySchema, polledInvoiceSettlementProviderResultSchema, polledInvoiceSettlementResultSchema, pollInvoiceSettlementInputSchema, profitabilityQuerySchema, renderInvoiceInputSchema, revenueReportQuerySchema, supplierPaymentListQuerySchema, taxRegimeListQuerySchema, updateBookingGuaranteeSchema, updateBookingItemCommissionSchema, updateBookingItemTaxLineSchema, updateBookingPaymentScheduleSchema, updateCreditNoteLineItemSchema, updateCreditNoteSchema, updateInvoiceExternalRefSchema, updateInvoiceLineItemSchema, updateInvoiceNumberSeriesSchema, updateInvoiceRenditionSchema, updateInvoiceSchema, updateInvoiceTemplateSchema, updatePaymentAuthorizationSchema, updatePaymentCaptureSchema, updatePaymentInstrumentSchema, updatePaymentSchema, updatePaymentSessionSchema, updateSupplierPaymentSchema, updateTaxRegimeSchema, } from "./validation.js";
|
|
55
|
-
export { publicBookingFinanceDocumentsSchema, publicBookingFinancePaymentsSchema, publicBookingPaymentOptionsSchema, publicFinanceBookingDocumentSchema, publicFinanceBookingPaymentSchema, publicFinanceDocumentAvailabilitySchema, publicFinanceDocumentFormatSchema, publicFinanceInvoiceTypeSchema, publicPaymentOptionsQuerySchema, publicPaymentSessionSchema, publicStartPaymentSessionSchema, publicValidateVoucherSchema, publicVoucherValidationSchema, } from "./validation-public.js";
|
|
55
|
+
export { publicBookingFinanceDocumentsSchema, publicBookingFinancePaymentsSchema, publicBookingPaymentOptionsSchema, publicFinanceBookingDocumentSchema, publicFinanceBookingPaymentSchema, publicFinanceDocumentAvailabilitySchema, publicFinanceDocumentFormatSchema, publicFinanceDocumentLookupQuerySchema, publicFinanceDocumentLookupSchema, publicFinanceInvoiceTypeSchema, publicPaymentOptionsQuerySchema, publicPaymentSessionSchema, publicStartPaymentSessionSchema, publicValidateVoucherSchema, publicVoucherValidationSchema, } from "./validation-public.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EventBus } from "@voyantjs/core";
|
|
1
2
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
3
|
import { financeDocumentsService } from "./service-documents.js";
|
|
3
4
|
type Env = {
|
|
@@ -11,6 +12,8 @@ export type InvoiceDocumentGenerator = Parameters<typeof financeDocumentsService
|
|
|
11
12
|
export interface FinanceDocumentRouteOptions {
|
|
12
13
|
invoiceDocumentGenerator?: InvoiceDocumentGenerator;
|
|
13
14
|
resolveInvoiceDocumentGenerator?: (bindings: Record<string, unknown>) => InvoiceDocumentGenerator | undefined;
|
|
15
|
+
eventBus?: EventBus;
|
|
16
|
+
resolveEventBus?: (bindings: Record<string, unknown>) => EventBus | undefined;
|
|
14
17
|
}
|
|
15
18
|
export declare function createFinanceAdminDocumentRoutes(options?: FinanceDocumentRouteOptions): import("hono/hono-base").HonoBase<Env, {
|
|
16
19
|
"/invoices/:id/generate-document": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-documents.d.ts","sourceRoot":"","sources":["../src/routes-documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAGhE,KAAK,GAAG,GAAG;IACT,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAC/C,OAAO,uBAAuB,CAAC,uBAAuB,CACvD,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;AAEjB,MAAM,WAAW,2BAA2B;IAC1C,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,+BAA+B,CAAC,EAAE,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,wBAAwB,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"routes-documents.d.ts","sourceRoot":"","sources":["../src/routes-documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAGhE,KAAK,GAAG,GAAG;IACT,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAC/C,OAAO,uBAAuB,CAAC,uBAAuB,CACvD,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;AAEjB,MAAM,WAAW,2BAA2B;IAC1C,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;IACnD,+BAA+B,CAAC,EAAE,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,wBAAwB,GAAG,SAAS,CAAA;IACzC,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,QAAQ,GAAG,SAAS,CAAA;CAC9E;AAgBD,wBAAgB,gCAAgC,CAAC,OAAO,GAAE,2BAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CA0CzF"}
|
package/dist/routes-documents.js
CHANGED
|
@@ -4,6 +4,9 @@ import { generateInvoiceDocumentInputSchema } from "./validation.js";
|
|
|
4
4
|
function resolveInvoiceDocumentGenerator(options, bindings) {
|
|
5
5
|
return options?.resolveInvoiceDocumentGenerator?.(bindings) ?? options?.invoiceDocumentGenerator;
|
|
6
6
|
}
|
|
7
|
+
function resolveEventBus(options, bindings) {
|
|
8
|
+
return options?.resolveEventBus?.(bindings) ?? options?.eventBus;
|
|
9
|
+
}
|
|
7
10
|
export function createFinanceAdminDocumentRoutes(options = {}) {
|
|
8
11
|
return new Hono()
|
|
9
12
|
.post("/invoices/:id/generate-document", async (c) => {
|
|
@@ -11,7 +14,7 @@ export function createFinanceAdminDocumentRoutes(options = {}) {
|
|
|
11
14
|
if (!generator) {
|
|
12
15
|
return c.json({ error: "Invoice document generator is not configured" }, 501);
|
|
13
16
|
}
|
|
14
|
-
const result = await financeDocumentsService.generateInvoiceDocument(c.get("db"), c.req.param("id"), generateInvoiceDocumentInputSchema.parse(await c.req.json().catch(() => ({}))), { generator, bindings: c.env });
|
|
17
|
+
const result = await financeDocumentsService.generateInvoiceDocument(c.get("db"), c.req.param("id"), generateInvoiceDocumentInputSchema.parse(await c.req.json().catch(() => ({}))), { generator, bindings: c.env, eventBus: resolveEventBus(options, c.env) });
|
|
15
18
|
if (result.status === "not_found")
|
|
16
19
|
return c.json({ error: "Invoice not found" }, 404);
|
|
17
20
|
if (result.status === "generator_failed") {
|
|
@@ -24,7 +27,7 @@ export function createFinanceAdminDocumentRoutes(options = {}) {
|
|
|
24
27
|
if (!generator) {
|
|
25
28
|
return c.json({ error: "Invoice document generator is not configured" }, 501);
|
|
26
29
|
}
|
|
27
|
-
const result = await financeDocumentsService.regenerateInvoiceDocument(c.get("db"), c.req.param("id"), generateInvoiceDocumentInputSchema.parse(await c.req.json().catch(() => ({}))), { generator, bindings: c.env });
|
|
30
|
+
const result = await financeDocumentsService.regenerateInvoiceDocument(c.get("db"), c.req.param("id"), generateInvoiceDocumentInputSchema.parse(await c.req.json().catch(() => ({}))), { generator, bindings: c.env, eventBus: resolveEventBus(options, c.env) });
|
|
28
31
|
if (result.status === "not_found")
|
|
29
32
|
return c.json({ error: "Invoice not found" }, 404);
|
|
30
33
|
if (result.status === "generator_failed") {
|
package/dist/routes-public.d.ts
CHANGED
|
@@ -105,9 +105,58 @@ export declare const publicFinanceRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
105
105
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
|
+
} & {
|
|
109
|
+
"/documents/by-reference": {
|
|
110
|
+
$get: {
|
|
111
|
+
input: {};
|
|
112
|
+
output: {
|
|
113
|
+
data: {
|
|
114
|
+
invoiceId: string;
|
|
115
|
+
invoiceNumber: string;
|
|
116
|
+
invoiceType: "invoice" | "proforma" | "credit_note";
|
|
117
|
+
invoiceStatus: "draft" | "sent" | "partially_paid" | "paid" | "overdue" | "void";
|
|
118
|
+
currency: string;
|
|
119
|
+
totalCents: number;
|
|
120
|
+
paidCents: number;
|
|
121
|
+
balanceDueCents: number;
|
|
122
|
+
issueDate: string;
|
|
123
|
+
dueDate: string;
|
|
124
|
+
renditionId: string | null;
|
|
125
|
+
documentStatus: "pending" | "failed" | "ready" | "stale" | "missing";
|
|
126
|
+
format: "json" | "pdf" | "html" | "xml" | null;
|
|
127
|
+
language: string | null;
|
|
128
|
+
generatedAt: string | null;
|
|
129
|
+
fileSize: number | null;
|
|
130
|
+
checksum: string | null;
|
|
131
|
+
downloadUrl: string | null;
|
|
132
|
+
bookingId: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
outputFormat: "json";
|
|
136
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
137
|
+
} | {
|
|
138
|
+
input: {};
|
|
139
|
+
output: {
|
|
140
|
+
error: string;
|
|
141
|
+
};
|
|
142
|
+
outputFormat: "json";
|
|
143
|
+
status: 404;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
108
146
|
} & {
|
|
109
147
|
"/bookings/:bookingId/documents": {
|
|
110
148
|
$get: {
|
|
149
|
+
input: {
|
|
150
|
+
param: {
|
|
151
|
+
bookingId: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
output: {
|
|
155
|
+
error: string;
|
|
156
|
+
};
|
|
157
|
+
outputFormat: "json";
|
|
158
|
+
status: 404;
|
|
159
|
+
} | {
|
|
111
160
|
input: {
|
|
112
161
|
param: {
|
|
113
162
|
bookingId: string;
|
|
@@ -140,17 +189,6 @@ export declare const publicFinanceRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
140
189
|
};
|
|
141
190
|
outputFormat: "json";
|
|
142
191
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
143
|
-
} | {
|
|
144
|
-
input: {
|
|
145
|
-
param: {
|
|
146
|
-
bookingId: string;
|
|
147
|
-
};
|
|
148
|
-
};
|
|
149
|
-
output: {
|
|
150
|
-
error: string;
|
|
151
|
-
};
|
|
152
|
-
outputFormat: "json";
|
|
153
|
-
status: 404;
|
|
154
192
|
};
|
|
155
193
|
};
|
|
156
194
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAiBvD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA8F5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
package/dist/routes-public.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
2
|
import { notFound } from "./routes-shared.js";
|
|
3
3
|
import { publicFinanceService } from "./service-public.js";
|
|
4
|
-
import { publicPaymentOptionsQuerySchema, publicStartPaymentSessionSchema, publicValidateVoucherSchema, } from "./validation-public.js";
|
|
4
|
+
import { publicFinanceDocumentLookupQuerySchema, publicPaymentOptionsQuerySchema, publicStartPaymentSessionSchema, publicValidateVoucherSchema, } from "./validation-public.js";
|
|
5
5
|
function paymentConflictError(error) {
|
|
6
6
|
if (error instanceof Error) {
|
|
7
7
|
return error.message;
|
|
@@ -12,6 +12,10 @@ export const publicFinanceRoutes = new Hono()
|
|
|
12
12
|
.post("/vouchers/validate", async (c) => {
|
|
13
13
|
const result = await publicFinanceService.validateVoucher(c.get("db"), publicValidateVoucherSchema.parse(await c.req.json()));
|
|
14
14
|
return c.json({ data: result });
|
|
15
|
+
})
|
|
16
|
+
.get("/documents/by-reference", async (c) => {
|
|
17
|
+
const document = await publicFinanceService.getDocumentByReference(c.get("db"), publicFinanceDocumentLookupQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams)).reference);
|
|
18
|
+
return document ? c.json({ data: document }) : notFound(c, "Finance document not found");
|
|
15
19
|
})
|
|
16
20
|
.get("/bookings/:bookingId/documents", async (c) => {
|
|
17
21
|
const documents = await publicFinanceService.getBookingDocuments(c.get("db"), c.req.param("bookingId"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EventBus } from "@voyantjs/core";
|
|
1
2
|
import { type InvoiceSettlementPoller } from "./service-settlement.js";
|
|
2
3
|
type Env = {
|
|
3
4
|
Bindings: Record<string, unknown>;
|
|
@@ -9,6 +10,8 @@ type Env = {
|
|
|
9
10
|
export interface FinanceSettlementRouteOptions {
|
|
10
11
|
invoiceSettlementPollers?: Record<string, InvoiceSettlementPoller>;
|
|
11
12
|
resolveInvoiceSettlementPollers?: (bindings: Record<string, unknown>) => Record<string, InvoiceSettlementPoller> | undefined;
|
|
13
|
+
eventBus?: EventBus;
|
|
14
|
+
resolveEventBus?: (bindings: Record<string, unknown>) => EventBus | undefined;
|
|
12
15
|
}
|
|
13
16
|
export declare function createFinanceAdminSettlementRoutes(options?: FinanceSettlementRouteOptions): import("hono/hono-base").HonoBase<Env, {
|
|
14
17
|
"/invoices/:id/poll-settlement": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-settlement.d.ts","sourceRoot":"","sources":["../src/routes-settlement.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes-settlement.d.ts","sourceRoot":"","sources":["../src/routes-settlement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG9C,OAAO,EAA4B,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AAGhG,KAAK,GAAG,GAAG;IACT,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,SAAS,EAAE;QACT,EAAE,EAAE,OAAO,yBAAyB,EAAE,kBAAkB,CAAA;QACxD,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,MAAM,WAAW,6BAA6B;IAC5C,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IAClE,+BAA+B,CAAC,EAAE,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAAG,SAAS,CAAA;IACxD,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,QAAQ,GAAG,SAAS,CAAA;CAC9E;AAkBD,wBAAgB,kCAAkC,CAAC,OAAO,GAAE,6BAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAmB7F;AAED,YAAY,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -4,11 +4,15 @@ import { pollInvoiceSettlementInputSchema } from "./validation.js";
|
|
|
4
4
|
function resolveInvoiceSettlementPollers(options, bindings) {
|
|
5
5
|
return (options?.resolveInvoiceSettlementPollers?.(bindings) ?? options?.invoiceSettlementPollers ?? {});
|
|
6
6
|
}
|
|
7
|
+
function resolveEventBus(options, bindings) {
|
|
8
|
+
return options?.resolveEventBus?.(bindings) ?? options?.eventBus;
|
|
9
|
+
}
|
|
7
10
|
export function createFinanceAdminSettlementRoutes(options = {}) {
|
|
8
11
|
return new Hono().post("/invoices/:id/poll-settlement", async (c) => {
|
|
9
12
|
const result = await financeSettlementService.pollInvoiceSettlement(c.get("db"), c.req.param("id"), pollInvoiceSettlementInputSchema.parse(await c.req.json().catch(() => ({}))), {
|
|
10
13
|
bindings: c.env,
|
|
11
14
|
invoiceSettlementPollers: resolveInvoiceSettlementPollers(options, c.env),
|
|
15
|
+
eventBus: resolveEventBus(options, c.env),
|
|
12
16
|
});
|
|
13
17
|
if ("status" in result && result.status === "not_found") {
|
|
14
18
|
return c.json({ error: "Invoice not found" }, 404);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EventBus } from "@voyantjs/core";
|
|
1
2
|
import type { StorageProvider, StorageUploadBody } from "@voyantjs/voyant-storage";
|
|
2
3
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
3
4
|
import { type invoiceLineItems, type invoiceRenditions, type invoices, invoiceTemplates, type payments } from "./schema.js";
|
|
@@ -27,6 +28,7 @@ export type InvoiceDocumentGenerator = (context: InvoiceDocumentGeneratorContext
|
|
|
27
28
|
export interface InvoiceDocumentRuntimeOptions {
|
|
28
29
|
bindings?: Record<string, unknown>;
|
|
29
30
|
generator: InvoiceDocumentGenerator;
|
|
31
|
+
eventBus?: EventBus;
|
|
30
32
|
}
|
|
31
33
|
export interface StorageBackedInvoiceDocumentUpload {
|
|
32
34
|
body: StorageUploadBody;
|
|
@@ -48,12 +50,23 @@ export interface GeneratedInvoiceDocumentRecord {
|
|
|
48
50
|
renderedBody: string;
|
|
49
51
|
rendition: typeof invoiceRenditions.$inferSelect;
|
|
50
52
|
}
|
|
53
|
+
export interface InvoiceDocumentGeneratedEvent {
|
|
54
|
+
invoiceId: string;
|
|
55
|
+
invoiceStatus: (typeof invoices.$inferSelect)["status"];
|
|
56
|
+
invoiceType: (typeof invoices.$inferSelect)["invoiceType"];
|
|
57
|
+
renditionId: string;
|
|
58
|
+
format: (typeof invoiceRenditions.$inferSelect)["format"];
|
|
59
|
+
renderedBodyFormat: "html" | "markdown" | "lexical_json";
|
|
60
|
+
regenerated: boolean;
|
|
61
|
+
}
|
|
51
62
|
export declare function defaultStorageBackedInvoiceDocumentSerializer(context: InvoiceDocumentGeneratorContext): Promise<StorageBackedInvoiceDocumentUpload> | StorageBackedInvoiceDocumentUpload;
|
|
52
63
|
export declare function defaultPdfInvoiceDocumentSerializer(context: InvoiceDocumentGeneratorContext): Promise<StorageBackedInvoiceDocumentUpload>;
|
|
53
64
|
export declare function createStorageBackedInvoiceDocumentGenerator(options: StorageBackedInvoiceDocumentGeneratorOptions): InvoiceDocumentGenerator;
|
|
54
65
|
export declare function createPdfInvoiceDocumentGenerator(options: Omit<StorageBackedInvoiceDocumentGeneratorOptions, "serializer">): InvoiceDocumentGenerator;
|
|
55
66
|
export declare const financeDocumentsService: {
|
|
56
|
-
generateInvoiceDocument(db: PostgresJsDatabase, invoiceId: string, input: GenerateInvoiceDocumentInput, runtime: InvoiceDocumentRuntimeOptions
|
|
67
|
+
generateInvoiceDocument(db: PostgresJsDatabase, invoiceId: string, input: GenerateInvoiceDocumentInput, runtime: InvoiceDocumentRuntimeOptions, options?: {
|
|
68
|
+
regenerated?: boolean;
|
|
69
|
+
}): Promise<{
|
|
57
70
|
status: "not_found" | "generator_failed";
|
|
58
71
|
} | ({
|
|
59
72
|
status: "generated";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-documents.d.ts","sourceRoot":"","sources":["../src/service-documents.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service-documents.d.ts","sourceRoot":"","sources":["../src/service-documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,gBAAgB,EAChB,KAAK,QAAQ,EACd,MAAM,aAAa,CAAA;AAEpB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAA;AAEnE,MAAM,WAAW,iCAAiC;IAChD,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAA;IACxC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,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A6C,CAC3D,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,kCAAkC,CAAC,GAAG,kCAAkC,CA0BlF;AAED,wBAAsB,mCAAmC,CACvD,OAAO,EAAE,+BAA+B,GACvC,OAAO,CAAC,kCAAkC,CAAC,CAyB7C;AAED,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,4CAA4C,GACpD,wBAAwB,CAmC1B;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,IAAI,CAAC,4CAA4C,EAAE,YAAY,CAAC,GACxE,wBAAwB,CAK1B;AAsDD,eAAO,MAAM,uBAAuB;gCAE5B,kBAAkB,aACX,MAAM,SACV,4BAA4B,WAC1B,6BAA6B,YAC7B;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GACjC,OAAO,CACN;QAAE,MAAM,EAAE,WAAW,GAAG,kBAAkB,CAAA;KAAE,GAC5C,CAAC;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,GAAG,8BAA8B,CAAC,CAC7D;kCA4EK,kBAAkB,aACX,MAAM,SACV,4BAA4B,WAC1B,6BAA6B;gBAjF1B,WAAW,GAAG,kBAAkB;;gBAC/B,WAAW;;CAoF3B,CAAA"}
|
|
@@ -162,7 +162,7 @@ async function prepareInvoiceDocument(db, invoiceId, input) {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
export const financeDocumentsService = {
|
|
165
|
-
async generateInvoiceDocument(db, invoiceId, input, runtime) {
|
|
165
|
+
async generateInvoiceDocument(db, invoiceId, input, runtime, options = {}) {
|
|
166
166
|
const prepared = await prepareInvoiceDocument(db, invoiceId, input);
|
|
167
167
|
if (prepared.status === "not_found") {
|
|
168
168
|
return { status: "not_found" };
|
|
@@ -212,6 +212,15 @@ export const financeDocumentsService = {
|
|
|
212
212
|
if (!rendition) {
|
|
213
213
|
return { status: "not_found" };
|
|
214
214
|
}
|
|
215
|
+
await runtime.eventBus?.emit("invoice.document.generated", {
|
|
216
|
+
invoiceId: prepared.invoice.id,
|
|
217
|
+
invoiceStatus: prepared.invoice.status,
|
|
218
|
+
invoiceType: prepared.invoice.invoiceType,
|
|
219
|
+
renditionId: rendition.id,
|
|
220
|
+
format: rendition.format,
|
|
221
|
+
renderedBodyFormat: prepared.renderedBodyFormat,
|
|
222
|
+
regenerated: options.regenerated ?? false,
|
|
223
|
+
});
|
|
215
224
|
return {
|
|
216
225
|
status: "generated",
|
|
217
226
|
invoiceId: prepared.invoice.id,
|
|
@@ -221,6 +230,6 @@ export const financeDocumentsService = {
|
|
|
221
230
|
};
|
|
222
231
|
},
|
|
223
232
|
async regenerateInvoiceDocument(db, invoiceId, input, runtime) {
|
|
224
|
-
return this.generateInvoiceDocument(db, invoiceId, input, runtime);
|
|
233
|
+
return this.generateInvoiceDocument(db, invoiceId, input, runtime, { regenerated: true });
|
|
225
234
|
},
|
|
226
235
|
};
|
package/dist/service-public.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
-
import type { PublicBookingFinanceDocuments, PublicBookingFinancePayments, PublicPaymentOptionsQuery, PublicStartPaymentSessionInput, PublicValidateVoucherInput } from "./validation-public.js";
|
|
2
|
+
import type { PublicBookingFinanceDocuments, PublicBookingFinancePayments, PublicFinanceDocumentLookup, PublicPaymentOptionsQuery, PublicStartPaymentSessionInput, PublicValidateVoucherInput } from "./validation-public.js";
|
|
3
3
|
export declare const publicFinanceService: {
|
|
4
4
|
getBookingDocuments(db: PostgresJsDatabase, bookingId: string): Promise<PublicBookingFinanceDocuments | null>;
|
|
5
|
+
getDocumentByReference(db: PostgresJsDatabase, reference: string): Promise<PublicFinanceDocumentLookup | null>;
|
|
5
6
|
getBookingPaymentOptions(db: PostgresJsDatabase, bookingId: string, query: PublicPaymentOptionsQuery): Promise<{
|
|
6
7
|
bookingId: string;
|
|
7
8
|
accounts: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWjE,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,
|
|
1
|
+
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWjE,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAE5B,2BAA2B,EAC3B,yBAAyB,EACzB,8BAA8B,EAC9B,0BAA0B,EAC3B,MAAM,wBAAwB,CAAA;AA4J/B,eAAO,MAAM,oBAAoB;4BAEzB,kBAAkB,aACX,MAAM,GAChB,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC;+BA2C1C,kBAAkB,aACX,MAAM,GAChB,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;iCA0CxC,kBAAkB,aACX,MAAM,SACV,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAoH5B,kBAAkB,aACX,MAAM,GAChB,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC;0BA2DnB,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAM3D,kBAAkB,aACX,MAAM,cACL,MAAM,SACX,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;4CA4BjC,kBAAkB,aACX,MAAM,eACJ,MAAM,SACZ,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAuBjC,kBAAkB,aACX,MAAM,SACV,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAMb,kBAAkB,SAAS,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FhF,CAAA"}
|
package/dist/service-public.js
CHANGED
|
@@ -105,6 +105,31 @@ function toPublicPaymentSession(session) {
|
|
|
105
105
|
failureMessage: session.failureMessage ?? null,
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
+
function mapInvoiceDocument(invoice, renditions) {
|
|
109
|
+
const selectedRendition = renditions.find((rendition) => rendition.status === "ready") ?? renditions[0] ?? null;
|
|
110
|
+
const metadata = getMetadataRecord(selectedRendition?.metadata ?? null);
|
|
111
|
+
const downloadUrl = getMetadataDownloadUrl(metadata) ?? maybeUrl(selectedRendition?.storageKey ?? null);
|
|
112
|
+
return {
|
|
113
|
+
invoiceId: invoice.id,
|
|
114
|
+
invoiceNumber: invoice.invoiceNumber,
|
|
115
|
+
invoiceType: invoice.invoiceType,
|
|
116
|
+
invoiceStatus: invoice.status,
|
|
117
|
+
currency: invoice.currency,
|
|
118
|
+
totalCents: invoice.totalCents,
|
|
119
|
+
paidCents: invoice.paidCents,
|
|
120
|
+
balanceDueCents: invoice.balanceDueCents,
|
|
121
|
+
issueDate: invoice.issueDate,
|
|
122
|
+
dueDate: invoice.dueDate,
|
|
123
|
+
renditionId: selectedRendition?.id ?? null,
|
|
124
|
+
documentStatus: selectedRendition?.status ?? "missing",
|
|
125
|
+
format: selectedRendition?.format ?? null,
|
|
126
|
+
language: selectedRendition?.language ?? null,
|
|
127
|
+
generatedAt: normalizeDateTime(selectedRendition?.generatedAt),
|
|
128
|
+
fileSize: selectedRendition?.fileSize ?? null,
|
|
129
|
+
checksum: selectedRendition?.checksum ?? null,
|
|
130
|
+
downloadUrl,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
108
133
|
export const publicFinanceService = {
|
|
109
134
|
async getBookingDocuments(db, bookingId) {
|
|
110
135
|
const [booking] = await db
|
|
@@ -136,32 +161,42 @@ export const publicFinanceService = {
|
|
|
136
161
|
}
|
|
137
162
|
return {
|
|
138
163
|
bookingId,
|
|
139
|
-
documents: invoiceRows.map((invoice) =>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
documents: invoiceRows.map((invoice) => mapInvoiceDocument(invoice, renditionByInvoiceId.get(invoice.id) ?? [])),
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
async getDocumentByReference(db, reference) {
|
|
168
|
+
const [invoiceMatch, paymentMatch] = await Promise.all([
|
|
169
|
+
db
|
|
170
|
+
.select()
|
|
171
|
+
.from(invoices)
|
|
172
|
+
.where(eq(invoices.invoiceNumber, reference))
|
|
173
|
+
.orderBy(desc(invoices.createdAt))
|
|
174
|
+
.limit(1),
|
|
175
|
+
db
|
|
176
|
+
.select({
|
|
177
|
+
invoiceId: payments.invoiceId,
|
|
178
|
+
})
|
|
179
|
+
.from(payments)
|
|
180
|
+
.where(eq(payments.referenceNumber, reference))
|
|
181
|
+
.orderBy(desc(payments.createdAt))
|
|
182
|
+
.limit(1),
|
|
183
|
+
]);
|
|
184
|
+
const invoiceId = invoiceMatch[0]?.id ?? paymentMatch[0]?.invoiceId ?? null;
|
|
185
|
+
if (!invoiceId) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
const [invoice] = await db.select().from(invoices).where(eq(invoices.id, invoiceId)).limit(1);
|
|
189
|
+
if (!invoice?.bookingId) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const renditions = await db
|
|
193
|
+
.select()
|
|
194
|
+
.from(invoiceRenditions)
|
|
195
|
+
.where(eq(invoiceRenditions.invoiceId, invoice.id))
|
|
196
|
+
.orderBy(desc(invoiceRenditions.createdAt));
|
|
197
|
+
return {
|
|
198
|
+
bookingId: invoice.bookingId,
|
|
199
|
+
...mapInvoiceDocument(invoice, renditions),
|
|
165
200
|
};
|
|
166
201
|
},
|
|
167
202
|
async getBookingPaymentOptions(db, bookingId, query) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EventBus } from "@voyantjs/core";
|
|
1
2
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
3
|
import type { Invoice as FinanceInvoice, InvoiceExternalRef } from "./schema.js";
|
|
3
4
|
import type { PolledInvoiceSettlementResult, PollInvoiceSettlementInput } from "./validation.js";
|
|
@@ -26,6 +27,15 @@ export type InvoiceSettlementPoller = (context: InvoiceSettlementPollerContext)
|
|
|
26
27
|
export interface FinanceSettlementRuntimeOptions {
|
|
27
28
|
bindings?: Record<string, unknown>;
|
|
28
29
|
invoiceSettlementPollers?: Record<string, InvoiceSettlementPoller>;
|
|
30
|
+
eventBus?: EventBus;
|
|
31
|
+
}
|
|
32
|
+
export interface InvoiceSettledEvent {
|
|
33
|
+
invoiceId: string;
|
|
34
|
+
paymentId: string;
|
|
35
|
+
provider: string;
|
|
36
|
+
newlyAppliedAmountCents: number;
|
|
37
|
+
paidCents: number;
|
|
38
|
+
balanceDueCents: number;
|
|
29
39
|
}
|
|
30
40
|
export declare const financeSettlementService: {
|
|
31
41
|
pollInvoiceSettlement(db: PostgresJsDatabase, invoiceId: string, input: PollInvoiceSettlementInput, runtime?: FinanceSettlementRuntimeOptions): Promise<PolledInvoiceSettlementResult | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-settlement.d.ts","sourceRoot":"","sources":["../src/service-settlement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhF,OAAO,KAAK,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,M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M,uBAAuB,GAAG,CACpC,OAAO,EAAE,8BAA8B,KACpC,OAAO,CAAC,6BAA6B,CAAC,CAAA;AAE3C,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA;IAClE,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;CACxB;AAyED,eAAO,MAAM,wBAAwB;8BAE7B,kBAAkB,aACX,MAAM,SACV,0BAA0B,YACxB,+BAA+B,GACvC,OAAO,CAAC,6BAA6B,GAAG;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC;CAmJpE,CAAA"}
|
|
@@ -120,6 +120,16 @@ export const financeSettlementService = {
|
|
|
120
120
|
});
|
|
121
121
|
createdPaymentId = payment?.id ?? null;
|
|
122
122
|
invoice = (await financeService.getInvoiceById(db, invoice.id)) ?? invoice;
|
|
123
|
+
if (createdPaymentId) {
|
|
124
|
+
await runtime.eventBus?.emit("invoice.settled", {
|
|
125
|
+
invoiceId: invoice.id,
|
|
126
|
+
paymentId: createdPaymentId,
|
|
127
|
+
provider: externalRef.provider,
|
|
128
|
+
newlyAppliedAmountCents,
|
|
129
|
+
paidCents: invoice.paidCents,
|
|
130
|
+
balanceDueCents: invoice.balanceDueCents,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
123
133
|
}
|
|
124
134
|
}
|
|
125
135
|
results.push({
|
|
@@ -69,6 +69,9 @@ export declare const publicValidateVoucherSchema: z.ZodObject<{
|
|
|
69
69
|
currency: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
70
70
|
amountCents: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
71
71
|
}, z.core.$strip>;
|
|
72
|
+
export declare const publicFinanceDocumentLookupQuerySchema: z.ZodObject<{
|
|
73
|
+
reference: z.ZodString;
|
|
74
|
+
}, z.core.$strip>;
|
|
72
75
|
export declare const publicPaymentAccountSchema: z.ZodObject<{
|
|
73
76
|
id: z.ZodString;
|
|
74
77
|
label: z.ZodString;
|
|
@@ -341,6 +344,49 @@ export declare const publicBookingFinanceDocumentsSchema: z.ZodObject<{
|
|
|
341
344
|
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
342
345
|
}, z.core.$strip>>;
|
|
343
346
|
}, z.core.$strip>;
|
|
347
|
+
export declare const publicFinanceDocumentLookupSchema: z.ZodObject<{
|
|
348
|
+
invoiceId: z.ZodString;
|
|
349
|
+
invoiceNumber: z.ZodString;
|
|
350
|
+
invoiceType: z.ZodEnum<{
|
|
351
|
+
invoice: "invoice";
|
|
352
|
+
proforma: "proforma";
|
|
353
|
+
credit_note: "credit_note";
|
|
354
|
+
}>;
|
|
355
|
+
invoiceStatus: z.ZodEnum<{
|
|
356
|
+
draft: "draft";
|
|
357
|
+
sent: "sent";
|
|
358
|
+
partially_paid: "partially_paid";
|
|
359
|
+
paid: "paid";
|
|
360
|
+
overdue: "overdue";
|
|
361
|
+
void: "void";
|
|
362
|
+
}>;
|
|
363
|
+
currency: z.ZodString;
|
|
364
|
+
totalCents: z.ZodNumber;
|
|
365
|
+
paidCents: z.ZodNumber;
|
|
366
|
+
balanceDueCents: z.ZodNumber;
|
|
367
|
+
issueDate: z.ZodString;
|
|
368
|
+
dueDate: z.ZodString;
|
|
369
|
+
renditionId: z.ZodNullable<z.ZodString>;
|
|
370
|
+
documentStatus: z.ZodEnum<{
|
|
371
|
+
pending: "pending";
|
|
372
|
+
failed: "failed";
|
|
373
|
+
ready: "ready";
|
|
374
|
+
stale: "stale";
|
|
375
|
+
missing: "missing";
|
|
376
|
+
}>;
|
|
377
|
+
format: z.ZodNullable<z.ZodEnum<{
|
|
378
|
+
json: "json";
|
|
379
|
+
pdf: "pdf";
|
|
380
|
+
html: "html";
|
|
381
|
+
xml: "xml";
|
|
382
|
+
}>>;
|
|
383
|
+
language: z.ZodNullable<z.ZodString>;
|
|
384
|
+
generatedAt: z.ZodNullable<z.ZodString>;
|
|
385
|
+
fileSize: z.ZodNullable<z.ZodNumber>;
|
|
386
|
+
checksum: z.ZodNullable<z.ZodString>;
|
|
387
|
+
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
388
|
+
bookingId: z.ZodString;
|
|
389
|
+
}, z.core.$strip>;
|
|
344
390
|
export declare const publicFinanceBookingPaymentSchema: z.ZodObject<{
|
|
345
391
|
id: z.ZodString;
|
|
346
392
|
invoiceId: z.ZodString;
|
|
@@ -435,6 +481,8 @@ export type PublicBookingPaymentOptions = z.infer<typeof publicBookingPaymentOpt
|
|
|
435
481
|
export type PublicPaymentSession = z.infer<typeof publicPaymentSessionSchema>;
|
|
436
482
|
export type PublicFinanceBookingDocument = z.infer<typeof publicFinanceBookingDocumentSchema>;
|
|
437
483
|
export type PublicBookingFinanceDocuments = z.infer<typeof publicBookingFinanceDocumentsSchema>;
|
|
484
|
+
export type PublicFinanceDocumentLookupQuery = z.infer<typeof publicFinanceDocumentLookupQuerySchema>;
|
|
485
|
+
export type PublicFinanceDocumentLookup = z.infer<typeof publicFinanceDocumentLookupSchema>;
|
|
438
486
|
export type PublicFinanceBookingPayment = z.infer<typeof publicFinanceBookingPaymentSchema>;
|
|
439
487
|
export type PublicBookingFinancePayments = z.infer<typeof publicBookingFinancePaymentsSchema>;
|
|
440
488
|
export type PublicStartPaymentSessionInput = z.infer<typeof publicStartPaymentSessionSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-public.d.ts","sourceRoot":"","sources":["../src/validation-public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EA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,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC7F,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA;AAC/F,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACpD,OAAO,sCAAsC,CAC9C,CAAA;AACD,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAC3F,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA;AAC3F,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAA;AAC7F,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA;AAC5F,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AACpF,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
|
|
@@ -42,6 +42,9 @@ export const publicValidateVoucherSchema = z.object({
|
|
|
42
42
|
currency: z.string().min(3).max(3).optional().nullable(),
|
|
43
43
|
amountCents: z.number().int().min(1).optional().nullable(),
|
|
44
44
|
});
|
|
45
|
+
export const publicFinanceDocumentLookupQuerySchema = z.object({
|
|
46
|
+
reference: z.string().min(1).max(255),
|
|
47
|
+
});
|
|
45
48
|
export const publicPaymentAccountSchema = z.object({
|
|
46
49
|
id: z.string(),
|
|
47
50
|
label: z.string(),
|
|
@@ -138,6 +141,9 @@ export const publicBookingFinanceDocumentsSchema = z.object({
|
|
|
138
141
|
bookingId: z.string(),
|
|
139
142
|
documents: z.array(publicFinanceBookingDocumentSchema),
|
|
140
143
|
});
|
|
144
|
+
export const publicFinanceDocumentLookupSchema = publicFinanceBookingDocumentSchema.extend({
|
|
145
|
+
bookingId: z.string(),
|
|
146
|
+
});
|
|
141
147
|
export const publicFinanceBookingPaymentSchema = z.object({
|
|
142
148
|
id: z.string(),
|
|
143
149
|
invoiceId: z.string(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/finance",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"drizzle-orm": "^0.45.2",
|
|
34
34
|
"hono": "^4.12.10",
|
|
35
35
|
"zod": "^4.3.6",
|
|
36
|
-
"@voyantjs/bookings": "0.4.
|
|
37
|
-
"@voyantjs/core": "0.4.
|
|
38
|
-
"@voyantjs/db": "0.4.
|
|
39
|
-
"@voyantjs/hono": "0.4.
|
|
40
|
-
"@voyantjs/utils": "0.4.
|
|
41
|
-
"@voyantjs/voyant-storage": "0.4.
|
|
36
|
+
"@voyantjs/bookings": "0.4.2",
|
|
37
|
+
"@voyantjs/core": "0.4.2",
|
|
38
|
+
"@voyantjs/db": "0.4.2",
|
|
39
|
+
"@voyantjs/hono": "0.4.2",
|
|
40
|
+
"@voyantjs/utils": "0.4.2",
|
|
41
|
+
"@voyantjs/voyant-storage": "0.4.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"typescript": "^6.0.2",
|