@vendit-dev/thirdparty-adapters 0.4.1 → 0.6.0
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/.tool-versions +1 -0
- package/lib/adapters/amanoKorea.d.ts +1 -1
- package/lib/adapters/amanoKorea.js +8 -11
- package/lib/adapters/parking/amano.d.ts +19 -0
- package/lib/adapters/parking/amano.js +25 -0
- package/lib/adapters/parking/nicePark.d.ts +20 -0
- package/lib/adapters/parking/nicePark.js +149 -0
- package/lib/adapters/parking/parkingThirdParty.type.d.ts +36 -0
- package/lib/adapters/parking/parkingThirdParty.type.js +9 -0
- package/lib/adapters/parking/parkingThridPartyCaller.d.ts +12 -0
- package/lib/adapters/parking/parkingThridPartyCaller.js +148 -0
- package/lib/adapters/parking/parkingThridPartyCaller.type.d.ts +4 -0
- package/lib/adapters/parking/parkingThridPartyCaller.type.js +31 -0
- package/lib/adapters/sanhaWings.d.ts +4 -4
- package/lib/adapters/sanhaWings.js +20 -20
- package/lib/adapters/smartAccess.d.ts +4 -4
- package/lib/adapters/smartAccess.js +27 -27
- package/lib/adapters/themrIoT.d.ts +56 -53
- package/lib/adapters/themrIoT.js +7 -7
- package/lib/index.d.ts +3 -1
- package/lib/index.js +5 -1
- package/lib/types/amanoKorea.d.ts +7 -7
- package/lib/utils/mutex.js +4 -4
- package/package.json +8 -4
package/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodejs 16.20.1
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
|
|
2
2
|
import { AmanoHttpResponse, DeletePreDiscountInfoInput, DeletePreDiscountInfoResponse, FeeCarSearchInput, GetFeeCarSearchResponse, GetPreDiscountListInfoResponse, InsertPreDiscountInfoInput, InsertPreDiscountInfoResponse, PreDiscountListInfoInput, UpdatePreDiscountInfoInput, UpdatePreDiscountInfoResponse } from '../types/amanoKorea';
|
|
3
3
|
import MutexLock from '../utils/mutex';
|
|
4
|
-
|
|
4
|
+
type VenditAmanoKoreaAuthInfo = {
|
|
5
5
|
scope: string;
|
|
6
6
|
credential: {
|
|
7
7
|
lotAreaNo: string;
|
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -54,8 +54,8 @@ var node_fetch_1 = __importDefault(require("node-fetch"));
|
|
|
54
54
|
var mutex_1 = __importDefault(require("../utils/mutex"));
|
|
55
55
|
var AmanoKoreaAdapter = /** @class */ (function () {
|
|
56
56
|
function AmanoKoreaAdapter(_a) {
|
|
57
|
-
var _this = this;
|
|
58
57
|
var authenticator = _a.authenticator, redis = _a.redis;
|
|
58
|
+
var _this = this;
|
|
59
59
|
this.API_PORT = 9948;
|
|
60
60
|
this.PROVIDER_KEY = 'AmanoKorea';
|
|
61
61
|
// base64
|
|
@@ -103,7 +103,7 @@ var AmanoKoreaAdapter = /** @class */ (function () {
|
|
|
103
103
|
}
|
|
104
104
|
return [2 /*return*/, this.parseJSONSafe(existingAuth)];
|
|
105
105
|
}
|
|
106
|
-
lockId = "AMANO-HKEY|"
|
|
106
|
+
lockId = "AMANO-HKEY|".concat(accommodationId);
|
|
107
107
|
return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
|
|
108
108
|
case 2:
|
|
109
109
|
lockHash = _c.sent();
|
|
@@ -166,7 +166,7 @@ var AmanoKoreaAdapter = /** @class */ (function () {
|
|
|
166
166
|
_b.label = 1;
|
|
167
167
|
case 1:
|
|
168
168
|
_b.trys.push([1, 4, , 5]);
|
|
169
|
-
return [4 /*yield*/, node_fetch_1.default(this.API_HOST
|
|
169
|
+
return [4 /*yield*/, (0, node_fetch_1.default)("".concat(this.API_HOST, ":").concat(this.API_PORT, "/interop/").concat(directory), {
|
|
170
170
|
method: 'POST',
|
|
171
171
|
headers: {
|
|
172
172
|
'Content-Type': 'application/json',
|
|
@@ -212,8 +212,7 @@ var AmanoKoreaAdapter = /** @class */ (function () {
|
|
|
212
212
|
_a = this, lotAreaNo = _a.lotAreaNo, discCodeNo = _a.discCodeNo;
|
|
213
213
|
return [2 /*return*/, this.callAPI({
|
|
214
214
|
directory: 'getPreDiscountListInfo.do',
|
|
215
|
-
resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
|
|
216
|
-
discCodeNo: discCodeNo }),
|
|
215
|
+
resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo, discCodeNo: discCodeNo }),
|
|
217
216
|
})];
|
|
218
217
|
});
|
|
219
218
|
}); };
|
|
@@ -226,8 +225,7 @@ var AmanoKoreaAdapter = /** @class */ (function () {
|
|
|
226
225
|
_b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
|
|
227
226
|
return [2 /*return*/, this.callAPI({
|
|
228
227
|
directory: 'insertPreDiscountInfo.do',
|
|
229
|
-
resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
|
|
230
|
-
discCodeNo: discCodeNo }),
|
|
228
|
+
resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo, discCodeNo: discCodeNo }),
|
|
231
229
|
})];
|
|
232
230
|
});
|
|
233
231
|
});
|
|
@@ -241,8 +239,7 @@ var AmanoKoreaAdapter = /** @class */ (function () {
|
|
|
241
239
|
_b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
|
|
242
240
|
return [2 /*return*/, this.callAPI({
|
|
243
241
|
directory: 'updatePreDiscountInfo.do',
|
|
244
|
-
resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
|
|
245
|
-
discCodeNo: discCodeNo }),
|
|
242
|
+
resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo, discCodeNo: discCodeNo }),
|
|
246
243
|
})];
|
|
247
244
|
});
|
|
248
245
|
});
|
|
@@ -285,7 +282,7 @@ var AmanoKoreaAdapter = /** @class */ (function () {
|
|
|
285
282
|
}
|
|
286
283
|
AmanoKoreaAdapter.indexAccommodation = function (_a) {
|
|
287
284
|
var accommodationId = _a.accommodationId;
|
|
288
|
-
return "AUTH|AMANO-KOREA-API|"
|
|
285
|
+
return "AUTH|AMANO-KOREA-API|".concat(accommodationId);
|
|
289
286
|
};
|
|
290
287
|
return AmanoKoreaAdapter;
|
|
291
288
|
}());
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DeregisterParkingDiscountCommand, DeregisterParkingPassCommand, ParkingThirdParty, RegisterParkingDiscountCommand, RegisterParkingPassCommand, SearchVehiclesByNumberCriteria } from './parkingThirdParty.type';
|
|
2
|
+
interface AmanoConfig {
|
|
3
|
+
lotAreaNo: string;
|
|
4
|
+
registUserId: string;
|
|
5
|
+
password: string;
|
|
6
|
+
eqpmNo: string;
|
|
7
|
+
discCodeNo: string;
|
|
8
|
+
apiHost: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class AmanoThirdParty implements ParkingThirdParty {
|
|
11
|
+
private configuration;
|
|
12
|
+
constructor(configuration: AmanoConfig);
|
|
13
|
+
searchVehiclesByNumber(criteria: SearchVehiclesByNumberCriteria): Promise<any[]>;
|
|
14
|
+
registerParkingDiscount(command: RegisterParkingDiscountCommand): Promise<boolean>;
|
|
15
|
+
deregisterParkingDiscount(command: DeregisterParkingDiscountCommand): Promise<boolean>;
|
|
16
|
+
registerParkingPass(command: RegisterParkingPassCommand): Promise<boolean>;
|
|
17
|
+
deregisterParkingPass(command: DeregisterParkingPassCommand): Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmanoThirdParty = void 0;
|
|
4
|
+
var AmanoThirdParty = /** @class */ (function () {
|
|
5
|
+
function AmanoThirdParty(configuration) {
|
|
6
|
+
this.configuration = configuration;
|
|
7
|
+
}
|
|
8
|
+
AmanoThirdParty.prototype.searchVehiclesByNumber = function (criteria) {
|
|
9
|
+
throw new Error('Method not implemented in Amano yet.');
|
|
10
|
+
};
|
|
11
|
+
AmanoThirdParty.prototype.registerParkingDiscount = function (command) {
|
|
12
|
+
throw new Error('Method not implemented in Amano yet.');
|
|
13
|
+
};
|
|
14
|
+
AmanoThirdParty.prototype.deregisterParkingDiscount = function (command) {
|
|
15
|
+
throw new Error('Method not implemented in Amano yet.');
|
|
16
|
+
};
|
|
17
|
+
AmanoThirdParty.prototype.registerParkingPass = function (command) {
|
|
18
|
+
throw new Error('Method not implemented in Amano yet.');
|
|
19
|
+
};
|
|
20
|
+
AmanoThirdParty.prototype.deregisterParkingPass = function (command) {
|
|
21
|
+
throw new Error('Method not implemented in Amano yet.');
|
|
22
|
+
};
|
|
23
|
+
return AmanoThirdParty;
|
|
24
|
+
}());
|
|
25
|
+
exports.AmanoThirdParty = AmanoThirdParty;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DeregisterParkingDiscountCommand, DeregisterParkingPassCommand, ParkingThirdParty, RegisterParkingDiscountCommand, RegisterParkingPassCommand, SearchVehiclesByNumberCriteria, SearchVehiclesByNumberResult } from './parkingThirdParty.type';
|
|
2
|
+
interface NiceParkingConfig {
|
|
3
|
+
dbHost: string;
|
|
4
|
+
dbPort: string;
|
|
5
|
+
dbUserName: string;
|
|
6
|
+
dbPassword: string;
|
|
7
|
+
groupCode: string;
|
|
8
|
+
placeCode: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class NiceParkThirdParty implements ParkingThirdParty {
|
|
11
|
+
private configuration;
|
|
12
|
+
private sequelize;
|
|
13
|
+
constructor(configuration: NiceParkingConfig);
|
|
14
|
+
searchVehiclesByNumber(criteria: SearchVehiclesByNumberCriteria): Promise<SearchVehiclesByNumberResult[]>;
|
|
15
|
+
registerParkingDiscount(command: RegisterParkingDiscountCommand): Promise<boolean>;
|
|
16
|
+
deregisterParkingDiscount(command: DeregisterParkingDiscountCommand): Promise<boolean>;
|
|
17
|
+
registerParkingPass(command: RegisterParkingPassCommand): Promise<boolean>;
|
|
18
|
+
deregisterParkingPass(command: DeregisterParkingPassCommand): Promise<boolean>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.NiceParkThirdParty = void 0;
|
|
43
|
+
var sequelize_1 = require("sequelize");
|
|
44
|
+
var tedious_1 = __importDefault(require("tedious"));
|
|
45
|
+
var moment_1 = __importDefault(require("moment"));
|
|
46
|
+
var NiceParkDbName = 'NPMU';
|
|
47
|
+
var NiceParkThirdParty = /** @class */ (function () {
|
|
48
|
+
function NiceParkThirdParty(configuration) {
|
|
49
|
+
this.configuration = configuration;
|
|
50
|
+
this.configuration.dbPort = '46000';
|
|
51
|
+
this.sequelize = new sequelize_1.Sequelize(NiceParkDbName, configuration.dbUserName, configuration.dbPassword, {
|
|
52
|
+
dialect: 'mssql',
|
|
53
|
+
host: configuration.dbHost,
|
|
54
|
+
port: Number(configuration.dbPort),
|
|
55
|
+
dialectOptions: {
|
|
56
|
+
options: {
|
|
57
|
+
encrypt: false,
|
|
58
|
+
cryptoCredentialsDetails: {
|
|
59
|
+
minVersion: 'TLSv1.2', // or 'TLSv1.3'
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
dialectModule: tedious_1.default,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
NiceParkThirdParty.prototype.searchVehiclesByNumber = function (criteria) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
var vehicleNumber, result, refinedResult, err_1;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
vehicleNumber = criteria.vehicleNumber;
|
|
73
|
+
_a.label = 1;
|
|
74
|
+
case 1:
|
|
75
|
+
_a.trys.push([1, 3, , 4]);
|
|
76
|
+
return [4 /*yield*/, this.sequelize.query("exec sp_External_Link_Search_CarNo4 '".concat(vehicleNumber, "'"))];
|
|
77
|
+
case 2:
|
|
78
|
+
result = _a.sent();
|
|
79
|
+
refinedResult = result[0].map(function (item) { return ({
|
|
80
|
+
vehicleNumber: item.carNo.replace(' ', ''),
|
|
81
|
+
enteredAt: new Date(item.inCarDtm),
|
|
82
|
+
}); });
|
|
83
|
+
console.log('NiceParkThirdParty#searchVehiclesByNumber result: ', refinedResult);
|
|
84
|
+
return [2 /*return*/, refinedResult];
|
|
85
|
+
case 3:
|
|
86
|
+
err_1 = _a.sent();
|
|
87
|
+
return [2 /*return*/, []];
|
|
88
|
+
case 4: return [2 /*return*/];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
NiceParkThirdParty.prototype.registerParkingDiscount = function (command) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
var vehicleNumber, from, minutes, result, err_2;
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
switch (_a.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
vehicleNumber = command.vehicleNumber, from = command.from, minutes = command.minutes;
|
|
100
|
+
_a.label = 1;
|
|
101
|
+
case 1:
|
|
102
|
+
_a.trys.push([1, 3, , 4]);
|
|
103
|
+
return [4 /*yield*/, this.sequelize.query("exec sp_External_Link_Discount '".concat(vehicleNumber, "', '1', '").concat(minutes, "', '").concat(this.configuration.placeCode || '000001'))];
|
|
104
|
+
case 2:
|
|
105
|
+
result = _a.sent();
|
|
106
|
+
console.log('NiceParkThirdParty#registerParkingDiscount result: ', result);
|
|
107
|
+
return [2 /*return*/, result[0].result === '1'];
|
|
108
|
+
case 3:
|
|
109
|
+
err_2 = _a.sent();
|
|
110
|
+
return [2 /*return*/, false];
|
|
111
|
+
case 4: return [2 /*return*/];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
NiceParkThirdParty.prototype.deregisterParkingDiscount = function (command) {
|
|
117
|
+
throw new Error('Method not implemented in NicePark yet.');
|
|
118
|
+
};
|
|
119
|
+
NiceParkThirdParty.prototype.registerParkingPass = function (command) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
var from, to, vehicleNumber, fromDateString, toDateString, result, err_3;
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
switch (_a.label) {
|
|
124
|
+
case 0:
|
|
125
|
+
from = command.from, to = command.to, vehicleNumber = command.vehicleNumber;
|
|
126
|
+
fromDateString = (0, moment_1.default)(from).format('YYYYMMDD');
|
|
127
|
+
toDateString = (0, moment_1.default)(to).format('YYYYMMDD');
|
|
128
|
+
_a.label = 1;
|
|
129
|
+
case 1:
|
|
130
|
+
_a.trys.push([1, 3, , 4]);
|
|
131
|
+
return [4 /*yield*/, this.sequelize.query("exec sp_External_Link_RegRegular_CODEIN '".concat(vehicleNumber, "', '").concat(fromDateString, "', '").concat(toDateString, "', '', '', ,'', ,'', '', '0', '").concat(this.configuration.groupCode, "'"))];
|
|
132
|
+
case 2:
|
|
133
|
+
result = _a.sent();
|
|
134
|
+
console.log('NiceParkThirdParty#registerParkingDiscount result: ', result);
|
|
135
|
+
return [2 /*return*/, result[0].result === '1'];
|
|
136
|
+
case 3:
|
|
137
|
+
err_3 = _a.sent();
|
|
138
|
+
return [2 /*return*/, false];
|
|
139
|
+
case 4: return [2 /*return*/];
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
NiceParkThirdParty.prototype.deregisterParkingPass = function (command) {
|
|
145
|
+
throw new Error('Method not implemented in NicePark yet.');
|
|
146
|
+
};
|
|
147
|
+
return NiceParkThirdParty;
|
|
148
|
+
}());
|
|
149
|
+
exports.NiceParkThirdParty = NiceParkThirdParty;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface SearchVehiclesByNumberCriteria {
|
|
2
|
+
accommodationId: string;
|
|
3
|
+
vehicleNumber: string;
|
|
4
|
+
targetDate?: Date;
|
|
5
|
+
}
|
|
6
|
+
export interface RegisterParkingDiscountCommand {
|
|
7
|
+
accommodationId: string;
|
|
8
|
+
vehicleNumber: string;
|
|
9
|
+
from?: Date;
|
|
10
|
+
minutes: number;
|
|
11
|
+
}
|
|
12
|
+
export interface DeregisterParkingDiscountCommand {
|
|
13
|
+
accommodationId: string;
|
|
14
|
+
vehicleNumber: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RegisterParkingPassCommand {
|
|
17
|
+
accommodationId: string;
|
|
18
|
+
vehicleNumber: string;
|
|
19
|
+
from: Date;
|
|
20
|
+
to: Date;
|
|
21
|
+
}
|
|
22
|
+
export interface DeregisterParkingPassCommand {
|
|
23
|
+
accommodationId: string;
|
|
24
|
+
vehicleNumber: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SearchVehiclesByNumberResult {
|
|
27
|
+
vehicleNumber: string;
|
|
28
|
+
enteredAt?: Date;
|
|
29
|
+
}
|
|
30
|
+
export declare abstract class ParkingThirdParty {
|
|
31
|
+
abstract searchVehiclesByNumber(criteria: SearchVehiclesByNumberCriteria): Promise<SearchVehiclesByNumberResult[]>;
|
|
32
|
+
abstract registerParkingDiscount(command: RegisterParkingDiscountCommand): Promise<boolean>;
|
|
33
|
+
abstract deregisterParkingDiscount(command: DeregisterParkingDiscountCommand): Promise<boolean>;
|
|
34
|
+
abstract registerParkingPass(command: RegisterParkingPassCommand): Promise<boolean>;
|
|
35
|
+
abstract deregisterParkingPass(command: DeregisterParkingPassCommand): Promise<boolean>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParkingThirdParty = void 0;
|
|
4
|
+
var ParkingThirdParty = /** @class */ (function () {
|
|
5
|
+
function ParkingThirdParty() {
|
|
6
|
+
}
|
|
7
|
+
return ParkingThirdParty;
|
|
8
|
+
}());
|
|
9
|
+
exports.ParkingThirdParty = ParkingThirdParty;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeregisterParkingDiscountCommand, DeregisterParkingPassCommand, ParkingThirdParty, RegisterParkingDiscountCommand, RegisterParkingPassCommand, SearchVehiclesByNumberCriteria } from './parkingThirdParty.type';
|
|
2
|
+
import { BaseParkingThirdPartyCaller } from './parkingThridPartyCaller.type';
|
|
3
|
+
export default class ParkingThirdPartyCaller implements BaseParkingThirdPartyCaller {
|
|
4
|
+
private parkingThirdParty;
|
|
5
|
+
constructor();
|
|
6
|
+
use(parkingThirdParty: ParkingThirdParty): void;
|
|
7
|
+
searchVehiclesByNumber(criteria: SearchVehiclesByNumberCriteria): Promise<any[]>;
|
|
8
|
+
registerParkingDiscount(command: RegisterParkingDiscountCommand): Promise<boolean>;
|
|
9
|
+
deregisterParkingDiscount(command: DeregisterParkingDiscountCommand): Promise<boolean>;
|
|
10
|
+
registerParkingPass(command: RegisterParkingPassCommand): Promise<boolean>;
|
|
11
|
+
deregisterParkingPass(command: DeregisterParkingPassCommand): Promise<boolean>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var ParkingThirdPartyCaller = /** @class */ (function () {
|
|
40
|
+
// eslint-disable-next-line no-useless-constructor, @typescript-eslint/no-empty-function
|
|
41
|
+
function ParkingThirdPartyCaller() {
|
|
42
|
+
}
|
|
43
|
+
ParkingThirdPartyCaller.prototype.use = function (parkingThirdParty) {
|
|
44
|
+
this.parkingThirdParty = parkingThirdParty;
|
|
45
|
+
};
|
|
46
|
+
ParkingThirdPartyCaller.prototype.searchVehiclesByNumber = function (criteria) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
48
|
+
var searchResult, err_1;
|
|
49
|
+
return __generator(this, function (_a) {
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
_a.trys.push([0, 2, , 3]);
|
|
53
|
+
return [4 /*yield*/, this.parkingThirdParty.searchVehiclesByNumber(criteria)];
|
|
54
|
+
case 1:
|
|
55
|
+
searchResult = _a.sent();
|
|
56
|
+
return [2 /*return*/, searchResult];
|
|
57
|
+
case 2:
|
|
58
|
+
err_1 = _a.sent();
|
|
59
|
+
console.error("searchVehiclesByNumber failed: ".concat(err_1));
|
|
60
|
+
return [2 /*return*/, []];
|
|
61
|
+
case 3: return [2 /*return*/];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
ParkingThirdPartyCaller.prototype.registerParkingDiscount = function (command) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
68
|
+
var err_2;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
_a.trys.push([0, 2, , 3]);
|
|
73
|
+
return [4 /*yield*/, this.parkingThirdParty.registerParkingDiscount(command)];
|
|
74
|
+
case 1:
|
|
75
|
+
_a.sent();
|
|
76
|
+
return [2 /*return*/, true];
|
|
77
|
+
case 2:
|
|
78
|
+
err_2 = _a.sent();
|
|
79
|
+
console.error("registerParkingDiscount failed: ".concat(err_2));
|
|
80
|
+
return [2 /*return*/, false];
|
|
81
|
+
case 3: return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
ParkingThirdPartyCaller.prototype.deregisterParkingDiscount = function (command) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var err_3;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
_a.trys.push([0, 2, , 3]);
|
|
93
|
+
return [4 /*yield*/, this.parkingThirdParty.deregisterParkingDiscount(command)];
|
|
94
|
+
case 1:
|
|
95
|
+
_a.sent();
|
|
96
|
+
return [2 /*return*/, true];
|
|
97
|
+
case 2:
|
|
98
|
+
err_3 = _a.sent();
|
|
99
|
+
console.error("deregisterParkingDiscount failed: ".concat(err_3));
|
|
100
|
+
return [2 /*return*/, false];
|
|
101
|
+
case 3: return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
ParkingThirdPartyCaller.prototype.registerParkingPass = function (command) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
108
|
+
var err_4;
|
|
109
|
+
return __generator(this, function (_a) {
|
|
110
|
+
switch (_a.label) {
|
|
111
|
+
case 0:
|
|
112
|
+
_a.trys.push([0, 2, , 3]);
|
|
113
|
+
return [4 /*yield*/, this.parkingThirdParty.registerParkingPass(command)];
|
|
114
|
+
case 1:
|
|
115
|
+
_a.sent();
|
|
116
|
+
return [2 /*return*/, true];
|
|
117
|
+
case 2:
|
|
118
|
+
err_4 = _a.sent();
|
|
119
|
+
console.error("registerParkingPass failed: ".concat(err_4));
|
|
120
|
+
return [2 /*return*/, false];
|
|
121
|
+
case 3: return [2 /*return*/];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
ParkingThirdPartyCaller.prototype.deregisterParkingPass = function (command) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
var err_5;
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0:
|
|
132
|
+
_a.trys.push([0, 2, , 3]);
|
|
133
|
+
return [4 /*yield*/, this.parkingThirdParty.deregisterParkingPass(command)];
|
|
134
|
+
case 1:
|
|
135
|
+
_a.sent();
|
|
136
|
+
return [2 /*return*/, true];
|
|
137
|
+
case 2:
|
|
138
|
+
err_5 = _a.sent();
|
|
139
|
+
console.error("deregisterParkingPass failed: ".concat(err_5));
|
|
140
|
+
return [2 /*return*/, false];
|
|
141
|
+
case 3: return [2 /*return*/];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
return ParkingThirdPartyCaller;
|
|
147
|
+
}());
|
|
148
|
+
exports.default = ParkingThirdPartyCaller;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// interface ParkingThirdParty {
|
|
3
|
+
// searchVehiclesByNumber: () => any;
|
|
4
|
+
// parkingThridPartyCaller
|
|
5
|
+
// }
|
|
6
|
+
var __extends = (this && this.__extends) || (function () {
|
|
7
|
+
var extendStatics = function (d, b) {
|
|
8
|
+
extendStatics = Object.setPrototypeOf ||
|
|
9
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
10
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
11
|
+
return extendStatics(d, b);
|
|
12
|
+
};
|
|
13
|
+
return function (d, b) {
|
|
14
|
+
if (typeof b !== "function" && b !== null)
|
|
15
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
16
|
+
extendStatics(d, b);
|
|
17
|
+
function __() { this.constructor = d; }
|
|
18
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
19
|
+
};
|
|
20
|
+
})();
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.BaseParkingThirdPartyCaller = void 0;
|
|
23
|
+
var parkingThirdParty_type_1 = require("./parkingThirdParty.type");
|
|
24
|
+
var BaseParkingThirdPartyCaller = /** @class */ (function (_super) {
|
|
25
|
+
__extends(BaseParkingThirdPartyCaller, _super);
|
|
26
|
+
function BaseParkingThirdPartyCaller() {
|
|
27
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
28
|
+
}
|
|
29
|
+
return BaseParkingThirdPartyCaller;
|
|
30
|
+
}(parkingThirdParty_type_1.ParkingThirdParty));
|
|
31
|
+
exports.BaseParkingThirdPartyCaller = BaseParkingThirdPartyCaller;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
|
|
2
2
|
import MutexLock from '../utils/mutex';
|
|
3
|
-
|
|
3
|
+
type VenditWingsAuthInfo = {
|
|
4
4
|
scope: string;
|
|
5
5
|
credential: {
|
|
6
6
|
companyId: string;
|
|
@@ -20,13 +20,13 @@ declare type VenditWingsAuthInfo = {
|
|
|
20
20
|
};
|
|
21
21
|
expiresAt: number;
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
type WingsCommonCredential = {
|
|
24
24
|
vendorId: string;
|
|
25
25
|
companyId: string;
|
|
26
26
|
apiKey: string;
|
|
27
27
|
kioskIp: string;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
type WingsApiCommonResponse = {
|
|
30
30
|
resultData: any;
|
|
31
31
|
};
|
|
32
32
|
export declare class WingsApiController {
|
|
@@ -127,7 +127,7 @@ export default class WingsAdapter {
|
|
|
127
127
|
langType: string;
|
|
128
128
|
}) => Promise<{
|
|
129
129
|
walkinInfo: any;
|
|
130
|
-
roomInfo: [
|
|
130
|
+
roomInfo: any[];
|
|
131
131
|
} | null>;
|
|
132
132
|
processWalkIn: ({ accommodationId, roomTypeCode, startDate, endDate, nights, salesDate, guestName, adultCount, childCount, dailyRoomFees, carNumber, mobileNumber, }: {
|
|
133
133
|
accommodationId: string;
|
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -65,8 +65,8 @@ var WINGS_COMMON_REQUEST_PARAMS = {
|
|
|
65
65
|
};
|
|
66
66
|
var WingsApiController = /** @class */ (function () {
|
|
67
67
|
function WingsApiController(_a) {
|
|
68
|
-
var _this = this;
|
|
69
68
|
var contextApi = _a.contextApi;
|
|
69
|
+
var _this = this;
|
|
70
70
|
this.callWingsApi = function (_a) {
|
|
71
71
|
var route = _a.route, _b = _a.params, params = _b === void 0 ? {} : _b, auth = _a.auth;
|
|
72
72
|
return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -79,9 +79,9 @@ var WingsApiController = /** @class */ (function () {
|
|
|
79
79
|
headers: __assign(__assign({}, WINGS_COMMON_REQUEST_HEADERS), auth.headers),
|
|
80
80
|
body: JSON.stringify(__assign(__assign(__assign({}, auth.params), WINGS_COMMON_REQUEST_PARAMS), params)),
|
|
81
81
|
};
|
|
82
|
-
console.log(this.URI
|
|
82
|
+
console.log("".concat(this.URI, "/").concat(this.CONTEXT, "/").concat(route));
|
|
83
83
|
console.log(requestOptions);
|
|
84
|
-
return [4 /*yield*/, node_fetch_1.default(this.URI
|
|
84
|
+
return [4 /*yield*/, (0, node_fetch_1.default)("".concat(this.URI, "/").concat(this.CONTEXT, "/").concat(route), requestOptions)];
|
|
85
85
|
case 1:
|
|
86
86
|
response = _c.sent();
|
|
87
87
|
console.log(response);
|
|
@@ -105,8 +105,8 @@ var apiController = new WingsApiController({
|
|
|
105
105
|
});
|
|
106
106
|
var WingsAdapter = /** @class */ (function () {
|
|
107
107
|
function WingsAdapter(_a) {
|
|
108
|
-
var _this = this;
|
|
109
108
|
var authenticator = _a.authenticator, redis = _a.redis;
|
|
109
|
+
var _this = this;
|
|
110
110
|
this.PROVIDER_KEY = 'SanhaWings';
|
|
111
111
|
this.checkWingsIntegration = function (_a) {
|
|
112
112
|
var accommodationId = _a.accommodationId;
|
|
@@ -129,7 +129,7 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
129
129
|
}
|
|
130
130
|
return [2 /*return*/, JSON.parse(existingAuth)];
|
|
131
131
|
}
|
|
132
|
-
lockId = "WINGS-HKEY|"
|
|
132
|
+
lockId = "WINGS-HKEY|".concat(accommodationId);
|
|
133
133
|
return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
|
|
134
134
|
case 2:
|
|
135
135
|
lockHash = _b.sent();
|
|
@@ -220,7 +220,7 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
220
220
|
response = _b.sent();
|
|
221
221
|
resultData = response.resultData;
|
|
222
222
|
if (!resultData) {
|
|
223
|
-
throw new Error("FAILED_TO_CHECKIN_"
|
|
223
|
+
throw new Error("FAILED_TO_CHECKIN_".concat(JSON.stringify(response)));
|
|
224
224
|
}
|
|
225
225
|
return [2 /*return*/, resultData];
|
|
226
226
|
case 4:
|
|
@@ -384,8 +384,8 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
384
384
|
route: 'ki02/kioskWalkInInfo',
|
|
385
385
|
auth: WingsAdapter.authFromCredentials(authInfo.credential),
|
|
386
386
|
params: {
|
|
387
|
-
ARRV_DATE: moment_1.default(startDate).format('YYYYMMDD'),
|
|
388
|
-
DEPT_DATE: moment_1.default(endDate).format('YYYYMMDD'),
|
|
387
|
+
ARRV_DATE: (0, moment_1.default)(startDate).format('YYYYMMDD'),
|
|
388
|
+
DEPT_DATE: (0, moment_1.default)(endDate).format('YYYYMMDD'),
|
|
389
389
|
ADULT_CNT: adultCount,
|
|
390
390
|
CHILD_CNT: childCount,
|
|
391
391
|
LANG_TYPE: langType,
|
|
@@ -423,10 +423,10 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
423
423
|
route: 'ki02/kioskWalkInRoomRate',
|
|
424
424
|
auth: WingsAdapter.authFromCredentials(authInfo.credential),
|
|
425
425
|
params: {
|
|
426
|
-
ARRV_DATE: moment_1.default(startDate).format('YYYYMMDD'),
|
|
427
|
-
DEPT_DATE: moment_1.default(endDate).format('YYYYMMDD'),
|
|
426
|
+
ARRV_DATE: (0, moment_1.default)(startDate).format('YYYYMMDD'),
|
|
427
|
+
DEPT_DATE: (0, moment_1.default)(endDate).format('YYYYMMDD'),
|
|
428
428
|
ROOM_TYPE_CODE: roomTypeCode,
|
|
429
|
-
SALES_DATE: moment_1.default(salesDate).format('YYYYMMDD'),
|
|
429
|
+
SALES_DATE: (0, moment_1.default)(salesDate).format('YYYYMMDD'),
|
|
430
430
|
BSNS_CODE: authInfo.credential.BSNS_CODE,
|
|
431
431
|
},
|
|
432
432
|
})];
|
|
@@ -460,8 +460,8 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
460
460
|
route: 'ki02/kioskWalkInInfo',
|
|
461
461
|
auth: WingsAdapter.authFromCredentials(authInfo.credential),
|
|
462
462
|
params: {
|
|
463
|
-
ARRV_DATE: moment_1.default(startDate).format('YYYYMMDD'),
|
|
464
|
-
DEPT_DATE: moment_1.default(endDate).format('YYYYMMDD'),
|
|
463
|
+
ARRV_DATE: (0, moment_1.default)(startDate).format('YYYYMMDD'),
|
|
464
|
+
DEPT_DATE: (0, moment_1.default)(endDate).format('YYYYMMDD'),
|
|
465
465
|
ADULT_CNT: adultCount,
|
|
466
466
|
CHILD_CNT: childCount,
|
|
467
467
|
LANG_TYPE: langType,
|
|
@@ -638,7 +638,7 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
638
638
|
FOLIO_NO: folioNumber,
|
|
639
639
|
ROOM_NO: roomNumber,
|
|
640
640
|
REG_DATE: registerDate,
|
|
641
|
-
REG_TIME: moment_1.default().format('HHmmSS'),
|
|
641
|
+
REG_TIME: (0, moment_1.default)().format('HHmmSS'),
|
|
642
642
|
ISSUE_CNT: issuedCount,
|
|
643
643
|
RESULT_MSG: resultMessage,
|
|
644
644
|
},
|
|
@@ -722,9 +722,9 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
722
722
|
RSPNS_CODE: parsedData.CORPRESPCODE.trim(),
|
|
723
723
|
TERM_NO: parsedData.TERMID.trim(),
|
|
724
724
|
APPR_NO: parsedData.APPROVALNO.trim(),
|
|
725
|
-
APPR_DATE: "20"
|
|
725
|
+
APPR_DATE: "20".concat(parsedData.TRADETIME.slice(0, 6)),
|
|
726
726
|
APPR_TIME: parsedData.TRADETIME.slice(6, 10),
|
|
727
|
-
CNFM_DATE: "20"
|
|
727
|
+
CNFM_DATE: "20".concat(parsedData.TRADETIME.slice(0, 6)),
|
|
728
728
|
CNFM_TYPE: parsedData.TRADETIME.slice(6, 10),
|
|
729
729
|
// Generated data
|
|
730
730
|
INSTA_MMS_CNT: parsedData.INSTA_MMS_CNT || '00',
|
|
@@ -783,7 +783,7 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
783
783
|
var foundPaymentInfo, parsedPayment, err_16;
|
|
784
784
|
return __generator(this, function (_b) {
|
|
785
785
|
switch (_b.label) {
|
|
786
|
-
case 0: return [4 /*yield*/, this.redis.get("SanhaWings|"
|
|
786
|
+
case 0: return [4 /*yield*/, this.redis.get("SanhaWings|".concat(paymentId))];
|
|
787
787
|
case 1:
|
|
788
788
|
foundPaymentInfo = _b.sent();
|
|
789
789
|
if (!foundPaymentInfo)
|
|
@@ -797,7 +797,7 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
797
797
|
folioNumber: folioNumber,
|
|
798
798
|
paymentAmount: parsedPayment.amount.toString(),
|
|
799
799
|
paymentInfo: parsedPayment.data,
|
|
800
|
-
saleDate: moment_1.default(parsedPayment.createdAt).format('YYYYMMDD'),
|
|
800
|
+
saleDate: (0, moment_1.default)(parsedPayment.createdAt).format('YYYYMMDD'),
|
|
801
801
|
})];
|
|
802
802
|
case 3:
|
|
803
803
|
_b.sent();
|
|
@@ -821,7 +821,7 @@ var WingsAdapter = /** @class */ (function () {
|
|
|
821
821
|
}
|
|
822
822
|
WingsAdapter.indexAccommodation = function (_a) {
|
|
823
823
|
var accommodationId = _a.accommodationId;
|
|
824
|
-
return "AUTH|WINGS-API|"
|
|
824
|
+
return "AUTH|WINGS-API|".concat(accommodationId);
|
|
825
825
|
};
|
|
826
826
|
WingsAdapter.authFromCredentials = function (_a) {
|
|
827
827
|
var vendorId = _a.vendorId, companyId = _a.companyId, apiKey = _a.apiKey, kioskIp = _a.kioskIp;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
|
|
2
2
|
import MutexLock from '../utils/mutex';
|
|
3
|
-
|
|
3
|
+
type OAuthTokenResponse = {
|
|
4
4
|
accessToken: string;
|
|
5
5
|
refreshToken: string;
|
|
6
6
|
tokenType: string;
|
|
7
7
|
expiresIn: number;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type OAuthRawTokenSet = {
|
|
10
10
|
refresh_token: string;
|
|
11
11
|
access_token: string;
|
|
12
12
|
expires_in: number;
|
|
13
13
|
token_type: string;
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
type SmartAccessRoom = {
|
|
16
16
|
roomId: string;
|
|
17
17
|
roomNumber: string;
|
|
18
18
|
path: string;
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
type SmartAccessRoomKey = {
|
|
21
21
|
deviceId: string;
|
|
22
22
|
deviceName: string;
|
|
23
23
|
keyList: {
|
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -55,8 +55,8 @@ var node_fetch_1 = __importDefault(require("node-fetch"));
|
|
|
55
55
|
var mutex_1 = __importDefault(require("../utils/mutex"));
|
|
56
56
|
var SmartAccessAdapter = /** @class */ (function () {
|
|
57
57
|
function SmartAccessAdapter(_a) {
|
|
58
|
-
var _this = this;
|
|
59
58
|
var authenticator = _a.authenticator, redis = _a.redis, apiHost = _a.apiHost;
|
|
59
|
+
var _this = this;
|
|
60
60
|
this.PROVIDER_KEY = 'SamsungSmartAccess';
|
|
61
61
|
this.parseJSONSafe = function (str) {
|
|
62
62
|
try {
|
|
@@ -91,7 +91,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
91
91
|
}
|
|
92
92
|
return [2 /*return*/, this.parseJSONSafe(existingAuth)];
|
|
93
93
|
}
|
|
94
|
-
lockId = "SMARTACCESS-HKEY|"
|
|
94
|
+
lockId = "SMARTACCESS-HKEY|".concat(accommodationId);
|
|
95
95
|
return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
|
|
96
96
|
case 2:
|
|
97
97
|
lockHash = _b.sent();
|
|
@@ -152,27 +152,28 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
152
152
|
this.callSmartAccessApi = function (_a) {
|
|
153
153
|
var route = _a.route, accommodationId = _a.accommodationId, params = _a.params, _b = _a.method, method = _b === void 0 ? 'post' : _b, headers = _a.headers;
|
|
154
154
|
return __awaiter(_this, void 0, void 0, function () {
|
|
155
|
-
var requestArgs, _c, _d, _e, _f,
|
|
155
|
+
var requestArgs, _c, _d, _e, _f, response, jsonResponse;
|
|
156
|
+
var _g, _h;
|
|
156
157
|
return __generator(this, function (_j) {
|
|
157
158
|
switch (_j.label) {
|
|
158
159
|
case 0:
|
|
159
160
|
_c = [__assign({ method: method }, (method !== 'get' && {
|
|
160
161
|
body: JSON.stringify(__assign({}, params)),
|
|
161
162
|
}))];
|
|
162
|
-
_d = {};
|
|
163
|
-
_e = [{ 'Content-Type': 'application/json' }];
|
|
164
|
-
_f = accommodationId;
|
|
165
|
-
if (!_f) return [3 /*break*/, 2];
|
|
166
163
|
_g = {};
|
|
167
|
-
|
|
164
|
+
_d = [{ 'Content-Type': 'application/json' }];
|
|
165
|
+
_e = accommodationId;
|
|
166
|
+
if (!_e) return [3 /*break*/, 2];
|
|
167
|
+
_h = {};
|
|
168
|
+
_f = "Bearer ".concat;
|
|
168
169
|
return [4 /*yield*/, this.getAccommodationAccessToken(accommodationId)];
|
|
169
170
|
case 1:
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
_e = (_h.Authorization = _f.apply("Bearer ", [_j.sent()]),
|
|
172
|
+
_h);
|
|
172
173
|
_j.label = 2;
|
|
173
174
|
case 2:
|
|
174
|
-
requestArgs = __assign.apply(void 0, _c.concat([(
|
|
175
|
-
return [4 /*yield*/, node_fetch_1.default(this.API_HOST
|
|
175
|
+
requestArgs = __assign.apply(void 0, _c.concat([(_g.headers = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_e)])), headers]), _g)]));
|
|
176
|
+
return [4 /*yield*/, (0, node_fetch_1.default)("".concat(this.API_HOST, "/sa/oauth/").concat(route), requestArgs)];
|
|
176
177
|
case 3:
|
|
177
178
|
response = _j.sent();
|
|
178
179
|
return [4 /*yield*/, response.json()];
|
|
@@ -192,7 +193,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
192
193
|
case 0: return [4 /*yield*/, this.callSmartAccessApi({
|
|
193
194
|
accommodationId: accommodationId,
|
|
194
195
|
method: 'get',
|
|
195
|
-
route: "v1/room/"
|
|
196
|
+
route: "v1/room/".concat(roomId, "/roominfo"),
|
|
196
197
|
})];
|
|
197
198
|
case 1:
|
|
198
199
|
roomResponse = _b.sent();
|
|
@@ -253,7 +254,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
253
254
|
return [4 /*yield*/, this.callSmartAccessApi({
|
|
254
255
|
accommodationId: accommodationId,
|
|
255
256
|
method: 'get',
|
|
256
|
-
route: "v1/room/"
|
|
257
|
+
route: "v1/room/".concat(parsedProperty.thirdPartyId, "/keyinfo"),
|
|
257
258
|
})];
|
|
258
259
|
case 3:
|
|
259
260
|
roomKeyResponse = _a.sent();
|
|
@@ -318,10 +319,10 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
318
319
|
keyType: keyType,
|
|
319
320
|
pinCode: null,
|
|
320
321
|
roomId: parsedProperty.thirdPartyId,
|
|
321
|
-
accessStartDate: moment_1.default(startDate)
|
|
322
|
+
accessStartDate: (0, moment_1.default)(startDate)
|
|
322
323
|
.add(9, 'hours')
|
|
323
324
|
.format('YYYYMMDDHHmm'),
|
|
324
|
-
accessEndDate: moment_1.default(endDate).add(9, 'hours').format('YYYYMMDDHHmm'),
|
|
325
|
+
accessEndDate: (0, moment_1.default)(endDate).add(9, 'hours').format('YYYYMMDDHHmm'),
|
|
325
326
|
},
|
|
326
327
|
})];
|
|
327
328
|
case 2:
|
|
@@ -330,13 +331,12 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
330
331
|
return [4 /*yield*/, this.callSmartAccessApi({
|
|
331
332
|
accommodationId: accommodationId,
|
|
332
333
|
method: 'get',
|
|
333
|
-
route: "v1/key/"
|
|
334
|
+
route: "v1/key/".concat(keyId, "/pincode"),
|
|
334
335
|
})];
|
|
335
336
|
case 3:
|
|
336
337
|
pinCodeQuery = _c.sent();
|
|
337
338
|
lockInfo = ((_b = pinCodeQuery === null || pinCodeQuery === void 0 ? void 0 : pinCodeQuery.lockList) === null || _b === void 0 ? void 0 : _b[0]) || {};
|
|
338
|
-
return [2 /*return*/, __assign(__assign({}, lockInfo), { pinCode: (lockInfo === null || lockInfo === void 0 ? void 0 : lockInfo.pinCode) || (parsedData === null || parsedData === void 0 ? void 0 : parsedData.masterPinCode), keyId: keyId,
|
|
339
|
-
pinCodeResult: pinCodeResult })];
|
|
339
|
+
return [2 /*return*/, __assign(__assign({}, lockInfo), { pinCode: (lockInfo === null || lockInfo === void 0 ? void 0 : lockInfo.pinCode) || (parsedData === null || parsedData === void 0 ? void 0 : parsedData.masterPinCode), keyId: keyId, pinCodeResult: pinCodeResult })];
|
|
340
340
|
case 4: return [2 /*return*/];
|
|
341
341
|
}
|
|
342
342
|
});
|
|
@@ -351,14 +351,14 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
351
351
|
case 0: return [4 /*yield*/, this.callSmartAccessApi({
|
|
352
352
|
accommodationId: accommodationId,
|
|
353
353
|
method: 'put',
|
|
354
|
-
route: "v1/key/"
|
|
354
|
+
route: "v1/key/".concat(keyId, "/pincode"),
|
|
355
355
|
params: {
|
|
356
356
|
userType: userType,
|
|
357
357
|
keyType: keyType,
|
|
358
|
-
accessStartDate: moment_1.default(startDate)
|
|
358
|
+
accessStartDate: (0, moment_1.default)(startDate)
|
|
359
359
|
.add(9, 'hours')
|
|
360
360
|
.format('YYYYMMDDHHmm'),
|
|
361
|
-
accessEndDate: moment_1.default(endDate).add(9, 'hours').format('YYYYMMDDHHmm'),
|
|
361
|
+
accessEndDate: (0, moment_1.default)(endDate).add(9, 'hours').format('YYYYMMDDHHmm'),
|
|
362
362
|
},
|
|
363
363
|
})];
|
|
364
364
|
case 1:
|
|
@@ -366,7 +366,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
366
366
|
return [4 /*yield*/, this.callSmartAccessApi({
|
|
367
367
|
accommodationId: accommodationId,
|
|
368
368
|
method: 'get',
|
|
369
|
-
route: "v1/key/"
|
|
369
|
+
route: "v1/key/".concat(keyId, "/pincode"),
|
|
370
370
|
})];
|
|
371
371
|
case 2:
|
|
372
372
|
pinCodeQuery = _b.sent();
|
|
@@ -384,7 +384,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
384
384
|
case 0: return [4 /*yield*/, this.callSmartAccessApi({
|
|
385
385
|
accommodationId: accommodationId,
|
|
386
386
|
method: 'put',
|
|
387
|
-
route: "v1/key/"
|
|
387
|
+
route: "v1/key/".concat(keyId, "/delete"),
|
|
388
388
|
})];
|
|
389
389
|
case 1:
|
|
390
390
|
pinCodeResult = _b.sent();
|
|
@@ -423,7 +423,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
423
423
|
deviceId = parsedProperty.thirdPartyId;
|
|
424
424
|
return [4 /*yield*/, this.callSmartAccessApi({
|
|
425
425
|
accommodationId: accommodationId,
|
|
426
|
-
route: "v1/device/"
|
|
426
|
+
route: "v1/device/".concat(deviceId, "/open"),
|
|
427
427
|
params: {
|
|
428
428
|
keyId: keyId,
|
|
429
429
|
},
|
|
@@ -486,7 +486,7 @@ var SmartAccessAdapter = /** @class */ (function () {
|
|
|
486
486
|
}
|
|
487
487
|
SmartAccessAdapter.indexAccommodation = function (_a) {
|
|
488
488
|
var accommodationId = _a.accommodationId;
|
|
489
|
-
return "AUTH|SMARTACCESS-API|"
|
|
489
|
+
return "AUTH|SMARTACCESS-API|".concat(accommodationId);
|
|
490
490
|
};
|
|
491
491
|
SmartAccessAdapter.refineRawTokenSet = function (rawTokenSet) {
|
|
492
492
|
var refreshToken = rawTokenSet.refresh_token, accessToken = rawTokenSet.access_token, expiresIn = rawTokenSet.expires_in, tokenType = rawTokenSet.token_type;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UserServiceGrpcCaller } from '@vendit-dev/utility-modules';
|
|
2
2
|
import MutexLock from '../utils/mutex';
|
|
3
|
-
|
|
3
|
+
type VenditThemrIoTAuthInfo = {
|
|
4
4
|
scope: string;
|
|
5
5
|
credential: {
|
|
6
6
|
hotel_id: string;
|
|
@@ -10,7 +10,7 @@ declare type VenditThemrIoTAuthInfo = {
|
|
|
10
10
|
expiresAt: number;
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
type DoorlockListResponse = {
|
|
14
14
|
code: number;
|
|
15
15
|
message: string;
|
|
16
16
|
count?: number;
|
|
@@ -25,62 +25,65 @@ declare type DoorlockListResponse = {
|
|
|
25
25
|
gatewayState: number;
|
|
26
26
|
}[];
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
28
|
+
type DoorlockDetailResponse = [
|
|
29
|
+
{
|
|
30
|
+
code: number;
|
|
31
|
+
message: string;
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
date: number;
|
|
35
|
+
lockAlias: string;
|
|
36
|
+
lockSound: number;
|
|
37
|
+
modelNum: string;
|
|
38
|
+
lockMac: string;
|
|
39
|
+
privacyLock: number;
|
|
40
|
+
deletePwd: string;
|
|
41
|
+
featureValue: string;
|
|
42
|
+
adminPwd: string;
|
|
43
|
+
soundVolume: number;
|
|
44
|
+
hasGateway: number;
|
|
45
|
+
autoLockTime: number;
|
|
46
|
+
wirelessKeypadFeatureValue: string;
|
|
47
|
+
floorNumber: number;
|
|
48
|
+
buildingNumber: number;
|
|
49
|
+
lockKey: string;
|
|
50
|
+
isFrozen: number;
|
|
51
|
+
lockName: string;
|
|
52
|
+
sector: string;
|
|
53
|
+
resetButton: number;
|
|
54
|
+
firmwareRevision: string;
|
|
55
|
+
tamperAlert: number;
|
|
56
|
+
specialValue: number;
|
|
57
|
+
displayPasscode: number;
|
|
58
|
+
noKeyPwd: string;
|
|
59
|
+
passageMode: number;
|
|
60
|
+
passageModeAutoUnlock: number;
|
|
61
|
+
timezoneRawOffset: number;
|
|
62
|
+
lockId: number;
|
|
63
|
+
electricQuantity: number;
|
|
64
|
+
lockFlagPos: number;
|
|
65
|
+
lockUpdateDate: number;
|
|
66
|
+
keyboardPwdVersion: number;
|
|
67
|
+
aesKeyStr: string;
|
|
68
|
+
hardwareRevision: string;
|
|
69
|
+
openDirection: number;
|
|
70
|
+
lockVersion: {
|
|
71
|
+
groupId: number;
|
|
72
|
+
protocolVersion: number;
|
|
73
|
+
protocolType: number;
|
|
74
|
+
orgId: number;
|
|
75
|
+
scene: number;
|
|
76
|
+
};
|
|
77
|
+
sensitivity: number;
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
type GetOTPPassCodeResponse = {
|
|
78
81
|
code: number;
|
|
79
82
|
message: string;
|
|
80
83
|
passcode: string;
|
|
81
84
|
passcodeId: number;
|
|
82
85
|
};
|
|
83
|
-
|
|
86
|
+
type writeAsyncRFCardRes = {
|
|
84
87
|
code: string;
|
|
85
88
|
issue_cd: string;
|
|
86
89
|
message: string;
|
package/lib/adapters/themrIoT.js
CHANGED
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -55,8 +55,8 @@ var node_fetch_1 = __importDefault(require("node-fetch"));
|
|
|
55
55
|
var mutex_1 = __importDefault(require("../utils/mutex"));
|
|
56
56
|
var ThemrIoTAdapter = /** @class */ (function () {
|
|
57
57
|
function ThemrIoTAdapter(_a) {
|
|
58
|
-
var _this = this;
|
|
59
58
|
var authenticator = _a.authenticator, redis = _a.redis, apiHost = _a.apiHost;
|
|
59
|
+
var _this = this;
|
|
60
60
|
this.API_HOST = 'http://api.hotel-lock.co.kr';
|
|
61
61
|
this.timeFormat = 'YYYY-MM-DD HH:mm:ss';
|
|
62
62
|
this.PROVIDER_KEY = 'TheMR';
|
|
@@ -72,7 +72,7 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
72
72
|
headers: { 'Content-Type': 'application/json' },
|
|
73
73
|
body: JSON.stringify(__assign({}, params)),
|
|
74
74
|
};
|
|
75
|
-
return [4 /*yield*/, node_fetch_1.default(""
|
|
75
|
+
return [4 /*yield*/, (0, node_fetch_1.default)("".concat(this.API_HOST).concat(route), requestOptions)];
|
|
76
76
|
case 1:
|
|
77
77
|
res = _c.sent();
|
|
78
78
|
return [4 /*yield*/, res.json()];
|
|
@@ -116,7 +116,7 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
116
116
|
}
|
|
117
117
|
return [2 /*return*/, this.parseJSONSafe(existingAuth)];
|
|
118
118
|
}
|
|
119
|
-
lockId = "THEMR-HKEY|"
|
|
119
|
+
lockId = "THEMR-HKEY|".concat(accommodationId);
|
|
120
120
|
return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
|
|
121
121
|
case 2:
|
|
122
122
|
lockHash = _b.sent();
|
|
@@ -159,8 +159,8 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
159
159
|
});
|
|
160
160
|
});
|
|
161
161
|
};
|
|
162
|
-
this.getDefaultCheckInDate = function () { return moment_1.default().add(9, 'hours').format(_this.timeFormat); };
|
|
163
|
-
this.getDefaultCheckOutDate = function () { return moment_1.default().add(9, 'hours').add(3, 'd').format(_this.timeFormat); };
|
|
162
|
+
this.getDefaultCheckInDate = function () { return (0, moment_1.default)().add(9, 'hours').format(_this.timeFormat); };
|
|
163
|
+
this.getDefaultCheckOutDate = function () { return (0, moment_1.default)().add(9, 'hours').add(3, 'd').format(_this.timeFormat); };
|
|
164
164
|
this.getAccommodationAccessToken = function (accommodationId) { return __awaiter(_this, void 0, void 0, function () {
|
|
165
165
|
var authInfo;
|
|
166
166
|
return __generator(this, function (_a) {
|
|
@@ -294,7 +294,7 @@ var ThemrIoTAdapter = /** @class */ (function () {
|
|
|
294
294
|
}
|
|
295
295
|
ThemrIoTAdapter.indexAccommodation = function (_a) {
|
|
296
296
|
var accommodationId = _a.accommodationId;
|
|
297
|
-
return "AUTH|THEMR-IOT-API|"
|
|
297
|
+
return "AUTH|THEMR-IOT-API|".concat(accommodationId);
|
|
298
298
|
};
|
|
299
299
|
return ThemrIoTAdapter;
|
|
300
300
|
}());
|
package/lib/index.d.ts
CHANGED
|
@@ -2,4 +2,6 @@ import AmanoKoreaAdapter from './adapters/amanoKorea';
|
|
|
2
2
|
import SanhaWingsAdapter from './adapters/sanhaWings';
|
|
3
3
|
import SmartAccessAdapter from './adapters/smartAccess';
|
|
4
4
|
import ThemrIoTAdapter from './adapters/themrIoT';
|
|
5
|
-
|
|
5
|
+
import { NiceParkThirdParty } from './adapters/parking/nicePark';
|
|
6
|
+
export { default as ParkingThirdPartyCaller } from './adapters/parking/parkingThridPartyCaller';
|
|
7
|
+
export { AmanoKoreaAdapter, SanhaWingsAdapter, NiceParkThirdParty, SmartAccessAdapter, ThemrIoTAdapter as TheMRIoTAdapter, };
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TheMRIoTAdapter = exports.SmartAccessAdapter = exports.SanhaWingsAdapter = exports.AmanoKoreaAdapter = void 0;
|
|
6
|
+
exports.TheMRIoTAdapter = exports.SmartAccessAdapter = exports.NiceParkThirdParty = exports.SanhaWingsAdapter = exports.AmanoKoreaAdapter = exports.ParkingThirdPartyCaller = void 0;
|
|
7
7
|
var amanoKorea_1 = __importDefault(require("./adapters/amanoKorea"));
|
|
8
8
|
exports.AmanoKoreaAdapter = amanoKorea_1.default;
|
|
9
9
|
var sanhaWings_1 = __importDefault(require("./adapters/sanhaWings"));
|
|
@@ -12,3 +12,7 @@ var smartAccess_1 = __importDefault(require("./adapters/smartAccess"));
|
|
|
12
12
|
exports.SmartAccessAdapter = smartAccess_1.default;
|
|
13
13
|
var themrIoT_1 = __importDefault(require("./adapters/themrIoT"));
|
|
14
14
|
exports.TheMRIoTAdapter = themrIoT_1.default;
|
|
15
|
+
var nicePark_1 = require("./adapters/parking/nicePark");
|
|
16
|
+
Object.defineProperty(exports, "NiceParkThirdParty", { enumerable: true, get: function () { return nicePark_1.NiceParkThirdParty; } });
|
|
17
|
+
var parkingThridPartyCaller_1 = require("./adapters/parking/parkingThridPartyCaller");
|
|
18
|
+
Object.defineProperty(exports, "ParkingThirdPartyCaller", { enumerable: true, get: function () { return __importDefault(parkingThridPartyCaller_1).default; } });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type PreDiscountListInfoInput = {
|
|
2
2
|
lotAreaNo: number;
|
|
3
3
|
registUserId?: string;
|
|
4
4
|
discCodeNo: number;
|
|
@@ -8,7 +8,7 @@ declare type PreDiscountListInfoInput = {
|
|
|
8
8
|
dongcode?: string;
|
|
9
9
|
hocode?: string;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type InsertPreDiscountInfoInput = {
|
|
12
12
|
lotAreaNo: number;
|
|
13
13
|
registUserId: string;
|
|
14
14
|
registUserName?: string;
|
|
@@ -23,7 +23,7 @@ declare type InsertPreDiscountInfoInput = {
|
|
|
23
23
|
memo?: string;
|
|
24
24
|
mobile?: string;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
type UpdatePreDiscountInfoInput = {
|
|
27
27
|
lotAreaNo: number;
|
|
28
28
|
registUserId: string;
|
|
29
29
|
registUserName?: string;
|
|
@@ -38,12 +38,12 @@ declare type UpdatePreDiscountInfoInput = {
|
|
|
38
38
|
memo?: string;
|
|
39
39
|
mobile?: string;
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
type DeletePreDiscountInfoInput = {
|
|
42
42
|
lotAreaNo: number;
|
|
43
43
|
registUserId?: string;
|
|
44
44
|
preDiscountId: number;
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
type FeeCarSearchInput = {
|
|
47
47
|
lotAreaNo: number;
|
|
48
48
|
eqpmNo: number;
|
|
49
49
|
carNo4Dight: string;
|
|
@@ -89,11 +89,11 @@ interface DeletePreDiscountInfoResponse {
|
|
|
89
89
|
eventName: 'Delete pre-discount information';
|
|
90
90
|
eventType: 'DeletePreDiscountInfo';
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
type AmanoPaymentType = 'PAY_FLAG_NONE' | 'PAY_FLAG_COMPLETE' | 'PAY_FLAG_RECALCULATE' | 'PAY_FLAG_DEBITCARD_RECHARGE' | 'PAY_FLAG_DEBITCARD_SALE' | 'PAY_FLAG_USED_PASSCARD' | 'PAY_FLAG_USED_DEBITCARD' | 'PAY_FLAG_USED_EVENTCARD' | 'PAY_FLAG_CANSEL' | 'PAY_FLAG_LOSTTICKET' | 'PAY_FLAG_MINAB';
|
|
93
93
|
/**
|
|
94
94
|
* 0 : 입차 1 : 출차
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
type AmanoInOutStatus = 0 | 1;
|
|
97
97
|
interface GetFeeCarSearchResponse {
|
|
98
98
|
eventName: 'Get Fee Car search';
|
|
99
99
|
eventType: 'GetFeeCarSearch';
|
package/lib/utils/mutex.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -42,9 +42,9 @@ var sleep = function (sleepTime) {
|
|
|
42
42
|
};
|
|
43
43
|
var MutexLock = /** @class */ (function () {
|
|
44
44
|
function MutexLock(_a) {
|
|
45
|
-
var _this = this;
|
|
46
45
|
var redis = _a.redis, hashPrefix = _a.hashPrefix, _b = _a.mutexLockInterval, mutexLockInterval = _b === void 0 ? 50 : _b;
|
|
47
|
-
|
|
46
|
+
var _this = this;
|
|
47
|
+
this.getMutexLockKey = function (id) { return "".concat(_this.hashPrefix).concat(id); };
|
|
48
48
|
this.tryMutexLock = function (streamId, lockHash) {
|
|
49
49
|
return _this.redis.set(_this.getMutexLockKey(streamId), lockHash, 'EX', 60, 'NX');
|
|
50
50
|
};
|
|
@@ -53,7 +53,7 @@ var MutexLock = /** @class */ (function () {
|
|
|
53
53
|
return __generator(this, function (_a) {
|
|
54
54
|
switch (_a.label) {
|
|
55
55
|
case 0:
|
|
56
|
-
lockHash = uuid_1.v4();
|
|
56
|
+
lockHash = (0, uuid_1.v4)();
|
|
57
57
|
_a.label = 1;
|
|
58
58
|
case 1:
|
|
59
59
|
if (!!lock) return [3 /*break*/, 4];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendit-dev/thirdparty-adapters",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Third party adapters between v-cloud and other PMS/CMS providers.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,8 +21,11 @@
|
|
|
21
21
|
"@babel/preset-env": "^7.10.4",
|
|
22
22
|
"@babel/preset-flow": "^7.10.4",
|
|
23
23
|
"@types/ioredis": "^5.0.0",
|
|
24
|
-
"@types/node": "^
|
|
24
|
+
"@types/node": "^20.4.5",
|
|
25
25
|
"@types/node-fetch": "^2.6.1",
|
|
26
|
+
"@types/sequelize": "^4.28.15",
|
|
27
|
+
"@types/tedious": "^4.0.9",
|
|
28
|
+
"@types/validator": "^13.7.17",
|
|
26
29
|
"@typescript-eslint/eslint-plugin": "^3.6.1",
|
|
27
30
|
"@typescript-eslint/parser": "^3.6.1",
|
|
28
31
|
"@vendit-dev/utility-modules": "^0.17.0",
|
|
@@ -32,12 +35,13 @@
|
|
|
32
35
|
"eslint": "^7.4.0",
|
|
33
36
|
"eslint-config-airbnb-base": "^13.1.0",
|
|
34
37
|
"eslint-plugin-import": "^2.16.0",
|
|
35
|
-
"
|
|
36
|
-
"typescript": "^3.9.6"
|
|
38
|
+
"typescript": "^5.1.6"
|
|
37
39
|
},
|
|
38
40
|
"dependencies": {
|
|
39
41
|
"moment": "^2.29.2",
|
|
40
42
|
"node-fetch": "2",
|
|
43
|
+
"sequelize": "^6.32.1",
|
|
44
|
+
"tedious": "^16.4.0",
|
|
41
45
|
"uuid": "^8.3.2"
|
|
42
46
|
}
|
|
43
47
|
}
|