@voyant-travel/commerce 0.1.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/LICENSE +201 -0
- package/README.md +145 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts +2 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.d.ts.map +1 -0
- package/dist/accepted-quote-version-reservation-golden-flow.test.js +398 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/interface.d.ts +18 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/interface.js +246 -0
- package/dist/interface.test.d.ts +2 -0
- package/dist/interface.test.d.ts.map +1 -0
- package/dist/interface.test.js +357 -0
- package/dist/markets/index.d.ts +11 -0
- package/dist/markets/index.d.ts.map +1 -0
- package/dist/markets/index.js +12 -0
- package/dist/markets/routes.d.ts +1182 -0
- package/dist/markets/routes.d.ts.map +1 -0
- package/dist/markets/routes.js +209 -0
- package/dist/markets/schema.d.ts +1527 -0
- package/dist/markets/schema.d.ts.map +1 -0
- package/dist/markets/schema.js +240 -0
- package/dist/markets/service-core.d.ts +253 -0
- package/dist/markets/service-core.d.ts.map +1 -0
- package/dist/markets/service-core.js +242 -0
- package/dist/markets/service-rules.d.ts +191 -0
- package/dist/markets/service-rules.d.ts.map +1 -0
- package/dist/markets/service-rules.js +155 -0
- package/dist/markets/service-shared.d.ts +36 -0
- package/dist/markets/service-shared.d.ts.map +1 -0
- package/dist/markets/service-shared.js +7 -0
- package/dist/markets/service.d.ts +43 -0
- package/dist/markets/service.d.ts.map +1 -0
- package/dist/markets/service.js +42 -0
- package/dist/markets/validation.d.ts +451 -0
- package/dist/markets/validation.d.ts.map +1 -0
- package/dist/markets/validation.js +160 -0
- package/dist/pricing/events.d.ts +53 -0
- package/dist/pricing/events.d.ts.map +1 -0
- package/dist/pricing/events.js +28 -0
- package/dist/pricing/index.d.ts +15 -0
- package/dist/pricing/index.d.ts.map +1 -0
- package/dist/pricing/index.js +18 -0
- package/dist/pricing/routes-core.d.ts +981 -0
- package/dist/pricing/routes-core.d.ts.map +1 -0
- package/dist/pricing/routes-core.js +102 -0
- package/dist/pricing/routes-public.d.ts +136 -0
- package/dist/pricing/routes-public.d.ts.map +1 -0
- package/dist/pricing/routes-public.js +14 -0
- package/dist/pricing/routes-rules.d.ts +1339 -0
- package/dist/pricing/routes-rules.d.ts.map +1 -0
- package/dist/pricing/routes-rules.js +138 -0
- package/dist/pricing/routes-shared.d.ts +14 -0
- package/dist/pricing/routes-shared.d.ts.map +1 -0
- package/dist/pricing/routes-shared.js +3 -0
- package/dist/pricing/routes.d.ts +7 -0
- package/dist/pricing/routes.d.ts.map +1 -0
- package/dist/pricing/routes.js +6 -0
- package/dist/pricing/schema-catalogs.d.ts +467 -0
- package/dist/pricing/schema-catalogs.d.ts.map +1 -0
- package/dist/pricing/schema-catalogs.js +47 -0
- package/dist/pricing/schema-categories.d.ts +497 -0
- package/dist/pricing/schema-categories.d.ts.map +1 -0
- package/dist/pricing/schema-categories.js +54 -0
- package/dist/pricing/schema-departure-overrides.d.ts +228 -0
- package/dist/pricing/schema-departure-overrides.d.ts.map +1 -0
- package/dist/pricing/schema-departure-overrides.js +36 -0
- package/dist/pricing/schema-option-rules.d.ts +1770 -0
- package/dist/pricing/schema-option-rules.d.ts.map +1 -0
- package/dist/pricing/schema-option-rules.js +181 -0
- package/dist/pricing/schema-policies.d.ts +395 -0
- package/dist/pricing/schema-policies.d.ts.map +1 -0
- package/dist/pricing/schema-policies.js +41 -0
- package/dist/pricing/schema-relations.d.ts +59 -0
- package/dist/pricing/schema-relations.d.ts.map +1 -0
- package/dist/pricing/schema-relations.js +111 -0
- package/dist/pricing/schema-shared.d.ts +11 -0
- package/dist/pricing/schema-shared.d.ts.map +1 -0
- package/dist/pricing/schema-shared.js +67 -0
- package/dist/pricing/schema.d.ts +8 -0
- package/dist/pricing/schema.d.ts.map +1 -0
- package/dist/pricing/schema.js +7 -0
- package/dist/pricing/service-catalog-plane-pricing.d.ts +95 -0
- package/dist/pricing/service-catalog-plane-pricing.d.ts.map +1 -0
- package/dist/pricing/service-catalog-plane-pricing.js +382 -0
- package/dist/pricing/service-catalogs.d.ts +139 -0
- package/dist/pricing/service-catalogs.d.ts.map +1 -0
- package/dist/pricing/service-catalogs.js +89 -0
- package/dist/pricing/service-categories.d.ts +147 -0
- package/dist/pricing/service-categories.d.ts.map +1 -0
- package/dist/pricing/service-categories.js +105 -0
- package/dist/pricing/service-departure-overrides.d.ts +67 -0
- package/dist/pricing/service-departure-overrides.d.ts.map +1 -0
- package/dist/pricing/service-departure-overrides.js +54 -0
- package/dist/pricing/service-option-rules.d.ts +321 -0
- package/dist/pricing/service-option-rules.d.ts.map +1 -0
- package/dist/pricing/service-option-rules.js +340 -0
- package/dist/pricing/service-policies.d.ts +123 -0
- package/dist/pricing/service-policies.d.ts.map +1 -0
- package/dist/pricing/service-policies.js +95 -0
- package/dist/pricing/service-public.d.ts +89 -0
- package/dist/pricing/service-public.d.ts.map +1 -0
- package/dist/pricing/service-public.js +473 -0
- package/dist/pricing/service-rule-resolver.d.ts +67 -0
- package/dist/pricing/service-rule-resolver.d.ts.map +1 -0
- package/dist/pricing/service-rule-resolver.js +204 -0
- package/dist/pricing/service-shared.d.ts +53 -0
- package/dist/pricing/service-shared.d.ts.map +1 -0
- package/dist/pricing/service-shared.js +4 -0
- package/dist/pricing/service-transfer-rules.d.ts +211 -0
- package/dist/pricing/service-transfer-rules.d.ts.map +1 -0
- package/dist/pricing/service-transfer-rules.js +139 -0
- package/dist/pricing/service.d.ts +79 -0
- package/dist/pricing/service.d.ts.map +1 -0
- package/dist/pricing/service.js +78 -0
- package/dist/pricing/validation-public.d.ts +412 -0
- package/dist/pricing/validation-public.d.ts.map +1 -0
- package/dist/pricing/validation-public.js +111 -0
- package/dist/pricing/validation-shared.d.ts +71 -0
- package/dist/pricing/validation-shared.d.ts.map +1 -0
- package/dist/pricing/validation-shared.js +63 -0
- package/dist/pricing/validation.d.ts +987 -0
- package/dist/pricing/validation.d.ts.map +1 -0
- package/dist/pricing/validation.js +307 -0
- package/dist/promotions/events.d.ts +38 -0
- package/dist/promotions/events.d.ts.map +1 -0
- package/dist/promotions/events.js +25 -0
- package/dist/promotions/index.d.ts +12 -0
- package/dist/promotions/index.d.ts.map +1 -0
- package/dist/promotions/index.js +17 -0
- package/dist/promotions/routes-shared.d.ts +14 -0
- package/dist/promotions/routes-shared.d.ts.map +1 -0
- package/dist/promotions/routes-shared.js +3 -0
- package/dist/promotions/routes.d.ts +395 -0
- package/dist/promotions/routes.d.ts.map +1 -0
- package/dist/promotions/routes.js +55 -0
- package/dist/promotions/schema.d.ts +675 -0
- package/dist/promotions/schema.d.ts.map +1 -0
- package/dist/promotions/schema.js +126 -0
- package/dist/promotions/service-booking-confirmed.d.ts +77 -0
- package/dist/promotions/service-booking-confirmed.d.ts.map +1 -0
- package/dist/promotions/service-booking-confirmed.js +134 -0
- package/dist/promotions/service-boundary-scheduler.d.ts +85 -0
- package/dist/promotions/service-boundary-scheduler.d.ts.map +1 -0
- package/dist/promotions/service-boundary-scheduler.js +141 -0
- package/dist/promotions/service-catalog-evaluator.d.ts +22 -0
- package/dist/promotions/service-catalog-evaluator.d.ts.map +1 -0
- package/dist/promotions/service-catalog-evaluator.js +33 -0
- package/dist/promotions/service-catalog-plane-promotions.d.ts +73 -0
- package/dist/promotions/service-catalog-plane-promotions.d.ts.map +1 -0
- package/dist/promotions/service-catalog-plane-promotions.js +118 -0
- package/dist/promotions/service-evaluator.d.ts +134 -0
- package/dist/promotions/service-evaluator.d.ts.map +1 -0
- package/dist/promotions/service-evaluator.js +302 -0
- package/dist/promotions/service-storefront.d.ts +147 -0
- package/dist/promotions/service-storefront.d.ts.map +1 -0
- package/dist/promotions/service-storefront.js +326 -0
- package/dist/promotions/service.d.ts +143 -0
- package/dist/promotions/service.d.ts.map +1 -0
- package/dist/promotions/service.js +359 -0
- package/dist/promotions/validation.d.ts +195 -0
- package/dist/promotions/validation.d.ts.map +1 -0
- package/dist/promotions/validation.js +167 -0
- package/dist/promotions/workflow-bulk-reindex.d.ts +36 -0
- package/dist/promotions/workflow-bulk-reindex.d.ts.map +1 -0
- package/dist/promotions/workflow-bulk-reindex.js +53 -0
- package/dist/promotions/workflow-runtime.d.ts +17 -0
- package/dist/promotions/workflow-runtime.d.ts.map +1 -0
- package/dist/promotions/workflow-runtime.js +9 -0
- package/dist/runtime.d.ts +18 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +27 -0
- package/dist/runtime.test.d.ts +2 -0
- package/dist/runtime.test.d.ts.map +1 -0
- package/dist/runtime.test.js +25 -0
- package/dist/schema.d.ts +5 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +4 -0
- package/dist/sellability/index.d.ts +13 -0
- package/dist/sellability/index.d.ts.map +1 -0
- package/dist/sellability/index.js +17 -0
- package/dist/sellability/routes.d.ts +2332 -0
- package/dist/sellability/routes.d.ts.map +1 -0
- package/dist/sellability/routes.js +166 -0
- package/dist/sellability/schema.d.ts +1716 -0
- package/dist/sellability/schema.d.ts.map +1 -0
- package/dist/sellability/schema.js +278 -0
- package/dist/sellability/service-records.d.ts +316 -0
- package/dist/sellability/service-records.d.ts.map +1 -0
- package/dist/sellability/service-records.js +253 -0
- package/dist/sellability/service-resolve.d.ts +72 -0
- package/dist/sellability/service-resolve.d.ts.map +1 -0
- package/dist/sellability/service-resolve.js +580 -0
- package/dist/sellability/service-shared.d.ts +124 -0
- package/dist/sellability/service-shared.d.ts.map +1 -0
- package/dist/sellability/service-shared.js +96 -0
- package/dist/sellability/service-snapshots.d.ts +191 -0
- package/dist/sellability/service-snapshots.d.ts.map +1 -0
- package/dist/sellability/service-snapshots.js +153 -0
- package/dist/sellability/service.d.ts +1038 -0
- package/dist/sellability/service.d.ts.map +1 -0
- package/dist/sellability/service.js +17 -0
- package/dist/sellability/validation.d.ts +477 -0
- package/dist/sellability/validation.d.ts.map +1 -0
- package/dist/sellability/validation.js +192 -0
- package/dist/types.d.ts +239 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-core.d.ts","sourceRoot":"","sources":["../../src/pricing/routes-core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAuBvD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAqN1B,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyant-travel/hono";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { notFound } from "./routes-shared.js";
|
|
4
|
+
import { pricingService } from "./service.js";
|
|
5
|
+
import { cancellationPolicyListQuerySchema, cancellationPolicyRuleListQuerySchema, insertCancellationPolicyRuleSchema, insertCancellationPolicySchema, insertPriceCatalogSchema, insertPriceScheduleSchema, insertPricingCategoryDependencySchema, insertPricingCategorySchema, priceCatalogListQuerySchema, priceScheduleListQuerySchema, pricingCategoryDependencyListQuerySchema, pricingCategoryListQuerySchema, updateCancellationPolicyRuleSchema, updateCancellationPolicySchema, updatePriceCatalogSchema, updatePriceScheduleSchema, updatePricingCategoryDependencySchema, updatePricingCategorySchema, } from "./validation.js";
|
|
6
|
+
export const pricingCoreRoutes = new Hono()
|
|
7
|
+
.get("/pricing-categories", async (c) => c.json(await pricingService.listPricingCategories(c.get("db"), await parseQuery(c, pricingCategoryListQuerySchema))))
|
|
8
|
+
.post("/pricing-categories", async (c) => c.json({
|
|
9
|
+
data: await pricingService.createPricingCategory(c.get("db"), await parseJsonBody(c, insertPricingCategorySchema)),
|
|
10
|
+
}, 201))
|
|
11
|
+
.get("/pricing-categories/:id", async (c) => {
|
|
12
|
+
const row = await pricingService.getPricingCategoryById(c.get("db"), c.req.param("id"));
|
|
13
|
+
return row ? c.json({ data: row }) : notFound(c, "Pricing category not found");
|
|
14
|
+
})
|
|
15
|
+
.patch("/pricing-categories/:id", async (c) => {
|
|
16
|
+
const row = await pricingService.updatePricingCategory(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePricingCategorySchema));
|
|
17
|
+
return row ? c.json({ data: row }) : notFound(c, "Pricing category not found");
|
|
18
|
+
})
|
|
19
|
+
.delete("/pricing-categories/:id", async (c) => {
|
|
20
|
+
const row = await pricingService.deletePricingCategory(c.get("db"), c.req.param("id"));
|
|
21
|
+
return row ? c.json({ success: true }) : notFound(c, "Pricing category not found");
|
|
22
|
+
})
|
|
23
|
+
.get("/pricing-category-dependencies", async (c) => c.json(await pricingService.listPricingCategoryDependencies(c.get("db"), await parseQuery(c, pricingCategoryDependencyListQuerySchema))))
|
|
24
|
+
.post("/pricing-category-dependencies", async (c) => c.json({
|
|
25
|
+
data: await pricingService.createPricingCategoryDependency(c.get("db"), await parseJsonBody(c, insertPricingCategoryDependencySchema)),
|
|
26
|
+
}, 201))
|
|
27
|
+
.get("/pricing-category-dependencies/:id", async (c) => {
|
|
28
|
+
const row = await pricingService.getPricingCategoryDependencyById(c.get("db"), c.req.param("id"));
|
|
29
|
+
return row ? c.json({ data: row }) : notFound(c, "Pricing category dependency not found");
|
|
30
|
+
})
|
|
31
|
+
.patch("/pricing-category-dependencies/:id", async (c) => {
|
|
32
|
+
const row = await pricingService.updatePricingCategoryDependency(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePricingCategoryDependencySchema));
|
|
33
|
+
return row ? c.json({ data: row }) : notFound(c, "Pricing category dependency not found");
|
|
34
|
+
})
|
|
35
|
+
.delete("/pricing-category-dependencies/:id", async (c) => {
|
|
36
|
+
const row = await pricingService.deletePricingCategoryDependency(c.get("db"), c.req.param("id"));
|
|
37
|
+
return row ? c.json({ success: true }) : notFound(c, "Pricing category dependency not found");
|
|
38
|
+
})
|
|
39
|
+
.get("/cancellation-policies", async (c) => c.json(await pricingService.listCancellationPolicies(c.get("db"), await parseQuery(c, cancellationPolicyListQuerySchema))))
|
|
40
|
+
.post("/cancellation-policies", async (c) => c.json({
|
|
41
|
+
data: await pricingService.createCancellationPolicy(c.get("db"), await parseJsonBody(c, insertCancellationPolicySchema)),
|
|
42
|
+
}, 201))
|
|
43
|
+
.get("/cancellation-policies/:id", async (c) => {
|
|
44
|
+
const row = await pricingService.getCancellationPolicyById(c.get("db"), c.req.param("id"));
|
|
45
|
+
return row ? c.json({ data: row }) : notFound(c, "Cancellation policy not found");
|
|
46
|
+
})
|
|
47
|
+
.patch("/cancellation-policies/:id", async (c) => {
|
|
48
|
+
const row = await pricingService.updateCancellationPolicy(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateCancellationPolicySchema));
|
|
49
|
+
return row ? c.json({ data: row }) : notFound(c, "Cancellation policy not found");
|
|
50
|
+
})
|
|
51
|
+
.delete("/cancellation-policies/:id", async (c) => {
|
|
52
|
+
const row = await pricingService.deleteCancellationPolicy(c.get("db"), c.req.param("id"));
|
|
53
|
+
return row ? c.json({ success: true }) : notFound(c, "Cancellation policy not found");
|
|
54
|
+
})
|
|
55
|
+
.get("/cancellation-policy-rules", async (c) => c.json(await pricingService.listCancellationPolicyRules(c.get("db"), await parseQuery(c, cancellationPolicyRuleListQuerySchema))))
|
|
56
|
+
.post("/cancellation-policy-rules", async (c) => c.json({
|
|
57
|
+
data: await pricingService.createCancellationPolicyRule(c.get("db"), await parseJsonBody(c, insertCancellationPolicyRuleSchema)),
|
|
58
|
+
}, 201))
|
|
59
|
+
.get("/cancellation-policy-rules/:id", async (c) => {
|
|
60
|
+
const row = await pricingService.getCancellationPolicyRuleById(c.get("db"), c.req.param("id"));
|
|
61
|
+
return row ? c.json({ data: row }) : notFound(c, "Cancellation policy rule not found");
|
|
62
|
+
})
|
|
63
|
+
.patch("/cancellation-policy-rules/:id", async (c) => {
|
|
64
|
+
const row = await pricingService.updateCancellationPolicyRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateCancellationPolicyRuleSchema));
|
|
65
|
+
return row ? c.json({ data: row }) : notFound(c, "Cancellation policy rule not found");
|
|
66
|
+
})
|
|
67
|
+
.delete("/cancellation-policy-rules/:id", async (c) => {
|
|
68
|
+
const row = await pricingService.deleteCancellationPolicyRule(c.get("db"), c.req.param("id"));
|
|
69
|
+
return row ? c.json({ success: true }) : notFound(c, "Cancellation policy rule not found");
|
|
70
|
+
})
|
|
71
|
+
.get("/price-catalogs", async (c) => c.json(await pricingService.listPriceCatalogs(c.get("db"), await parseQuery(c, priceCatalogListQuerySchema))))
|
|
72
|
+
.post("/price-catalogs", async (c) => c.json({
|
|
73
|
+
data: await pricingService.createPriceCatalog(c.get("db"), await parseJsonBody(c, insertPriceCatalogSchema)),
|
|
74
|
+
}, 201))
|
|
75
|
+
.get("/price-catalogs/:id", async (c) => {
|
|
76
|
+
const row = await pricingService.getPriceCatalogById(c.get("db"), c.req.param("id"));
|
|
77
|
+
return row ? c.json({ data: row }) : notFound(c, "Price catalog not found");
|
|
78
|
+
})
|
|
79
|
+
.patch("/price-catalogs/:id", async (c) => {
|
|
80
|
+
const row = await pricingService.updatePriceCatalog(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePriceCatalogSchema));
|
|
81
|
+
return row ? c.json({ data: row }) : notFound(c, "Price catalog not found");
|
|
82
|
+
})
|
|
83
|
+
.delete("/price-catalogs/:id", async (c) => {
|
|
84
|
+
const row = await pricingService.deletePriceCatalog(c.get("db"), c.req.param("id"));
|
|
85
|
+
return row ? c.json({ success: true }) : notFound(c, "Price catalog not found");
|
|
86
|
+
})
|
|
87
|
+
.get("/price-schedules", async (c) => c.json(await pricingService.listPriceSchedules(c.get("db"), await parseQuery(c, priceScheduleListQuerySchema))))
|
|
88
|
+
.post("/price-schedules", async (c) => c.json({
|
|
89
|
+
data: await pricingService.createPriceSchedule(c.get("db"), await parseJsonBody(c, insertPriceScheduleSchema)),
|
|
90
|
+
}, 201))
|
|
91
|
+
.get("/price-schedules/:id", async (c) => {
|
|
92
|
+
const row = await pricingService.getPriceScheduleById(c.get("db"), c.req.param("id"));
|
|
93
|
+
return row ? c.json({ data: row }) : notFound(c, "Price schedule not found");
|
|
94
|
+
})
|
|
95
|
+
.patch("/price-schedules/:id", async (c) => {
|
|
96
|
+
const row = await pricingService.updatePriceSchedule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updatePriceScheduleSchema));
|
|
97
|
+
return row ? c.json({ data: row }) : notFound(c, "Price schedule not found");
|
|
98
|
+
})
|
|
99
|
+
.delete("/price-schedules/:id", async (c) => {
|
|
100
|
+
const row = await pricingService.deletePriceSchedule(c.get("db"), c.req.param("id"));
|
|
101
|
+
return row ? c.json({ success: true }) : notFound(c, "Price schedule not found");
|
|
102
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type Env } from "./routes-shared.js";
|
|
2
|
+
export declare const publicPricingRoutes: import("hono/hono-base").HonoBase<Env, {
|
|
3
|
+
"/products/:productId/pricing": {
|
|
4
|
+
$get: {
|
|
5
|
+
input: {
|
|
6
|
+
param: {
|
|
7
|
+
productId: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
output: {
|
|
11
|
+
error: string;
|
|
12
|
+
};
|
|
13
|
+
outputFormat: "json";
|
|
14
|
+
status: 404;
|
|
15
|
+
} | {
|
|
16
|
+
input: {
|
|
17
|
+
param: {
|
|
18
|
+
productId: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
output: {
|
|
22
|
+
data: {
|
|
23
|
+
productId: string;
|
|
24
|
+
catalog: {
|
|
25
|
+
currencyCode: string;
|
|
26
|
+
id: string;
|
|
27
|
+
code: string;
|
|
28
|
+
name: string;
|
|
29
|
+
};
|
|
30
|
+
options: {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description: string | null;
|
|
34
|
+
status: string;
|
|
35
|
+
isDefault: boolean;
|
|
36
|
+
bookingMode: string;
|
|
37
|
+
capacityMode: string;
|
|
38
|
+
pricingRules: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description: string | null;
|
|
42
|
+
pricingMode: "on_request" | "per_person" | "per_booking" | "starting_from" | "free";
|
|
43
|
+
baseSellAmountCents: number | null;
|
|
44
|
+
minPerBooking: number | null;
|
|
45
|
+
maxPerBooking: number | null;
|
|
46
|
+
isDefault: boolean;
|
|
47
|
+
cancellationPolicyId: string | null;
|
|
48
|
+
unitPrices: {
|
|
49
|
+
id: string;
|
|
50
|
+
unitId: string;
|
|
51
|
+
unitName: string;
|
|
52
|
+
unitType: string;
|
|
53
|
+
pricingMode: "on_request" | "per_person" | "per_booking" | "free" | "per_unit" | "included";
|
|
54
|
+
sellAmountCents: number | null;
|
|
55
|
+
minQuantity: number | null;
|
|
56
|
+
maxQuantity: number | null;
|
|
57
|
+
pricingCategoryId: string | null;
|
|
58
|
+
sortOrder: number;
|
|
59
|
+
tiers: {
|
|
60
|
+
id: string;
|
|
61
|
+
minQuantity: number;
|
|
62
|
+
maxQuantity: number | null;
|
|
63
|
+
sellAmountCents: number | null;
|
|
64
|
+
sortOrder: number;
|
|
65
|
+
}[];
|
|
66
|
+
}[];
|
|
67
|
+
startTimeAdjustments: {
|
|
68
|
+
id: string;
|
|
69
|
+
startTimeId: string;
|
|
70
|
+
label: string | null;
|
|
71
|
+
startTimeLocal: string;
|
|
72
|
+
ruleMode: string;
|
|
73
|
+
adjustmentType: string | null;
|
|
74
|
+
sellAdjustmentCents: number | null;
|
|
75
|
+
adjustmentBasisPoints: number | null;
|
|
76
|
+
}[];
|
|
77
|
+
}[];
|
|
78
|
+
}[];
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
outputFormat: "json";
|
|
82
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
} & {
|
|
86
|
+
"/products/:productId/availability": {
|
|
87
|
+
$get: {
|
|
88
|
+
input: {
|
|
89
|
+
param: {
|
|
90
|
+
productId: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
output: {
|
|
94
|
+
error: string;
|
|
95
|
+
};
|
|
96
|
+
outputFormat: "json";
|
|
97
|
+
status: 404;
|
|
98
|
+
} | {
|
|
99
|
+
input: {
|
|
100
|
+
param: {
|
|
101
|
+
productId: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
output: {
|
|
105
|
+
productId: string;
|
|
106
|
+
slots: {
|
|
107
|
+
id: string;
|
|
108
|
+
optionId: string | null;
|
|
109
|
+
dateLocal: string | null;
|
|
110
|
+
startsAt: string | null;
|
|
111
|
+
endsAt: string | null;
|
|
112
|
+
timezone: string;
|
|
113
|
+
status: string;
|
|
114
|
+
unlimited: boolean;
|
|
115
|
+
remainingPax: number | null;
|
|
116
|
+
remainingResources: number | null;
|
|
117
|
+
pastCutoff: boolean;
|
|
118
|
+
tooEarly: boolean;
|
|
119
|
+
startTime: {
|
|
120
|
+
id: string;
|
|
121
|
+
label: string | null;
|
|
122
|
+
startTimeLocal: string;
|
|
123
|
+
durationMinutes: number | null;
|
|
124
|
+
} | null;
|
|
125
|
+
}[];
|
|
126
|
+
total: number;
|
|
127
|
+
limit: number;
|
|
128
|
+
offset: number;
|
|
129
|
+
};
|
|
130
|
+
outputFormat: "json";
|
|
131
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
}, "/", "/products/:productId/availability">;
|
|
135
|
+
export type PublicPricingRoutes = typeof publicPricingRoutes;
|
|
136
|
+
//# sourceMappingURL=routes-public.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes-public.d.ts","sourceRoot":"","sources":["../../src/pricing/routes-public.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAY,MAAM,oBAAoB,CAAA;AAOvD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CAkB5B,CAAA;AAEJ,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { parseQuery } from "@voyant-travel/hono";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { notFound } from "./routes-shared.js";
|
|
4
|
+
import { publicPricingService } from "./service-public.js";
|
|
5
|
+
import { publicAvailabilitySnapshotQuerySchema, publicProductPricingQuerySchema, } from "./validation-public.js";
|
|
6
|
+
export const publicPricingRoutes = new Hono()
|
|
7
|
+
.get("/products/:productId/pricing", async (c) => {
|
|
8
|
+
const snapshot = await publicPricingService.getProductPricingSnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicProductPricingQuerySchema));
|
|
9
|
+
return snapshot ? c.json({ data: snapshot }) : notFound(c, "Public pricing snapshot not found");
|
|
10
|
+
})
|
|
11
|
+
.get("/products/:productId/availability", async (c) => {
|
|
12
|
+
const snapshot = await publicPricingService.getAvailabilitySnapshot(c.get("db"), c.req.param("productId"), parseQuery(c, publicAvailabilitySnapshotQuerySchema));
|
|
13
|
+
return snapshot ? c.json(snapshot) : notFound(c, "Public availability snapshot not found");
|
|
14
|
+
});
|