@voyantjs/finance 0.31.4 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/routes-public.d.ts +40 -40
- package/dist/routes-public.d.ts.map +1 -1
- package/dist/routes-public.js +50 -7
- package/dist/routes-shared.d.ts +9 -0
- package/dist/routes-shared.d.ts.map +1 -1
- package/dist/routes-shared.js +7 -0
- package/dist/service-public.d.ts +1 -0
- package/dist/service-public.d.ts.map +1 -1
- package/dist/service-public.js +8 -0
- package/package.json +7 -7
package/dist/routes-public.d.ts
CHANGED
|
@@ -111,6 +111,13 @@ export declare function createPublicFinanceRoutes(options?: PublicFinanceRouteOp
|
|
|
111
111
|
} & {
|
|
112
112
|
"/documents/by-reference": {
|
|
113
113
|
$get: {
|
|
114
|
+
input: {};
|
|
115
|
+
output: {
|
|
116
|
+
error: string;
|
|
117
|
+
};
|
|
118
|
+
outputFormat: "json";
|
|
119
|
+
status: 404;
|
|
120
|
+
} | {
|
|
114
121
|
input: {};
|
|
115
122
|
output: {
|
|
116
123
|
data: {
|
|
@@ -137,13 +144,6 @@ export declare function createPublicFinanceRoutes(options?: PublicFinanceRouteOp
|
|
|
137
144
|
};
|
|
138
145
|
outputFormat: "json";
|
|
139
146
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
140
|
-
} | {
|
|
141
|
-
input: {};
|
|
142
|
-
output: {
|
|
143
|
-
error: string;
|
|
144
|
-
};
|
|
145
|
-
outputFormat: "json";
|
|
146
|
-
status: 404;
|
|
147
147
|
};
|
|
148
148
|
};
|
|
149
149
|
} & {
|
|
@@ -356,19 +356,6 @@ export declare function createPublicFinanceRoutes(options?: PublicFinanceRouteOp
|
|
|
356
356
|
} & {
|
|
357
357
|
"/bookings/:bookingId/payment-schedules/:scheduleId/payment-session": {
|
|
358
358
|
$post: {
|
|
359
|
-
input: {
|
|
360
|
-
param: {
|
|
361
|
-
bookingId: string;
|
|
362
|
-
} & {
|
|
363
|
-
scheduleId: string;
|
|
364
|
-
};
|
|
365
|
-
};
|
|
366
|
-
output: {
|
|
367
|
-
error: string;
|
|
368
|
-
};
|
|
369
|
-
outputFormat: "json";
|
|
370
|
-
status: 404;
|
|
371
|
-
} | {
|
|
372
359
|
input: {
|
|
373
360
|
param: {
|
|
374
361
|
bookingId: string;
|
|
@@ -408,6 +395,19 @@ export declare function createPublicFinanceRoutes(options?: PublicFinanceRouteOp
|
|
|
408
395
|
};
|
|
409
396
|
outputFormat: "json";
|
|
410
397
|
status: 201;
|
|
398
|
+
} | {
|
|
399
|
+
input: {
|
|
400
|
+
param: {
|
|
401
|
+
bookingId: string;
|
|
402
|
+
} & {
|
|
403
|
+
scheduleId: string;
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
output: {
|
|
407
|
+
error: string;
|
|
408
|
+
};
|
|
409
|
+
outputFormat: "json";
|
|
410
|
+
status: 404;
|
|
411
411
|
} | {
|
|
412
412
|
input: {
|
|
413
413
|
param: {
|
|
@@ -667,6 +667,13 @@ export declare const publicFinanceRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
667
667
|
} & {
|
|
668
668
|
"/documents/by-reference": {
|
|
669
669
|
$get: {
|
|
670
|
+
input: {};
|
|
671
|
+
output: {
|
|
672
|
+
error: string;
|
|
673
|
+
};
|
|
674
|
+
outputFormat: "json";
|
|
675
|
+
status: 404;
|
|
676
|
+
} | {
|
|
670
677
|
input: {};
|
|
671
678
|
output: {
|
|
672
679
|
data: {
|
|
@@ -693,13 +700,6 @@ export declare const publicFinanceRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
693
700
|
};
|
|
694
701
|
outputFormat: "json";
|
|
695
702
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
696
|
-
} | {
|
|
697
|
-
input: {};
|
|
698
|
-
output: {
|
|
699
|
-
error: string;
|
|
700
|
-
};
|
|
701
|
-
outputFormat: "json";
|
|
702
|
-
status: 404;
|
|
703
703
|
};
|
|
704
704
|
};
|
|
705
705
|
} & {
|
|
@@ -912,19 +912,6 @@ export declare const publicFinanceRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
912
912
|
} & {
|
|
913
913
|
"/bookings/:bookingId/payment-schedules/:scheduleId/payment-session": {
|
|
914
914
|
$post: {
|
|
915
|
-
input: {
|
|
916
|
-
param: {
|
|
917
|
-
bookingId: string;
|
|
918
|
-
} & {
|
|
919
|
-
scheduleId: string;
|
|
920
|
-
};
|
|
921
|
-
};
|
|
922
|
-
output: {
|
|
923
|
-
error: string;
|
|
924
|
-
};
|
|
925
|
-
outputFormat: "json";
|
|
926
|
-
status: 404;
|
|
927
|
-
} | {
|
|
928
915
|
input: {
|
|
929
916
|
param: {
|
|
930
917
|
bookingId: string;
|
|
@@ -964,6 +951,19 @@ export declare const publicFinanceRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
964
951
|
};
|
|
965
952
|
outputFormat: "json";
|
|
966
953
|
status: 201;
|
|
954
|
+
} | {
|
|
955
|
+
input: {
|
|
956
|
+
param: {
|
|
957
|
+
bookingId: string;
|
|
958
|
+
} & {
|
|
959
|
+
scheduleId: string;
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
output: {
|
|
963
|
+
error: string;
|
|
964
|
+
};
|
|
965
|
+
outputFormat: "json";
|
|
966
|
+
status: 404;
|
|
967
967
|
} | {
|
|
968
968
|
input: {
|
|
969
969
|
param: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../src/routes-public.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,GAAG,EAA2B,MAAM,oBAAoB,CAAA;AAStE,MAAM,WAAW,yBAAyB;IACxC,0BAA0B,CAAC,EAAE,CAC3B,QAAQ,EAAE,OAAO,EACjB,UAAU,EAAE,MAAM,KACf,OAAO,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAA8B,CAAA;AAE9D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
package/dist/routes-public.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { requireCheckoutCapability, } from "@voyantjs/bookings/checkout-capability";
|
|
2
|
+
import { idempotencyKey, parseJsonBody, parseQuery, UnauthorizedApiError } from "@voyantjs/hono";
|
|
2
3
|
import { Hono } from "hono";
|
|
3
|
-
import { notFound } from "./routes-shared.js";
|
|
4
|
+
import { getRuntimeEnv, notFound } from "./routes-shared.js";
|
|
4
5
|
import { publicFinanceService } from "./service-public.js";
|
|
5
6
|
import { publicFinanceDocumentLookupQuerySchema, publicPaymentOptionsQuerySchema, publicStartPaymentSessionSchema, publicValidateVoucherSchema, } from "./validation-public.js";
|
|
6
7
|
function paymentConflictError(error) {
|
|
@@ -9,30 +10,67 @@ function paymentConflictError(error) {
|
|
|
9
10
|
}
|
|
10
11
|
return "Unable to start payment session";
|
|
11
12
|
}
|
|
13
|
+
async function requireBookingCheckoutCapability(c, bookingId, action) {
|
|
14
|
+
await requireCheckoutCapability(c, bookingId, action, getRuntimeEnv(c));
|
|
15
|
+
}
|
|
16
|
+
function bookingCheckoutCapability(action) {
|
|
17
|
+
return async (c, next) => {
|
|
18
|
+
const bookingId = c.req.param("bookingId");
|
|
19
|
+
if (!bookingId) {
|
|
20
|
+
throw new UnauthorizedApiError("Missing checkout booking id");
|
|
21
|
+
}
|
|
22
|
+
await requireBookingCheckoutCapability(c, bookingId, action);
|
|
23
|
+
await next();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function invoiceCheckoutCapability(action) {
|
|
27
|
+
return async (c, next) => {
|
|
28
|
+
const invoiceId = c.req.param("invoiceId");
|
|
29
|
+
if (!invoiceId) {
|
|
30
|
+
throw new UnauthorizedApiError("Missing checkout invoice id");
|
|
31
|
+
}
|
|
32
|
+
const bookingId = await publicFinanceService.getInvoiceBookingId(c.get("db"), invoiceId);
|
|
33
|
+
if (!bookingId) {
|
|
34
|
+
return notFound(c, "Invoice not found");
|
|
35
|
+
}
|
|
36
|
+
await requireBookingCheckoutCapability(c, bookingId, action);
|
|
37
|
+
await next();
|
|
38
|
+
};
|
|
39
|
+
}
|
|
12
40
|
export function createPublicFinanceRoutes(options = {}) {
|
|
13
41
|
const resolveDocumentDownloadUrl = (bindings, storageKey) => options.resolveDocumentDownloadUrl?.(bindings, storageKey) ?? null;
|
|
14
42
|
return new Hono()
|
|
15
43
|
.post("/vouchers/validate", async (c) => {
|
|
16
|
-
const
|
|
44
|
+
const input = await parseJsonBody(c, publicValidateVoucherSchema);
|
|
45
|
+
if (input.bookingId) {
|
|
46
|
+
await requireBookingCheckoutCapability(c, input.bookingId, "payment:read");
|
|
47
|
+
}
|
|
48
|
+
const result = await publicFinanceService.validateVoucher(c.get("db"), input);
|
|
17
49
|
return c.json({ data: result });
|
|
18
50
|
})
|
|
19
51
|
.get("/documents/by-reference", async (c) => {
|
|
20
52
|
const document = await publicFinanceService.getDocumentByReference(c.get("db"), parseQuery(c, publicFinanceDocumentLookupQuerySchema).reference, {
|
|
21
53
|
resolveDocumentDownloadUrl: (storageKey) => resolveDocumentDownloadUrl(c.env, storageKey),
|
|
22
54
|
});
|
|
55
|
+
if (document?.bookingId) {
|
|
56
|
+
await requireBookingCheckoutCapability(c, document.bookingId, "payment:read");
|
|
57
|
+
}
|
|
23
58
|
return document ? c.json({ data: document }) : notFound(c, "Finance document not found");
|
|
24
59
|
})
|
|
25
60
|
.get("/bookings/:bookingId/documents", async (c) => {
|
|
61
|
+
await requireBookingCheckoutCapability(c, c.req.param("bookingId"), "payment:read");
|
|
26
62
|
const documents = await publicFinanceService.getBookingDocuments(c.get("db"), c.req.param("bookingId"), {
|
|
27
63
|
resolveDocumentDownloadUrl: (storageKey) => resolveDocumentDownloadUrl(c.env, storageKey),
|
|
28
64
|
});
|
|
29
65
|
return documents ? c.json({ data: documents }) : notFound(c, "Booking documents not found");
|
|
30
66
|
})
|
|
31
67
|
.get("/bookings/:bookingId/payments", async (c) => {
|
|
68
|
+
await requireBookingCheckoutCapability(c, c.req.param("bookingId"), "payment:read");
|
|
32
69
|
const payments = await publicFinanceService.getBookingPayments(c.get("db"), c.req.param("bookingId"));
|
|
33
70
|
return payments ? c.json({ data: payments }) : notFound(c, "Booking payments not found");
|
|
34
71
|
})
|
|
35
72
|
.get("/bookings/:bookingId/payment-options", async (c) => {
|
|
73
|
+
await requireBookingCheckoutCapability(c, c.req.param("bookingId"), "payment:read");
|
|
36
74
|
const paymentOptions = await publicFinanceService.getBookingPaymentOptions(c.get("db"), c.req.param("bookingId"), parseQuery(c, publicPaymentOptionsQuerySchema));
|
|
37
75
|
return paymentOptions
|
|
38
76
|
? c.json({ data: paymentOptions })
|
|
@@ -40,9 +78,12 @@ export function createPublicFinanceRoutes(options = {}) {
|
|
|
40
78
|
})
|
|
41
79
|
.get("/payment-sessions/:sessionId", async (c) => {
|
|
42
80
|
const session = await publicFinanceService.getPaymentSession(c.get("db"), c.req.param("sessionId"));
|
|
81
|
+
if (session?.bookingId) {
|
|
82
|
+
await requireBookingCheckoutCapability(c, session.bookingId, "payment:read");
|
|
83
|
+
}
|
|
43
84
|
return session ? c.json({ data: session }) : notFound(c, "Payment session not found");
|
|
44
85
|
})
|
|
45
|
-
.post("/bookings/:bookingId/payment-schedules/:scheduleId/payment-session", async (c) => {
|
|
86
|
+
.post("/bookings/:bookingId/payment-schedules/:scheduleId/payment-session", bookingCheckoutCapability("payment:start"), idempotencyKey(), async (c) => {
|
|
46
87
|
try {
|
|
47
88
|
const session = await publicFinanceService.startBookingSchedulePaymentSession(c.get("db"), c.req.param("bookingId"), c.req.param("scheduleId"), await parseJsonBody(c, publicStartPaymentSessionSchema));
|
|
48
89
|
return session
|
|
@@ -53,16 +94,18 @@ export function createPublicFinanceRoutes(options = {}) {
|
|
|
53
94
|
return c.json({ error: paymentConflictError(error) }, 409);
|
|
54
95
|
}
|
|
55
96
|
})
|
|
56
|
-
.post("/bookings/:bookingId/guarantees/:guaranteeId/payment-session", async (c) => {
|
|
97
|
+
.post("/bookings/:bookingId/guarantees/:guaranteeId/payment-session", bookingCheckoutCapability("payment:start"), idempotencyKey(), async (c) => {
|
|
57
98
|
try {
|
|
58
99
|
const session = await publicFinanceService.startBookingGuaranteePaymentSession(c.get("db"), c.req.param("bookingId"), c.req.param("guaranteeId"), await parseJsonBody(c, publicStartPaymentSessionSchema));
|
|
59
|
-
return session
|
|
100
|
+
return session
|
|
101
|
+
? c.json({ data: session }, 201)
|
|
102
|
+
: notFound(c, "Booking guarantee not found");
|
|
60
103
|
}
|
|
61
104
|
catch (error) {
|
|
62
105
|
return c.json({ error: paymentConflictError(error) }, 409);
|
|
63
106
|
}
|
|
64
107
|
})
|
|
65
|
-
.post("/invoices/:invoiceId/payment-session", async (c) => {
|
|
108
|
+
.post("/invoices/:invoiceId/payment-session", invoiceCheckoutCapability("payment:start"), idempotencyKey(), async (c) => {
|
|
66
109
|
try {
|
|
67
110
|
const session = await publicFinanceService.startInvoicePaymentSession(c.get("db"), c.req.param("invoiceId"), await parseJsonBody(c, publicStartPaymentSessionSchema));
|
|
68
111
|
return session ? c.json({ data: session }, 201) : notFound(c, "Invoice not found");
|
package/dist/routes-shared.d.ts
CHANGED
|
@@ -2,12 +2,21 @@ import type { ModuleContainer } from "@voyantjs/core";
|
|
|
2
2
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
3
3
|
import type { Context } from "hono";
|
|
4
4
|
export type Env = {
|
|
5
|
+
Bindings: Partial<{
|
|
6
|
+
VOYANT_CHECKOUT_CAPABILITY_SECRET: string;
|
|
7
|
+
CHECKOUT_CAPABILITY_SECRET: string;
|
|
8
|
+
VOYANT_CHECKOUT_CAPABILITY_TTL_SECONDS: string;
|
|
9
|
+
CHECKOUT_CAPABILITY_TTL_SECONDS: string;
|
|
10
|
+
SESSION_CLAIMS_SECRET: string;
|
|
11
|
+
BETTER_AUTH_SECRET: string;
|
|
12
|
+
}>;
|
|
5
13
|
Variables: {
|
|
6
14
|
db: PostgresJsDatabase;
|
|
7
15
|
userId?: string;
|
|
8
16
|
container?: ModuleContainer;
|
|
9
17
|
};
|
|
10
18
|
};
|
|
19
|
+
export declare function getRuntimeEnv(c: Context): any;
|
|
11
20
|
export declare function notFound<T extends Env>(c: Context<T>, error: string): Response & import("hono").TypedResponse<{
|
|
12
21
|
error: string;
|
|
13
22
|
}, 404, "json">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes-shared.d.ts","sourceRoot":"","sources":["../src/routes-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,MAAM,MAAM,GAAG,GAAG;IAChB,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,eAAe,CAAA;KAC5B,CAAA;CACF,CAAA;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM;;gBAEnE"}
|
|
1
|
+
{"version":3,"file":"routes-shared.d.ts","sourceRoot":"","sources":["../src/routes-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,MAAM,MAAM,GAAG,GAAG;IAChB,QAAQ,EAAE,OAAO,CAAC;QAChB,iCAAiC,EAAE,MAAM,CAAA;QACzC,0BAA0B,EAAE,MAAM,CAAA;QAClC,sCAAsC,EAAE,MAAM,CAAA;QAC9C,+BAA+B,EAAE,MAAM,CAAA;QACvC,qBAAqB,EAAE,MAAM,CAAA;QAC7B,kBAAkB,EAAE,MAAM,CAAA;KAC3B,CAAC,CAAA;IACF,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,SAAS,CAAC,EAAE,eAAe,CAAA;KAC5B,CAAA;CACF,CAAA;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,OAYvC;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM;;gBAEnE"}
|
package/dist/routes-shared.js
CHANGED
package/dist/service-public.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare const publicFinanceService: {
|
|
|
75
75
|
failureMessage: string | null;
|
|
76
76
|
notes: string | null;
|
|
77
77
|
} | null>;
|
|
78
|
+
getInvoiceBookingId(db: PostgresJsDatabase, invoiceId: string): Promise<string | null>;
|
|
78
79
|
startBookingSchedulePaymentSession(db: PostgresJsDatabase, bookingId: string, scheduleId: string, input: PublicStartPaymentSessionInput): Promise<{
|
|
79
80
|
id: string;
|
|
80
81
|
targetType: "other" | "booking" | "order" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "flight_order";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-public.d.ts","sourceRoot":"","sources":["../src/service-public.ts"],"names":[],"mappings":"AAE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AoB;4BAEzB,kBAAkB,aACX,MAAM,YACR,2BAA2B,GACnC,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC;+BA6C1C,kBAAkB,aACX,MAAM,YACR,2BAA2B,GACnC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAKnC,kBAAkB,aAAa,MAAM;2CAW7D,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsEhF,CAAA"}
|
package/dist/service-public.js
CHANGED
|
@@ -318,6 +318,14 @@ export const publicFinanceService = {
|
|
|
318
318
|
const session = await financeService.getPaymentSessionById(db, sessionId);
|
|
319
319
|
return session ? toPublicPaymentSession(session) : null;
|
|
320
320
|
},
|
|
321
|
+
async getInvoiceBookingId(db, invoiceId) {
|
|
322
|
+
const [invoice] = await db
|
|
323
|
+
.select({ bookingId: invoices.bookingId })
|
|
324
|
+
.from(invoices)
|
|
325
|
+
.where(eq(invoices.id, invoiceId))
|
|
326
|
+
.limit(1);
|
|
327
|
+
return invoice?.bookingId ?? null;
|
|
328
|
+
},
|
|
321
329
|
async startBookingSchedulePaymentSession(db, bookingId, scheduleId, input) {
|
|
322
330
|
const [schedule] = await db
|
|
323
331
|
.select({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/finance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"drizzle-orm": "^0.45.2",
|
|
40
40
|
"hono": "^4.12.10",
|
|
41
41
|
"zod": "^4.3.6",
|
|
42
|
-
"@voyantjs/bookings": "0.
|
|
43
|
-
"@voyantjs/core": "0.
|
|
44
|
-
"@voyantjs/db": "0.
|
|
45
|
-
"@voyantjs/hono": "0.
|
|
46
|
-
"@voyantjs/utils": "0.
|
|
47
|
-
"@voyantjs/storage": "0.
|
|
42
|
+
"@voyantjs/bookings": "0.32.0",
|
|
43
|
+
"@voyantjs/core": "0.32.0",
|
|
44
|
+
"@voyantjs/db": "0.32.0",
|
|
45
|
+
"@voyantjs/hono": "0.32.0",
|
|
46
|
+
"@voyantjs/utils": "0.32.0",
|
|
47
|
+
"@voyantjs/storage": "0.32.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"typescript": "^6.0.2",
|