@dv4resi/dvss-backend-module-offering-im 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +48 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -154,6 +154,7 @@ interface ICapabilityIntegration {
|
|
|
154
154
|
providerId?: bigint;
|
|
155
155
|
config?: ICapabilityIntegrationConfig;
|
|
156
156
|
capabilityId?: bigint;
|
|
157
|
+
projectId?: number;
|
|
157
158
|
}
|
|
158
159
|
interface IValidatedCapabilityIntegration {
|
|
159
160
|
id: bigint;
|
|
@@ -162,6 +163,7 @@ interface IValidatedCapabilityIntegration {
|
|
|
162
163
|
config: IValidatedCapabilityIntegrationConfig;
|
|
163
164
|
capabilityId?: bigint;
|
|
164
165
|
headers?: Record<string, string>;
|
|
166
|
+
projectId?: number;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
interface IApiCallRequest<TBody = unknown> {
|
package/dist/index.js
CHANGED
|
@@ -950,7 +950,7 @@ function mapStatus(t) {
|
|
|
950
950
|
return CREDIT_STATUS_ENUM.ACTIVE;
|
|
951
951
|
}
|
|
952
952
|
__name(mapStatus, "mapStatus");
|
|
953
|
-
function mapTrybeCreditsToSystem(res) {
|
|
953
|
+
function mapTrybeCreditsToSystem(res, integration) {
|
|
954
954
|
const groups = /* @__PURE__ */ new Map();
|
|
955
955
|
for (const t of res.data) {
|
|
956
956
|
const key = `${t.coupon_name}|${t.issued_at}`;
|
|
@@ -963,6 +963,8 @@ function mapTrybeCreditsToSystem(res) {
|
|
|
963
963
|
const first = items[0];
|
|
964
964
|
const couponCodes = items.map((i) => i.coupon_code);
|
|
965
965
|
records.push({
|
|
966
|
+
capabilityIntegrationId: integration.id,
|
|
967
|
+
projectId: integration.projectId,
|
|
966
968
|
name: first.coupon_name,
|
|
967
969
|
description: first.coupon_description ?? void 0,
|
|
968
970
|
type: CREDIT_TYPE_ENUM.COUPON,
|
|
@@ -993,7 +995,18 @@ function mapTrybeCreditsToSystem(res) {
|
|
|
993
995
|
__name(mapTrybeCreditsToSystem, "mapTrybeCreditsToSystem");
|
|
994
996
|
|
|
995
997
|
// ../../packages/dvss-integration-trybe/src/capabilities/credit-management/credit-booking.service.ts
|
|
996
|
-
|
|
998
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
999
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1000
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1001
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1002
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1003
|
+
}
|
|
1004
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1005
|
+
function _ts_metadata10(k, v) {
|
|
1006
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1007
|
+
}
|
|
1008
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1009
|
+
exports.TrybeCreditBooking = class _TrybeCreditBooking {
|
|
997
1010
|
static {
|
|
998
1011
|
__name(this, "TrybeCreditBooking");
|
|
999
1012
|
}
|
|
@@ -1024,40 +1037,56 @@ var TrybeCreditBooking = class _TrybeCreditBooking {
|
|
|
1024
1037
|
if (opts?.page != null) query.set("page", String(opts.page));
|
|
1025
1038
|
if (opts?.count != null) query.set("per_page", String(opts.count));
|
|
1026
1039
|
const statusFilterValues = opts?.filters?.[0]?.by === CREDIT_FILTER_BY_ENUM.STATUS ? opts.filters[0].values : [];
|
|
1027
|
-
if (statusFilterValues.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1040
|
+
if (statusFilterValues.includes(CREDIT_STATUS_ENUM.EXPIRED)) {
|
|
1041
|
+
query.set("expired", "true");
|
|
1042
|
+
} else {
|
|
1043
|
+
query.set("expired", "false");
|
|
1044
|
+
}
|
|
1045
|
+
if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REDEEMED)) {
|
|
1046
|
+
query.set("redeemed", "true");
|
|
1047
|
+
} else {
|
|
1048
|
+
query.set("redeemed", "false");
|
|
1049
|
+
}
|
|
1050
|
+
if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REVOKED)) {
|
|
1051
|
+
query.set("revoked", "true");
|
|
1052
|
+
} else {
|
|
1053
|
+
query.set("revoked", "false");
|
|
1034
1054
|
}
|
|
1035
1055
|
const queryString = query.toString();
|
|
1036
|
-
const url = `/
|
|
1056
|
+
const url = `/customers/customers/${request.customerId}/credits` + (queryString ? `?${queryString}` : "");
|
|
1037
1057
|
const raw = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1038
1058
|
apiMethod: HTTP_METHOD.GET,
|
|
1039
1059
|
url,
|
|
1040
1060
|
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1041
1061
|
headers: validatedIntegration.headers
|
|
1042
1062
|
}, validatedIntegration, loggedInUserId);
|
|
1043
|
-
return mapTrybeCreditsToSystem(raw);
|
|
1063
|
+
return mapTrybeCreditsToSystem(raw, validatedIntegration);
|
|
1044
1064
|
}
|
|
1045
1065
|
};
|
|
1066
|
+
exports.TrybeCreditBooking = _ts_decorate13([
|
|
1067
|
+
common.Injectable(),
|
|
1068
|
+
_ts_metadata10("design:type", Function),
|
|
1069
|
+
_ts_metadata10("design:paramtypes", [
|
|
1070
|
+
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
1071
|
+
typeof exports.TrafficGatewayService === "undefined" ? Object : exports.TrafficGatewayService,
|
|
1072
|
+
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService
|
|
1073
|
+
])
|
|
1074
|
+
], exports.TrybeCreditBooking);
|
|
1046
1075
|
|
|
1047
1076
|
// ../../packages/dvss-integration-trybe/src/app.module.ts
|
|
1048
|
-
function
|
|
1077
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1049
1078
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1050
1079
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1051
1080
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1052
1081
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1053
1082
|
}
|
|
1054
|
-
__name(
|
|
1083
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1055
1084
|
exports.IntegrationTrybeModule = class AppModule2 {
|
|
1056
1085
|
static {
|
|
1057
1086
|
__name(this, "AppModule");
|
|
1058
1087
|
}
|
|
1059
1088
|
};
|
|
1060
|
-
exports.IntegrationTrybeModule =
|
|
1089
|
+
exports.IntegrationTrybeModule = _ts_decorate14([
|
|
1061
1090
|
common.Module({
|
|
1062
1091
|
imports: [
|
|
1063
1092
|
// Load environment variables from root .env file
|
|
@@ -1076,12 +1105,12 @@ exports.IntegrationTrybeModule = _ts_decorate13([
|
|
|
1076
1105
|
AppService2,
|
|
1077
1106
|
exports.TrybeAuthService,
|
|
1078
1107
|
exports.TrybeCustomerManagement,
|
|
1079
|
-
TrybeCreditBooking
|
|
1108
|
+
exports.TrybeCreditBooking
|
|
1080
1109
|
],
|
|
1081
1110
|
exports: [
|
|
1082
1111
|
exports.TrybeAuthService,
|
|
1083
1112
|
exports.TrybeCustomerManagement,
|
|
1084
|
-
TrybeCreditBooking
|
|
1113
|
+
exports.TrybeCreditBooking
|
|
1085
1114
|
]
|
|
1086
1115
|
})
|
|
1087
1116
|
], exports.IntegrationTrybeModule);
|
|
@@ -1101,19 +1130,19 @@ var TrybeWellnessAppointmentBooking = class extends BaseWellnessAppointmentBooki
|
|
|
1101
1130
|
};
|
|
1102
1131
|
|
|
1103
1132
|
// src/app.module.ts
|
|
1104
|
-
function
|
|
1133
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
1105
1134
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1106
1135
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1107
1136
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1108
1137
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1109
1138
|
}
|
|
1110
|
-
__name(
|
|
1139
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
1111
1140
|
exports.OfferingIntegrationManager = class AppModule3 {
|
|
1112
1141
|
static {
|
|
1113
1142
|
__name(this, "AppModule");
|
|
1114
1143
|
}
|
|
1115
1144
|
};
|
|
1116
|
-
exports.OfferingIntegrationManager =
|
|
1145
|
+
exports.OfferingIntegrationManager = _ts_decorate15([
|
|
1117
1146
|
common.Module({
|
|
1118
1147
|
imports: [
|
|
1119
1148
|
exports.IntegrationTrybeModule,
|
|
@@ -1157,7 +1186,6 @@ exports.CREDIT_TYPE_ENUM = CREDIT_TYPE_ENUM;
|
|
|
1157
1186
|
exports.HTTP_METHOD = HTTP_METHOD;
|
|
1158
1187
|
exports.INTEGRATION_PROVIDER_ENUM = INTEGRATION_PROVIDER_ENUM;
|
|
1159
1188
|
exports.TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY = TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY;
|
|
1160
|
-
exports.TrybeCreditBooking = TrybeCreditBooking;
|
|
1161
1189
|
exports.TrybePackageManagement = TrybePackageManagement;
|
|
1162
1190
|
exports.TrybeWellnessAppointmentBooking = TrybeWellnessAppointmentBooking;
|
|
1163
1191
|
//# sourceMappingURL=index.js.map
|
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","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,WAAWF,QAAAA,EAAQ;AACjC,EAAA;AACF,CAAA;;;;;;;;;;;;;;ACAA,IAAMG,YAAAA,GAAcC,YAAAA,CAAQC,SAAAA,EAA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ACAkE,MAAAA;;IAEFzF,OAAAA,EAAS;AAACgC,MAAAA,wBAAAA;AAAkBT,MAAAA,+BAAAA;AAAyBkE,MAAAA;;;;;;ACvBhD,IAAekB,yBAAf,MAAeA;EAVtB;;;AAkBA;;;ACRO,IAAeC,+BAAAA,GAAf,cAAuDzG,8BAAAA,CAAAA;EAV9D;;;AAkDA;;;;;;;;;;ACtCab,qCAAN,gBAAA,CAAMA;AAAAA,EAAAA;;;AAAW;;;IALtBC,OAAAA,EAAS;AAACsH,MAAAA,8BAAAA;AAAwBH,MAAAA;;IAClC5G,WAAAA,EAAa;AAACvG,MAAAA;;IACdwG,SAAAA,EAAW;AAAC1G,MAAAA,UAAAA;AAAYwN,MAAAA,8BAAAA;AAAwBH,MAAAA;;IAChD1G,OAAAA,EAAS;AAAC6G,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}\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}\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} 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): 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 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 type { ITrybeGetCustomerCreditsResponse } from '../../models';\nimport { mapTrybeCreditsToSystem } from './credit-booking.mapper';\nimport { TrybeAuthService } from '../../utils/auth/auth.service';\n\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.length) {\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.EXPIRED)) {\n query.set('expired', 'true');\n }\n if (statusFilterValues.includes(CREDIT_STATUS_ENUM.REDEEMED)) {\n query.set('redeemed', 'true');\n }\n }\n\n const queryString = query.toString();\n const url =\n `/shop/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);\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/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,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AAA,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dv4resi/dvss-backend-module-offering-im",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Module for Offering Integration Manager",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@dvss/dvss-integration-libs": "*",
|
|
56
|
-
"@dvss/dvss-integration-trybe": "*"
|
|
57
|
-
"@swc/core": "^1.13.5"
|
|
56
|
+
"@dvss/dvss-integration-trybe": "*"
|
|
58
57
|
},
|
|
59
58
|
"jest": {
|
|
60
59
|
"moduleFileExtensions": [
|