@dv4resi/dvss-backend-module-offering-im 0.0.4 → 0.0.6
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/README.md +53 -79
- package/dist/index.d.ts +418 -18
- package/dist/index.js +712 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/app.service.ts","../src/app.controller.ts","../../../packages/dvss-integration-trybe/src/load-env.ts","../../../packages/dvss-integration-trybe/src/app.service.ts","../../../packages/dvss-integration-trybe/src/app.controller.ts","../../../packages/dvss-integration-libs/src/load-env.ts","../../../packages/dvss-integration-libs/src/app.service.ts","../../../packages/dvss-integration-libs/src/app.controller.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/logging/request-logger.service.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/rate-limiter/rate-limiter.service.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/constants/http.constant.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/gateway/traffic-gateway.service.ts","../../../packages/dvss-integration-libs/src/app.module.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/constants/traffic-router.constant.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/auth/auth.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/wellness/appointment-booking.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/credit-management/credit-booking.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/customer-management/customer-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/package-management/package-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/contact-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/credit-note-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/customer-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/customer-payment-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/invoice-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/loa-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/tax-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/payment.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/payment-method-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/user-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/membership/subcapabilities/customer-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/membership/subcapabilities/membership-management.base.ts","../../../packages/dvss-integration-libs/src/integration-common-utils/models/credit-management.model.ts","../../../packages/dvss-integration-libs/src/integration-common-utils/models/capability-integration.model.ts","../../../packages/dvss-integration-trybe/src/capabilities/customer-management/customer-management.service.ts","../../../packages/dvss-integration-trybe/src/utils/auth/auth.service.ts","../../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.mapper.ts","../../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.service.ts","../../../packages/dvss-integration-trybe/src/app.module.ts","../../../packages/dvss-integration-trybe/src/capabilities/package-management/package-management.service.ts","../../../packages/dvss-integration-trybe/src/capabilities/wellness/appointment-booking.service.ts","../src/app.module.ts"],"names":["AppService","getHello","AppController","appService","rootEnvPath","resolve","__dirname","config","path","console","log","name","IntegrationRequestLoggerService","className","logger","logRequest","logData","loggedInUserId","method","url","headers","requestBody","info","SYSTEM_USER_ID","integrationId","sanitizeHeaders","timestamp","Date","logResponse","statusCode","duration","responseBody","logError","error","logIntegrationRequest","undefined","sanitized","sensitiveKeys","key","Object","keys","includes","toLowerCase","RateLimiterService","validateAndEnforceRateLimit","HTTP_METHOD","TrafficGatewayService","httpService","requestLogger","rateLimiter","executeIntegrationRequest","request","integration","_context","startTime","now","prepareHeaders","requestConfig","prepareRequestConfig","fullUrl","constructFullUrl","baseUrl","id","apiMethod","body","apiResponse","executeHttpRequest","responseData","data","status","errorDetails","extractErrorDetails","platformConfig","message","String","headerType","POST","PUT","PATCH","responseType","requestUrl","normalizedBaseUrl","endsWith","slice","normalizedRequestUrl","startsWith","GET","firstValueFrom","get","post","put","patch","DELETE","delete","Error","errorObject","response","AppModule","imports","ConfigModule","forRoot","envFilePath","isGlobal","HttpModule","LoggerModule","controllers","providers","exports","TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY","BaseAuth","BaseWellnessAppointmentBooking","BaseCreditBooking","BaseCustomerManagement","BasePackageManagement","BaseAccountingContactManagement","BaseAccountingCreditNoteManagement","BaseAccountingCustomerManagement","BaseAccountingCustomerPaymentManagement","BaseAccountingInvoiceManagement","BaseAccountingLOAManagement","BaseAccountingTaxManagement","BasePayment","BasePaymentMethodManagement","BasePaymentUserManagement","BaseMembershipCustomerManagement","BaseMembershipManagement","CREDIT_TYPE_ENUM","CREDIT_STATUS_ENUM","CREDIT_FILTER_BY_ENUM","INTEGRATION_PROVIDER_ENUM","TrybeCustomerManagement","fileName","trafficGatewayService","createCustomer","searchCustomer","email","customerId","length","updateCustomer","TrybeAuthService","trybeCustomerManagement","validateConfig","integrationConfig","apiKey","siteId","organisationId","Authorization","testIntegration","validatedIntegration","fetchAccessToken","mapStatus","t","redeemed_at","REDEEMED","revoked_at","REVOKED","expires_at","EXPIRED","ACTIVE","mapTrybeCreditsToSystem","res","groups","Map","coupon_name","issued_at","list","push","set","records","items","first","couponCodes","map","i","coupon_code","capabilityIntegrationId","projectId","description","coupon_description","type","COUPON","externalId","expiresAt","expiresDate","split","startsAt","startDate","value","meta","integrationDetails","customer_id","membershipId","membership_id","multiUse","multi_use","redeemedAt","revokedAt","totalCount","TrybeCreditBooking","trybeAuthService","fetchCustomerCredits","query","URLSearchParams","opts","options","page","count","statusFilterValues","filters","by","STATUS","values","queryString","toString","raw","IntegrationLibsModule","TrybePackageManagement","TrybeWellnessAppointmentBooking","IntegrationTrybeModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,aAAN,MAAMA;AAAAA,EAAAA;;;EACX,WAAA,GAAc;AAEd,EAAA;EAEAC,QAAAA,GAAmB;AACjB,IAAA,OAAO,cAAA;AACT,EAAA;AACF,CAAA;;;;;;;;;;;;;;;;;;;ACPO,IAAMC,gBAAN,MAAMA;AAAAA,EAAAA;;;;AACX,EAAA,WAAA,CAA6BC,UAAAA,EAAwB;SAAxBA,UAAAA,GAAAA,UAAAA;AAAyB,EAAA;EAGtDF,QAAAA,GAAmB;AACjB,IAAA,OAAO,IAAA,CAAKE,WAAWF,QAAAA,EAAQ;AACjC,EAAA;AACF,CAAA;;;;;;;;;;;;;;ACAA,IAAMG,WAAAA,GAAcC,YAAAA,CAAQC,SAAAA,EAAW,eAAA,CAAA;AACvCC,aAAAA,CAAO;EAAEC,IAAAA,EAAMJ;AAAY,CAAA,CAAA;;;;;;;;;;;;ACTpB,IAAMJ,cAAN,MAAMA;AAAAA,EAAAA;;;;;;EAIX,WAAA,GAAc;AAEd,EAAA;EAEAC,QAAAA,GAAmB;AACjBQ,IAAAA,OAAAA,CAAQC,GAAAA,CAAI,CAAA,EAAG,IAAA,CAAK,WAAA,CAAYC,IAAI,CAAA,UAAA,CAAY,CAAA;AAChD,IAAA,OAAO,cAAA;AACT,EAAA;AACF,CAAA;;;;;;;;;;;;;;;;;;;ACXO,IAAMT,iBAAN,MAAMA;AAAAA,EAAAA;;;;AACX,EAAA,WAAA,CAA6BC,UAAAA,EAAwB;SAAxBA,UAAAA,GAAAA,UAAAA;AAAyB,EAAA;EAGtDF,QAAAA,GAAmB;AACjB,IAAA,OAAO,IAAA,CAAKE,W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AqB7I,OAAOiE,cAAAA,CAAeX,OAAAA;AACpDzC,MAAAA,OAAAA,EAASgI,oBAAAA,CAAqBhI;AAChC,KAAA,EACAgI,sBACAnI,cAAAA,CAAAA;AAGJ,IAAA,OAAO8I,uBAAAA,CAAwBuD,KAAKlE,oBAAAA,CAAAA;AACtC,EAAA;AACF;;;;;;;;;;;;;;;;;;;ACzEanD,iCAAN,gBAAA,CAAMA;AAAAA,EAAAA;;;AAAW;;;IApBtBC,OAAAA,EAAS;;AAEPC,MAAAA,mBAAAA,CAAaC,OAAAA,CAAQ;QACnBC,WAAAA,EAAahG,YAAAA,CAAQC,WAAW,eAAA,CAAA;QAChCgG,QAAAA,EAAU;OAEZ,CAAA;AACAiH,MAAAA,6BAAAA;AACAhH,MAAAA,gBAAAA;AACAC,MAAAA;;IAEFC,WAAAA,EAAa;AAACvG,MAAAA;;IACdwG,SAAAA,EAAW;AACT1G,MAAAA,WAAAA;AACA2I,MAAAA,wBAAAA;AACAT,MAAAA,+BAAAA;AACAoE,MAAAA;;IAEF3F,OAAAA,EAAS;AAACgC,MAAAA,wBAAAA;AAAkBT,MAAAA,+BAAAA;AAAyBoE,MAAAA;;;;;;ACvBhD,IAAekB,yBAAf,MAAeA;EAVtB;;;AAkBA;;;ACRO,IAAeC,+BAAAA,GAAf,cAAuD3G,8BAAAA,CAAAA;EAV9D;;;AAkDA;;;;;;;;;;ACtCab,qCAAN,gBAAA,CAAMA;AAAAA,EAAAA;;;AAAW;;;IALtBC,OAAAA,EAAS;AAACwH,MAAAA,8BAAAA;AAAwBH,MAAAA;;IAClC9G,WAAAA,EAAa;AAACvG,MAAAA;;IACdwG,SAAAA,EAAW;AAAC1G,MAAAA,UAAAA;AAAY0N,MAAAA,8BAAAA;AAAwBH,MAAAA;;IAChD5G,OAAAA,EAAS;AAAC+G,MAAAA,8BAAAA;AAAwBH,MAAAA","file":"index.js","sourcesContent":["import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n constructor() {\n // Service initialization\n }\n\n getHello(): string {\n return 'Hello World!';\n }\n}\n","import { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service';\n\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n @Get('offering-im')\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","/**\n * Load environment variables from root .env file\n * This must be imported/required before any other modules that depend on environment variables\n * (e.g., @dv4resi/dvss-backend-module-utility checks env vars at module import time)\n */\nimport { config } from 'dotenv';\nimport { resolve } from 'path';\n\n// Resolve path to root .env file\n// From src/: ../../../\n// From dist/: ../../../\nconst rootEnvPath = resolve(__dirname, '../../../.env');\nconfig({ path: rootEnvPath });\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n /**\n * Creates an instance of the app service\n */\n constructor() {\n // Service initialization\n }\n\n getHello(): string {\n console.log(`${this.constructor.name}::getHello`);\n return 'Hello World!';\n }\n}\n","import { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service';\n\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n @Get('integration-trybe')\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","/**\n * Load environment variables from root .env file\n * This must be imported/required before any other modules that depend on environment variables\n * (e.g., @dv4resi/dvss-backend-module-utility checks env vars at module import time)\n */\nimport { config } from 'dotenv';\nimport { resolve } from 'path';\n\n// Resolve path to root .env file\n// From src/: ../../../\n// From dist/: ../../../\nconst rootEnvPath = resolve(__dirname, '../../../.env');\nconfig({ path: rootEnvPath });\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n getHello(): string {\n return 'Hello World!';\n }\n}\n","import { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service';\n\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n @Get('integration-libs')\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","import {\n LoggerService,\n SYSTEM_USER_ID,\n} from '@dv4resi/dvss-backend-module-utility';\nimport { Injectable } from '@nestjs/common';\n\n/**\n * Request logging data structure\n */\nexport interface IIntegrationRequestLog {\n integrationId?: bigint | string;\n method: string;\n url: string;\n headers?: Record<string, string>;\n requestBody?: unknown;\n responseBody?: unknown;\n statusCode?: number;\n duration?: number;\n loggedInUserId?: bigint;\n timestamp?: Date;\n error?: unknown;\n}\n\n/**\n * Service to expose the functionality to log integration requests\n * Uses LoggerService from @dv4resi/dvss-backend-module-utility\n */\n@Injectable()\nexport class IntegrationRequestLoggerService {\n private readonly className = IntegrationRequestLoggerService.name;\n\n constructor(private readonly logger: LoggerService) {}\n\n /**\n * Log integration request (before making the API call)\n *\n * @param logData - The request log data to be logged\n */\n logRequest(logData: IIntegrationRequestLog): void {\n const { loggedInUserId, method, url, headers, requestBody } = logData;\n\n this.logger.info(\n loggedInUserId || SYSTEM_USER_ID,\n this.logRequest.name,\n this.className,\n `Integration API Request: ${method} ${url}`,\n {\n integrationId: logData.integrationId,\n method,\n url,\n headers: this.sanitizeHeaders(headers),\n requestBody,\n timestamp: logData.timestamp || new Date(),\n },\n );\n }\n\n /**\n * Log integration response (after successful API call)\n *\n * @param logData - The response log data to be logged\n */\n logResponse(logData: IIntegrationRequestLog): void {\n const { loggedInUserId, method, url, statusCode, duration, responseBody } =\n logData;\n\n this.logger.info(\n loggedInUserId || SYSTEM_USER_ID,\n this.logResponse.name,\n this.className,\n `Integration API Response: ${method} ${url} - ${statusCode} (${duration}ms)`,\n {\n integrationId: logData.integrationId,\n method,\n url,\n statusCode,\n duration,\n responseBody,\n timestamp: logData.timestamp || new Date(),\n },\n );\n }\n\n /**\n * Log integration error (after failed API call)\n *\n * @param logData - The error log data to be logged\n */\n logError(logData: IIntegrationRequestLog): void {\n const { loggedInUserId, method, url, statusCode, duration, error } =\n logData;\n\n this.logger.error(\n loggedInUserId || SYSTEM_USER_ID,\n this.logError.name,\n this.className,\n `Integration API Error: ${method} ${url} - ${statusCode || 'N/A'} (${duration || 0}ms)`,\n {\n integrationId: logData.integrationId,\n method,\n url,\n statusCode,\n duration,\n error,\n timestamp: logData.timestamp || new Date(),\n },\n );\n }\n\n /**\n * Log integration request (legacy method for backward compatibility)\n * This method determines whether to log as request, response, or error based on the logData\n *\n * @param logData - The request log data to be logged\n */\n logIntegrationRequest(logData: IIntegrationRequestLog): void {\n if (logData.error) {\n this.logError(logData);\n } else if (logData.statusCode && logData.responseBody !== undefined) {\n this.logResponse(logData);\n } else {\n this.logRequest(logData);\n }\n }\n\n /**\n * Sanitize headers to remove sensitive information\n *\n * @param headers - The headers to sanitize\n * @returns Sanitized headers\n */\n private sanitizeHeaders(\n headers?: Record<string, string>,\n ): Record<string, string> | undefined {\n if (!headers) {\n return undefined;\n }\n\n const sanitized = { ...headers };\n const sensitiveKeys = [\n 'authorization',\n 'api-key',\n 'apikey',\n 'x-api-key',\n 'cookie',\n ];\n\n for (const key of Object.keys(sanitized)) {\n if (sensitiveKeys.includes(key.toLowerCase())) {\n sanitized[key] = '***REDACTED***';\n }\n }\n\n return sanitized;\n }\n}\n","import { Injectable } from '@nestjs/common';\n\n/**\n * Service to expose the functionality to validate and enforce rate limits\n */\n@Injectable()\nexport class RateLimiterService {\n /**\n * Validate and enforce rate limit\n *\n * @returns Promise resolving when the rate limit is validated and enforced\n */\n async validateAndEnforceRateLimit(): Promise<void> {\n // TODO Get the rate limit from the configuration store\n // TODO Validate the rate limit\n // TODO Enforce the rate limit\n // TODO If the rate limit is exceeded, throw an error\n // TODO If the rate limit is not exceeded, pass the request to the traffic gateway\n }\n}\n","/**\n * HTTP method constants\n */\nexport enum HTTP_METHOD {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n","import { HttpService } from '@nestjs/axios';\nimport { Injectable } from '@nestjs/common';\nimport { firstValueFrom } from 'rxjs';\nimport { HTTP_METHOD } from '../constants/http.constant';\nimport {\n IntegrationRequestLoggerService,\n type IIntegrationRequestLog,\n} from '../logging/request-logger.service';\nimport { RateLimiterService } from '../rate-limiter/rate-limiter.service';\nimport { IValidatedCapabilityIntegration } from '../../integration-common-utils';\n\n/**\n * Request configuration for API calls\n */\nexport interface IApiCallRequest<TBody = unknown> {\n apiMethod: HTTP_METHOD;\n url: string;\n baseUrl: string;\n headers?: Record<string, string>;\n body?: TBody;\n responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';\n headerType?: 'json' | 'xml';\n}\n\n/**\n * Request context for deriving rate limits and other settings\n */\nexport interface IIntegrationRequestContext {\n projectId?: bigint;\n propertyId?: bigint;\n capabilityId?: bigint;\n [key: string]: unknown;\n}\n\n/**\n * Service to expose the functionality to execute integration requests\n * This service provides a generic API call method that can be used for any third-party integration\n */\n@Injectable()\nexport class TrafficGatewayService {\n constructor(\n private readonly httpService: HttpService,\n private readonly requestLogger: IntegrationRequestLoggerService,\n private readonly rateLimiter: RateLimiterService,\n ) {}\n\n /**\n * Execute a generic API call to a third-party integration\n *\n * @template TResponse - The expected response type\n * @template TRequestBody - The request body type (optional)\n * @param request - The API call request configuration\n * @param integration - The integration configuration\n * @param loggedInUserId - Optional user ID for logging purposes\n * @param _context - Optional context for deriving rate limits and other settings (projectId, propertyId, etc.)\n * @returns Promise resolving to the API response data\n * @throws Error if the request fails or rate limit is exceeded\n */\n async executeIntegrationRequest<TResponse = unknown, TRequestBody = unknown>(\n request: IApiCallRequest<TRequestBody>,\n integration: IValidatedCapabilityIntegration,\n loggedInUserId?: bigint,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _context?: IIntegrationRequestContext,\n ): Promise<TResponse> {\n const startTime = Date.now();\n\n try {\n // Prepare headers with authorization\n const headers = this.prepareHeaders(request);\n\n // Prepare request configuration\n const requestConfig = this.prepareRequestConfig(request, headers);\n\n // Rate limiting check with context for deriving rate limits\n await this.rateLimiter.validateAndEnforceRateLimit();\n\n // Construct full URL with proper handling of trailing slashes\n const fullUrl = this.constructFullUrl(request.baseUrl, request.url);\n\n // Prepare log data with full URL and headers for request logging\n const logData: IIntegrationRequestLog = {\n integrationId: integration.id,\n method: request.apiMethod,\n url: fullUrl,\n headers,\n requestBody: request.body,\n loggedInUserId,\n timestamp: new Date(),\n };\n\n // Log the request before making the API call\n this.requestLogger.logRequest(logData);\n\n // Execute the HTTP request based on method\n const apiResponse = await this.executeHttpRequest<TResponse>(\n request,\n fullUrl,\n requestConfig,\n );\n\n const duration = Date.now() - startTime;\n const responseData = apiResponse.data;\n\n // Log the successful response\n this.requestLogger.logResponse({\n ...logData,\n responseBody: responseData,\n statusCode: apiResponse.status,\n duration,\n });\n\n return responseData;\n } catch (error) {\n const duration = Date.now() - startTime;\n const errorDetails = this.extractErrorDetails(error);\n\n // Get base URL safely for error logging\n const baseUrl = integration.config.platformConfig.baseUrl;\n const fullUrl = this.constructFullUrl(baseUrl, request.url);\n\n // Log the failed request with error details\n this.requestLogger.logError({\n integrationId: integration.id,\n method: request.apiMethod,\n url: fullUrl,\n headers: request.headers,\n requestBody: request.body,\n loggedInUserId,\n timestamp: new Date(),\n error: errorDetails.message || String(error),\n statusCode: errorDetails.statusCode,\n duration,\n });\n\n // Re-throw the error for the caller to handle\n throw error;\n }\n }\n\n /**\n * Prepare headers for the API request\n *\n * @private\n * @param request - The API call request configuration\n * @param apiKey - The API key for authorization\n * @returns Prepared headers object\n */\n private prepareHeaders(request: IApiCallRequest): Record<string, string> {\n request.headerType = request.headerType || 'json';\n\n const headers: Record<string, string> = {\n ...(request.headers || {}),\n };\n\n // Set default content type if not provided for methods that send body\n if (\n !headers['Content-Type'] &&\n request.headerType === 'json' &&\n (request.apiMethod === HTTP_METHOD.POST ||\n request.apiMethod === HTTP_METHOD.PUT ||\n request.apiMethod === HTTP_METHOD.PATCH)\n ) {\n headers['Content-Type'] = 'application/json';\n }\n\n // Set default accept header if not provided\n if (!headers['Accept'] && request.headerType === 'json') {\n headers['Accept'] = 'application/json';\n }\n\n return headers;\n }\n\n /**\n * Prepare request configuration object\n *\n * @private\n * @param request - The API call request configuration\n * @param headers - Prepared headers\n * @returns Request configuration object\n */\n private prepareRequestConfig(\n request: IApiCallRequest,\n headers: Record<string, string>,\n ): Record<string, unknown> {\n const requestConfig: Record<string, unknown> = {\n headers,\n };\n\n if (request.responseType) {\n requestConfig.responseType = request.responseType;\n }\n\n return requestConfig;\n }\n\n /**\n * Construct full URL from base URL and request URL\n * Handles trailing slashes properly\n *\n * @private\n * @param baseUrl - The base URL from platform config\n * @param requestUrl - The request URL path\n * @returns Constructed full URL\n */\n private constructFullUrl(baseUrl: string, requestUrl: string): string {\n const normalizedBaseUrl = baseUrl.endsWith('/')\n ? baseUrl.slice(0, -1)\n : baseUrl;\n const normalizedRequestUrl = requestUrl.startsWith('/')\n ? requestUrl\n : `/${requestUrl}`;\n\n return `${normalizedBaseUrl}${normalizedRequestUrl}`;\n }\n\n /**\n * Execute HTTP request based on the method\n *\n * @private\n * @template TResponse - The expected response type\n * @param request - The API call request configuration\n * @param fullUrl - The full URL to make the request to\n * @param requestConfig - The request configuration\n * @returns Promise resolving to the HTTP response\n * @throws Error if the HTTP method is unsupported\n */\n private async executeHttpRequest<TResponse>(\n request: IApiCallRequest,\n fullUrl: string,\n requestConfig: Record<string, unknown>,\n ) {\n switch (request.apiMethod) {\n case HTTP_METHOD.GET: {\n return await firstValueFrom(\n this.httpService.get<TResponse>(fullUrl, requestConfig),\n );\n }\n case HTTP_METHOD.POST: {\n return await firstValueFrom(\n this.httpService.post<TResponse>(\n fullUrl,\n request.body,\n requestConfig,\n ),\n );\n }\n case HTTP_METHOD.PUT: {\n return await firstValueFrom(\n this.httpService.put<TResponse>(fullUrl, request.body, requestConfig),\n );\n }\n case HTTP_METHOD.PATCH: {\n return await firstValueFrom(\n this.httpService.patch<TResponse>(\n fullUrl,\n request.body,\n requestConfig,\n ),\n );\n }\n case HTTP_METHOD.DELETE: {\n return await firstValueFrom(\n this.httpService.delete<TResponse>(fullUrl, requestConfig),\n );\n }\n default: {\n throw new Error(\n `Unsupported HTTP method: ${String(request.apiMethod)}`,\n );\n }\n }\n }\n\n /**\n * Extract error details from an error object\n *\n * @private\n * @param error - The error object\n * @returns Extracted error details\n */\n private extractErrorDetails(error: unknown): {\n message?: string;\n statusCode?: number;\n } {\n const errorObject = error as {\n status?: number;\n response?: { data?: unknown; status?: number };\n message?: string;\n };\n\n return {\n message: errorObject.message,\n statusCode: errorObject.status || errorObject.response?.status,\n };\n }\n}\n","// Load environment variables BEFORE importing modules that check env vars at import time\nimport './load-env';\nimport { LoggerModule } from '@dv4resi/dvss-backend-module-utility';\nimport { HttpModule } from '@nestjs/axios';\nimport { ConfigModule } from '@nestjs/config';\nimport { Module } from '@nestjs/common';\nimport { resolve } from 'path';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { IntegrationRequestLoggerService } from './integration-traffic-router/logging/request-logger.service';\nimport { RateLimiterService } from './integration-traffic-router/rate-limiter/rate-limiter.service';\nimport { TrafficGatewayService } from './integration-traffic-router/gateway/traffic-gateway.service';\n\n@Module({\n imports: [\n // Load environment variables from root .env file\n ConfigModule.forRoot({\n envFilePath: resolve(__dirname, '../../../.env'),\n isGlobal: true,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }) as any,\n HttpModule,\n LoggerModule,\n ],\n controllers: [AppController],\n providers: [\n AppService,\n TrafficGatewayService,\n IntegrationRequestLoggerService,\n RateLimiterService,\n ],\n exports: [\n TrafficGatewayService,\n IntegrationRequestLoggerService,\n RateLimiterService,\n ],\n})\nexport class AppModule {}\n","export const TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY =\n 'traffic-router-configuration-store';\n","import {\n ICapabilityIntegration,\n IValidatedCapabilityIntegration,\n} from '../../integration-common-utils';\n\n/**\n * Base abstract class for integration authentication operations\n * Provides a foundation for implementing authentication functionality\n * for different integration providers\n *\n * This class should be extended by concrete implementations that provide\n * specific authentication operations for different integration systems\n */\nexport abstract class BaseAuth {\n /**\n * Abstract method to validate integration configuration\n * Must be implemented by concrete classes\n *\n * @param config - Integration configuration object\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to validated configuration\n */\n abstract validateConfig(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): IValidatedCapabilityIntegration;\n\n /**\n * Abstract method to test integration connection\n * Must be implemented by concrete classes\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving when test is completed\n */\n abstract testIntegration(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<boolean>;\n\n /**\n * Abstract method to fetch an access token from the integration provider.\n * Must be implemented by concrete classes.\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to the access token string\n */\n abstract fetchAccessToken(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<string>;\n}\n","/**\n * Base abstract class for wellness appointment booking operations\n * Provides a foundation for implementing appointment booking functionality\n * within wellness capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific appointment booking operations for different wellness systems\n */\nexport abstract class BaseWellnessAppointmentBooking {\n /**\n * Abstract method to fetch a wellness appointment session\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session is fetched\n */\n abstract fetchWellnessAppointmentSession(): Promise<void>;\n\n /**\n * Abstract method to check availability of a wellness appointment session\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the availability check is completed\n */\n abstract checkWellnessAppointmentSessionAvailability(): Promise<void>;\n\n /**\n * Abstract method to create a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session order is created\n */\n abstract createWellnessAppointmentSessionOrder(): Promise<void>;\n\n /**\n * Abstract method to add items to a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the order items are added\n */\n abstract addWellnessAppointmentSessionOrderItems(): Promise<void>;\n\n /**\n * Abstract method to confirm a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session order is confirmed\n */\n abstract confirmWellnessAppointmentSessionOrder(): Promise<void>;\n}\n","import {\n ICapabilityIntegration,\n ICustomerCreditsSystemResponse,\n IGetCustomerCreditsRequest,\n} from '../../../integration-common-utils';\n\n/**\n * Base abstract class for credit booking operations\n * Provides a foundation for implementing credit booking functionality\n *\n * This class should be extended by concrete implementations that provide\n * specific credit booking operations for different systems\n */\nexport abstract class BaseCreditBooking {\n /**\n * Abstract method to fetch customer credits\n * Must be implemented by concrete classes\n *\n * @param request - The request object containing the customer ID\n * @param integration - The integration object\n * @param loggedInUserId - The user ID of the logged in user\n * @returns Promise resolving to the system customer credits response (totalCount, records)\n */\n abstract fetchCustomerCredits(\n request: IGetCustomerCreditsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ICustomerCreditsSystemResponse>;\n}\n","import {\n ICustomer,\n IGetCustomerRequest,\n IValidatedCapabilityIntegration,\n} from '../../../integration-common-utils';\n\n/**\n * Base abstract class for customer management operations\n * Provides a foundation for implementing customer management functionality\n * within capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer management operations for different systems\n */\nexport abstract class BaseCustomerManagement {\n /**\n * Abstract method to create a new customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createCustomer(): Promise<void>;\n\n /**\n * Abstract method to search for customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the search is completed\n */\n abstract searchCustomer(\n request: IGetCustomerRequest,\n integration: IValidatedCapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ICustomer | undefined>;\n\n /**\n * Abstract method to update an existing customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n abstract updateCustomer(): Promise<void>;\n}\n","/**\n * Base abstract class for package management operations\n * Provides a foundation for implementing package management functionality\n * within capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific package management operations for different systems\n */\nexport abstract class BasePackageManagement {\n /**\n * Abstract method to fetch course types\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the course types are fetched\n */\n abstract fetchCourseTypes(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting contact management operations\n * Provides a foundation for implementing contact management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific contact management operations for different accounting systems\n */\nexport abstract class BaseAccountingContactManagement {\n /**\n * Abstract method to create an accounting contact person\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact person is created\n */\n abstract createAccountingContactPerson(): Promise<void>;\n\n /**\n * Abstract method to update an accounting contact person\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact person is updated\n */\n abstract updateAccountingContactPerson(): Promise<void>;\n\n /**\n * Abstract method to delete an accounting contact person\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact person is deleted\n */\n abstract deleteAccountingContactPerson(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting credit note management operations\n * Provides a foundation for implementing credit note management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific credit note management operations for different accounting systems\n */\nexport abstract class BaseAccountingCreditNoteManagement {\n /**\n * Abstract method to create an accounting credit note\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the credit note is created\n */\n abstract createAccountingCreditNote(): Promise<void>;\n\n /**\n * Abstract method to apply an accounting credit note\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the credit note is applied\n */\n abstract applyAccountingCreditNote(): Promise<void>;\n\n /**\n * Abstract method to refund accounting excess payment\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the excess payment is refunded\n */\n abstract refundAccountingExcessPayment(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting customer management operations\n * Provides a foundation for implementing customer management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer management operations for different accounting systems\n */\nexport abstract class BaseAccountingCustomerManagement {\n /**\n * Abstract method to create an accounting customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createAccountingCustomer(): Promise<void>;\n\n /**\n * Abstract method to list accounting contacts\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contacts are listed\n */\n abstract listAccountingContacts(): Promise<void>;\n\n /**\n * Abstract method to update an accounting contact\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact is updated\n */\n abstract updateAccountingContact(): Promise<void>;\n\n /**\n * Abstract method to delete an accounting contact\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact is deleted\n */\n abstract deleteAccountingContact(): Promise<void>;\n\n /**\n * Abstract method to change the status of an accounting contact\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact status is changed\n */\n abstract changeAccountingContactStatus(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting customer payment management operations\n * Provides a foundation for implementing customer payment management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer payment management operations for different accounting systems\n */\nexport abstract class BaseAccountingCustomerPaymentManagement {\n /**\n * Abstract method to create an accounting customer payment\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer payment is created\n */\n abstract createAccountingCustomerPayment(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting invoice management operations\n * Provides a foundation for implementing invoice management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific invoice management operations for different accounting systems\n */\nexport abstract class BaseAccountingInvoiceManagement {\n /**\n * Abstract method to create an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is created\n */\n abstract createAccountingInvoice(): Promise<void>;\n\n /**\n * Abstract method to update an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is updated\n */\n abstract updateAccountingInvoice(): Promise<void>;\n\n /**\n * Abstract method to delete an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is deleted\n */\n abstract deleteAccountingInvoice(): Promise<void>;\n\n /**\n * Abstract method to download an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is downloaded\n */\n abstract downloadAccountingInvoice(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting chart of accounts (LOA) management operations\n * Provides a foundation for implementing chart of accounts management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific chart of accounts management operations for different accounting systems\n */\nexport abstract class BaseAccountingLOAManagement {\n /**\n * Abstract method to list accounting chart of accounts\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the chart of accounts is listed\n */\n abstract listAccountingChartOfAccounts(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting tax management operations\n * Provides a foundation for implementing tax management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific tax management operations for different accounting systems\n */\nexport abstract class BaseAccountingTaxManagement {\n /**\n * Abstract method to list accounting taxes\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the taxes are listed\n */\n abstract listAccountingTaxes(): Promise<void>;\n}\n","/**\n * Base abstract class for payment operations\n * Provides a foundation for implementing payment functionality\n * within payment capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific payment operations for different payment systems\n */\nexport abstract class BasePayment {\n /**\n * Abstract method to create a payment setup intent\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment setup intent is created\n */\n abstract createPaymentSetupIntent(): Promise<void>;\n\n /**\n * Abstract method to confirm a payment setup intent\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment setup intent is confirmed\n */\n abstract confirmPaymentSetupIntent(): Promise<void>;\n\n /**\n * Abstract method to cancel a payment setup intent\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment setup intent is cancelled\n */\n abstract cancelPaymentSetupIntent(): Promise<void>;\n\n /**\n * Abstract method to create a payment ephemeral key\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment ephemeral key is created\n */\n abstract createPaymentEphemeralKey(): Promise<void>;\n}\n","/**\n * Base abstract class for payment method management operations\n * Provides a foundation for implementing payment method management functionality\n * within payment capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific payment method management operations for different payment systems\n */\nexport abstract class BasePaymentMethodManagement {\n /**\n * Abstract method to create a payment method\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment method is created\n */\n abstract createPaymentMethod(): Promise<void>;\n\n /**\n * Abstract method to attach a payment method to a customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment method is attached\n */\n abstract attachPaymentMethodToCustomer(): Promise<void>;\n\n /**\n * Abstract method to list payment methods for a customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment methods are listed\n */\n abstract listPaymentMethodForCustomer(): Promise<void>;\n\n /**\n * Abstract method to detach a payment method from a customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment method is detached\n */\n abstract detachPaymentMethodFromCustomer(): Promise<void>;\n}\n","/**\n * Base abstract class for payment user management operations\n * Provides a foundation for implementing user management functionality\n * within payment capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific user management operations for different payment systems\n */\nexport abstract class BasePaymentUserManagement {\n /**\n * Abstract method to list payment customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customers are listed\n */\n abstract listPaymentCustomers(): Promise<void>;\n\n /**\n * Abstract method to create a new payment customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createPaymentCustomer(): Promise<void>;\n\n /**\n * Abstract method to update an existing payment customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n abstract updatePaymentCustomer(): Promise<void>;\n\n /**\n * Abstract method to delete a payment customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is deleted\n */\n abstract deletePaymentCustomer(): Promise<void>;\n\n /**\n * Abstract method to search for payment customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the search is completed\n */\n abstract searchPaymentCustomers(): Promise<void>;\n}\n","/**\n * Base abstract class for membership customer management operations\n * Provides a foundation for implementing customer management functionality\n * within membership capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer management operations for different membership systems\n */\nexport abstract class BaseMembershipCustomerManagement {\n /**\n * Abstract method to get all membership customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when all customers are retrieved\n */\n abstract getMembershipAllCustomers(): Promise<void>;\n\n /**\n * Abstract method to get a specific membership customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is retrieved\n */\n abstract getMembershipCustomer(): Promise<void>;\n\n /**\n * Abstract method to create a new membership customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createMembershipCustomer(): Promise<void>;\n\n /**\n * Abstract method to update an existing membership customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n abstract updateMembershipCustomer(): Promise<void>;\n}\n","/**\n * Base abstract class for membership management operations\n * Provides a foundation for implementing membership management functionality\n * within membership capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific membership management operations for different membership systems\n */\nexport abstract class BaseMembershipManagement {\n /**\n * Abstract method to get membership types\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the membership types are retrieved\n */\n abstract getMembershipTypes(): Promise<void>;\n\n /**\n * Abstract method to get a membership\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the membership is retrieved\n */\n abstract getMembership(): Promise<void>;\n}\n","/**\n * System-level credit and customer credits response types.\n * Aligned with payment MS GetUserCredits / Credit shape for consumption across the system.\n * Integrations map their provider-specific responses to these types.\n */\n\n/** Credit type values aligned with payment MS CREDIT_TYPE_ENUM */\nexport enum CREDIT_TYPE_ENUM {\n COUPON = 'COUPON',\n AMOUNT = 'AMOUNT',\n}\n\n/** Credit status values aligned with payment MS CREDIT_STATUS_ENUM */\nexport enum CREDIT_STATUS_ENUM {\n ACTIVE = 'ACTIVE',\n REDEEMED = 'REDEEMED',\n EXPIRED = 'EXPIRED',\n REVOKED = 'REVOKED',\n}\n\nexport enum CREDIT_FILTER_BY_ENUM {\n TYPE = 'TYPE',\n STATUS = 'STATUS',\n}\n\n/**\n * A single credit in the system format.\n * Matches the shape expected by payment MS Credit (plain interface, no GraphQL).\n * Fields not provided by an integration (e.g. id, projectId) are optional.\n */\nexport interface ICredit {\n id?: bigint;\n name: string;\n description?: string;\n type: CREDIT_TYPE_ENUM;\n status: CREDIT_STATUS_ENUM;\n projectId?: number;\n propertyId?: number;\n externalId?: string;\n expiresAt?: Date;\n expiresDate?: string;\n startsAt?: Date;\n startDate?: string;\n value?: string;\n capabilityIntegrationId?: bigint;\n meta?: Record<string, unknown>;\n}\n\n/**\n * System response for customer credits.\n * Matches payment MS GetUserCredits: { totalCount, records }.\n */\nexport interface ICustomerCreditsSystemResponse {\n totalCount: number;\n records: ICredit[];\n}\n\nexport interface IGetCustomerCreditsRequestFilters {\n by: CREDIT_FILTER_BY_ENUM;\n values: string[];\n}\n\nexport interface IGetCustomerCreditsRequestOptions {\n filters?: IGetCustomerCreditsRequestFilters[];\n page?: number;\n count?: number;\n}\n\nexport interface IGetCustomerCreditsRequest {\n customerId: string;\n options?: IGetCustomerCreditsRequestOptions;\n}\n","export enum INTEGRATION_PROVIDER_ENUM {\n TRYBE = 'TRYBE',\n}\n\ninterface IPlatformConfig {\n baseUrl?: string;\n}\n\ninterface IIntegrationConfig {\n siteId?: string;\n apiKey?: string;\n organisationId?: string;\n}\n\nexport interface ICapabilityIntegrationConfig {\n platformConfig?: IPlatformConfig;\n integrationConfig?: IIntegrationConfig;\n}\n\nexport interface IValidatedCapabilityIntegrationConfig {\n platformConfig: Required<IPlatformConfig>;\n integrationConfig: Required<IIntegrationConfig>;\n}\n\nexport interface ICapabilityIntegration {\n id: bigint;\n provider?: INTEGRATION_PROVIDER_ENUM | null;\n providerId?: bigint;\n config?: ICapabilityIntegrationConfig;\n capabilityId?: bigint;\n projectId?: number;\n}\n\nexport interface IValidatedCapabilityIntegration {\n id: bigint;\n provider?: INTEGRATION_PROVIDER_ENUM | null;\n providerId?: bigint;\n config: IValidatedCapabilityIntegrationConfig;\n capabilityId?: bigint;\n headers?: Record<string, string>;\n projectId?: number;\n}\n","/**\n * Trybe implementation for wellness customer management operations\n * Provides concrete implementation of customer management functionality\n * for Trybe wellness systems\n *\n * This class extends the base customer management operations with\n * Trybe-specific implementations\n */\nimport { Injectable } from '@nestjs/common';\nimport { LoggerService } from '@dv4resi/dvss-backend-module-utility';\nimport {\n BaseCustomerManagement,\n HTTP_METHOD,\n IGetCustomerRequest,\n IValidatedCapabilityIntegration,\n TrafficGatewayService,\n} from '@dvss/dvss-integration-libs';\nimport {\n ITrybeCustomer,\n ITrybeCustomerResponse,\n ITrybeGetCustomerByEmailResponse,\n} from '../../models';\n\n@Injectable()\nexport class TrybeCustomerManagement implements BaseCustomerManagement {\n private readonly fileName = 'customer-management.service';\n\n /**\n * Creates an instance of the service\n */\n constructor(\n private readonly logger: LoggerService,\n private readonly trafficGatewayService: TrafficGatewayService,\n ) {}\n\n /**\n * Abstract method to create a new customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n createCustomer(): Promise<void> {\n throw new Error('createCustomer not yet implemented');\n }\n\n /**\n * Abstract method to search for wellness customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the search is completed\n */\n async searchCustomer(\n request: IGetCustomerRequest,\n integration: IValidatedCapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ITrybeCustomer | undefined> {\n this.logger.info(\n loggedInUserId,\n this.searchCustomer.name,\n this.fileName,\n `${TrybeCustomerManagement.name} -> ${this.searchCustomer.name} Called`,\n { request },\n );\n\n if (!request.email && !request.customerId) {\n throw new Error(\n 'Either email or customerId is required to get a customer from Trybe',\n );\n }\n\n if (request.customerId) {\n const response =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeCustomerResponse,\n string\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `/customers/customers/${request.customerId}`,\n baseUrl: integration.config.platformConfig.baseUrl,\n headers: integration.headers,\n },\n integration,\n loggedInUserId,\n );\n\n if (!response.data) {\n return undefined;\n }\n\n return response.data;\n }\n\n if (request.email) {\n const response =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeGetCustomerByEmailResponse,\n string\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `/customers/customers/?email=${request.email}`,\n baseUrl: integration.config.platformConfig.baseUrl,\n headers: integration.headers,\n },\n integration,\n loggedInUserId,\n );\n\n if (!response.data || response.data.length === 0) {\n return undefined;\n }\n\n return response.data[0];\n }\n }\n\n /**\n * Abstract method to update an existing customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n updateCustomer(): Promise<void> {\n throw new Error('updateCustomer not yet implemented');\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport {\n BaseAuth,\n ICapabilityIntegration,\n IValidatedCapabilityIntegration,\n} from '@dvss/dvss-integration-libs';\nimport { TrybeCustomerManagement } from '../../capabilities/customer-management/customer-management.service';\nimport { LoggerService } from '@dv4resi/dvss-backend-module-utility';\n\n@Injectable()\nexport class TrybeAuthService implements BaseAuth {\n private readonly fileName = 'auth.service';\n\n /**\n * Creates an instance of the Trybe authentication service\n */\n constructor(\n private readonly trybeCustomerManagement: TrybeCustomerManagement,\n private readonly logger: LoggerService,\n ) {}\n\n /**\n * Validates Trybe integration configuration\n * Checks for required fields: apiKey, siteId, organisationId, and baseUrl\n *\n * @param config - Integration configuration object\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to validated configuration\n * @throws Error if config is invalid\n */\n validateConfig(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): IValidatedCapabilityIntegration {\n this.logger.info(\n loggedInUserId,\n this.validateConfig.name,\n this.fileName,\n `${TrybeAuthService.name} -> ${this.validateConfig.name} Called`,\n { integration },\n );\n\n if (!integration.config) {\n throw new Error('Integration configuration is missing');\n }\n\n const { config } = integration;\n\n const integrationConfig = config.integrationConfig || {};\n const platformConfig = config.platformConfig || {};\n\n if (Object.keys(integrationConfig).length > 0) {\n if (!integrationConfig.apiKey) {\n throw new Error(\n 'Integration configuration is invalid: API Key not found',\n );\n } else if (!integrationConfig.siteId) {\n throw new Error(\n 'Integration configuration is invalid: Site ID not found',\n );\n } else if (!integrationConfig.organisationId) {\n throw new Error(\n 'Integration configuration is invalid: Organisation ID not found',\n );\n }\n } else {\n throw new Error(\n 'Integration configuration is invalid: Integration config is empty',\n );\n }\n\n if (Object.keys(platformConfig).length > 0) {\n if (!platformConfig.baseUrl) {\n throw new Error(\n 'Platform configuration is invalid: Base URL not found',\n );\n }\n } else {\n throw new Error(\n 'Platform configuration is invalid: Platform config is empty',\n );\n }\n\n const headers: Record<string, string> = {\n Authorization: `Bearer ${integrationConfig.apiKey}`,\n };\n\n return {\n ...integration,\n headers,\n } as IValidatedCapabilityIntegration;\n }\n\n /**\n * Tests Trybe integration by making a test API call\n * Uses a test customer lookup to verify credentials are valid\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving when test is completed\n * @throws Error if authentication fails or API call fails\n */\n async testIntegration(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<boolean> {\n this.logger.info(\n loggedInUserId,\n this.testIntegration.name,\n this.fileName,\n `${TrybeAuthService.name} -> ${this.testIntegration.name} Called`,\n { integration },\n );\n\n // Validate config\n const validatedIntegration = this.validateConfig(\n integration,\n loggedInUserId,\n );\n\n // Perform test API call using traffic gateway\n await this.trybeCustomerManagement.searchCustomer(\n {\n email: 'test@integration.test',\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n this.logger.info(\n loggedInUserId,\n this.testIntegration.name,\n this.fileName,\n 'Trybe integration test successful. The credentials are valid.',\n );\n\n return true;\n }\n\n /**\n * Fetches an access token from the Trybe integration provider.\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to the access token string\n */\n fetchAccessToken(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<string> {\n this.logger.info(\n loggedInUserId,\n this.fetchAccessToken.name,\n this.fileName,\n `${TrybeAuthService.name} -> ${this.fetchAccessToken.name} Called`,\n { integration },\n );\n\n throw new Error('Method not implemented.');\n }\n}\n","import {\n type ICredit,\n type ICustomerCreditsSystemResponse,\n CREDIT_STATUS_ENUM,\n CREDIT_TYPE_ENUM,\n IValidatedCapabilityIntegration,\n} from '@dvss/dvss-integration-libs';\nimport type {\n ITrybeCredit,\n ITrybeGetCustomerCreditsResponse,\n} from '../../models';\n\nfunction mapStatus(t: ITrybeCredit): CREDIT_STATUS_ENUM {\n if (t.redeemed_at) return CREDIT_STATUS_ENUM.REDEEMED;\n if (t.revoked_at) return CREDIT_STATUS_ENUM.REVOKED;\n if (new Date(t.expires_at) < new Date()) return CREDIT_STATUS_ENUM.EXPIRED;\n return CREDIT_STATUS_ENUM.ACTIVE;\n}\n\n/**\n * Groups Trybe credits by (coupon_name, issued_at), then maps each group to one ICredit.\n * Within a group, only coupon_code can differ; all codes are in meta.integrationDetails.couponCodes.\n * value is set to the first coupon code.\n */\nexport function mapTrybeCreditsToSystem(\n res: ITrybeGetCustomerCreditsResponse,\n integration: IValidatedCapabilityIntegration,\n): ICustomerCreditsSystemResponse {\n const groups = new Map<string, ITrybeCredit[]>();\n for (const t of res.data) {\n const key = `${t.coupon_name}|${t.issued_at}`;\n const list = groups.get(key) ?? [];\n list.push(t);\n groups.set(key, list);\n }\n\n const records: ICredit[] = [];\n for (const [, items] of groups) {\n const first = items[0];\n const couponCodes = items.map((i) => i.coupon_code);\n records.push({\n capabilityIntegrationId: integration.id,\n projectId: integration.projectId,\n name: first.coupon_name,\n description: first.coupon_description ?? undefined,\n type: CREDIT_TYPE_ENUM.COUPON,\n status: mapStatus(first),\n externalId: first.id,\n expiresAt: new Date(first.expires_at),\n expiresDate: first.expires_at.split('T')[0],\n startsAt: new Date(first.issued_at),\n startDate: first.issued_at.split('T')[0],\n value: couponCodes[0],\n meta: {\n integrationDetails: {\n customerId: first.customer_id,\n membershipId: first.membership_id,\n multiUse: first.multi_use === 1,\n couponCodes,\n redeemedAt: first.redeemed_at,\n revokedAt: first.revoked_at,\n },\n },\n });\n }\n\n return {\n totalCount: records.length,\n records,\n };\n}\n","/**\n * Trybe implementation for credit booking operations\n * Provides concrete implementation of credit booking functionality\n * for Trybe systems\n *\n * This class extends the base credit booking operations with\n * Trybe-specific implementations\n */\nimport {\n BaseCreditBooking,\n CREDIT_FILTER_BY_ENUM,\n CREDIT_STATUS_ENUM,\n HTTP_METHOD,\n ICapabilityIntegration,\n ICustomerCreditsSystemResponse,\n IGetCustomerCreditsRequest,\n TrafficGatewayService,\n} from '@dvss/dvss-integration-libs';\nimport { LoggerService } from '@dv4resi/dvss-backend-module-utility';\nimport { Injectable } from '@nestjs/common';\nimport type { ITrybeGetCustomerCreditsResponse } from '../../models';\nimport { mapTrybeCreditsToSystem } from './credit-booking.mapper';\nimport { TrybeAuthService } from '../../utils/auth/auth.service';\n\n@Injectable()\nexport class TrybeCreditBooking implements BaseCreditBooking {\n private readonly fileName = 'credit-booking.service';\n\n /**\n * Creates an instance of the service\n */\n constructor(\n private readonly logger: LoggerService,\n private readonly trafficGatewayService: TrafficGatewayService,\n private readonly trybeAuthService: TrybeAuthService,\n ) {}\n\n /**\n * Fetches customer credits from Trybe and returns system-format response\n *\n * @returns Promise resolving to the system customer credits response\n */\n async fetchCustomerCredits(\n request: IGetCustomerCreditsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ICustomerCreditsSystemResponse> {\n this.logger.info(\n loggedInUserId,\n this.fetchCustomerCredits.name,\n this.fileName,\n `${TrybeCreditBooking.name} -> ${this.fetchCustomerCredits.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n\n const query = new URLSearchParams();\n const opts = request.options;\n\n if (opts?.page != null) query.set('page', String(opts.page));\n if (opts?.count != null) query.set('per_page', String(opts.count));\n\n const statusFilterValues =\n opts?.filters?.[0]?.by === CREDIT_FILTER_BY_ENUM.STATUS\n ? opts.filters[0].values\n : [];\n\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.EXPIRED)) {\n query.set('expired', 'true');\n } else {\n query.set('expired', 'false');\n }\n\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REDEEMED)) {\n query.set('redeemed', 'true');\n } else {\n query.set('redeemed', 'false');\n }\n\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REVOKED)) {\n query.set('revoked', 'true');\n } else {\n query.set('revoked', 'false');\n }\n\n const queryString = query.toString();\n const url =\n `/customers/customers/${request.customerId}/credits` +\n (queryString ? `?${queryString}` : '');\n\n const raw: ITrybeGetCustomerCreditsResponse =\n await this.trafficGatewayService.executeIntegrationRequest<ITrybeGetCustomerCreditsResponse>(\n {\n apiMethod: HTTP_METHOD.GET,\n url,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n return mapTrybeCreditsToSystem(raw, validatedIntegration);\n }\n}\n","// Load environment variables BEFORE importing modules that check env vars at import time\nimport './load-env';\nimport { LoggerModule } from '@dv4resi/dvss-backend-module-utility';\nimport { HttpModule } from '@nestjs/axios';\nimport { ConfigModule } from '@nestjs/config';\nimport { Module } from '@nestjs/common';\nimport { resolve } from 'path';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { IntegrationLibsModule } from '@dvss/dvss-integration-libs';\nimport { TrybeAuthService } from './utils/auth/auth.service';\nimport { TrybeCustomerManagement } from './capabilities/customer-management/customer-management.service';\nimport { TrybeCreditBooking } from './capabilities/credit-management/credit-booking.service';\n\n@Module({\n imports: [\n // Load environment variables from root .env file\n ConfigModule.forRoot({\n envFilePath: resolve(__dirname, '../../../.env'),\n isGlobal: true,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }) as any,\n IntegrationLibsModule,\n HttpModule,\n LoggerModule,\n ],\n controllers: [AppController],\n providers: [\n AppService,\n TrybeAuthService,\n TrybeCustomerManagement,\n TrybeCreditBooking,\n ],\n exports: [TrybeAuthService, TrybeCustomerManagement, TrybeCreditBooking],\n})\nexport class AppModule {}\n","/**\n * Trybe implementation for package management operations\n * Provides concrete implementation of package management functionality\n * for Trybe systems\n *\n * This class extends the base package management operations with\n * Trybe-specific implementations\n */\nimport { BasePackageManagement } from '@dvss/dvss-integration-libs';\n\nexport abstract class TrybePackageManagement implements BasePackageManagement {\n /**\n * Abstract method to fetch course types\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the course types are fetched\n */\n abstract fetchCourseTypes(): Promise<void>;\n}\n","/**\n * Trybe implementation for wellness appointment booking operations\n * Provides concrete implementation of appointment booking functionality\n * for Trybe wellness systems\n *\n * This class extends the base appointment booking operations with\n * Trybe-specific implementations\n */\nimport { BaseWellnessAppointmentBooking } from '@dvss/dvss-integration-libs';\n\nexport abstract class TrybeWellnessAppointmentBooking extends BaseWellnessAppointmentBooking {\n /**\n * Abstract method to fetch a wellness appointment session\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session is fetched\n */\n abstract fetchWellnessAppointmentSession(): Promise<void>;\n\n /**\n * Abstract method to check availability of a wellness appointment session\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the availability check is completed\n */\n abstract checkWellnessAppointmentSessionAvailability(): Promise<void>;\n\n /**\n * Abstract method to create a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session order is created\n */\n abstract createWellnessAppointmentSessionOrder(): Promise<void>;\n\n /**\n * Abstract method to add items to a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the order items are added\n */\n abstract addWellnessAppointmentSessionOrderItems(): Promise<void>;\n\n /**\n * Abstract method to confirm a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session order is confirmed\n */\n abstract confirmWellnessAppointmentSessionOrder(): Promise<void>;\n}\n","import { Module } from '@nestjs/common';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { IntegrationTrybeModule } from '@dvss/dvss-integration-trybe';\nimport { IntegrationLibsModule } from '@dvss/dvss-integration-libs';\n\n@Module({\n imports: [IntegrationTrybeModule, IntegrationLibsModule],\n controllers: [AppController],\n providers: [AppService, IntegrationTrybeModule, IntegrationLibsModule],\n exports: [IntegrationTrybeModule, IntegrationLibsModule],\n})\nexport class AppModule {}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/app.service.ts","../src/app.controller.ts","../../../packages/dvss-integration-trybe/src/load-env.ts","../../../packages/dvss-integration-trybe/src/app.service.ts","../../../packages/dvss-integration-trybe/src/app.controller.ts","../../../packages/dvss-integration-libs/src/load-env.ts","../../../packages/dvss-integration-libs/src/app.service.ts","../../../packages/dvss-integration-libs/src/app.controller.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/logging/request-logger.service.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/rate-limiter/rate-limiter.service.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/constants/http.constant.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/gateway/traffic-gateway.service.ts","../../../packages/dvss-integration-libs/src/app.module.ts","../../../packages/dvss-integration-libs/src/integration-traffic-router/constants/traffic-router.constant.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/auth/auth.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/wellness/wellness-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/credit-management/credit-booking.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/customer-management/customer-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/package-management/package-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/contact-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/credit-note-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/customer-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/customer-payment-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/invoice-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/loa-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/accounting/subcapabilities/tax-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/payment.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/payment-method-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/payment/subcapabilities/user-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/membership/subcapabilities/customer-management.base.ts","../../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/membership/subcapabilities/membership-management.base.ts","../../../packages/dvss-integration-libs/src/integration-common-utils/models/credit-management.model.ts","../../../packages/dvss-integration-libs/src/integration-common-utils/models/capability-integration.model.ts","../../../packages/dvss-integration-libs/src/integration-common-utils/models/wellness-management.model.ts","../../../packages/dvss-integration-trybe/src/capabilities/customer-management/customer-management.service.ts","../../../packages/dvss-integration-trybe/src/utils/auth/auth.service.ts","../../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.mapper.ts","../../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.service.ts","../../../packages/dvss-integration-trybe/src/utils/date.util.ts","../../../packages/dvss-integration-trybe/src/utils/pagination.util.ts","../../../packages/dvss-integration-trybe/src/models/wellness-management.model.ts","../../../packages/dvss-integration-trybe/src/capabilities/wellness/wellness-management.mapper.ts","../../../packages/dvss-integration-trybe/src/capabilities/wellness/wellness-management.service.ts","../../../packages/dvss-integration-trybe/src/app.module.ts","../src/app.module.ts"],"names":["AppService","getHello","AppController","appService","rootEnvPath","resolve","__dirname","config","path","console","log","name","IntegrationRequestLoggerService","className","logger","logRequest","logData","loggedInUserId","method","url","headers","requestBody","info","SYSTEM_USER_ID","integrationId","sanitizeHeaders","timestamp","Date","logResponse","statusCode","duration","responseBody","logError","error","logIntegrationRequest","undefined","sanitized","sensitiveKeys","key","Object","keys","includes","toLowerCase","RateLimiterService","validateAndEnforceRateLimit","HTTP_METHOD","TrafficGatewayService","httpService","requestLogger","rateLimiter","executeIntegrationRequest","request","integration","_context","startTime","now","prepareHeaders","requestConfig","prepareRequestConfig","fullUrl","constructFullUrl","baseUrl","id","apiMethod","body","apiResponse","executeHttpRequest","responseData","data","status","errorDetails","extractErrorDetails","platformConfig","message","String","headerType","POST","PUT","PATCH","responseType","requestUrl","normalizedBaseUrl","endsWith","slice","normalizedRequestUrl","startsWith","GET","firstValueFrom","get","post","put","patch","DELETE","delete","Error","errorObject","response","AppModule","imports","ConfigModule","forRoot","envFilePath","isGlobal","HttpModule","LoggerModule","controllers","providers","exports","TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY","BaseAuth","BaseWellnessManagement","BaseCreditBooking","BaseCustomerManagement","BasePackageManagement","BaseAccountingContactManagement","BaseAccountingCreditNoteManagement","BaseAccountingCustomerManagement","BaseAccountingCustomerPaymentManagement","BaseAccountingInvoiceManagement","BaseAccountingLOAManagement","BaseAccountingTaxManagement","BasePayment","BasePaymentMethodManagement","BasePaymentUserManagement","BaseMembershipCustomerManagement","BaseMembershipManagement","CREDIT_TYPE_ENUM","CREDIT_STATUS_ENUM","CREDIT_FILTER_BY_ENUM","INTEGRATION_PROVIDER_ENUM","BOOKABLE_ITEM_TYPE_ENUM","BOOKABLE_ITEM_STATUS_ENUM","DAY_OF_WEEK","TrybeCustomerManagement","fileName","trafficGatewayService","createCustomer","searchCustomer","email","customerId","length","updateCustomer","TrybeAuthService","trybeCustomerManagement","validateConfig","integrationConfig","apiKey","siteId","organisationId","Authorization","testIntegration","validatedIntegration","fetchAccessToken","mapStatus","t","redeemed_at","REDEEMED","revoked_at","REVOKED","expires_at","EXPIRED","ACTIVE","mapTrybeCreditsToSystem","res","groups","Map","coupon_name","issued_at","list","push","set","records","index","items","first","couponCodes","map","i","coupon_code","BigInt","capabilityIntegrationId","projectId","description","coupon_description","type","COUPON","externalId","expiresAt","expiresDate","split","startsAt","startDate","value","meta","integrationDetails","customer_id","membershipId","membership_id","multiUse","multi_use","redeemedAt","revokedAt","totalCount","TrybeCreditBooking","trybeAuthService","fetchCustomerCredits","query","URLSearchParams","opts","options","page","count","statusFilterValues","filters","by","STATUS","values","queryString","toString","raw","formatDateForTrybe","date","isStartOfDay","year","getFullYear","month","getMonth","padStart","day","getDate","hours","minutes","seconds","extractTimeFromIsoString","isoString","timeMatch","match","snakeToCamel","str","replaceAll","_","letter","toUpperCase","convertKeysToCamelCase","object","Array","isArray","item","converted","entries","fetchAllPages","firstPageResponse","shouldFetchAll","fetchPage","lastPage","last_page","pageResponse","TRYBE_OFFERING_TYPE_ENUM","TRYBE_WEEKDAYS_MAPPING","monday","MON","tuesday","TUE","wednesday","WED","thursday","THU","friday","FRI","saturday","SAT","sunday","SUN","mapTrybeImageToMedia","image","originalUrl","original_url","file_name","mimeType","mime_type","mapTrybeWeekdays","weekdays","mapTrybePriceRuleToPriceMeta","priceRule","currency","normalizedCurrency","price","configuredForDays","mapTrybePriceRulesToPrices","priceRules","externalResourceId","label","pricesMeta","mapTrybeAppointmentToBookableItem","appointment","linkedItems","APPOINTMENT","icon","primaryAsset","prices","price_rules","linkedBookableItems","updatedAt","updated_at","productCode","product_code","siteIds","site_ids","roomIds","room_ids","equipmentIds","equipment_ids","practitionerIds","practitioner_ids","durations","endBuffer","end_buffer","startTimeInterval","start_time_interval","maxAdvanceBookingsInterval","max_advance_bookings_interval","minAdvanceBookingsInterval","min_advance_bookings_interval","tagIds","tag_ids","tags","categoryIds","category_ids","offeredOnline","offered_online","private","visibility","customersOnly","customers_only","membersOnly","members_only","membershipBookingWindowsEnabled","membership_booking_windows_enabled","membershipBookingWindows","membership_booking_windows","trybeMeta","upsellOfferings","upsell_offerings","crossSellOfferings","cross_sell_offerings","relatedRetailOfferings","related_retail_offerings","customerCancellationPermitted","customer_cancellation_permitted","customerCancellationMinDuration","customer_cancellation_min_duration","minGuests","min_guests","maxGuests","max_guests","allocateMultiCapacityRooms","allocate_multi_capacity_rooms","enquiriesEnabled","enquiries_enabled","revenueCentre","revenue_centre","includePricingOnCalendar","include_pricing_on_calendar","maxPerBasket","max_per_basket","maxPerGuest","max_per_guest","shopPractitionerSelectionEnabled","shop_practitioner_selection_enabled","deletedAt","deleted_at","mapTrybeSessionToBookableItem","session","SESSION","site_id","maxBookingsPerMember","max_bookings_per_member","waitlistEnabled","waitlist_enabled","maxBasketsPerSession","max_baskets_per_session","recurrenceGroups","recurrence_groups","mapTrybeCourseToBookableItem","course","COURSE","couponId","coupon_id","offerings","offering","offeringType","offering_type","offeringId","offering_id","offeringName","offering_name","quantity","creditsValidityInterval","credits_validity_interval","availabilityRules","availability_rules","mapTrybeCategoryToBookableItemCategory","category","voucherApplicable","voucher_applicable","mapTrybeAppointmentsToSystemResponse","appointments","courseLookup","apt","linkedCourses","courseIndex","mapTrybeSessionsToSystemResponse","sessions","mapTrybeCoursesToSystemResponse","courses","mapTrybeCategoriesToSystemResponse","categories","mapTrybeOfferingTypeToBookableItemType","mapTrybeCouponCodeOfferingToBookableItem","mapTrybeCouponCodeOfferingsToSystemResponse","groupByDate","getDateKey","result","mapTrybeSessionAvailabilityToSystemResponse","filtered","filter","s","remaining_capacity","grouped","dateMatch","start_time","dates","sessionList","time","fromTime","toTime","end_time","_s","_e","camelCaseMeta","sort","a","b","getTime","mapTrybeAppointmentAvailabilityToSystemResponse","slots","quantity_available","slotList","slot","TrybeWellnessManagement","fetchPractitioners","fetchWellnessAppointmentSession","checkWellnessAppointmentSessionAvailability","createWellnessAppointmentSessionOrder","addWellnessAppointmentSessionOrderItems","confirmWellnessAppointmentSessionOrder","fetchAppointments","shouldFetchAllAppointments","apiUrl","join","total","fetchSessions","shouldFetchAllSessions","fetchCourses","shouldFetchAllCourses","fetchCategories","shouldFetchAllCategories","fetchBookableItemsFromCredit","couponCodeId","fetchSessionAvailabilityForOffering","formattedDateTimeFrom","dateTimeFrom","formattedDateTimeTo","dateTimeTo","externalOfferingBookableItemId","encodeURIComponent","fetchAppointmentAvailabilityForOffering","IntegrationLibsModule","IntegrationTrybeModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,aAAN,MAAMA;AAAAA,EAAAA;;;EACX,WAAA,GAAc;AAEd,EAAA;EAEAC,QAAAA,GAAmB;AACjB,IAAA,OAAO,cAAA;AACT,EAAA;AACF,CAAA;;;;;;;;;;;;;;;;;;;ACPO,IAAMC,gBAAN,MAAMA;AAAAA,EAAAA;;;;AACX,EAAA,WAAA,CAA6BC,UAAAA,EAAwB;SAAxBA,UAAAA,GAAAA,UAAAA;AAAyB,EAAA;EAGtDF,QAAAA,GAAmB;AACjB,IAAA,OAAO,IAAA,CAAKE,WAAWF,QAAAA,EAAQ;AACjC,EAAA;AACF,CAAA;;;;;;;;;;;;;;ACAA,IAAMG,WAAAA,GAAcC,YAAAA,CAAQC,SAAAA,EAAW,eAAA,CAAA;AACvCC,aAAAA,CAAO;EAAEC,IAAAA,EAAMJ;AAAY,CAAA,CAAA;;;;;;;;;;;;ACTpB,IAAMJ,cAAN,MAAMA;AAAAA,EAAAA;;;;;;EAIX,WAAA,GAAc;AAEd,EAAA;EAEAC,QAAAA,GAAmB;AACjBQ,IAAAA,OAAAA,CAAQC,GAAAA,CAAI,CAAA,EAAG,IAAA,CAAK,WAAA,CAAYC,IAAI,CAAA,UAAA,CAAY,CAAA;AAChD,IAAA,OAAO,cAAA;AACT,EAAA;AACF,CAAA;;;;;;;;;;;;;;;;;;;ACXO,IAAMT,iBAAN,MAAMA;AAAAA,EAAAA;;;;AACX,EAAA,WAAA,CAA6BC,UAAAA,EAAwB;SAAxBA,UAAAA,GAAAA,UAAAA;AAAyB,EAAA;EAGtDF,QAAAA,GAAmB;AACjB,IAAA,OAAO,IAAA,CAAKE,WAAWF,QAAAA,EAAQ;AACjC,EAA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;;;;;;;;;;AC/fa6B,iCAAN,gBAAA,CAAMA;AAAAA,EAAAA;;;AAAW;;;IA1BtBC,OAAAA,EAAS;;AAEPC,MAAAA,mBAAAA,CAAaC,OAAAA,CAAQ;QACnBC,WAAAA,EAAahG,YAAAA,CAAQC,WAAW,eAAA,CAAA;QAChCgG,QAAAA,EAAU;OAEZ,CAAA;AACAuX,MAAAA,6BAAAA;AACAtX,MAAAA,gBAAAA;AACAC,MAAAA;;IAEFC,WAAAA,EAAa;AAACvG,MAAAA;;IACdwG,SAAAA,EAAW;AACT1G,MAAAA,WAAAA;AACA8I,MAAAA,wBAAAA;AACAT,MAAAA,+BAAAA;AACAsE,MAAAA,0BAAAA;AACAsP,MAAAA;;IAEFtV,OAAAA,EAAS;AACPmC,MAAAA,wBAAAA;AACAT,MAAAA,+BAAAA;AACAsE,MAAAA,0BAAAA;AACAsP,MAAAA;;;;;;;;;;;;;AC3BShW,qCAAN,gBAAA,CAAMA;AAAAA,EAAAA;;;AAAW;;;IALtBC,OAAAA,EAAS;AAAC4X,MAAAA,8BAAAA;AAAwBD,MAAAA;;IAClCpX,WAAAA,EAAa;AAACvG,MAAAA;;IACdwG,SAAAA,EAAW;AAAC1G,MAAAA,UAAAA;AAAY8d,MAAAA,8BAAAA;AAAwBD,MAAAA;;IAChDlX,OAAAA,EAAS;AAACmX,MAAAA,8BAAAA;AAAwBD,MAAAA","file":"index.js","sourcesContent":["import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n constructor() {\n // Service initialization\n }\n\n getHello(): string {\n return 'Hello World!';\n }\n}\n","import { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service';\n\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n @Get('offering-im')\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","/**\n * Load environment variables from root .env file\n * This must be imported/required before any other modules that depend on environment variables\n * (e.g., @dv4resi/dvss-backend-module-utility checks env vars at module import time)\n */\nimport { config } from 'dotenv';\nimport { resolve } from 'path';\n\n// Resolve path to root .env file\n// From src/: ../../../\n// From dist/: ../../../\nconst rootEnvPath = resolve(__dirname, '../../../.env');\nconfig({ path: rootEnvPath });\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n /**\n * Creates an instance of the app service\n */\n constructor() {\n // Service initialization\n }\n\n getHello(): string {\n console.log(`${this.constructor.name}::getHello`);\n return 'Hello World!';\n }\n}\n","import { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service';\n\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n @Get('integration-trybe')\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","/**\n * Load environment variables from root .env file\n * This must be imported/required before any other modules that depend on environment variables\n * (e.g., @dv4resi/dvss-backend-module-utility checks env vars at module import time)\n */\nimport { config } from 'dotenv';\nimport { resolve } from 'path';\n\n// Resolve path to root .env file\n// From src/: ../../../\n// From dist/: ../../../\nconst rootEnvPath = resolve(__dirname, '../../../.env');\nconfig({ path: rootEnvPath });\n","import { Injectable } from '@nestjs/common';\n\n@Injectable()\nexport class AppService {\n getHello(): string {\n return 'Hello World!';\n }\n}\n","import { Controller, Get } from '@nestjs/common';\nimport { AppService } from './app.service';\n\n@Controller()\nexport class AppController {\n constructor(private readonly appService: AppService) {}\n\n @Get('integration-libs')\n getHello(): string {\n return this.appService.getHello();\n }\n}\n","import {\n LoggerService,\n SYSTEM_USER_ID,\n} from '@dv4resi/dvss-backend-module-utility';\nimport { Injectable } from '@nestjs/common';\n\n/**\n * Request logging data structure\n */\nexport interface IIntegrationRequestLog {\n integrationId?: bigint | string;\n method: string;\n url: string;\n headers?: Record<string, string>;\n requestBody?: unknown;\n responseBody?: unknown;\n statusCode?: number;\n duration?: number;\n loggedInUserId?: bigint;\n timestamp?: Date;\n error?: unknown;\n}\n\n/**\n * Service to expose the functionality to log integration requests\n * Uses LoggerService from @dv4resi/dvss-backend-module-utility\n */\n@Injectable()\nexport class IntegrationRequestLoggerService {\n private readonly className = IntegrationRequestLoggerService.name;\n\n constructor(private readonly logger: LoggerService) {}\n\n /**\n * Log integration request (before making the API call)\n *\n * @param logData - The request log data to be logged\n */\n logRequest(logData: IIntegrationRequestLog): void {\n const { loggedInUserId, method, url, headers, requestBody } = logData;\n\n this.logger.info(\n loggedInUserId || SYSTEM_USER_ID,\n this.logRequest.name,\n this.className,\n `Integration API Request: ${method} ${url}`,\n {\n integrationId: logData.integrationId,\n method,\n url,\n headers: this.sanitizeHeaders(headers),\n requestBody,\n timestamp: logData.timestamp || new Date(),\n },\n );\n }\n\n /**\n * Log integration response (after successful API call)\n *\n * @param logData - The response log data to be logged\n */\n logResponse(logData: IIntegrationRequestLog): void {\n const { loggedInUserId, method, url, statusCode, duration, responseBody } =\n logData;\n\n this.logger.info(\n loggedInUserId || SYSTEM_USER_ID,\n this.logResponse.name,\n this.className,\n `Integration API Response: ${method} ${url} - ${statusCode} (${duration}ms)`,\n {\n integrationId: logData.integrationId,\n method,\n url,\n statusCode,\n duration,\n responseBody,\n timestamp: logData.timestamp || new Date(),\n },\n );\n }\n\n /**\n * Log integration error (after failed API call)\n *\n * @param logData - The error log data to be logged\n */\n logError(logData: IIntegrationRequestLog): void {\n const { loggedInUserId, method, url, statusCode, duration, error } =\n logData;\n\n this.logger.error(\n loggedInUserId || SYSTEM_USER_ID,\n this.logError.name,\n this.className,\n `Integration API Error: ${method} ${url} - ${statusCode || 'N/A'} (${duration || 0}ms)`,\n {\n integrationId: logData.integrationId,\n method,\n url,\n statusCode,\n duration,\n error,\n timestamp: logData.timestamp || new Date(),\n },\n );\n }\n\n /**\n * Log integration request (legacy method for backward compatibility)\n * This method determines whether to log as request, response, or error based on the logData\n *\n * @param logData - The request log data to be logged\n */\n logIntegrationRequest(logData: IIntegrationRequestLog): void {\n if (logData.error) {\n this.logError(logData);\n } else if (logData.statusCode && logData.responseBody !== undefined) {\n this.logResponse(logData);\n } else {\n this.logRequest(logData);\n }\n }\n\n /**\n * Sanitize headers to remove sensitive information\n *\n * @param headers - The headers to sanitize\n * @returns Sanitized headers\n */\n private sanitizeHeaders(\n headers?: Record<string, string>,\n ): Record<string, string> | undefined {\n if (!headers) {\n return undefined;\n }\n\n const sanitized = { ...headers };\n const sensitiveKeys = [\n 'authorization',\n 'api-key',\n 'apikey',\n 'x-api-key',\n 'cookie',\n ];\n\n for (const key of Object.keys(sanitized)) {\n if (sensitiveKeys.includes(key.toLowerCase())) {\n sanitized[key] = '***REDACTED***';\n }\n }\n\n return sanitized;\n }\n}\n","import { Injectable } from '@nestjs/common';\n\n/**\n * Service to expose the functionality to validate and enforce rate limits\n */\n@Injectable()\nexport class RateLimiterService {\n /**\n * Validate and enforce rate limit\n *\n * @returns Promise resolving when the rate limit is validated and enforced\n */\n async validateAndEnforceRateLimit(): Promise<void> {\n // TODO Get the rate limit from the configuration store\n // TODO Validate the rate limit\n // TODO Enforce the rate limit\n // TODO If the rate limit is exceeded, throw an error\n // TODO If the rate limit is not exceeded, pass the request to the traffic gateway\n }\n}\n","/**\n * HTTP method constants\n */\nexport enum HTTP_METHOD {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n","import { HttpService } from '@nestjs/axios';\nimport { Injectable } from '@nestjs/common';\nimport { firstValueFrom } from 'rxjs';\nimport { HTTP_METHOD } from '../constants/http.constant';\nimport {\n IntegrationRequestLoggerService,\n type IIntegrationRequestLog,\n} from '../logging/request-logger.service';\nimport { RateLimiterService } from '../rate-limiter/rate-limiter.service';\nimport { IValidatedCapabilityIntegration } from '../../integration-common-utils';\n\n/**\n * Request configuration for API calls\n */\nexport interface IApiCallRequest<TBody = unknown> {\n apiMethod: HTTP_METHOD;\n url: string;\n baseUrl: string;\n headers?: Record<string, string>;\n body?: TBody;\n responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';\n headerType?: 'json' | 'xml';\n}\n\n/**\n * Request context for deriving rate limits and other settings\n */\nexport interface IIntegrationRequestContext {\n projectId?: bigint;\n propertyId?: bigint;\n capabilityId?: bigint;\n [key: string]: unknown;\n}\n\n/**\n * Service to expose the functionality to execute integration requests\n * This service provides a generic API call method that can be used for any third-party integration\n */\n@Injectable()\nexport class TrafficGatewayService {\n constructor(\n private readonly httpService: HttpService,\n private readonly requestLogger: IntegrationRequestLoggerService,\n private readonly rateLimiter: RateLimiterService,\n ) {}\n\n /**\n * Execute a generic API call to a third-party integration\n *\n * @template TResponse - The expected response type\n * @template TRequestBody - The request body type (optional)\n * @param request - The API call request configuration\n * @param integration - The integration configuration\n * @param loggedInUserId - Optional user ID for logging purposes\n * @param _context - Optional context for deriving rate limits and other settings (projectId, propertyId, etc.)\n * @returns Promise resolving to the API response data\n * @throws Error if the request fails or rate limit is exceeded\n */\n async executeIntegrationRequest<TResponse = unknown, TRequestBody = unknown>(\n request: IApiCallRequest<TRequestBody>,\n integration: IValidatedCapabilityIntegration,\n loggedInUserId?: bigint,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _context?: IIntegrationRequestContext,\n ): Promise<TResponse> {\n const startTime = Date.now();\n\n try {\n // Prepare headers with authorization\n const headers = this.prepareHeaders(request);\n\n // Prepare request configuration\n const requestConfig = this.prepareRequestConfig(request, headers);\n\n // Rate limiting check with context for deriving rate limits\n await this.rateLimiter.validateAndEnforceRateLimit();\n\n // Construct full URL with proper handling of trailing slashes\n const fullUrl = this.constructFullUrl(request.baseUrl, request.url);\n\n // Prepare log data with full URL and headers for request logging\n const logData: IIntegrationRequestLog = {\n integrationId: integration.id,\n method: request.apiMethod,\n url: fullUrl,\n headers,\n requestBody: request.body,\n loggedInUserId,\n timestamp: new Date(),\n };\n\n // Log the request before making the API call\n this.requestLogger.logRequest(logData);\n\n // Execute the HTTP request based on method\n const apiResponse = await this.executeHttpRequest<TResponse>(\n request,\n fullUrl,\n requestConfig,\n );\n\n const duration = Date.now() - startTime;\n const responseData = apiResponse.data;\n\n // Log the successful response\n this.requestLogger.logResponse({\n ...logData,\n responseBody: responseData,\n statusCode: apiResponse.status,\n duration,\n });\n\n return responseData;\n } catch (error) {\n const duration = Date.now() - startTime;\n const errorDetails = this.extractErrorDetails(error);\n\n // Get base URL safely for error logging\n const baseUrl = integration.config.platformConfig.baseUrl;\n const fullUrl = this.constructFullUrl(baseUrl, request.url);\n\n // Log the failed request with error details\n this.requestLogger.logError({\n integrationId: integration.id,\n method: request.apiMethod,\n url: fullUrl,\n headers: request.headers,\n requestBody: request.body,\n loggedInUserId,\n timestamp: new Date(),\n error: errorDetails.message || String(error),\n statusCode: errorDetails.statusCode,\n duration,\n });\n\n // Re-throw the error for the caller to handle\n throw error;\n }\n }\n\n /**\n * Prepare headers for the API request\n *\n * @private\n * @param request - The API call request configuration\n * @param apiKey - The API key for authorization\n * @returns Prepared headers object\n */\n private prepareHeaders(request: IApiCallRequest): Record<string, string> {\n request.headerType = request.headerType || 'json';\n\n const headers: Record<string, string> = {\n ...(request.headers || {}),\n };\n\n // Set default content type if not provided for methods that send body\n if (\n !headers['Content-Type'] &&\n request.headerType === 'json' &&\n (request.apiMethod === HTTP_METHOD.POST ||\n request.apiMethod === HTTP_METHOD.PUT ||\n request.apiMethod === HTTP_METHOD.PATCH)\n ) {\n headers['Content-Type'] = 'application/json';\n }\n\n // Set default accept header if not provided\n if (!headers['Accept'] && request.headerType === 'json') {\n headers['Accept'] = 'application/json';\n }\n\n return headers;\n }\n\n /**\n * Prepare request configuration object\n *\n * @private\n * @param request - The API call request configuration\n * @param headers - Prepared headers\n * @returns Request configuration object\n */\n private prepareRequestConfig(\n request: IApiCallRequest,\n headers: Record<string, string>,\n ): Record<string, unknown> {\n const requestConfig: Record<string, unknown> = {\n headers,\n };\n\n if (request.responseType) {\n requestConfig.responseType = request.responseType;\n }\n\n return requestConfig;\n }\n\n /**\n * Construct full URL from base URL and request URL\n * Handles trailing slashes properly\n *\n * @private\n * @param baseUrl - The base URL from platform config\n * @param requestUrl - The request URL path\n * @returns Constructed full URL\n */\n private constructFullUrl(baseUrl: string, requestUrl: string): string {\n const normalizedBaseUrl = baseUrl.endsWith('/')\n ? baseUrl.slice(0, -1)\n : baseUrl;\n const normalizedRequestUrl = requestUrl.startsWith('/')\n ? requestUrl\n : `/${requestUrl}`;\n\n return `${normalizedBaseUrl}${normalizedRequestUrl}`;\n }\n\n /**\n * Execute HTTP request based on the method\n *\n * @private\n * @template TResponse - The expected response type\n * @param request - The API call request configuration\n * @param fullUrl - The full URL to make the request to\n * @param requestConfig - The request configuration\n * @returns Promise resolving to the HTTP response\n * @throws Error if the HTTP method is unsupported\n */\n private async executeHttpRequest<TResponse>(\n request: IApiCallRequest,\n fullUrl: string,\n requestConfig: Record<string, unknown>,\n ) {\n switch (request.apiMethod) {\n case HTTP_METHOD.GET: {\n return await firstValueFrom(\n this.httpService.get<TResponse>(fullUrl, requestConfig),\n );\n }\n case HTTP_METHOD.POST: {\n return await firstValueFrom(\n this.httpService.post<TResponse>(\n fullUrl,\n request.body,\n requestConfig,\n ),\n );\n }\n case HTTP_METHOD.PUT: {\n return await firstValueFrom(\n this.httpService.put<TResponse>(fullUrl, request.body, requestConfig),\n );\n }\n case HTTP_METHOD.PATCH: {\n return await firstValueFrom(\n this.httpService.patch<TResponse>(\n fullUrl,\n request.body,\n requestConfig,\n ),\n );\n }\n case HTTP_METHOD.DELETE: {\n return await firstValueFrom(\n this.httpService.delete<TResponse>(fullUrl, requestConfig),\n );\n }\n default: {\n throw new Error(\n `Unsupported HTTP method: ${String(request.apiMethod)}`,\n );\n }\n }\n }\n\n /**\n * Extract error details from an error object\n *\n * @private\n * @param error - The error object\n * @returns Extracted error details\n */\n private extractErrorDetails(error: unknown): {\n message?: string;\n statusCode?: number;\n } {\n const errorObject = error as {\n status?: number;\n response?: { data?: unknown; status?: number };\n message?: string;\n };\n\n return {\n message: errorObject.message,\n statusCode: errorObject.status || errorObject.response?.status,\n };\n }\n}\n","// Load environment variables BEFORE importing modules that check env vars at import time\nimport './load-env';\nimport { LoggerModule } from '@dv4resi/dvss-backend-module-utility';\nimport { HttpModule } from '@nestjs/axios';\nimport { ConfigModule } from '@nestjs/config';\nimport { Module } from '@nestjs/common';\nimport { resolve } from 'path';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { IntegrationRequestLoggerService } from './integration-traffic-router/logging/request-logger.service';\nimport { RateLimiterService } from './integration-traffic-router/rate-limiter/rate-limiter.service';\nimport { TrafficGatewayService } from './integration-traffic-router/gateway/traffic-gateway.service';\n\n@Module({\n imports: [\n // Load environment variables from root .env file\n ConfigModule.forRoot({\n envFilePath: resolve(__dirname, '../../../.env'),\n isGlobal: true,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }) as any,\n HttpModule,\n LoggerModule,\n ],\n controllers: [AppController],\n providers: [\n AppService,\n TrafficGatewayService,\n IntegrationRequestLoggerService,\n RateLimiterService,\n ],\n exports: [\n TrafficGatewayService,\n IntegrationRequestLoggerService,\n RateLimiterService,\n ],\n})\nexport class AppModule {}\n","export const TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY =\n 'traffic-router-configuration-store';\n","import {\n ICapabilityIntegration,\n IValidatedCapabilityIntegration,\n} from '../../integration-common-utils';\n\n/**\n * Base abstract class for integration authentication operations\n * Provides a foundation for implementing authentication functionality\n * for different integration providers\n *\n * This class should be extended by concrete implementations that provide\n * specific authentication operations for different integration systems\n */\nexport abstract class BaseAuth {\n /**\n * Abstract method to validate integration configuration\n * Must be implemented by concrete classes\n *\n * @param config - Integration configuration object\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to validated configuration\n */\n abstract validateConfig(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): IValidatedCapabilityIntegration;\n\n /**\n * Abstract method to test integration connection\n * Must be implemented by concrete classes\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving when test is completed\n */\n abstract testIntegration(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<boolean>;\n\n /**\n * Abstract method to fetch an access token from the integration provider.\n * Must be implemented by concrete classes.\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to the access token string\n */\n abstract fetchAccessToken(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<string>;\n}\n","import {\n type IBookableItem,\n type IBookableItemCategory,\n type ICapabilityIntegration,\n type IFetchOfferingAvailabilityRequest,\n type IGetAppointmentsRequest,\n type IGetAvailableDatesAndTimeSlotsResponse,\n type IGetBookableItemsFromCreditRequest,\n type IGetCategoriesRequest,\n type IGetCoursesRequest,\n type IGetSessionsRequest,\n} from '../../../integration-common-utils';\nimport { type ISystemResponse } from '../../../integration-common-utils/models/common.model';\n\n/**\n * Base abstract class for wellness management operations\n * Provides a foundation for implementing wellness management functionality\n * within capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific wellness management operations for different systems\n */\nexport abstract class BaseWellnessManagement {\n abstract fetchAppointments(\n request: IGetAppointmentsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>>;\n\n abstract fetchSessions(\n request: IGetSessionsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>>;\n\n abstract fetchCourses(\n request: IGetCoursesRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>>;\n\n abstract fetchCategories(\n request: IGetCategoriesRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItemCategory>>;\n\n abstract fetchBookableItemsFromCredit(\n request: IGetBookableItemsFromCreditRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>>;\n\n abstract fetchSessionAvailabilityForOffering(\n request: IFetchOfferingAvailabilityRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<IGetAvailableDatesAndTimeSlotsResponse>;\n\n abstract fetchAppointmentAvailabilityForOffering(\n request: IFetchOfferingAvailabilityRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<IGetAvailableDatesAndTimeSlotsResponse>;\n\n abstract fetchPractitioners(): Promise<void>; // return type Offering Resource\n\n /**\n * Abstract method to fetch a wellness appointment session\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session is fetched\n */\n abstract fetchWellnessAppointmentSession(): Promise<void>;\n\n /**\n * Abstract method to check availability of a wellness appointment session\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the availability check is completed\n */\n abstract checkWellnessAppointmentSessionAvailability(): Promise<void>;\n\n /**\n * Abstract method to create a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session order is created\n */\n abstract createWellnessAppointmentSessionOrder(): Promise<void>;\n\n /**\n * Abstract method to add items to a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the order items are added\n */\n abstract addWellnessAppointmentSessionOrderItems(): Promise<void>;\n\n /**\n * Abstract method to confirm a wellness appointment session order\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the appointment session order is confirmed\n */\n abstract confirmWellnessAppointmentSessionOrder(): Promise<void>;\n}\n","import {\n ICapabilityIntegration,\n ICredit,\n IGetCustomerCreditsRequest,\n} from '../../../integration-common-utils';\nimport { ISystemResponse } from '../../../integration-common-utils/models/common.model';\n\n/**\n * Base abstract class for credit booking operations\n * Provides a foundation for implementing credit booking functionality\n *\n * This class should be extended by concrete implementations that provide\n * specific credit booking operations for different systems\n */\nexport abstract class BaseCreditBooking {\n /**\n * Abstract method to fetch customer credits\n * Must be implemented by concrete classes\n *\n * @param request - The request object containing the customer ID\n * @param integration - The integration object\n * @param loggedInUserId - The user ID of the logged in user\n * @returns Promise resolving to the system customer credits response (totalCount, records)\n */\n abstract fetchCustomerCredits(\n request: IGetCustomerCreditsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<ICredit>>;\n}\n","import {\n ICustomer,\n IGetCustomerRequest,\n IValidatedCapabilityIntegration,\n} from '../../../integration-common-utils';\n\n/**\n * Base abstract class for customer management operations\n * Provides a foundation for implementing customer management functionality\n * within capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer management operations for different systems\n */\nexport abstract class BaseCustomerManagement {\n /**\n * Abstract method to create a new customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createCustomer(): Promise<void>;\n\n /**\n * Abstract method to search for customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the search is completed\n */\n abstract searchCustomer(\n request: IGetCustomerRequest,\n integration: IValidatedCapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ICustomer | undefined>;\n\n /**\n * Abstract method to update an existing customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n abstract updateCustomer(): Promise<void>;\n}\n","/**\n * Base abstract class for package management operations\n * Provides a foundation for implementing package management functionality\n * within capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific package management operations for different systems\n */\nexport abstract class BasePackageManagement {\n /**\n * Abstract method to fetch course types\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the course types are fetched\n */\n abstract fetchCourseTypes(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting contact management operations\n * Provides a foundation for implementing contact management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific contact management operations for different accounting systems\n */\nexport abstract class BaseAccountingContactManagement {\n /**\n * Abstract method to create an accounting contact person\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact person is created\n */\n abstract createAccountingContactPerson(): Promise<void>;\n\n /**\n * Abstract method to update an accounting contact person\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact person is updated\n */\n abstract updateAccountingContactPerson(): Promise<void>;\n\n /**\n * Abstract method to delete an accounting contact person\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact person is deleted\n */\n abstract deleteAccountingContactPerson(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting credit note management operations\n * Provides a foundation for implementing credit note management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific credit note management operations for different accounting systems\n */\nexport abstract class BaseAccountingCreditNoteManagement {\n /**\n * Abstract method to create an accounting credit note\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the credit note is created\n */\n abstract createAccountingCreditNote(): Promise<void>;\n\n /**\n * Abstract method to apply an accounting credit note\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the credit note is applied\n */\n abstract applyAccountingCreditNote(): Promise<void>;\n\n /**\n * Abstract method to refund accounting excess payment\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the excess payment is refunded\n */\n abstract refundAccountingExcessPayment(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting customer management operations\n * Provides a foundation for implementing customer management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer management operations for different accounting systems\n */\nexport abstract class BaseAccountingCustomerManagement {\n /**\n * Abstract method to create an accounting customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createAccountingCustomer(): Promise<void>;\n\n /**\n * Abstract method to list accounting contacts\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contacts are listed\n */\n abstract listAccountingContacts(): Promise<void>;\n\n /**\n * Abstract method to update an accounting contact\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact is updated\n */\n abstract updateAccountingContact(): Promise<void>;\n\n /**\n * Abstract method to delete an accounting contact\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact is deleted\n */\n abstract deleteAccountingContact(): Promise<void>;\n\n /**\n * Abstract method to change the status of an accounting contact\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the contact status is changed\n */\n abstract changeAccountingContactStatus(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting customer payment management operations\n * Provides a foundation for implementing customer payment management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer payment management operations for different accounting systems\n */\nexport abstract class BaseAccountingCustomerPaymentManagement {\n /**\n * Abstract method to create an accounting customer payment\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer payment is created\n */\n abstract createAccountingCustomerPayment(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting invoice management operations\n * Provides a foundation for implementing invoice management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific invoice management operations for different accounting systems\n */\nexport abstract class BaseAccountingInvoiceManagement {\n /**\n * Abstract method to create an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is created\n */\n abstract createAccountingInvoice(): Promise<void>;\n\n /**\n * Abstract method to update an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is updated\n */\n abstract updateAccountingInvoice(): Promise<void>;\n\n /**\n * Abstract method to delete an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is deleted\n */\n abstract deleteAccountingInvoice(): Promise<void>;\n\n /**\n * Abstract method to download an accounting invoice\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the invoice is downloaded\n */\n abstract downloadAccountingInvoice(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting chart of accounts (LOA) management operations\n * Provides a foundation for implementing chart of accounts management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific chart of accounts management operations for different accounting systems\n */\nexport abstract class BaseAccountingLOAManagement {\n /**\n * Abstract method to list accounting chart of accounts\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the chart of accounts is listed\n */\n abstract listAccountingChartOfAccounts(): Promise<void>;\n}\n","/**\n * Base abstract class for accounting tax management operations\n * Provides a foundation for implementing tax management functionality\n * within accounting capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific tax management operations for different accounting systems\n */\nexport abstract class BaseAccountingTaxManagement {\n /**\n * Abstract method to list accounting taxes\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the taxes are listed\n */\n abstract listAccountingTaxes(): Promise<void>;\n}\n","/**\n * Base abstract class for payment operations\n * Provides a foundation for implementing payment functionality\n * within payment capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific payment operations for different payment systems\n */\nexport abstract class BasePayment {\n /**\n * Abstract method to create a payment setup intent\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment setup intent is created\n */\n abstract createPaymentSetupIntent(): Promise<void>;\n\n /**\n * Abstract method to confirm a payment setup intent\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment setup intent is confirmed\n */\n abstract confirmPaymentSetupIntent(): Promise<void>;\n\n /**\n * Abstract method to cancel a payment setup intent\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment setup intent is cancelled\n */\n abstract cancelPaymentSetupIntent(): Promise<void>;\n\n /**\n * Abstract method to create a payment ephemeral key\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment ephemeral key is created\n */\n abstract createPaymentEphemeralKey(): Promise<void>;\n}\n","/**\n * Base abstract class for payment method management operations\n * Provides a foundation for implementing payment method management functionality\n * within payment capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific payment method management operations for different payment systems\n */\nexport abstract class BasePaymentMethodManagement {\n /**\n * Abstract method to create a payment method\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment method is created\n */\n abstract createPaymentMethod(): Promise<void>;\n\n /**\n * Abstract method to attach a payment method to a customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment method is attached\n */\n abstract attachPaymentMethodToCustomer(): Promise<void>;\n\n /**\n * Abstract method to list payment methods for a customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment methods are listed\n */\n abstract listPaymentMethodForCustomer(): Promise<void>;\n\n /**\n * Abstract method to detach a payment method from a customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the payment method is detached\n */\n abstract detachPaymentMethodFromCustomer(): Promise<void>;\n}\n","/**\n * Base abstract class for payment user management operations\n * Provides a foundation for implementing user management functionality\n * within payment capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific user management operations for different payment systems\n */\nexport abstract class BasePaymentUserManagement {\n /**\n * Abstract method to list payment customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customers are listed\n */\n abstract listPaymentCustomers(): Promise<void>;\n\n /**\n * Abstract method to create a new payment customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createPaymentCustomer(): Promise<void>;\n\n /**\n * Abstract method to update an existing payment customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n abstract updatePaymentCustomer(): Promise<void>;\n\n /**\n * Abstract method to delete a payment customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is deleted\n */\n abstract deletePaymentCustomer(): Promise<void>;\n\n /**\n * Abstract method to search for payment customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the search is completed\n */\n abstract searchPaymentCustomers(): Promise<void>;\n}\n","/**\n * Base abstract class for membership customer management operations\n * Provides a foundation for implementing customer management functionality\n * within membership capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific customer management operations for different membership systems\n */\nexport abstract class BaseMembershipCustomerManagement {\n /**\n * Abstract method to get all membership customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when all customers are retrieved\n */\n abstract getMembershipAllCustomers(): Promise<void>;\n\n /**\n * Abstract method to get a specific membership customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is retrieved\n */\n abstract getMembershipCustomer(): Promise<void>;\n\n /**\n * Abstract method to create a new membership customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n abstract createMembershipCustomer(): Promise<void>;\n\n /**\n * Abstract method to update an existing membership customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n abstract updateMembershipCustomer(): Promise<void>;\n}\n","/**\n * Base abstract class for membership management operations\n * Provides a foundation for implementing membership management functionality\n * within membership capabilities\n *\n * This class should be extended by concrete implementations that provide\n * specific membership management operations for different membership systems\n */\nexport abstract class BaseMembershipManagement {\n /**\n * Abstract method to get membership types\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the membership types are retrieved\n */\n abstract getMembershipTypes(): Promise<void>;\n\n /**\n * Abstract method to get a membership\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the membership is retrieved\n */\n abstract getMembership(): Promise<void>;\n}\n","/**\n * System-level credit and customer credits response types.\n * Aligned with payment MS GetUserCredits / Credit shape for consumption across the system.\n * Integrations map their provider-specific responses to these types.\n */\n\n/** Credit type values aligned with payment MS CREDIT_TYPE_ENUM */\nexport enum CREDIT_TYPE_ENUM {\n COUPON = 'COUPON',\n AMOUNT = 'AMOUNT',\n}\n\n/** Credit status values aligned with payment MS CREDIT_STATUS_ENUM */\nexport enum CREDIT_STATUS_ENUM {\n ACTIVE = 'ACTIVE',\n REDEEMED = 'REDEEMED',\n EXPIRED = 'EXPIRED',\n REVOKED = 'REVOKED',\n}\n\nexport enum CREDIT_FILTER_BY_ENUM {\n TYPE = 'TYPE',\n STATUS = 'STATUS',\n}\n\n/**\n * A single credit in the system format.\n * Matches the shape expected by payment MS Credit (plain interface, no GraphQL).\n * Fields not provided by an integration (e.g. id, projectId) are optional.\n */\nexport interface ICredit {\n id?: bigint;\n name: string;\n description?: string;\n type: CREDIT_TYPE_ENUM;\n status: CREDIT_STATUS_ENUM;\n projectId?: number;\n propertyId?: number;\n externalId?: string;\n expiresAt?: Date;\n expiresDate?: string;\n startsAt?: Date;\n startDate?: string;\n value?: string;\n capabilityIntegrationId?: bigint;\n meta?: Record<string, unknown>;\n}\n\n/**\n * System response for customer credits.\n * Matches payment MS GetUserCredits: { totalCount, records }.\n */\nexport interface IGetCustomerCreditsRequestFilters {\n by: CREDIT_FILTER_BY_ENUM;\n values: string[];\n}\n\nexport interface IGetCustomerCreditsRequestOptions {\n filters?: IGetCustomerCreditsRequestFilters[];\n page?: number;\n count?: number;\n}\n\nexport interface IGetCustomerCreditsRequest {\n customerId: string;\n options?: IGetCustomerCreditsRequestOptions;\n}\n","export enum INTEGRATION_PROVIDER_ENUM {\n TRYBE = 'TRYBE',\n}\n\ninterface IPlatformConfig {\n baseUrl?: string;\n}\n\ninterface IIntegrationConfig {\n siteId?: string;\n apiKey?: string;\n organisationId?: string;\n}\n\nexport interface ICapabilityIntegrationConfig {\n platformConfig?: IPlatformConfig;\n integrationConfig?: IIntegrationConfig;\n}\n\nexport interface IValidatedCapabilityIntegrationConfig {\n platformConfig: Required<IPlatformConfig>;\n integrationConfig: Required<IIntegrationConfig>;\n}\n\nexport interface ICapabilityIntegration {\n id: bigint;\n provider?: INTEGRATION_PROVIDER_ENUM | null;\n providerId?: bigint;\n config?: ICapabilityIntegrationConfig;\n capabilityId?: bigint;\n projectId?: number;\n}\n\nexport interface IValidatedCapabilityIntegration {\n id: bigint;\n provider?: INTEGRATION_PROVIDER_ENUM | null;\n providerId?: bigint;\n config: IValidatedCapabilityIntegrationConfig;\n capabilityId?: bigint;\n headers?: Record<string, string>;\n projectId?: number;\n}\n","export enum BOOKABLE_ITEM_TYPE_ENUM {\n APPOINTMENT = 'APPOINTMENT',\n SESSION = 'SESSION',\n COURSE = 'COURSE',\n}\n\nexport enum BOOKABLE_ITEM_STATUS_ENUM {\n ACTIVE = 'ACTIVE',\n INACTIVE = 'INACTIVE',\n}\n\nexport enum DAY_OF_WEEK {\n MON = 'MON',\n TUE = 'TUE',\n WED = 'WED',\n THU = 'THU',\n FRI = 'FRI',\n SAT = 'SAT',\n SUN = 'SUN',\n}\n\nexport interface IBookableItemPriceMeta {\n id?: bigint;\n externalId?: string;\n status?: BOOKABLE_ITEM_STATUS_ENUM;\n price: number;\n currency: string;\n configuredForDays?: DAY_OF_WEEK[];\n config?: Record<string, unknown>;\n}\n\nexport interface IBookableItemPrice {\n id?: bigint;\n label?: string;\n currency: string;\n price: number;\n externalResourceId?: string;\n durationInMinute?: number;\n configuredForDays?: DAY_OF_WEEK[];\n pricesMeta?: IBookableItemPriceMeta[];\n config?: Record<string, unknown>;\n}\n\nexport interface IBookableItemMedia {\n id?: string;\n url?: string;\n originalUrl?: string;\n fileName?: string;\n mimeType?: string;\n thumbnailUrl?: string;\n}\n\nexport interface IBookableItem {\n id?: bigint;\n externalId: string;\n name: string;\n description?: string;\n type: BOOKABLE_ITEM_TYPE_ENUM;\n status: BOOKABLE_ITEM_STATUS_ENUM;\n icon?: IBookableItemMedia;\n primaryAsset?: IBookableItemMedia;\n prices?: IBookableItemPrice[];\n linkedBookableItems?: IBookableItem[];\n updatedAt?: Date;\n createdAt?: Date;\n meta?: Record<string, unknown>;\n}\n\nexport interface IBookableItemCategory {\n id?: bigint;\n externalId: string;\n name: string;\n description?: string;\n meta?: Record<string, unknown>;\n}\n\nexport interface IWellnessManagementRequestOptions {\n page?: number;\n count?: number;\n}\n\nexport interface IGetAppointmentsRequest {\n shouldFetchAllAppointments: boolean;\n practitionerIds?: string[];\n options?: IWellnessManagementRequestOptions;\n}\n\nexport interface IGetSessionsRequest {\n shouldFetchAllSessions: boolean;\n practitionerIds?: string[];\n options?: IWellnessManagementRequestOptions;\n}\n\nexport interface IGetCoursesRequest {\n shouldFetchAllCourses: boolean;\n options?: IWellnessManagementRequestOptions;\n}\n\nexport interface IGetCategoriesRequest {\n shouldFetchAllCategories: boolean;\n options?: IWellnessManagementRequestOptions;\n}\n\nexport interface IGetBookableItemsFromCreditRequest {\n couponCodeId: string;\n options?: IWellnessManagementRequestOptions;\n}\n\nexport interface IFetchOfferingAvailabilityRequest {\n externalOfferingBookableItemId: string;\n dateTimeFrom: Date;\n dateTimeTo: Date;\n}\n\nexport interface IAvailableTimeSlot {\n fromTime: string;\n toTime: string;\n meta?: unknown;\n}\n\nexport interface IAvailableDateWithSlots {\n date: Date;\n meta?: unknown;\n time: IAvailableTimeSlot[];\n}\n\nexport interface IGetAvailableDatesAndTimeSlotsResponse {\n dates: IAvailableDateWithSlots[];\n}\n","/**\n * Trybe implementation for wellness customer management operations\n * Provides concrete implementation of customer management functionality\n * for Trybe wellness systems\n *\n * This class extends the base customer management operations with\n * Trybe-specific implementations\n */\nimport { Injectable } from '@nestjs/common';\nimport { LoggerService } from '@dv4resi/dvss-backend-module-utility';\nimport {\n BaseCustomerManagement,\n HTTP_METHOD,\n IGetCustomerRequest,\n IValidatedCapabilityIntegration,\n TrafficGatewayService,\n} from '@dvss/dvss-integration-libs';\nimport {\n ITrybeCustomer,\n ITrybeCustomerResponse,\n ITrybeGetCustomerByEmailResponse,\n} from '../../models';\n\n@Injectable()\nexport class TrybeCustomerManagement implements BaseCustomerManagement {\n private readonly fileName = 'customer-management.service';\n\n /**\n * Creates an instance of the service\n */\n constructor(\n private readonly logger: LoggerService,\n private readonly trafficGatewayService: TrafficGatewayService,\n ) {}\n\n /**\n * Abstract method to create a new customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is created\n */\n createCustomer(): Promise<void> {\n throw new Error('createCustomer not yet implemented');\n }\n\n /**\n * Abstract method to search for wellness customers\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the search is completed\n */\n async searchCustomer(\n request: IGetCustomerRequest,\n integration: IValidatedCapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ITrybeCustomer | undefined> {\n this.logger.info(\n loggedInUserId,\n this.searchCustomer.name,\n this.fileName,\n `${TrybeCustomerManagement.name} -> ${this.searchCustomer.name} Called`,\n { request },\n );\n\n if (!request.email && !request.customerId) {\n throw new Error(\n 'Either email or customerId is required to get a customer from Trybe',\n );\n }\n\n if (request.customerId) {\n const response =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeCustomerResponse,\n string\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `/customers/customers/${request.customerId}`,\n baseUrl: integration.config.platformConfig.baseUrl,\n headers: integration.headers,\n },\n integration,\n loggedInUserId,\n );\n\n if (!response.data) {\n return undefined;\n }\n\n return response.data;\n }\n\n if (request.email) {\n const response =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeGetCustomerByEmailResponse,\n string\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `/customers/customers/?email=${request.email}`,\n baseUrl: integration.config.platformConfig.baseUrl,\n headers: integration.headers,\n },\n integration,\n loggedInUserId,\n );\n\n if (!response.data || response.data.length === 0) {\n return undefined;\n }\n\n return response.data[0];\n }\n }\n\n /**\n * Abstract method to update an existing customer\n * Must be implemented by concrete classes\n *\n * @returns Promise resolving when the customer is updated\n */\n updateCustomer(): Promise<void> {\n throw new Error('updateCustomer not yet implemented');\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport {\n BaseAuth,\n ICapabilityIntegration,\n IValidatedCapabilityIntegration,\n} from '@dvss/dvss-integration-libs';\nimport { TrybeCustomerManagement } from '../../capabilities/customer-management/customer-management.service';\nimport { LoggerService } from '@dv4resi/dvss-backend-module-utility';\n\n@Injectable()\nexport class TrybeAuthService implements BaseAuth {\n private readonly fileName = 'auth.service';\n\n /**\n * Creates an instance of the Trybe authentication service\n */\n constructor(\n private readonly trybeCustomerManagement: TrybeCustomerManagement,\n private readonly logger: LoggerService,\n ) {}\n\n /**\n * Validates Trybe integration configuration\n * Checks for required fields: apiKey, siteId, organisationId, and baseUrl\n *\n * @param config - Integration configuration object\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to validated configuration\n * @throws Error if config is invalid\n */\n validateConfig(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): IValidatedCapabilityIntegration {\n this.logger.info(\n loggedInUserId,\n this.validateConfig.name,\n this.fileName,\n `${TrybeAuthService.name} -> ${this.validateConfig.name} Called`,\n { integration },\n );\n\n if (!integration.config) {\n throw new Error('Integration configuration is missing');\n }\n\n const { config } = integration;\n\n const integrationConfig = config.integrationConfig || {};\n const platformConfig = config.platformConfig || {};\n\n if (Object.keys(integrationConfig).length > 0) {\n if (!integrationConfig.apiKey) {\n throw new Error(\n 'Integration configuration is invalid: API Key not found',\n );\n } else if (!integrationConfig.siteId) {\n throw new Error(\n 'Integration configuration is invalid: Site ID not found',\n );\n } else if (!integrationConfig.organisationId) {\n throw new Error(\n 'Integration configuration is invalid: Organisation ID not found',\n );\n }\n } else {\n throw new Error(\n 'Integration configuration is invalid: Integration config is empty',\n );\n }\n\n if (Object.keys(platformConfig).length > 0) {\n if (!platformConfig.baseUrl) {\n throw new Error(\n 'Platform configuration is invalid: Base URL not found',\n );\n }\n } else {\n throw new Error(\n 'Platform configuration is invalid: Platform config is empty',\n );\n }\n\n const headers: Record<string, string> = {\n Authorization: `Bearer ${integrationConfig.apiKey}`,\n };\n\n return {\n ...integration,\n headers,\n } as IValidatedCapabilityIntegration;\n }\n\n /**\n * Tests Trybe integration by making a test API call\n * Uses a test customer lookup to verify credentials are valid\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving when test is completed\n * @throws Error if authentication fails or API call fails\n */\n async testIntegration(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<boolean> {\n this.logger.info(\n loggedInUserId,\n this.testIntegration.name,\n this.fileName,\n `${TrybeAuthService.name} -> ${this.testIntegration.name} Called`,\n { integration },\n );\n\n // Validate config\n const validatedIntegration = this.validateConfig(\n integration,\n loggedInUserId,\n );\n\n // Perform test API call using traffic gateway\n await this.trybeCustomerManagement.searchCustomer(\n {\n email: 'test@integration.test',\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n this.logger.info(\n loggedInUserId,\n this.testIntegration.name,\n this.fileName,\n 'Trybe integration test successful. The credentials are valid.',\n );\n\n return true;\n }\n\n /**\n * Fetches an access token from the Trybe integration provider.\n *\n * @param integration - Integration object with configuration\n * @param loggedInUserId - User ID for logging\n * @returns Promise resolving to the access token string\n */\n fetchAccessToken(\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<string> {\n this.logger.info(\n loggedInUserId,\n this.fetchAccessToken.name,\n this.fileName,\n `${TrybeAuthService.name} -> ${this.fetchAccessToken.name} Called`,\n { integration },\n );\n\n throw new Error('Method not implemented.');\n }\n}\n","import {\n type ICredit,\n CREDIT_STATUS_ENUM,\n CREDIT_TYPE_ENUM,\n IValidatedCapabilityIntegration,\n} from '@dvss/dvss-integration-libs';\nimport type {\n ITrybeCredit,\n ITrybeGetCustomerCreditsResponse,\n} from '../../models';\nimport { ISystemResponse } from '@dvss/dvss-integration-libs/integration-common-utils/models/common.model';\n\nfunction mapStatus(t: ITrybeCredit): CREDIT_STATUS_ENUM {\n if (t.redeemed_at) return CREDIT_STATUS_ENUM.REDEEMED;\n if (t.revoked_at) return CREDIT_STATUS_ENUM.REVOKED;\n if (new Date(t.expires_at) < new Date()) return CREDIT_STATUS_ENUM.EXPIRED;\n return CREDIT_STATUS_ENUM.ACTIVE;\n}\n\n/**\n * Groups Trybe credits by (coupon_name, issued_at), then maps each group to one ICredit.\n * Within a group, only coupon_code can differ; all codes are in meta.integrationDetails.couponCodes.\n * value is set to the first coupon code.\n */\nexport function mapTrybeCreditsToSystem(\n res: ITrybeGetCustomerCreditsResponse,\n integration: IValidatedCapabilityIntegration,\n): ISystemResponse<ICredit> {\n const groups = new Map<string, ITrybeCredit[]>();\n for (const t of res.data) {\n const key = `${t.coupon_name}|${t.issued_at}`;\n const list = groups.get(key) ?? [];\n list.push(t);\n groups.set(key, list);\n }\n\n const records: ICredit[] = [];\n let index = 0;\n for (const [, items] of groups) {\n const first = items[0];\n const couponCodes = items.map((i) => i.coupon_code);\n records.push({\n id: BigInt(index + 1),\n capabilityIntegrationId: integration.id,\n projectId: integration.projectId,\n name: first.coupon_name,\n description: first.coupon_description ?? undefined,\n type: CREDIT_TYPE_ENUM.COUPON,\n status: mapStatus(first),\n externalId: first.id,\n expiresAt: new Date(first.expires_at),\n expiresDate: first.expires_at.split('T')[0],\n startsAt: new Date(first.issued_at),\n startDate: first.issued_at.split('T')[0],\n value: couponCodes[0],\n meta: {\n integrationDetails: {\n customerId: first.customer_id,\n membershipId: first.membership_id,\n multiUse: first.multi_use === 1,\n couponCodes,\n redeemedAt: first.redeemed_at,\n revokedAt: first.revoked_at,\n },\n },\n });\n index++;\n }\n\n return {\n totalCount: records.length,\n records,\n };\n}\n","/**\n * Trybe implementation for credit booking operations\n * Provides concrete implementation of credit booking functionality\n * for Trybe systems\n *\n * This class extends the base credit booking operations with\n * Trybe-specific implementations\n */\nimport {\n BaseCreditBooking,\n CREDIT_FILTER_BY_ENUM,\n CREDIT_STATUS_ENUM,\n HTTP_METHOD,\n ICapabilityIntegration,\n ICredit,\n IGetCustomerCreditsRequest,\n TrafficGatewayService,\n} from '@dvss/dvss-integration-libs';\nimport { LoggerService } from '@dv4resi/dvss-backend-module-utility';\nimport { Injectable } from '@nestjs/common';\nimport type { ITrybeGetCustomerCreditsResponse } from '../../models';\nimport { mapTrybeCreditsToSystem } from './credit-booking.mapper';\nimport { TrybeAuthService } from '../../utils/auth/auth.service';\nimport { ISystemResponse } from '@dvss/dvss-integration-libs/integration-common-utils/models/common.model';\n\n@Injectable()\nexport class TrybeCreditBooking implements BaseCreditBooking {\n private readonly fileName = 'credit-booking.service';\n\n /**\n * Creates an instance of the service\n */\n constructor(\n private readonly logger: LoggerService,\n private readonly trafficGatewayService: TrafficGatewayService,\n private readonly trybeAuthService: TrybeAuthService,\n ) {}\n\n /**\n * Fetches customer credits from Trybe and returns system-format response\n *\n * @returns Promise resolving to the system customer credits response\n */\n async fetchCustomerCredits(\n request: IGetCustomerCreditsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<ICredit>> {\n this.logger.info(\n loggedInUserId,\n this.fetchCustomerCredits.name,\n this.fileName,\n `${TrybeCreditBooking.name} -> ${this.fetchCustomerCredits.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n\n const query = new URLSearchParams();\n const opts = request.options;\n\n if (opts?.page != null) query.set('page', String(opts.page));\n if (opts?.count != null) query.set('per_page', String(opts.count));\n\n const statusFilterValues =\n opts?.filters?.[0]?.by === CREDIT_FILTER_BY_ENUM.STATUS\n ? opts.filters[0].values\n : [];\n\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.EXPIRED)) {\n query.set('expired', 'true');\n } else {\n query.set('expired', 'false');\n }\n\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REDEEMED)) {\n query.set('redeemed', 'true');\n } else {\n query.set('redeemed', 'false');\n }\n\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REVOKED)) {\n query.set('revoked', 'true');\n } else {\n query.set('revoked', 'false');\n }\n\n const queryString = query.toString();\n const url =\n `/customers/customers/${request.customerId}/credits` +\n (queryString ? `?${queryString}` : '');\n\n const raw: ITrybeGetCustomerCreditsResponse =\n await this.trafficGatewayService.executeIntegrationRequest<ITrybeGetCustomerCreditsResponse>(\n {\n apiMethod: HTTP_METHOD.GET,\n url,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n return mapTrybeCreditsToSystem(raw, validatedIntegration);\n }\n}\n","/**\n * Format date for Trybe API (start or end of day with timezone)\n */\nexport function formatDateForTrybe(date: Date, isStartOfDay: boolean): string {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n const hours = isStartOfDay ? '00' : '23';\n const minutes = isStartOfDay ? '00' : '59';\n const seconds = isStartOfDay ? '00' : '59';\n\n // Fixed timezone offset: -05:00\n return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}-05:00`;\n}\n\n/**\n * Extract time from ISO string (e.g. '2026-09-23T08:30:00-04:00' -> '08:30')\n */\nexport function extractTimeFromIsoString(isoString: string): string {\n const timeMatch = isoString.match(/T(\\d{2}:\\d{2})/);\n return timeMatch ? timeMatch[1] : '';\n}\n\nfunction snakeToCamel(str: string): string {\n return str.replaceAll(/_([a-z])/g, (_, letter: string) =>\n letter.toUpperCase(),\n );\n}\n\n/**\n * Recursively convert object keys from snake_case to camelCase\n */\nexport function convertKeysToCamelCase(object: unknown): unknown {\n if (object === null || object === undefined) {\n return object;\n }\n if (Array.isArray(object)) {\n return object.map((item) => convertKeysToCamelCase(item));\n }\n if (typeof object === 'object') {\n const converted: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(object)) {\n converted[snakeToCamel(key)] = convertKeysToCamelCase(value);\n }\n return converted;\n }\n return object;\n}\n","export const fetchAllPages = async <\n T,\n TResponse extends { data: T[]; meta: { last_page: number } },\n>(\n firstPageResponse: TResponse,\n shouldFetchAll: boolean,\n fetchPage: (page: number) => Promise<TResponse>,\n): Promise<T[]> => {\n const items: T[] = [];\n items.push(...firstPageResponse.data);\n\n if (!shouldFetchAll) {\n return items;\n }\n\n const lastPage = firstPageResponse.meta.last_page;\n\n for (let page = 2; page <= lastPage; page += 1) {\n const pageResponse = await fetchPage(page);\n items.push(...pageResponse.data);\n }\n\n return items;\n};\n","import { type IGetTrybeResourcesCommonResponse } from './trybe-common.model';\n\n// ==================== TRYBE HELPER TYPES ====================\n\nexport interface ITrybeImage {\n id: string;\n file_name: string;\n mime_type: string;\n size: number;\n url: string;\n original_url: string;\n}\n\nexport interface ITrybeMeta {\n title: string;\n description: string;\n}\n\nexport interface ITrybePriceRule {\n id: string;\n price: number;\n weekdays?: string[];\n date_from: string;\n date_to: string;\n time_from?: string;\n time_to?: string;\n}\n\n// ==================== TRYBE CATEGORY ====================\n\nexport interface ITrybeCategory {\n id: string;\n name: string;\n voucher_applicable: unknown;\n}\n\nexport type ITrybeGetCategoriesResponse =\n IGetTrybeResourcesCommonResponse<ITrybeCategory>;\n\n// ==================== TRYBE APPOINTMENT ====================\n\nexport interface ITrybeAppointmentPriceRule extends ITrybePriceRule {\n appointment_type_id: string;\n}\n\nexport interface ITrybeAppointment {\n id: string;\n name: string;\n description?: string;\n currency: string;\n product_code: string;\n image?: ITrybeImage;\n site_ids: string[];\n room_ids: string[];\n equipment_ids: unknown[];\n practitioner_ids: string[];\n category_ids: string[];\n durations: number[];\n end_buffer: number;\n start_time_interval: number;\n max_advance_bookings_interval?: string;\n min_advance_bookings_interval?: string;\n tag_ids: unknown[];\n tags: unknown[];\n categories: ITrybeCategory[];\n price_rules: ITrybeAppointmentPriceRule[];\n contraindications: unknown[];\n offered_online: boolean;\n private: boolean;\n visibility: string;\n customers_only: boolean;\n members_only: boolean;\n membership_booking_windows_enabled: boolean;\n membership_booking_windows: unknown[];\n meta: ITrybeMeta;\n upsell_offerings: unknown[];\n cross_sell_offerings: unknown[];\n related_retail_offerings: unknown[];\n customer_cancellation_permitted?: string;\n customer_cancellation_min_duration?: string;\n min_guests: number;\n max_guests: number;\n allocate_multi_capacity_rooms: boolean;\n enquiries_enabled: boolean;\n revenue_centre: unknown;\n include_pricing_on_calendar: boolean;\n max_per_basket: unknown;\n max_per_guest: unknown;\n shop_practitioner_selection_enabled: boolean;\n updated_at: string;\n deleted_at: string;\n}\n\nexport type ITrybeGetAppointmentsResponse =\n IGetTrybeResourcesCommonResponse<ITrybeAppointment>;\n\n// ==================== TRYBE SESSION ====================\n\nexport interface ITrybeSessionPriceRule extends ITrybePriceRule {\n session_type_id: string;\n}\n\nexport interface ITrybeSessionMeta {\n title: string;\n description: string;\n}\n\nexport interface ITrybeSessionRecurrenceGroup {\n id: string;\n name: string;\n practitioner: {\n id: string;\n name: string;\n };\n room: ITrybeSessionRoom;\n weekdays: string[];\n start_time: string;\n start_times: ITrybeSessionStartTime[];\n capacity: number;\n recurrence_start?: string;\n recurrence_end?: string;\n session_type_id: string;\n deleted_at: string;\n}\n\nexport interface ITrybeSessionRoom {\n id: string;\n name: string;\n capacity: number;\n}\n\nexport interface ITrybeSessionStartTime {\n value: string;\n id: string;\n}\n\nexport interface ITrybeSession {\n id: string;\n name: string;\n description?: string;\n currency: string;\n product_code: string;\n image?: ITrybeImage;\n site_id: string;\n category_ids: string[];\n price_rules: ITrybeSessionPriceRule[];\n duration?: number;\n offered_online: boolean;\n private: boolean;\n visibility: string;\n customers_only: boolean;\n members_only: boolean;\n membership_booking_windows_enabled: boolean;\n membership_booking_windows: unknown[];\n max_bookings_per_member: number;\n meta: ITrybeSessionMeta;\n upsell_offerings: unknown[];\n cross_sell_offerings: unknown[];\n related_retail_offerings: unknown[];\n customer_cancellation_permitted?: string;\n customer_cancellation_min_duration?: string;\n waitlist_enabled: boolean;\n max_advance_bookings_interval?: string;\n min_advance_bookings_interval?: string;\n min_guests: number;\n max_guests: number;\n categories: ITrybeCategory[];\n max_baskets_per_session?: number;\n recurrence_groups: ITrybeSessionRecurrenceGroup[];\n revenue_centre: string;\n include_pricing_on_calendar: boolean;\n max_per_basket: string;\n max_per_guest: string;\n updated_at: string;\n deleted_at: string;\n}\n\nexport type ITrybeGetSessionsResponse =\n IGetTrybeResourcesCommonResponse<ITrybeSession>;\n\n// ==================== TRYBE COURSE ====================\n\nexport interface ITrybeOffering {\n offering_type: string;\n offering_id: string;\n offering_name: string;\n}\n\nexport interface ITrybeCourse {\n id: string;\n name: string;\n description?: string;\n currency: string;\n product_code: string;\n coupon_id: string;\n offerings: ITrybeOffering[];\n offering_type: string;\n offering_id: string;\n image?: ITrybeImage;\n site_id: string;\n category_ids: string[];\n quantity: number;\n credits_validity_interval?: string;\n offered_online: boolean;\n private: boolean;\n visibility: string;\n customers_only: boolean;\n members_only: boolean;\n meta: ITrybeMeta;\n upsell_offerings: ITrybeOffering[];\n cross_sell_offerings: ITrybeOffering[];\n related_retail_offerings: ITrybeOffering[];\n availability_rules: unknown[];\n price_rules: ITrybePriceRule[];\n revenue_centre: unknown;\n updated_at: string;\n deleted_at: string;\n}\n\nexport type ITrybeGetCoursesResponse =\n IGetTrybeResourcesCommonResponse<ITrybeCourse>;\n\nexport enum TRYBE_OFFERING_TYPE_ENUM {\n APPOINTMENT = 'APPOINTMENT',\n SESSION = 'SESSION',\n COURSE = 'COURSE',\n}\n\nexport interface ITrybeCouponCodeOffering {\n offering_type: TRYBE_OFFERING_TYPE_ENUM;\n offering_id: string;\n offering_name: string;\n}\n\nexport interface ITrybeCouponCodeOfferingsData {\n id: string;\n offerings: ITrybeCouponCodeOffering[];\n discount_type: string;\n fixed_amount: unknown;\n percentage: number;\n}\n\nexport interface ITrybeGetCouponCodeOfferingsResponse {\n data: ITrybeCouponCodeOfferingsData;\n}\n\n// ==================== TRYBE AVAILABILITY ====================\n\nexport interface ITrybeAppointmentSlot {\n start_time: string;\n end_time: string;\n duration: number;\n end_buffer: number;\n practitioner_ids: string[];\n total_quantity: number;\n quantity_available: number;\n is_valid: boolean;\n currency: string;\n price: number;\n nonoptimal_practitioner_allocation: boolean;\n nonoptimal_practitioner_ids: string[];\n bookable_from: string;\n bookable_to: string | null;\n}\n\nexport interface ITrybeAppointmentAvailabilityResponse {\n data: ITrybeAppointmentSlot[];\n}\n\nexport interface ITrybeSessionPractitioner {\n id: string;\n name: string;\n}\n\nexport interface ITrybeSessionRoom {\n id: string;\n name: string;\n capacity: number;\n}\n\nexport interface ITrybeSessionAvailability {\n id: string;\n practitioner_id: string;\n practitioner: ITrybeSessionPractitioner;\n room_id: string;\n room: ITrybeSessionRoom;\n start_time: string;\n end_time: string;\n duration: number;\n capacity: number;\n remaining_capacity: number;\n waitlist_enabled: boolean;\n is_valid: boolean;\n price: number;\n currency: string;\n no_availability_reason?: string;\n no_availability_message?: string;\n}\n\nexport interface ITrybeSessionAvailabilityResponse {\n data: ITrybeSessionAvailability[];\n}\n","import {\n type IAvailableDateWithSlots,\n type IAvailableTimeSlot,\n type IBookableItem,\n type IBookableItemCategory,\n type IBookableItemMedia,\n type IBookableItemPrice,\n type IBookableItemPriceMeta,\n type IGetAvailableDatesAndTimeSlotsResponse,\n type ISystemResponse,\n BOOKABLE_ITEM_STATUS_ENUM,\n BOOKABLE_ITEM_TYPE_ENUM,\n DAY_OF_WEEK,\n} from '@dvss/dvss-integration-libs';\nimport type {\n ITrybeAppointment,\n ITrybeAppointmentSlot,\n ITrybeCategory,\n ITrybeCouponCodeOffering,\n ITrybeCourse,\n ITrybeImage,\n ITrybePriceRule,\n ITrybeSession,\n ITrybeSessionAvailability,\n} from '../../models';\nimport { TRYBE_OFFERING_TYPE_ENUM } from '../../models';\nimport { convertKeysToCamelCase, extractTimeFromIsoString } from '../../utils';\n\n// ==================== CONSTANTS ====================\n\nconst TRYBE_WEEKDAYS_MAPPING: Record<string, DAY_OF_WEEK> = {\n monday: DAY_OF_WEEK.MON,\n tuesday: DAY_OF_WEEK.TUE,\n wednesday: DAY_OF_WEEK.WED,\n thursday: DAY_OF_WEEK.THU,\n friday: DAY_OF_WEEK.FRI,\n saturday: DAY_OF_WEEK.SAT,\n sunday: DAY_OF_WEEK.SUN,\n};\n\n// ==================== HELPER MAPPERS ====================\n\nexport function mapTrybeImageToMedia(\n image?: ITrybeImage,\n): IBookableItemMedia | undefined {\n if (!image) return undefined;\n return {\n id: image.id,\n url: image.url,\n originalUrl: image.original_url,\n fileName: image.file_name,\n mimeType: image.mime_type,\n };\n}\n\nfunction mapTrybeWeekdays(weekdays: string[]): DAY_OF_WEEK[] {\n return weekdays.map((day) => TRYBE_WEEKDAYS_MAPPING[day.toLowerCase()]);\n}\n\n/**\n * Maps Trybe price rule to price meta\n * Returns raw price from Trybe without any conversion\n */\nfunction mapTrybePriceRuleToPriceMeta(\n priceRule: ITrybePriceRule,\n currency: string,\n index: number,\n): IBookableItemPriceMeta[] {\n const normalizedCurrency = currency ? currency.toUpperCase() : 'USD';\n\n if (!priceRule.weekdays || priceRule.weekdays.length === 0) {\n return [\n {\n id: BigInt(index),\n externalId: priceRule.id,\n status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,\n price: priceRule.price,\n currency: normalizedCurrency,\n config: priceRule as unknown as Record<string, unknown>,\n },\n ];\n }\n\n return [\n {\n id: BigInt(index),\n externalId: priceRule.id,\n status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,\n price: priceRule.price,\n currency: normalizedCurrency,\n configuredForDays: mapTrybeWeekdays(priceRule.weekdays),\n },\n ];\n}\n\n/**\n * Maps Trybe price rules to prices\n * Returns raw prices from Trybe without any conversion\n */\nexport function mapTrybePriceRulesToPrices(\n priceRules: ITrybePriceRule[],\n currency: string,\n externalResourceId: string,\n): IBookableItemPrice[] {\n const normalizedCurrency = currency ? currency.toUpperCase() : 'USD';\n\n return priceRules.map((priceRule, index) => ({\n id: BigInt(index + 1),\n label: undefined,\n currency: normalizedCurrency,\n price: priceRule.price,\n externalResourceId,\n configuredForDays: priceRule.weekdays\n ? mapTrybeWeekdays(priceRule.weekdays)\n : undefined,\n pricesMeta: mapTrybePriceRuleToPriceMeta(priceRule, currency, index + 1),\n config: priceRule as unknown as Record<string, unknown>,\n }));\n}\n\n// ==================== MAIN MAPPERS ====================\n\nexport function mapTrybeAppointmentToBookableItem(\n appointment: ITrybeAppointment,\n index: number,\n linkedItems?: IBookableItem[],\n): IBookableItem {\n return {\n id: BigInt(index + 1),\n externalId: appointment.id,\n name: appointment.name,\n description: appointment.description,\n type: BOOKABLE_ITEM_TYPE_ENUM.APPOINTMENT,\n status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,\n icon: mapTrybeImageToMedia(appointment.image),\n primaryAsset: mapTrybeImageToMedia(appointment.image),\n prices: mapTrybePriceRulesToPrices(\n appointment.price_rules,\n appointment.currency,\n appointment.id,\n ),\n linkedBookableItems: linkedItems,\n updatedAt: appointment.updated_at\n ? new Date(appointment.updated_at)\n : undefined,\n meta: {\n // All Trybe-specific fields that don't map to system response\n externalId: appointment.id,\n productCode: appointment.product_code,\n siteIds: appointment.site_ids,\n roomIds: appointment.room_ids,\n equipmentIds: appointment.equipment_ids,\n practitionerIds: appointment.practitioner_ids,\n durations: appointment.durations,\n endBuffer: appointment.end_buffer,\n startTimeInterval: appointment.start_time_interval,\n maxAdvanceBookingsInterval: appointment.max_advance_bookings_interval,\n minAdvanceBookingsInterval: appointment.min_advance_bookings_interval,\n tagIds: appointment.tag_ids,\n tags: appointment.tags,\n categoryIds: appointment.category_ids,\n offeredOnline: appointment.offered_online,\n private: appointment.private,\n visibility: appointment.visibility,\n customersOnly: appointment.customers_only,\n membersOnly: appointment.members_only,\n membershipBookingWindowsEnabled:\n appointment.membership_booking_windows_enabled,\n membershipBookingWindows: appointment.membership_booking_windows,\n trybeMeta: appointment.meta,\n upsellOfferings: appointment.upsell_offerings,\n crossSellOfferings: appointment.cross_sell_offerings,\n relatedRetailOfferings: appointment.related_retail_offerings,\n customerCancellationPermitted:\n appointment.customer_cancellation_permitted,\n customerCancellationMinDuration:\n appointment.customer_cancellation_min_duration,\n minGuests: appointment.min_guests,\n maxGuests: appointment.max_guests,\n allocateMultiCapacityRooms: appointment.allocate_multi_capacity_rooms,\n enquiriesEnabled: appointment.enquiries_enabled,\n revenueCentre: appointment.revenue_centre,\n includePricingOnCalendar: appointment.include_pricing_on_calendar,\n maxPerBasket: appointment.max_per_basket,\n maxPerGuest: appointment.max_per_guest,\n shopPractitionerSelectionEnabled:\n appointment.shop_practitioner_selection_enabled,\n deletedAt: appointment.deleted_at,\n },\n };\n}\n\nexport function mapTrybeSessionToBookableItem(\n session: ITrybeSession,\n index: number,\n linkedItems?: IBookableItem[],\n): IBookableItem {\n return {\n id: BigInt(index + 1),\n externalId: session.id,\n name: session.name,\n description: session.description,\n type: BOOKABLE_ITEM_TYPE_ENUM.SESSION,\n status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,\n icon: mapTrybeImageToMedia(session.image),\n primaryAsset: mapTrybeImageToMedia(session.image),\n prices: mapTrybePriceRulesToPrices(\n session.price_rules,\n session.currency,\n session.id,\n ),\n linkedBookableItems: linkedItems,\n updatedAt: session.updated_at ? new Date(session.updated_at) : undefined,\n meta: {\n // All Trybe-specific fields\n externalId: session.id,\n productCode: session.product_code,\n siteId: session.site_id,\n duration: session.duration,\n categoryIds: session.category_ids,\n offeredOnline: session.offered_online,\n private: session.private,\n visibility: session.visibility,\n customersOnly: session.customers_only,\n membersOnly: session.members_only,\n membershipBookingWindowsEnabled:\n session.membership_booking_windows_enabled,\n membershipBookingWindows: session.membership_booking_windows,\n maxBookingsPerMember: session.max_bookings_per_member,\n trybeMeta: session.meta,\n upsellOfferings: session.upsell_offerings,\n crossSellOfferings: session.cross_sell_offerings,\n relatedRetailOfferings: session.related_retail_offerings,\n customerCancellationPermitted: session.customer_cancellation_permitted,\n customerCancellationMinDuration:\n session.customer_cancellation_min_duration,\n waitlistEnabled: session.waitlist_enabled,\n maxAdvanceBookingsInterval: session.max_advance_bookings_interval,\n minAdvanceBookingsInterval: session.min_advance_bookings_interval,\n minGuests: session.min_guests,\n maxGuests: session.max_guests,\n maxBasketsPerSession: session.max_baskets_per_session,\n recurrenceGroups: session.recurrence_groups,\n revenueCentre: session.revenue_centre,\n includePricingOnCalendar: session.include_pricing_on_calendar,\n maxPerBasket: session.max_per_basket,\n maxPerGuest: session.max_per_guest,\n deletedAt: session.deleted_at,\n },\n };\n}\n\nexport function mapTrybeCourseToBookableItem(\n course: ITrybeCourse,\n index: number,\n): IBookableItem {\n return {\n id: BigInt(index + 1),\n externalId: course.id,\n name: course.name,\n description: course.description,\n type: BOOKABLE_ITEM_TYPE_ENUM.COURSE,\n status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,\n icon: mapTrybeImageToMedia(course.image),\n primaryAsset: mapTrybeImageToMedia(course.image),\n prices: mapTrybePriceRulesToPrices(\n course.price_rules,\n course.currency,\n course.id,\n ),\n updatedAt: course.updated_at ? new Date(course.updated_at) : undefined,\n meta: {\n // All Trybe-specific fields\n externalId: course.id,\n productCode: course.product_code,\n couponId: course.coupon_id,\n offerings: course.offerings.map((offering) => ({\n offeringType: offering.offering_type,\n offeringId: offering.offering_id,\n offeringName: offering.offering_name,\n })),\n offeringType: course.offering_type,\n offeringId: course.offering_id,\n quantity: course.quantity,\n creditsValidityInterval: course.credits_validity_interval,\n siteId: course.site_id,\n categoryIds: course.category_ids,\n offeredOnline: course.offered_online,\n private: course.private,\n visibility: course.visibility,\n customersOnly: course.customers_only,\n membersOnly: course.members_only,\n trybeMeta: course.meta,\n upsellOfferings: course.upsell_offerings,\n crossSellOfferings: course.cross_sell_offerings,\n relatedRetailOfferings: course.related_retail_offerings,\n availabilityRules: course.availability_rules,\n revenueCentre: course.revenue_centre,\n deletedAt: course.deleted_at,\n },\n };\n}\n\nexport function mapTrybeCategoryToBookableItemCategory(\n category: ITrybeCategory,\n index: number,\n): IBookableItemCategory {\n return {\n id: BigInt(index + 1),\n externalId: category.id,\n name: category.name,\n meta: {\n voucherApplicable: category.voucher_applicable,\n },\n };\n}\n\n// ==================== RESPONSE MAPPERS ====================\n\nexport function mapTrybeAppointmentsToSystemResponse(\n appointments: ITrybeAppointment[],\n totalCount: number,\n courseLookup?: Map<string, ITrybeCourse[]>,\n): ISystemResponse<IBookableItem> {\n const records = appointments.map((apt, index) => {\n const linkedCourses = courseLookup?.get(apt.id) ?? [];\n const linkedItems = linkedCourses.map((course, courseIndex) =>\n mapTrybeCourseToBookableItem(course, courseIndex),\n );\n return mapTrybeAppointmentToBookableItem(\n apt,\n index,\n linkedItems.length > 0 ? linkedItems : undefined,\n );\n });\n\n return {\n totalCount,\n records,\n };\n}\n\nexport function mapTrybeSessionsToSystemResponse(\n sessions: ITrybeSession[],\n totalCount: number,\n courseLookup?: Map<string, ITrybeCourse[]>,\n): ISystemResponse<IBookableItem> {\n const records = sessions.map((session, index) => {\n const linkedCourses = courseLookup?.get(session.id) ?? [];\n const linkedItems = linkedCourses.map((course, courseIndex) =>\n mapTrybeCourseToBookableItem(course, courseIndex),\n );\n return mapTrybeSessionToBookableItem(\n session,\n index,\n linkedItems.length > 0 ? linkedItems : undefined,\n );\n });\n\n return {\n totalCount,\n records,\n };\n}\n\nexport function mapTrybeCoursesToSystemResponse(\n courses: ITrybeCourse[],\n totalCount: number,\n): ISystemResponse<IBookableItem> {\n const records = courses.map((course, index) =>\n mapTrybeCourseToBookableItem(course, index),\n );\n\n return {\n totalCount,\n records,\n };\n}\n\nexport function mapTrybeCategoriesToSystemResponse(\n categories: ITrybeCategory[],\n totalCount: number,\n): ISystemResponse<IBookableItemCategory> {\n const records = categories.map((category, index) =>\n mapTrybeCategoryToBookableItemCategory(category, index),\n );\n\n return {\n totalCount,\n records,\n };\n}\n\nfunction mapTrybeOfferingTypeToBookableItemType(\n offeringType: TRYBE_OFFERING_TYPE_ENUM,\n): BOOKABLE_ITEM_TYPE_ENUM {\n switch (offeringType) {\n case TRYBE_OFFERING_TYPE_ENUM.APPOINTMENT:\n return BOOKABLE_ITEM_TYPE_ENUM.APPOINTMENT;\n case TRYBE_OFFERING_TYPE_ENUM.SESSION:\n return BOOKABLE_ITEM_TYPE_ENUM.SESSION;\n case TRYBE_OFFERING_TYPE_ENUM.COURSE:\n return BOOKABLE_ITEM_TYPE_ENUM.COURSE;\n default:\n return BOOKABLE_ITEM_TYPE_ENUM.APPOINTMENT;\n }\n}\n\nexport function mapTrybeCouponCodeOfferingToBookableItem(\n offering: ITrybeCouponCodeOffering,\n index: number,\n): IBookableItem {\n return {\n id: BigInt(index + 1),\n externalId: offering.offering_id,\n name: offering.offering_name,\n type: mapTrybeOfferingTypeToBookableItemType(offering.offering_type),\n status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,\n };\n}\n\nexport function mapTrybeCouponCodeOfferingsToSystemResponse(\n offerings: ITrybeCouponCodeOffering[],\n): ISystemResponse<IBookableItem> {\n const records = offerings.map((offering, index) =>\n mapTrybeCouponCodeOfferingToBookableItem(offering, index),\n );\n\n return {\n totalCount: records.length,\n records,\n };\n}\n\n// ==================== AVAILABILITY MAPPERS ====================\n\nfunction groupByDate<T>(\n items: T[],\n getDateKey: (item: T) => string,\n): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n for (const item of items) {\n const key = getDateKey(item);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!result[key]) result[key] = [];\n result[key].push(item);\n }\n return result;\n}\n\nexport function mapTrybeSessionAvailabilityToSystemResponse(\n sessions: ITrybeSessionAvailability[],\n): IGetAvailableDatesAndTimeSlotsResponse {\n const filtered = sessions.filter((s) => s.remaining_capacity > 0);\n const grouped = groupByDate(filtered, (s) => {\n const dateMatch = s.start_time.match(/^(\\d{4}-\\d{2}-\\d{2})/);\n return dateMatch ? dateMatch[1] : '';\n });\n\n const dates: IAvailableDateWithSlots[] = Object.entries(grouped)\n .filter(([date]) => date !== '')\n .map(([date, sessionList]) => {\n const time: IAvailableTimeSlot[] = sessionList.map((session) => {\n const fromTime = extractTimeFromIsoString(session.start_time);\n const toTime = extractTimeFromIsoString(session.end_time);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { start_time: _s, end_time: _e, ...meta } = session;\n const camelCaseMeta = convertKeysToCamelCase(meta) as Record<\n string,\n unknown\n >;\n return { fromTime, toTime, meta: camelCaseMeta };\n });\n return {\n date: new Date(date),\n meta: {},\n time,\n };\n })\n .sort((a, b) => a.date.getTime() - b.date.getTime());\n\n return { dates };\n}\n\nexport function mapTrybeAppointmentAvailabilityToSystemResponse(\n slots: ITrybeAppointmentSlot[],\n): IGetAvailableDatesAndTimeSlotsResponse {\n const filtered = slots.filter((s) => s.quantity_available > 0);\n const grouped = groupByDate(filtered, (s) => {\n const dateMatch = s.start_time.match(/^(\\d{4}-\\d{2}-\\d{2})/);\n return dateMatch ? dateMatch[1] : '';\n });\n\n const dates: IAvailableDateWithSlots[] = Object.entries(grouped)\n .filter(([date]) => date !== '')\n .map(([date, slotList]) => {\n const time: IAvailableTimeSlot[] = slotList.map((slot) => {\n const fromTime = extractTimeFromIsoString(slot.start_time);\n const toTime = extractTimeFromIsoString(slot.end_time);\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { start_time: _s, end_time: _e, ...meta } = slot;\n const camelCaseMeta = convertKeysToCamelCase(meta) as Record<\n string,\n unknown\n >;\n return { fromTime, toTime, meta: camelCaseMeta };\n });\n return {\n date: new Date(date),\n meta: {},\n time,\n };\n })\n .sort((a, b) => a.date.getTime() - b.date.getTime());\n\n return { dates };\n}\n","/**\n * Trybe implementation for wellness management operations\n * Provides concrete implementation of wellness management functionality\n * for Trybe systems\n *\n * This class extends the base wellness management operations with\n * Trybe-specific implementations\n */\nimport { Injectable } from '@nestjs/common';\nimport { LoggerService } from '@dv4resi/dvss-backend-module-utility';\nimport {\n BaseWellnessManagement,\n HTTP_METHOD,\n type IBookableItem,\n type IBookableItemCategory,\n type ICapabilityIntegration,\n type IFetchOfferingAvailabilityRequest,\n type IGetAvailableDatesAndTimeSlotsResponse,\n type IGetAppointmentsRequest,\n type IGetBookableItemsFromCreditRequest,\n type IGetCategoriesRequest,\n type IGetCoursesRequest,\n type IGetSessionsRequest,\n type ISystemResponse,\n TrafficGatewayService,\n} from '@dvss/dvss-integration-libs';\nimport {\n TrybeAuthService,\n fetchAllPages,\n formatDateForTrybe,\n} from '../../utils';\nimport {\n type IGetTrybeResourcesCommonResponse,\n type ITrybeAppointment,\n type ITrybeAppointmentAvailabilityResponse,\n type ITrybeCategory,\n type ITrybeCourse,\n type ITrybeGetAppointmentsResponse,\n type ITrybeGetCategoriesResponse,\n type ITrybeGetCoursesResponse,\n type ITrybeGetCouponCodeOfferingsResponse,\n type ITrybeGetSessionsResponse,\n type ITrybeSession,\n type ITrybeSessionAvailabilityResponse,\n} from '../../models';\nimport {\n mapTrybeAppointmentsToSystemResponse,\n mapTrybeAppointmentAvailabilityToSystemResponse,\n mapTrybeCategoriesToSystemResponse,\n mapTrybeCoursesToSystemResponse,\n mapTrybeCouponCodeOfferingsToSystemResponse,\n mapTrybeSessionAvailabilityToSystemResponse,\n mapTrybeSessionsToSystemResponse,\n} from './wellness-management.mapper';\n\n@Injectable()\nexport class TrybeWellnessManagement implements BaseWellnessManagement {\n private readonly fileName = 'wellness-management.service';\n\n constructor(\n private readonly logger: LoggerService,\n private readonly trafficGatewayService: TrafficGatewayService,\n private readonly trybeAuthService: TrybeAuthService,\n ) {}\n\n fetchPractitioners(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n fetchWellnessAppointmentSession(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n checkWellnessAppointmentSessionAvailability(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n createWellnessAppointmentSessionOrder(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n addWellnessAppointmentSessionOrderItems(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n confirmWellnessAppointmentSessionOrder(): Promise<void> {\n throw new Error('Method not implemented.');\n }\n\n async fetchAppointments(\n request: IGetAppointmentsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>> {\n this.logger.info(\n loggedInUserId,\n this.fetchAppointments.name,\n this.fileName,\n `${TrybeWellnessManagement.name} -> ${this.fetchAppointments.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n const siteId = validatedIntegration.config.integrationConfig.siteId;\n\n if (\n request.shouldFetchAllAppointments &&\n request.options?.page !== undefined\n ) {\n throw new Error(\n 'Pagination options are not supported when fetching all appointments.',\n );\n }\n\n const query = new URLSearchParams();\n if (request.options?.page != null) {\n query.set('page', String(request.options.page));\n }\n if (request.options?.count != null) {\n query.set('per_page', String(request.options.count));\n }\n\n const queryString = query.toString();\n const apiUrl =\n `/shop/appointment-types?site_id=${siteId}` +\n (request.practitionerIds && request.practitionerIds.length > 0\n ? `&practitioner_id=${request.practitionerIds.join(',')}`\n : '') +\n (queryString ? `&${queryString}` : '');\n\n const firstPageResponse =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeGetAppointmentsResponse,\n IGetAppointmentsRequest\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: apiUrl,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n const records = await fetchAllPages<\n ITrybeAppointment,\n ITrybeGetAppointmentsResponse\n >(firstPageResponse, request.shouldFetchAllAppointments, (page) =>\n this.trafficGatewayService.executeIntegrationRequest<\n IGetTrybeResourcesCommonResponse<ITrybeAppointment>,\n unknown\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `${apiUrl}&page=${page}`,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n ),\n );\n\n return mapTrybeAppointmentsToSystemResponse(\n records,\n firstPageResponse.meta.total,\n );\n }\n\n async fetchSessions(\n request: IGetSessionsRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>> {\n this.logger.info(\n loggedInUserId,\n this.fetchSessions.name,\n this.fileName,\n `${TrybeWellnessManagement.name} -> ${this.fetchSessions.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n const siteId = validatedIntegration.config.integrationConfig.siteId;\n\n if (request.shouldFetchAllSessions && request.options?.page !== undefined) {\n throw new Error(\n 'Pagination options are not supported when fetching all sessions.',\n );\n }\n\n const query = new URLSearchParams();\n if (request.options?.page != null) {\n query.set('page', String(request.options.page));\n }\n if (request.options?.count != null) {\n query.set('per_page', String(request.options.count));\n }\n\n const queryString = query.toString();\n const apiUrl =\n `/shop/session-types?site_id=${siteId}` +\n (request.practitionerIds && request.practitionerIds.length > 0\n ? `&practitioner_id=${request.practitionerIds.join(',')}`\n : '') +\n (queryString ? `&${queryString}` : '');\n\n const firstPageResponse =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeGetSessionsResponse,\n IGetSessionsRequest\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: apiUrl,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n const records = await fetchAllPages<\n ITrybeSession,\n ITrybeGetSessionsResponse\n >(firstPageResponse, request.shouldFetchAllSessions, (page) =>\n this.trafficGatewayService.executeIntegrationRequest<\n IGetTrybeResourcesCommonResponse<ITrybeSession>,\n unknown\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `${apiUrl}&page=${page}`,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n ),\n );\n\n return mapTrybeSessionsToSystemResponse(\n records,\n firstPageResponse.meta.total,\n );\n }\n\n async fetchCourses(\n request: IGetCoursesRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>> {\n this.logger.info(\n loggedInUserId,\n this.fetchCourses.name,\n this.fileName,\n `${TrybeWellnessManagement.name} -> ${this.fetchCourses.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n const organisationId =\n validatedIntegration.config.integrationConfig.organisationId;\n\n if (request.shouldFetchAllCourses && request.options?.page !== undefined) {\n throw new Error(\n 'Pagination options are not supported when fetching all courses.',\n );\n }\n\n const query = new URLSearchParams();\n if (request.options?.page != null) {\n query.set('page', String(request.options.page));\n }\n if (request.options?.count != null) {\n query.set('per_page', String(request.options.count));\n }\n\n const queryString = query.toString();\n const apiUrl =\n `/shop/course-types?organisation_id=${organisationId}` +\n (queryString ? `&${queryString}` : '');\n\n const firstPageResponse =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeGetCoursesResponse,\n IGetCoursesRequest\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: apiUrl,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n const records = await fetchAllPages<ITrybeCourse, ITrybeGetCoursesResponse>(\n firstPageResponse,\n request.shouldFetchAllCourses,\n (page) =>\n this.trafficGatewayService.executeIntegrationRequest<\n IGetTrybeResourcesCommonResponse<ITrybeCourse>,\n unknown\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `${apiUrl}&page=${page}`,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n ),\n );\n\n return mapTrybeCoursesToSystemResponse(\n records,\n firstPageResponse.meta.total,\n );\n }\n\n async fetchCategories(\n request: IGetCategoriesRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItemCategory>> {\n this.logger.info(\n loggedInUserId,\n this.fetchCategories.name,\n this.fileName,\n `${TrybeWellnessManagement.name} -> ${this.fetchCategories.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n const organisationId =\n validatedIntegration.config.integrationConfig.organisationId;\n\n if (\n request.shouldFetchAllCategories &&\n request.options?.page !== undefined\n ) {\n throw new Error(\n 'Pagination options are not supported when fetching all categories.',\n );\n }\n\n const query = new URLSearchParams();\n if (request.options?.page != null) {\n query.set('page', String(request.options.page));\n }\n if (request.options?.count != null) {\n query.set('per_page', String(request.options.count));\n }\n\n const queryString = query.toString();\n const apiUrl =\n `/shop/organisations/${organisationId}/categories` +\n (queryString ? `?${queryString}` : '');\n\n const firstPageResponse =\n await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeGetCategoriesResponse,\n IGetCategoriesRequest\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: apiUrl,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n const records = await fetchAllPages<\n ITrybeCategory,\n ITrybeGetCategoriesResponse\n >(firstPageResponse, request.shouldFetchAllCategories, (page) =>\n this.trafficGatewayService.executeIntegrationRequest<\n IGetTrybeResourcesCommonResponse<ITrybeCategory>,\n unknown\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: `${apiUrl}${apiUrl.includes('?') ? '&' : '?'}page=${page}`,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n ),\n );\n\n return mapTrybeCategoriesToSystemResponse(\n records,\n firstPageResponse.meta.total,\n );\n }\n\n async fetchBookableItemsFromCredit(\n request: IGetBookableItemsFromCreditRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<ISystemResponse<IBookableItem>> {\n this.logger.info(\n loggedInUserId,\n this.fetchBookableItemsFromCredit.name,\n this.fileName,\n `${TrybeWellnessManagement.name} -> ${this.fetchBookableItemsFromCredit.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n\n const query = new URLSearchParams();\n if (request.options?.page != null) {\n query.set('page', String(request.options.page));\n }\n if (request.options?.count != null) {\n query.set('per_page', String(request.options.count));\n }\n\n const queryString = query.toString();\n const apiUrl =\n `/shop/coupon-codes/${request.couponCodeId}/offering-discounts` +\n (queryString ? `?${queryString}` : '');\n\n const response = await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeGetCouponCodeOfferingsResponse,\n IGetBookableItemsFromCreditRequest\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: apiUrl,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n return mapTrybeCouponCodeOfferingsToSystemResponse(response.data.offerings);\n }\n\n async fetchSessionAvailabilityForOffering(\n request: IFetchOfferingAvailabilityRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<IGetAvailableDatesAndTimeSlotsResponse> {\n this.logger.info(\n loggedInUserId,\n this.fetchSessionAvailabilityForOffering.name,\n this.fileName,\n `${TrybeWellnessManagement.name} -> ${this.fetchSessionAvailabilityForOffering.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n const siteId = validatedIntegration.config.integrationConfig.siteId;\n\n const formattedDateTimeFrom = formatDateForTrybe(\n request.dateTimeFrom,\n true,\n );\n const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false);\n\n const apiUrl =\n `/shop/item-availability/sessions/${siteId}/${request.externalOfferingBookableItemId}` +\n `?date_time_from=${encodeURIComponent(formattedDateTimeFrom)}` +\n `&date_time_to=${encodeURIComponent(formattedDateTimeTo)}` +\n `&offeringId=${request.externalOfferingBookableItemId}`;\n\n const response = await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeSessionAvailabilityResponse,\n IFetchOfferingAvailabilityRequest\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: apiUrl,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n return mapTrybeSessionAvailabilityToSystemResponse(response.data);\n }\n\n async fetchAppointmentAvailabilityForOffering(\n request: IFetchOfferingAvailabilityRequest,\n integration: ICapabilityIntegration,\n loggedInUserId: bigint,\n ): Promise<IGetAvailableDatesAndTimeSlotsResponse> {\n this.logger.info(\n loggedInUserId,\n this.fetchAppointmentAvailabilityForOffering.name,\n this.fileName,\n `${TrybeWellnessManagement.name} -> ${this.fetchAppointmentAvailabilityForOffering.name} Called`,\n { request },\n );\n\n const validatedIntegration = this.trybeAuthService.validateConfig(\n integration,\n loggedInUserId,\n );\n const siteId = validatedIntegration.config.integrationConfig.siteId;\n\n const formattedDateTimeFrom = formatDateForTrybe(\n request.dateTimeFrom,\n true,\n );\n const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false);\n\n const apiUrl =\n `/shop/item-availability/appointment-slots/${siteId}/${request.externalOfferingBookableItemId}` +\n `?date_time_from=${encodeURIComponent(formattedDateTimeFrom)}` +\n `&date_time_to=${encodeURIComponent(formattedDateTimeTo)}` +\n `&OfferingID=${request.externalOfferingBookableItemId}`;\n\n const response = await this.trafficGatewayService.executeIntegrationRequest<\n ITrybeAppointmentAvailabilityResponse,\n IFetchOfferingAvailabilityRequest\n >(\n {\n apiMethod: HTTP_METHOD.GET,\n url: apiUrl,\n baseUrl: validatedIntegration.config.platformConfig.baseUrl,\n headers: validatedIntegration.headers,\n },\n validatedIntegration,\n loggedInUserId,\n );\n\n return mapTrybeAppointmentAvailabilityToSystemResponse(response.data);\n }\n}\n","// Load environment variables BEFORE importing modules that check env vars at import time\nimport './load-env';\nimport { LoggerModule } from '@dv4resi/dvss-backend-module-utility';\nimport { HttpModule } from '@nestjs/axios';\nimport { ConfigModule } from '@nestjs/config';\nimport { Module } from '@nestjs/common';\nimport { resolve } from 'path';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { IntegrationLibsModule } from '@dvss/dvss-integration-libs';\nimport { TrybeAuthService } from './utils/auth/auth.service';\nimport { TrybeCustomerManagement } from './capabilities/customer-management/customer-management.service';\nimport { TrybeCreditBooking } from './capabilities/credit-management/credit-booking.service';\nimport { TrybeWellnessManagement } from './capabilities/wellness/wellness-management.service';\n\n@Module({\n imports: [\n // Load environment variables from root .env file\n ConfigModule.forRoot({\n envFilePath: resolve(__dirname, '../../../.env'),\n isGlobal: true,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n }) as any,\n IntegrationLibsModule,\n HttpModule,\n LoggerModule,\n ],\n controllers: [AppController],\n providers: [\n AppService,\n TrybeAuthService,\n TrybeCustomerManagement,\n TrybeCreditBooking,\n TrybeWellnessManagement,\n ],\n exports: [\n TrybeAuthService,\n TrybeCustomerManagement,\n TrybeCreditBooking,\n TrybeWellnessManagement,\n ],\n})\nexport class AppModule {}\n","import { Module } from '@nestjs/common';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { IntegrationTrybeModule } from '@dvss/dvss-integration-trybe';\nimport { IntegrationLibsModule } from '@dvss/dvss-integration-libs';\n\n@Module({\n imports: [IntegrationTrybeModule, IntegrationLibsModule],\n controllers: [AppController],\n providers: [AppService, IntegrationTrybeModule, IntegrationLibsModule],\n exports: [IntegrationTrybeModule, IntegrationLibsModule],\n})\nexport class AppModule {}\n"]}
|