@dv4resi/dvss-backend-module-offering-im 0.0.9 → 0.0.10
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 -2
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -837,8 +837,8 @@ interface ITrybeCredit {
|
|
|
837
837
|
coupon_code: string;
|
|
838
838
|
multi_use: number;
|
|
839
839
|
issued_at: string;
|
|
840
|
-
expires_at
|
|
841
|
-
redeemed_at
|
|
840
|
+
expires_at?: string;
|
|
841
|
+
redeemed_at?: string | null;
|
|
842
842
|
revoked_at: string | null;
|
|
843
843
|
}
|
|
844
844
|
type ITrybeGetCustomerCreditsResponse = IGetTrybeResourcesCommonResponse<ITrybeCredit>;
|
package/dist/index.js
CHANGED
|
@@ -891,11 +891,10 @@ exports.BaseIntegrationConfiguration = class BaseIntegrationConfiguration {
|
|
|
891
891
|
parentId: updateData.parentId,
|
|
892
892
|
updatedBy: loggedInUserId
|
|
893
893
|
};
|
|
894
|
-
|
|
894
|
+
return await this.integrationConfigurationDao.updateCapabilityIntegration({
|
|
895
895
|
id: request.id,
|
|
896
896
|
updateData: updateDataForDao
|
|
897
897
|
}, loggedInUserId);
|
|
898
|
-
return result;
|
|
899
898
|
}
|
|
900
899
|
/**
|
|
901
900
|
* Validates icon and nickname. Can be overridden in subclasses for provider-specific validation.
|
|
@@ -2776,16 +2775,16 @@ exports.IntegrationResourceManagementDao = class IntegrationResourceManagementDa
|
|
|
2776
2775
|
});
|
|
2777
2776
|
const raw = insertResult;
|
|
2778
2777
|
const insertedId = raw[0]?.insertId != null ? Number(raw[0].insertId) : 0;
|
|
2779
|
-
const
|
|
2780
|
-
const ids =
|
|
2778
|
+
const isInserted = insertedId > 0;
|
|
2779
|
+
const ids = isInserted ? [
|
|
2781
2780
|
BigInt(insertedId)
|
|
2782
2781
|
] : [];
|
|
2783
|
-
this.logger.info(context.loggedInUserId, this.addCapabilityIntegrationMapping.name, this.fileName, `Mapping add ${
|
|
2782
|
+
this.logger.info(context.loggedInUserId, this.addCapabilityIntegrationMapping.name, this.fileName, `Mapping add ${isInserted ? "successful" : "failed"}`, {
|
|
2784
2783
|
insertedId,
|
|
2785
|
-
status
|
|
2784
|
+
status: isInserted
|
|
2786
2785
|
});
|
|
2787
2786
|
return {
|
|
2788
|
-
status,
|
|
2787
|
+
status: isInserted,
|
|
2789
2788
|
ids
|
|
2790
2789
|
};
|
|
2791
2790
|
} catch (error) {
|
|
@@ -3123,6 +3122,7 @@ exports.TrybeAuthService = class _TrybeAuthService {
|
|
|
3123
3122
|
throw new Error("Platform configuration is invalid: Platform config is empty");
|
|
3124
3123
|
}
|
|
3125
3124
|
const headers = {
|
|
3125
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3126
3126
|
Authorization: `Bearer ${integrationConfig.apiKey}`
|
|
3127
3127
|
};
|
|
3128
3128
|
return {
|
|
@@ -3177,14 +3177,14 @@ exports.TrybeAuthService = _ts_decorate16([
|
|
|
3177
3177
|
function mapStatus(t) {
|
|
3178
3178
|
if (t.redeemed_at) return CREDIT_STATUS_ENUM.REDEEMED;
|
|
3179
3179
|
if (t.revoked_at) return CREDIT_STATUS_ENUM.REVOKED;
|
|
3180
|
-
if (new Date(t.expires_at) < /* @__PURE__ */ new Date()) return CREDIT_STATUS_ENUM.EXPIRED;
|
|
3180
|
+
if (t.expires_at && new Date(t.expires_at) < /* @__PURE__ */ new Date()) return CREDIT_STATUS_ENUM.EXPIRED;
|
|
3181
3181
|
return CREDIT_STATUS_ENUM.ACTIVE;
|
|
3182
3182
|
}
|
|
3183
3183
|
__name(mapStatus, "mapStatus");
|
|
3184
3184
|
function mapTrybeCreditsToSystem(res, integration) {
|
|
3185
3185
|
const groups = /* @__PURE__ */ new Map();
|
|
3186
3186
|
for (const t of res.data) {
|
|
3187
|
-
const key = `${t.coupon_name}|${t.expires_at
|
|
3187
|
+
const key = `${t.coupon_name}|${t.expires_at?.split("T")[0]}`;
|
|
3188
3188
|
const list = groups.get(key) ?? [];
|
|
3189
3189
|
list.push(t);
|
|
3190
3190
|
groups.set(key, list);
|
|
@@ -3203,8 +3203,8 @@ function mapTrybeCreditsToSystem(res, integration) {
|
|
|
3203
3203
|
type: CREDIT_TYPE_ENUM.COUPON,
|
|
3204
3204
|
status: mapStatus(first),
|
|
3205
3205
|
externalId: first.id,
|
|
3206
|
-
expiresAt: new Date(first.expires_at),
|
|
3207
|
-
expiresDate: first.expires_at
|
|
3206
|
+
expiresAt: first.expires_at ? new Date(first.expires_at) : void 0,
|
|
3207
|
+
expiresDate: first.expires_at?.split("T")[0],
|
|
3208
3208
|
startsAt: new Date(first.issued_at),
|
|
3209
3209
|
startDate: first.issued_at.split("T")[0],
|
|
3210
3210
|
value: first.coupon_code,
|
|
@@ -3735,7 +3735,7 @@ function mapTrybeSessionAvailabilityToSystemResponse(sessions) {
|
|
|
3735
3735
|
const time = sessionList.map((session) => {
|
|
3736
3736
|
const fromTime = extractTimeFromIsoString(session.start_time);
|
|
3737
3737
|
const toTime = extractTimeFromIsoString(session.end_time);
|
|
3738
|
-
const { start_time:
|
|
3738
|
+
const { start_time: startTime, end_time: endTime, ...meta } = session;
|
|
3739
3739
|
const camelCaseMeta = convertKeysToCamelCase(meta);
|
|
3740
3740
|
return {
|
|
3741
3741
|
fromTime,
|
|
@@ -3764,7 +3764,7 @@ function mapTrybeAppointmentAvailabilityToSystemResponse(slots) {
|
|
|
3764
3764
|
const time = slotList.map((slot) => {
|
|
3765
3765
|
const fromTime = extractTimeFromIsoString(slot.start_time);
|
|
3766
3766
|
const toTime = extractTimeFromIsoString(slot.end_time);
|
|
3767
|
-
const { start_time:
|
|
3767
|
+
const { start_time: startTime, end_time: endTime, ...meta } = slot;
|
|
3768
3768
|
const camelCaseMeta = convertKeysToCamelCase(meta);
|
|
3769
3769
|
return {
|
|
3770
3770
|
fromTime,
|
|
@@ -4056,14 +4056,13 @@ exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
|
4056
4056
|
} else {
|
|
4057
4057
|
throw new Error("Course is not updatable");
|
|
4058
4058
|
}
|
|
4059
|
-
|
|
4059
|
+
return await this.trafficGatewayService.executeIntegrationRequest({
|
|
4060
4060
|
apiMethod: HTTP_METHOD.PUT,
|
|
4061
4061
|
url: `/shop/orders/${orderId}/items/${itemId}`,
|
|
4062
4062
|
baseUrl: validated.config.platformConfig.baseUrl,
|
|
4063
4063
|
headers: validated.headers,
|
|
4064
4064
|
body
|
|
4065
4065
|
}, validated, loggedInUserId);
|
|
4066
|
-
return res;
|
|
4067
4066
|
}
|
|
4068
4067
|
async addPaymentToOrder(request, integration, loggedInUserId) {
|
|
4069
4068
|
const validated = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|