@vendit-dev/thirdparty-adapters 0.3.24 → 0.3.26
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/lib/adapters/smartAccess.js +11 -8
- package/package.json +1 -1
|
@@ -121,7 +121,10 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
121
121
|
this.checkSmartAccessIntegration = function (_a) {
|
|
122
122
|
var accommodationId = _a.accommodationId;
|
|
123
123
|
return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
|
|
124
|
-
|
|
124
|
+
switch (_b.label) {
|
|
125
|
+
case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
|
|
126
|
+
case 1: return [2 /*return*/, !!(_b.sent())];
|
|
127
|
+
}
|
|
125
128
|
}); });
|
|
126
129
|
};
|
|
127
130
|
this.getAccommodationAuthInfo = function (_a) {
|
|
@@ -136,7 +139,8 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
136
139
|
console.log('AUTH 0', existingAuth);
|
|
137
140
|
if (existingAuth) {
|
|
138
141
|
if (existingAuth === 'NOT_FOUND') {
|
|
139
|
-
throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
142
|
+
// throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
143
|
+
return [2 /*return*/, false];
|
|
140
144
|
}
|
|
141
145
|
console.log('AUTH 1', existingAuth);
|
|
142
146
|
return [2 /*return*/, this.parseJSONSafe(existingAuth)];
|
|
@@ -164,15 +168,12 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
164
168
|
return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
|
|
165
169
|
case 6:
|
|
166
170
|
_b.sent();
|
|
167
|
-
throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
171
|
+
// throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
172
|
+
return [2 /*return*/, false];
|
|
168
173
|
case 7:
|
|
169
174
|
console.log('AUTH 5', existingAuth);
|
|
170
|
-
if (!existingAuth && !newAuth.credential && !newAuth.scope) {
|
|
171
|
-
console.log('AUTH 6', existingAuth);
|
|
172
|
-
return [2 /*return*/, false];
|
|
173
|
-
}
|
|
174
175
|
parsedCredential = this.parseJSONSafe(newAuth.credential);
|
|
175
|
-
console.log('AUTH
|
|
176
|
+
console.log('AUTH 6', parsedCredential);
|
|
176
177
|
return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), newAuth.credential, 'EX', 60 * 5)];
|
|
177
178
|
case 8:
|
|
178
179
|
_b.sent();
|
|
@@ -197,6 +198,8 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
197
198
|
case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
|
|
198
199
|
case 1:
|
|
199
200
|
authInfo = _a.sent();
|
|
201
|
+
if (!(authInfo === null || authInfo === void 0 ? void 0 : authInfo.accessToken))
|
|
202
|
+
throw new Error('THIRDPARTH_AUTH_NOT_FOUND');
|
|
200
203
|
return [2 /*return*/, authInfo.accessToken];
|
|
201
204
|
}
|
|
202
205
|
});
|