@hello-bill/node 1.0.3 → 2.0.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/express/index.d.cts +2 -2
- package/dist/express/index.d.ts +2 -2
- package/dist/express/index.js +41 -6
- package/dist/express/index.js.map +1 -1
- package/dist/express/index.mjs +41 -6
- package/dist/express/index.mjs.map +1 -1
- package/dist/hono/index.d.cts +2 -2
- package/dist/hono/index.d.ts +2 -2
- package/dist/hono/index.js +40 -15
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/index.mjs +40 -15
- package/dist/hono/index.mjs.map +1 -1
- package/dist/{index-BrfG82zs.d.cts → index-D81ftBQo.d.ts} +16 -4
- package/dist/{index-EXetQn1f.d.ts → index-lPvEf5hZ.d.cts} +16 -4
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -6
- package/dist/index.mjs.map +1 -1
- package/dist/koa/index.d.cts +2 -2
- package/dist/koa/index.d.ts +2 -2
- package/dist/koa/index.js +40 -14
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/index.mjs +40 -14
- package/dist/koa/index.mjs.map +1 -1
- package/dist/next/index.d.cts +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +31 -7
- package/dist/next/index.js.map +1 -1
- package/dist/next/index.mjs +31 -7
- package/dist/next/index.mjs.map +1 -1
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/webhook/index.d.cts +2 -2
- package/dist/webhook/index.d.ts +2 -2
- package/dist/webhook/index.js +14 -2
- package/dist/webhook/index.js.map +1 -1
- package/dist/webhook/index.mjs +14 -3
- package/dist/webhook/index.mjs.map +1 -1
- package/dist/{webhooks-DPpqf7d2.d.cts → webhooks-Cv4e8oXp.d.cts} +3 -2
- package/dist/{webhooks-DPpqf7d2.d.ts → webhooks-Cv4e8oXp.d.ts} +3 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aO as WebhookEvent, aC as SessionEmbedOpened, aB as SessionDetailsConfirmed, aE as SessionProductsSelected, aD as SessionLoaSigned, ay as SessionAccountCreated, aA as SessionAppInstalled, az as SessionAppDeferred, aJ as SubscriptionChanged, aG as SetupStatusChanged, a5 as MoveOutNotificationSent, a4 as MoveOutNotificationFailed, m as BankDetailsCollected, S as SessionPayload } from './webhooks-
|
|
1
|
+
import { aO as WebhookEvent, aC as SessionEmbedOpened, aB as SessionDetailsConfirmed, aE as SessionProductsSelected, aD as SessionLoaSigned, ay as SessionAccountCreated, aA as SessionAppInstalled, az as SessionAppDeferred, aJ as SubscriptionChanged, aG as SetupStatusChanged, a5 as MoveOutNotificationSent, a4 as MoveOutNotificationFailed, m as BankDetailsCollected, S as SessionPayload } from './webhooks-Cv4e8oXp.cjs';
|
|
2
2
|
|
|
3
3
|
interface TokenStorage {
|
|
4
4
|
get(clientId: string): Promise<{
|
|
@@ -200,6 +200,16 @@ interface WebhookHandlerOptions {
|
|
|
200
200
|
*/
|
|
201
201
|
now?: () => number;
|
|
202
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Thrown by `assertNever` when an event arrives whose `type` is not in the
|
|
205
|
+
* known union — typically a newer platform event that this SDK version does
|
|
206
|
+
* not yet handle. The `code` discriminator lets partners identify this class
|
|
207
|
+
* of error in log aggregation without an `instanceof` check.
|
|
208
|
+
*/
|
|
209
|
+
declare class UnknownWebhookEventError extends Error {
|
|
210
|
+
readonly code: "webhook.unknown_event_type";
|
|
211
|
+
constructor(eventType: string);
|
|
212
|
+
}
|
|
203
213
|
/**
|
|
204
214
|
* Creates the framework-agnostic webhook receive handler. Returns a function
|
|
205
215
|
* matching the same `HellobillRequest`/`HellobillResponse` shape used by the
|
|
@@ -323,11 +333,13 @@ interface HellobillHandlerSet {
|
|
|
323
333
|
*/
|
|
324
334
|
savingsSummary: (req: HellobillRequest, res: HellobillResponse) => Promise<void>;
|
|
325
335
|
/**
|
|
326
|
-
* Proxies GET /partner/sessions/:id/
|
|
336
|
+
* Proxies GET /partner/sessions/:id/service-slots.
|
|
327
337
|
* Reads session_id from req.query.session_id or req.params.id.
|
|
338
|
+
* Reads service (required) and provider (optional, defaults to 'any_van') from req.query.
|
|
339
|
+
* Returns 400 if service is missing.
|
|
328
340
|
* Scoped to the partner's access_token — no session_token required.
|
|
329
341
|
*/
|
|
330
|
-
|
|
342
|
+
serviceSlots: (req: HellobillRequest, res: HellobillResponse) => Promise<void>;
|
|
331
343
|
/**
|
|
332
344
|
* Optional webhook receiver. Present only when `opts.webhook` is supplied to
|
|
333
345
|
* `createHellobillHandler`. The Express adapter mounts POST /webhooks when
|
|
@@ -338,4 +350,4 @@ interface HellobillHandlerSet {
|
|
|
338
350
|
|
|
339
351
|
declare function createHellobillHandler(opts: CreateHellobillHandlerOptions): HellobillHandlerSet;
|
|
340
352
|
|
|
341
|
-
export { type CreateHellobillHandlerOptions as C, type HellobillHandlerSet as H, InMemoryTokenStorage as I, type Logger as L, type TokenStorage as T, type VerifyWebhookOptions as V, type WebhookDedupeStore as W, type HellobillRequest as a, type HellobillResponse as b, InMemoryWebhookDedupeStore as c, TokenManager as d, type TokenManagerOptions as e, type WebhookHandlerContext as f, type WebhookHandlerOptions as g, type WebhookHandlers as h, WebhookVerificationError as i, createHellobillHandler as j, createWebhookHandler as k, verifyWebhookSignature as l, verifyWebhook as v };
|
|
353
|
+
export { type CreateHellobillHandlerOptions as C, type HellobillHandlerSet as H, InMemoryTokenStorage as I, type Logger as L, type TokenStorage as T, UnknownWebhookEventError as U, type VerifyWebhookOptions as V, type WebhookDedupeStore as W, type HellobillRequest as a, type HellobillResponse as b, InMemoryWebhookDedupeStore as c, TokenManager as d, type TokenManagerOptions as e, type WebhookHandlerContext as f, type WebhookHandlerOptions as g, type WebhookHandlers as h, WebhookVerificationError as i, createHellobillHandler as j, createWebhookHandler as k, verifyWebhookSignature as l, verifyWebhook as v };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as TokenStorage, L as Logger } from './index-
|
|
2
|
-
export { C as CreateHellobillHandlerOptions, H as HellobillHandlerSet, a as HellobillRequest, b as HellobillResponse, I as InMemoryTokenStorage, c as InMemoryWebhookDedupeStore, d as TokenManager, e as TokenManagerOptions, V as VerifyWebhookOptions, W as WebhookDedupeStore, f as WebhookHandlerContext, g as WebhookHandlerOptions, h as WebhookHandlers, i as WebhookVerificationError, j as createHellobillHandler, k as createWebhookHandler, v as verifyWebhook, l as verifyWebhookSignature } from './index-
|
|
3
|
-
import { R as RequestId, S as SessionPayload, a as SessionResponse, b as SessionGetResponse, P as ProductsQuery, c as ProductsResponse, d as PropertyDetailResponse, L as LoaListResponse, C as CreateCustomerInput, e as CustomerCreateResponse, f as CustomerId, g as CustomerStatusResponse, B as BankDetailsRequest, h as BankDetailsResponse } from './webhooks-
|
|
4
|
-
export { A as Address, i as AddressObject, j as AddressesObject, k as ApiVersion, l as AppDeeplinks, m as BankDetailsCollected, n as BankDetailsConsent, o as BankDetailsObject, p as BankDetailsStatus, q as BillType, r as BreakdownCoverProduct, s as BroadbandProduct, t as BuildingStyle, u as BuildingType, v as CacheStatus, w as ClientMode, x as Consent, y as ContextEntry, z as CouncilTaxProduct, D as Customer, E as CustomerType, F as DataCompleteness, G as DiscoveryStatus, H as Email, I as EnergyProduct, J as Environment, K as EpcRating, M as FinalRead, N as FuelType, O as HeatingType, Q as HomeInsuranceProduct, T as IdempotencyKey, U as IsoDate, V as IsoDateTime, W as LoASignature, X as LoaId, Y as LoaRecord, Z as LocationRole, _ as MaskedSortCode, $ as Meters, a0 as MobileProduct, a1 as MoveIn, a2 as MoveObject, a3 as MoveOut, a4 as MoveOutNotificationFailed, a5 as MoveOutNotificationSent, a6 as MoveOutNotifyFlags, a7 as MoveOutReason, a8 as MoveOutStatus, a9 as NearbyPoi, aa as OccupantObject, ab as OccupantType, ac as OnboardingInfo, ad as OverallStatus, ae as Paginated, af as Person, ag as PhoneNumber, ah as Postcode, ai as Product, aj as ProductBase, ak as ProductCategory, al as ProductConfidence, am as ProductId, an as ProductSetup, ao as PropertyDetailObject, ap as PropertyLocation, aq as PropertyObject, ar as PropertyType, as as PropertyTypeCode, at as PropertyTypeSubcode, au as ProvidedFieldPath, av as SESSION_IDEMPOTENCY_TTL_MS, aw as SavingsSummaryResponse, ax as SelectedProduct, ay as SessionAccountCreated, az as SessionAppDeferred, aA as SessionAppInstalled, aB as SessionDetailsConfirmed, aC as SessionEmbedOpened, aD as SessionLoaSigned, aE as SessionProductsSelected, aF as SetupStatus, aG as SetupStatusChanged, aH as SignatureImage, aI as StoredBankDetails, aJ as SubscriptionChanged, aK as SubscriptionStatus, aL as TvLicenceProduct, aM as Url, aN as WaterProduct, aO as WebhookEvent, aP as WebhookEventBase, aQ as WebhookEventId, aR as WebhookEventType } from './webhooks-
|
|
1
|
+
import { T as TokenStorage, L as Logger } from './index-lPvEf5hZ.cjs';
|
|
2
|
+
export { C as CreateHellobillHandlerOptions, H as HellobillHandlerSet, a as HellobillRequest, b as HellobillResponse, I as InMemoryTokenStorage, c as InMemoryWebhookDedupeStore, d as TokenManager, e as TokenManagerOptions, U as UnknownWebhookEventError, V as VerifyWebhookOptions, W as WebhookDedupeStore, f as WebhookHandlerContext, g as WebhookHandlerOptions, h as WebhookHandlers, i as WebhookVerificationError, j as createHellobillHandler, k as createWebhookHandler, v as verifyWebhook, l as verifyWebhookSignature } from './index-lPvEf5hZ.cjs';
|
|
3
|
+
import { R as RequestId, S as SessionPayload, a as SessionResponse, b as SessionGetResponse, P as ProductsQuery, c as ProductsResponse, d as PropertyDetailResponse, L as LoaListResponse, C as CreateCustomerInput, e as CustomerCreateResponse, f as CustomerId, g as CustomerStatusResponse, B as BankDetailsRequest, h as BankDetailsResponse } from './webhooks-Cv4e8oXp.cjs';
|
|
4
|
+
export { A as Address, i as AddressObject, j as AddressesObject, k as ApiVersion, l as AppDeeplinks, m as BankDetailsCollected, n as BankDetailsConsent, o as BankDetailsObject, p as BankDetailsStatus, q as BillType, r as BreakdownCoverProduct, s as BroadbandProduct, t as BuildingStyle, u as BuildingType, v as CacheStatus, w as ClientMode, x as Consent, y as ContextEntry, z as CouncilTaxProduct, D as Customer, E as CustomerType, F as DataCompleteness, G as DiscoveryStatus, H as Email, I as EnergyProduct, J as Environment, K as EpcRating, M as FinalRead, N as FuelType, O as HeatingType, Q as HomeInsuranceProduct, T as IdempotencyKey, U as IsoDate, V as IsoDateTime, W as LoASignature, X as LoaId, Y as LoaRecord, Z as LocationRole, _ as MaskedSortCode, $ as Meters, a0 as MobileProduct, a1 as MoveIn, a2 as MoveObject, a3 as MoveOut, a4 as MoveOutNotificationFailed, a5 as MoveOutNotificationSent, a6 as MoveOutNotifyFlags, a7 as MoveOutReason, a8 as MoveOutStatus, a9 as NearbyPoi, aa as OccupantObject, ab as OccupantType, ac as OnboardingInfo, ad as OverallStatus, ae as Paginated, af as Person, ag as PhoneNumber, ah as Postcode, ai as Product, aj as ProductBase, ak as ProductCategory, al as ProductConfidence, am as ProductId, an as ProductSetup, ao as PropertyDetailObject, ap as PropertyLocation, aq as PropertyObject, ar as PropertyType, as as PropertyTypeCode, at as PropertyTypeSubcode, au as ProvidedFieldPath, av as SESSION_IDEMPOTENCY_TTL_MS, aw as SavingsSummaryResponse, ax as SelectedProduct, ay as SessionAccountCreated, az as SessionAppDeferred, aA as SessionAppInstalled, aB as SessionDetailsConfirmed, aC as SessionEmbedOpened, aD as SessionLoaSigned, aE as SessionProductsSelected, aF as SetupStatus, aG as SetupStatusChanged, aH as SignatureImage, aI as StoredBankDetails, aJ as SubscriptionChanged, aK as SubscriptionStatus, aL as TvLicenceProduct, aM as Url, aN as WaterProduct, aO as WebhookEvent, aP as WebhookEventBase, aQ as WebhookEventId, aR as WebhookEventType } from './webhooks-Cv4e8oXp.cjs';
|
|
5
5
|
import { ErrorEnvelope } from './types/index.cjs';
|
|
6
6
|
export { AnyvanSlot, AnyvanSlotsResponse, ErrorCode, ErrorType, RETRYABLE_HTTP_STATUSES } from './types/index.cjs';
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as TokenStorage, L as Logger } from './index-
|
|
2
|
-
export { C as CreateHellobillHandlerOptions, H as HellobillHandlerSet, a as HellobillRequest, b as HellobillResponse, I as InMemoryTokenStorage, c as InMemoryWebhookDedupeStore, d as TokenManager, e as TokenManagerOptions, V as VerifyWebhookOptions, W as WebhookDedupeStore, f as WebhookHandlerContext, g as WebhookHandlerOptions, h as WebhookHandlers, i as WebhookVerificationError, j as createHellobillHandler, k as createWebhookHandler, v as verifyWebhook, l as verifyWebhookSignature } from './index-
|
|
3
|
-
import { R as RequestId, S as SessionPayload, a as SessionResponse, b as SessionGetResponse, P as ProductsQuery, c as ProductsResponse, d as PropertyDetailResponse, L as LoaListResponse, C as CreateCustomerInput, e as CustomerCreateResponse, f as CustomerId, g as CustomerStatusResponse, B as BankDetailsRequest, h as BankDetailsResponse } from './webhooks-
|
|
4
|
-
export { A as Address, i as AddressObject, j as AddressesObject, k as ApiVersion, l as AppDeeplinks, m as BankDetailsCollected, n as BankDetailsConsent, o as BankDetailsObject, p as BankDetailsStatus, q as BillType, r as BreakdownCoverProduct, s as BroadbandProduct, t as BuildingStyle, u as BuildingType, v as CacheStatus, w as ClientMode, x as Consent, y as ContextEntry, z as CouncilTaxProduct, D as Customer, E as CustomerType, F as DataCompleteness, G as DiscoveryStatus, H as Email, I as EnergyProduct, J as Environment, K as EpcRating, M as FinalRead, N as FuelType, O as HeatingType, Q as HomeInsuranceProduct, T as IdempotencyKey, U as IsoDate, V as IsoDateTime, W as LoASignature, X as LoaId, Y as LoaRecord, Z as LocationRole, _ as MaskedSortCode, $ as Meters, a0 as MobileProduct, a1 as MoveIn, a2 as MoveObject, a3 as MoveOut, a4 as MoveOutNotificationFailed, a5 as MoveOutNotificationSent, a6 as MoveOutNotifyFlags, a7 as MoveOutReason, a8 as MoveOutStatus, a9 as NearbyPoi, aa as OccupantObject, ab as OccupantType, ac as OnboardingInfo, ad as OverallStatus, ae as Paginated, af as Person, ag as PhoneNumber, ah as Postcode, ai as Product, aj as ProductBase, ak as ProductCategory, al as ProductConfidence, am as ProductId, an as ProductSetup, ao as PropertyDetailObject, ap as PropertyLocation, aq as PropertyObject, ar as PropertyType, as as PropertyTypeCode, at as PropertyTypeSubcode, au as ProvidedFieldPath, av as SESSION_IDEMPOTENCY_TTL_MS, aw as SavingsSummaryResponse, ax as SelectedProduct, ay as SessionAccountCreated, az as SessionAppDeferred, aA as SessionAppInstalled, aB as SessionDetailsConfirmed, aC as SessionEmbedOpened, aD as SessionLoaSigned, aE as SessionProductsSelected, aF as SetupStatus, aG as SetupStatusChanged, aH as SignatureImage, aI as StoredBankDetails, aJ as SubscriptionChanged, aK as SubscriptionStatus, aL as TvLicenceProduct, aM as Url, aN as WaterProduct, aO as WebhookEvent, aP as WebhookEventBase, aQ as WebhookEventId, aR as WebhookEventType } from './webhooks-
|
|
1
|
+
import { T as TokenStorage, L as Logger } from './index-D81ftBQo.js';
|
|
2
|
+
export { C as CreateHellobillHandlerOptions, H as HellobillHandlerSet, a as HellobillRequest, b as HellobillResponse, I as InMemoryTokenStorage, c as InMemoryWebhookDedupeStore, d as TokenManager, e as TokenManagerOptions, U as UnknownWebhookEventError, V as VerifyWebhookOptions, W as WebhookDedupeStore, f as WebhookHandlerContext, g as WebhookHandlerOptions, h as WebhookHandlers, i as WebhookVerificationError, j as createHellobillHandler, k as createWebhookHandler, v as verifyWebhook, l as verifyWebhookSignature } from './index-D81ftBQo.js';
|
|
3
|
+
import { R as RequestId, S as SessionPayload, a as SessionResponse, b as SessionGetResponse, P as ProductsQuery, c as ProductsResponse, d as PropertyDetailResponse, L as LoaListResponse, C as CreateCustomerInput, e as CustomerCreateResponse, f as CustomerId, g as CustomerStatusResponse, B as BankDetailsRequest, h as BankDetailsResponse } from './webhooks-Cv4e8oXp.js';
|
|
4
|
+
export { A as Address, i as AddressObject, j as AddressesObject, k as ApiVersion, l as AppDeeplinks, m as BankDetailsCollected, n as BankDetailsConsent, o as BankDetailsObject, p as BankDetailsStatus, q as BillType, r as BreakdownCoverProduct, s as BroadbandProduct, t as BuildingStyle, u as BuildingType, v as CacheStatus, w as ClientMode, x as Consent, y as ContextEntry, z as CouncilTaxProduct, D as Customer, E as CustomerType, F as DataCompleteness, G as DiscoveryStatus, H as Email, I as EnergyProduct, J as Environment, K as EpcRating, M as FinalRead, N as FuelType, O as HeatingType, Q as HomeInsuranceProduct, T as IdempotencyKey, U as IsoDate, V as IsoDateTime, W as LoASignature, X as LoaId, Y as LoaRecord, Z as LocationRole, _ as MaskedSortCode, $ as Meters, a0 as MobileProduct, a1 as MoveIn, a2 as MoveObject, a3 as MoveOut, a4 as MoveOutNotificationFailed, a5 as MoveOutNotificationSent, a6 as MoveOutNotifyFlags, a7 as MoveOutReason, a8 as MoveOutStatus, a9 as NearbyPoi, aa as OccupantObject, ab as OccupantType, ac as OnboardingInfo, ad as OverallStatus, ae as Paginated, af as Person, ag as PhoneNumber, ah as Postcode, ai as Product, aj as ProductBase, ak as ProductCategory, al as ProductConfidence, am as ProductId, an as ProductSetup, ao as PropertyDetailObject, ap as PropertyLocation, aq as PropertyObject, ar as PropertyType, as as PropertyTypeCode, at as PropertyTypeSubcode, au as ProvidedFieldPath, av as SESSION_IDEMPOTENCY_TTL_MS, aw as SavingsSummaryResponse, ax as SelectedProduct, ay as SessionAccountCreated, az as SessionAppDeferred, aA as SessionAppInstalled, aB as SessionDetailsConfirmed, aC as SessionEmbedOpened, aD as SessionLoaSigned, aE as SessionProductsSelected, aF as SetupStatus, aG as SetupStatusChanged, aH as SignatureImage, aI as StoredBankDetails, aJ as SubscriptionChanged, aK as SubscriptionStatus, aL as TvLicenceProduct, aM as Url, aN as WaterProduct, aO as WebhookEvent, aP as WebhookEventBase, aQ as WebhookEventId, aR as WebhookEventType } from './webhooks-Cv4e8oXp.js';
|
|
5
5
|
import { ErrorEnvelope } from './types/index.js';
|
|
6
6
|
export { AnyvanSlot, AnyvanSlotsResponse, ErrorCode, ErrorType, RETRYABLE_HTTP_STATUSES } from './types/index.js';
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -432,8 +432,16 @@ var InMemoryWebhookDedupeStore = class {
|
|
|
432
432
|
};
|
|
433
433
|
|
|
434
434
|
// src/webhook/handler.ts
|
|
435
|
+
var UnknownWebhookEventError = class extends Error {
|
|
436
|
+
code = "webhook.unknown_event_type";
|
|
437
|
+
constructor(eventType) {
|
|
438
|
+
super(`Unhandled webhook event type: ${eventType}`);
|
|
439
|
+
this.name = "UnknownWebhookEventError";
|
|
440
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
435
443
|
function assertNever(x) {
|
|
436
|
-
throw new
|
|
444
|
+
throw new UnknownWebhookEventError(x.type ?? JSON.stringify(x));
|
|
437
445
|
}
|
|
438
446
|
var noopLogger = {
|
|
439
447
|
debug: () => {
|
|
@@ -598,7 +606,10 @@ function createWebhookHandler(opts) {
|
|
|
598
606
|
safeLogger.error("hellobill.webhook.handler_error", {
|
|
599
607
|
event_id: event.id,
|
|
600
608
|
event_type: event.type,
|
|
601
|
-
message: err.message
|
|
609
|
+
message: err.message,
|
|
610
|
+
// Include the typed error code when present so partners can identify
|
|
611
|
+
// known error classes (e.g. unknown event type) in log aggregation.
|
|
612
|
+
...err != null && typeof err === "object" && "code" in err ? { code: err.code } : {}
|
|
602
613
|
});
|
|
603
614
|
});
|
|
604
615
|
};
|
|
@@ -937,16 +948,25 @@ function createHellobillHandler(opts) {
|
|
|
937
948
|
if (!result2) return;
|
|
938
949
|
passthroughUpstream(res, result2.status, result2.body, result2.requestId, result2.headers);
|
|
939
950
|
};
|
|
940
|
-
const
|
|
951
|
+
const serviceSlots = async (req, res) => {
|
|
941
952
|
const rawSession = req.query.session_id ?? req.params?.id;
|
|
942
953
|
const sessionId = Array.isArray(rawSession) ? rawSession[0] : rawSession;
|
|
943
954
|
if (!sessionId) {
|
|
944
955
|
sendError(res, 400, "validation.missing_required_field", "session_id query parameter required");
|
|
945
956
|
return;
|
|
946
957
|
}
|
|
958
|
+
const rawService = req.query.service;
|
|
959
|
+
const service = Array.isArray(rawService) ? rawService[0] : rawService;
|
|
960
|
+
if (!service) {
|
|
961
|
+
sendError(res, 400, "validation.missing_required_field", "service query parameter required");
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
const rawProvider = req.query.provider;
|
|
965
|
+
const providerRaw = Array.isArray(rawProvider) ? rawProvider[0] : rawProvider;
|
|
966
|
+
const provider = typeof providerRaw === "string" && providerRaw.trim().length > 0 ? providerRaw.trim() : "any_van";
|
|
947
967
|
const result2 = await safeCallUpstream(res, {
|
|
948
968
|
method: "GET",
|
|
949
|
-
path: `/partner/sessions/${encodeURIComponent(sessionId)}/
|
|
969
|
+
path: `/partner/sessions/${encodeURIComponent(sessionId)}/service-slots?service=${encodeURIComponent(service)}&provider=${encodeURIComponent(provider)}`,
|
|
950
970
|
logger
|
|
951
971
|
});
|
|
952
972
|
if (!result2) return;
|
|
@@ -963,7 +983,7 @@ function createHellobillHandler(opts) {
|
|
|
963
983
|
property,
|
|
964
984
|
sessions: { list: sessionsList, get: sessionsGet },
|
|
965
985
|
savingsSummary,
|
|
966
|
-
|
|
986
|
+
serviceSlots
|
|
967
987
|
};
|
|
968
988
|
if (webhookHandler !== void 0) {
|
|
969
989
|
result.webhook = webhookHandler;
|
|
@@ -1166,6 +1186,7 @@ exports.HellobillApiError = HellobillApiError;
|
|
|
1166
1186
|
exports.InMemoryTokenStorage = InMemoryTokenStorage;
|
|
1167
1187
|
exports.InMemoryWebhookDedupeStore = InMemoryWebhookDedupeStore;
|
|
1168
1188
|
exports.TokenManager = TokenManager;
|
|
1189
|
+
exports.UnknownWebhookEventError = UnknownWebhookEventError;
|
|
1169
1190
|
exports.WebhookVerificationError = WebhookVerificationError;
|
|
1170
1191
|
exports.buildOnboardingInfo = buildOnboardingInfo;
|
|
1171
1192
|
exports.createHellobillHandler = createHellobillHandler;
|