@vendit-dev/thirdparty-adapters 0.2.4 → 0.2.5
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.
|
@@ -39,9 +39,11 @@ export default class SmartAccessAdapter {
|
|
|
39
39
|
authenticator: UserServiceGrpcCaller;
|
|
40
40
|
redis: any;
|
|
41
41
|
PROVIDER_KEY: string;
|
|
42
|
-
|
|
42
|
+
API_HOST: string;
|
|
43
|
+
constructor({ authenticator, redis, apiHost }: {
|
|
43
44
|
authenticator: UserServiceGrpcCaller;
|
|
44
45
|
redis: any;
|
|
46
|
+
apiHost: string;
|
|
45
47
|
});
|
|
46
48
|
checkSmartAccessIntegration: ({ accommodationId }: {
|
|
47
49
|
accommodationId: string;
|
|
@@ -107,7 +107,7 @@ exports.MutexLock = MutexLock;
|
|
|
107
107
|
var SmartAccessAdapter = /** @class */ (function () {
|
|
108
108
|
function SmartAccessAdapter(_a) {
|
|
109
109
|
var _this = this;
|
|
110
|
-
var authenticator = _a.authenticator, redis = _a.redis;
|
|
110
|
+
var authenticator = _a.authenticator, redis = _a.redis, apiHost = _a.apiHost;
|
|
111
111
|
this.PROVIDER_KEY = 'SamsungSmartAccess';
|
|
112
112
|
this.checkSmartAccessIntegration = function (_a) {
|
|
113
113
|
var accommodationId = _a.accommodationId;
|
|
@@ -204,11 +204,9 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
204
204
|
_j.label = 2;
|
|
205
205
|
case 2:
|
|
206
206
|
requestArgs = __assign.apply(void 0, _c.concat([(_d.headers = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_f)])), headers]), _d)]));
|
|
207
|
-
|
|
208
|
-
return [4 /*yield*/, node_fetch_1.default("https://oauth-iot-stg.samsung-ihp.com/sa/oauth/" + route, requestArgs)];
|
|
207
|
+
return [4 /*yield*/, node_fetch_1.default(this.API_HOST + "/sa/oauth/" + route, requestArgs)];
|
|
209
208
|
case 3:
|
|
210
209
|
response = _j.sent();
|
|
211
|
-
console.log(response);
|
|
212
210
|
return [4 /*yield*/, response.json()];
|
|
213
211
|
case 4:
|
|
214
212
|
jsonResponse = _j.sent();
|
|
@@ -414,7 +412,6 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
414
412
|
})];
|
|
415
413
|
case 3:
|
|
416
414
|
res = _b.sent();
|
|
417
|
-
console.log(res);
|
|
418
415
|
return [2 /*return*/, true];
|
|
419
416
|
case 4: return [2 /*return*/];
|
|
420
417
|
}
|
|
@@ -434,7 +431,6 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
434
431
|
})];
|
|
435
432
|
case 1:
|
|
436
433
|
response = _b.sent();
|
|
437
|
-
console.log(response);
|
|
438
434
|
return [2 /*return*/, true];
|
|
439
435
|
}
|
|
440
436
|
});
|
|
@@ -462,6 +458,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
462
458
|
});
|
|
463
459
|
};
|
|
464
460
|
this.authenticator = authenticator;
|
|
461
|
+
this.API_HOST = apiHost;
|
|
465
462
|
this.redis = redis;
|
|
466
463
|
this.mutexLock = new MutexLock({ hashPrefix: 'RES_SMARTACCESS_MUTEX_', mutexLockInterval: 50, redis: redis });
|
|
467
464
|
}
|