@vendit-dev/thirdparty-adapters 0.3.21 → 0.3.23
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.
|
@@ -133,10 +133,12 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
133
133
|
case 0: return [4 /*yield*/, this.redis.get(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }))];
|
|
134
134
|
case 1:
|
|
135
135
|
existingAuth = _b.sent();
|
|
136
|
+
console.log('AUTH 0', existingAuth);
|
|
136
137
|
if (existingAuth) {
|
|
137
138
|
if (existingAuth === 'NOT_FOUND') {
|
|
138
139
|
throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
139
140
|
}
|
|
141
|
+
console.log('AUTH 1', existingAuth);
|
|
140
142
|
return [2 /*return*/, this.parseJSONSafe(existingAuth)];
|
|
141
143
|
}
|
|
142
144
|
lockId = "SMARTACCESS-HKEY|" + accommodationId;
|
|
@@ -146,22 +148,27 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
146
148
|
return [4 /*yield*/, this.redis.get(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }))];
|
|
147
149
|
case 3:
|
|
148
150
|
existingAuth = _b.sent();
|
|
151
|
+
console.log('AUTH 2', existingAuth);
|
|
149
152
|
_b.label = 4;
|
|
150
153
|
case 4:
|
|
151
154
|
_b.trys.push([4, 9, 10, 12]);
|
|
152
155
|
if (existingAuth) {
|
|
156
|
+
console.log('AUTH 3', existingAuth);
|
|
153
157
|
return [2 /*return*/, this.parseJSONSafe(existingAuth)];
|
|
154
158
|
}
|
|
155
159
|
return [4 /*yield*/, this.authenticator.getThirdPartyCredential({ accommodationId: accommodationId, provider: this.PROVIDER_KEY })];
|
|
156
160
|
case 5:
|
|
157
161
|
newAuth = _b.sent();
|
|
162
|
+
console.log('AUTH 4', newAuth);
|
|
158
163
|
if (!!newAuth) return [3 /*break*/, 7];
|
|
159
164
|
return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
|
|
160
165
|
case 6:
|
|
161
166
|
_b.sent();
|
|
162
167
|
throw new Error('THIRDPARTY_AUTH_NOT_FOUND');
|
|
163
168
|
case 7:
|
|
169
|
+
console.log('AUTH 5', existingAuth);
|
|
164
170
|
parsedCredential = this.parseJSONSafe(newAuth.credential);
|
|
171
|
+
console.log('AUTH 6', parsedCredential);
|
|
165
172
|
return [4 /*yield*/, this.redis.set(SmartAccessAdapter.indexAccommodation({ accommodationId: accommodationId }), newAuth.credential, 'EX', 60 * 5)];
|
|
166
173
|
case 8:
|
|
167
174
|
_b.sent();
|