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