@vendit-dev/thirdparty-adapters 0.4.0 → 0.4.1-beta.2

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.
@@ -1,292 +1,292 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
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
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- var node_fetch_1 = __importDefault(require("node-fetch"));
54
- var mutex_1 = __importDefault(require("../utils/mutex"));
55
- var AmanoKoreaAdapter = /** @class */ (function () {
56
- function AmanoKoreaAdapter(_a) {
57
- var _this = this;
58
- var authenticator = _a.authenticator, redis = _a.redis;
59
- this.API_PORT = 9948;
60
- this.PROVIDER_KEY = 'AmanoKorea';
61
- // base64
62
- this.authorization = '';
63
- this.dateFormat = 'YYYYMMDDHHmmss';
64
- this.lotAreaNo = 20;
65
- this.discCodeNo = 99;
66
- this.parseJSONSafe = function (str) {
67
- try {
68
- return JSON.parse(str);
69
- }
70
- catch (e) {
71
- console.log('parseJSONSafe', e);
72
- return false;
73
- }
74
- };
75
- this.checkAmanoKoreaIntegration = function (_a) {
76
- var accommodationId = _a.accommodationId;
77
- return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
78
- switch (_b.label) {
79
- case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
80
- case 1: return [2 /*return*/, !!(_b.sent())];
81
- }
82
- }); });
83
- };
84
- this.getAccommodationAuthInfo = function (_a) {
85
- var accommodationId = _a.accommodationId;
86
- return __awaiter(_this, void 0, void 0, function () {
87
- var existingAuth, parsedCredential, _b, authorization, apiHost, lotAreaNo, discCodeNo, lockId, lockHash, newAuth, parsedCredential, err_1;
88
- return __generator(this, function (_c) {
89
- switch (_c.label) {
90
- case 0: return [4 /*yield*/, this.redis.get(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }))];
91
- case 1:
92
- existingAuth = _c.sent();
93
- if (existingAuth) {
94
- parsedCredential = this.parseJSONSafe(existingAuth);
95
- if (parsedCredential === null || parsedCredential === void 0 ? void 0 : parsedCredential.credential) {
96
- _b = this.parseJSONSafe(parsedCredential.credential), authorization = _b.authorization, apiHost = _b.apiHost, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
97
- this.setAuthorization({
98
- authorization: authorization,
99
- });
100
- this.lotAreaNo = lotAreaNo;
101
- this.discCodeNo = discCodeNo;
102
- this.API_HOST = apiHost;
103
- }
104
- return [2 /*return*/, this.parseJSONSafe(existingAuth)];
105
- }
106
- lockId = "AMANO-HKEY|" + accommodationId;
107
- return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
108
- case 2:
109
- lockHash = _c.sent();
110
- _c.label = 3;
111
- case 3:
112
- _c.trys.push([3, 8, 9, 11]);
113
- return [4 /*yield*/, this.authenticator.getThirdPartyCredential({
114
- accommodationId: accommodationId,
115
- provider: this.PROVIDER_KEY,
116
- })];
117
- case 4:
118
- newAuth = _c.sent();
119
- if (!(!newAuth || !(newAuth === null || newAuth === void 0 ? void 0 : newAuth.credential))) return [3 /*break*/, 6];
120
- return [4 /*yield*/, this.redis.set(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
121
- case 5:
122
- _c.sent();
123
- return [2 /*return*/, false];
124
- case 6:
125
- parsedCredential = this.parseJSONSafe(newAuth.credential);
126
- if (parsedCredential === null || parsedCredential === void 0 ? void 0 : parsedCredential.authorization) {
127
- this.setAuthorization({
128
- authorization: parsedCredential.authorization,
129
- });
130
- this.lotAreaNo = parsedCredential.lotAreaNo;
131
- this.discCodeNo = parsedCredential.discCodeNo;
132
- this.API_HOST = parsedCredential.apiHost;
133
- }
134
- else {
135
- throw new Error('Authorization is not found');
136
- }
137
- return [4 /*yield*/, this.redis.set(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }), JSON.stringify(newAuth), 'EX', 60 * 5)];
138
- case 7:
139
- _c.sent();
140
- return [2 /*return*/, parsedCredential];
141
- case 8:
142
- err_1 = _c.sent();
143
- console.log(err_1);
144
- throw err_1;
145
- case 9: return [4 /*yield*/, this.mutexLock.unlockMutexLock(lockId, lockHash)];
146
- case 10:
147
- _c.sent();
148
- return [7 /*endfinally*/];
149
- case 11: return [2 /*return*/];
150
- }
151
- });
152
- });
153
- };
154
- this.setAuthorization = function (_a) {
155
- var authorization = _a.authorization;
156
- _this.authorization = authorization;
157
- };
158
- this.callAPI = function (_a) {
159
- var directory = _a.directory, resources = _a.resources;
160
- return __awaiter(_this, void 0, void 0, function () {
161
- var fetchResult, fetchResultJson, err_2;
162
- return __generator(this, function (_b) {
163
- switch (_b.label) {
164
- case 0:
165
- console.log('callAPI', this.authorization);
166
- _b.label = 1;
167
- case 1:
168
- _b.trys.push([1, 4, , 5]);
169
- return [4 /*yield*/, node_fetch_1.default(this.API_HOST + ":" + this.API_PORT + "/interop/" + directory, {
170
- method: 'POST',
171
- headers: {
172
- 'Content-Type': 'application/json',
173
- Authorization: this.authorization,
174
- },
175
- body: JSON.stringify(__assign({}, resources)),
176
- })];
177
- case 2:
178
- fetchResult = _b.sent();
179
- console.log('fetchResult', fetchResult);
180
- return [4 /*yield*/, (fetchResult === null || fetchResult === void 0 ? void 0 : fetchResult.json())];
181
- case 3:
182
- fetchResultJson = _b.sent();
183
- return [2 /*return*/, fetchResultJson];
184
- case 4:
185
- err_2 = _b.sent();
186
- console.error('err', err_2);
187
- return [2 /*return*/, err_2];
188
- case 5: return [2 /*return*/];
189
- }
190
- });
191
- });
192
- };
193
- // syncTimeToMCS = async (): Promise<string> => {
194
- // const fetchRes = await fetch(
195
- // `${'http://deploy.amanopark.co.kr:9848/getTime'}`,
196
- // {
197
- // method: 'POST',
198
- // headers: {
199
- // 'Content-Type': 'application/json',
200
- // Authorization: this.authorization,
201
- // },
202
- // body: JSON.stringify({}),
203
- // },
204
- // );
205
- // const fetchResJson = await fetchRes.json();
206
- // return fetchResJson;
207
- // };
208
- // 방문차량 등록 내역 조회
209
- this.getPreDiscountListInfo = function (resources) { return __awaiter(_this, void 0, void 0, function () {
210
- var _a, lotAreaNo, discCodeNo;
211
- return __generator(this, function (_b) {
212
- _a = this, lotAreaNo = _a.lotAreaNo, discCodeNo = _a.discCodeNo;
213
- return [2 /*return*/, this.callAPI({
214
- directory: 'getPreDiscountListInfo.do',
215
- resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
216
- discCodeNo: discCodeNo }),
217
- })];
218
- });
219
- }); };
220
- // 방문차량 등록
221
- this.insertPreDiscountInfo = function (_a) {
222
- var resources = _a.resources;
223
- return __awaiter(_this, void 0, void 0, function () {
224
- var _b, lotAreaNo, discCodeNo;
225
- return __generator(this, function (_c) {
226
- _b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
227
- return [2 /*return*/, this.callAPI({
228
- directory: 'insertPreDiscountInfo.do',
229
- resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
230
- discCodeNo: discCodeNo }),
231
- })];
232
- });
233
- });
234
- };
235
- // 방문차량 수정
236
- this.updatePreDiscountInfo = function (_a) {
237
- var resources = _a.resources;
238
- return __awaiter(_this, void 0, void 0, function () {
239
- var _b, lotAreaNo, discCodeNo;
240
- return __generator(this, function (_c) {
241
- _b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
242
- return [2 /*return*/, this.callAPI({
243
- directory: 'updatePreDiscountInfo.do',
244
- resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
245
- discCodeNo: discCodeNo }),
246
- })];
247
- });
248
- });
249
- };
250
- // 방문차량 삭제
251
- this.deletePreDiscountInfo = function (_a) {
252
- var resources = _a.resources;
253
- return __awaiter(_this, void 0, void 0, function () {
254
- var lotAreaNo;
255
- return __generator(this, function (_b) {
256
- lotAreaNo = this.lotAreaNo;
257
- return [2 /*return*/, this.callAPI({
258
- directory: 'deletePreDiscountInfo.do',
259
- resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo }),
260
- })];
261
- });
262
- });
263
- };
264
- // 차량 조회 (요금 조회 대상)
265
- this.getFeeCarSearch = function (_a) {
266
- var resources = _a.resources;
267
- return __awaiter(_this, void 0, void 0, function () {
268
- var lotAreaNo;
269
- return __generator(this, function (_b) {
270
- lotAreaNo = this.lotAreaNo;
271
- return [2 /*return*/, this.callAPI({
272
- directory: 'getFeeCarSearch.do',
273
- resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo }),
274
- })];
275
- });
276
- });
277
- };
278
- this.authenticator = authenticator;
279
- this.redis = redis;
280
- this.mutexLock = new mutex_1.default({
281
- hashPrefix: 'RES_AMANO_MUTEX_',
282
- mutexLockInterval: 50,
283
- redis: redis,
284
- });
285
- }
286
- AmanoKoreaAdapter.indexAccommodation = function (_a) {
287
- var accommodationId = _a.accommodationId;
288
- return "AUTH|AMANO-KOREA-API|" + accommodationId;
289
- };
290
- return AmanoKoreaAdapter;
291
- }());
292
- exports.default = AmanoKoreaAdapter;
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ var node_fetch_1 = __importDefault(require("node-fetch"));
54
+ var mutex_1 = __importDefault(require("../utils/mutex"));
55
+ var AmanoKoreaAdapter = /** @class */ (function () {
56
+ function AmanoKoreaAdapter(_a) {
57
+ var _this = this;
58
+ var authenticator = _a.authenticator, redis = _a.redis;
59
+ this.API_PORT = 9948;
60
+ this.PROVIDER_KEY = 'AmanoKorea';
61
+ // base64
62
+ this.authorization = '';
63
+ this.dateFormat = 'YYYYMMDDHHmmss';
64
+ this.lotAreaNo = 20;
65
+ this.discCodeNo = 99;
66
+ this.parseJSONSafe = function (str) {
67
+ try {
68
+ return JSON.parse(str);
69
+ }
70
+ catch (e) {
71
+ console.log('parseJSONSafe', e);
72
+ return false;
73
+ }
74
+ };
75
+ this.checkAmanoKoreaIntegration = function (_a) {
76
+ var accommodationId = _a.accommodationId;
77
+ return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
78
+ switch (_b.label) {
79
+ case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
80
+ case 1: return [2 /*return*/, !!(_b.sent())];
81
+ }
82
+ }); });
83
+ };
84
+ this.getAccommodationAuthInfo = function (_a) {
85
+ var accommodationId = _a.accommodationId;
86
+ return __awaiter(_this, void 0, void 0, function () {
87
+ var existingAuth, parsedCredential, _b, authorization, apiHost, lotAreaNo, discCodeNo, lockId, lockHash, newAuth, parsedCredential, err_1;
88
+ return __generator(this, function (_c) {
89
+ switch (_c.label) {
90
+ case 0: return [4 /*yield*/, this.redis.get(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }))];
91
+ case 1:
92
+ existingAuth = _c.sent();
93
+ if (existingAuth) {
94
+ parsedCredential = this.parseJSONSafe(existingAuth);
95
+ if (parsedCredential === null || parsedCredential === void 0 ? void 0 : parsedCredential.credential) {
96
+ _b = this.parseJSONSafe(parsedCredential.credential), authorization = _b.authorization, apiHost = _b.apiHost, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
97
+ this.setAuthorization({
98
+ authorization: authorization,
99
+ });
100
+ this.lotAreaNo = lotAreaNo;
101
+ this.discCodeNo = discCodeNo;
102
+ this.API_HOST = apiHost;
103
+ }
104
+ return [2 /*return*/, this.parseJSONSafe(existingAuth)];
105
+ }
106
+ lockId = "AMANO-HKEY|" + accommodationId;
107
+ return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
108
+ case 2:
109
+ lockHash = _c.sent();
110
+ _c.label = 3;
111
+ case 3:
112
+ _c.trys.push([3, 8, 9, 11]);
113
+ return [4 /*yield*/, this.authenticator.getThirdPartyCredential({
114
+ accommodationId: accommodationId,
115
+ provider: this.PROVIDER_KEY,
116
+ })];
117
+ case 4:
118
+ newAuth = _c.sent();
119
+ if (!(!newAuth || !(newAuth === null || newAuth === void 0 ? void 0 : newAuth.credential))) return [3 /*break*/, 6];
120
+ return [4 /*yield*/, this.redis.set(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
121
+ case 5:
122
+ _c.sent();
123
+ return [2 /*return*/, false];
124
+ case 6:
125
+ parsedCredential = this.parseJSONSafe(newAuth.credential);
126
+ if (parsedCredential === null || parsedCredential === void 0 ? void 0 : parsedCredential.authorization) {
127
+ this.setAuthorization({
128
+ authorization: parsedCredential.authorization,
129
+ });
130
+ this.lotAreaNo = parsedCredential.lotAreaNo;
131
+ this.discCodeNo = parsedCredential.discCodeNo;
132
+ this.API_HOST = parsedCredential.apiHost;
133
+ }
134
+ else {
135
+ throw new Error('Authorization is not found');
136
+ }
137
+ return [4 /*yield*/, this.redis.set(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }), JSON.stringify(newAuth), 'EX', 60 * 5)];
138
+ case 7:
139
+ _c.sent();
140
+ return [2 /*return*/, parsedCredential];
141
+ case 8:
142
+ err_1 = _c.sent();
143
+ console.log(err_1);
144
+ throw err_1;
145
+ case 9: return [4 /*yield*/, this.mutexLock.unlockMutexLock(lockId, lockHash)];
146
+ case 10:
147
+ _c.sent();
148
+ return [7 /*endfinally*/];
149
+ case 11: return [2 /*return*/];
150
+ }
151
+ });
152
+ });
153
+ };
154
+ this.setAuthorization = function (_a) {
155
+ var authorization = _a.authorization;
156
+ _this.authorization = authorization;
157
+ };
158
+ this.callAPI = function (_a) {
159
+ var directory = _a.directory, resources = _a.resources;
160
+ return __awaiter(_this, void 0, void 0, function () {
161
+ var fetchResult, fetchResultJson, err_2;
162
+ return __generator(this, function (_b) {
163
+ switch (_b.label) {
164
+ case 0:
165
+ console.log('callAPI', this.authorization);
166
+ _b.label = 1;
167
+ case 1:
168
+ _b.trys.push([1, 4, , 5]);
169
+ return [4 /*yield*/, node_fetch_1.default(this.API_HOST + ":" + this.API_PORT + "/interop/" + directory, {
170
+ method: 'POST',
171
+ headers: {
172
+ 'Content-Type': 'application/json',
173
+ Authorization: this.authorization,
174
+ },
175
+ body: JSON.stringify(__assign({}, resources)),
176
+ })];
177
+ case 2:
178
+ fetchResult = _b.sent();
179
+ console.log('fetchResult', fetchResult);
180
+ return [4 /*yield*/, (fetchResult === null || fetchResult === void 0 ? void 0 : fetchResult.json())];
181
+ case 3:
182
+ fetchResultJson = _b.sent();
183
+ return [2 /*return*/, fetchResultJson];
184
+ case 4:
185
+ err_2 = _b.sent();
186
+ console.error('err', err_2);
187
+ return [2 /*return*/, err_2];
188
+ case 5: return [2 /*return*/];
189
+ }
190
+ });
191
+ });
192
+ };
193
+ // syncTimeToMCS = async (): Promise<string> => {
194
+ // const fetchRes = await fetch(
195
+ // `${'http://deploy.amanopark.co.kr:9848/getTime'}`,
196
+ // {
197
+ // method: 'POST',
198
+ // headers: {
199
+ // 'Content-Type': 'application/json',
200
+ // Authorization: this.authorization,
201
+ // },
202
+ // body: JSON.stringify({}),
203
+ // },
204
+ // );
205
+ // const fetchResJson = await fetchRes.json();
206
+ // return fetchResJson;
207
+ // };
208
+ // 방문차량 등록 내역 조회
209
+ this.getPreDiscountListInfo = function (resources) { return __awaiter(_this, void 0, void 0, function () {
210
+ var _a, lotAreaNo, discCodeNo;
211
+ return __generator(this, function (_b) {
212
+ _a = this, lotAreaNo = _a.lotAreaNo, discCodeNo = _a.discCodeNo;
213
+ return [2 /*return*/, this.callAPI({
214
+ directory: 'getPreDiscountListInfo.do',
215
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
216
+ discCodeNo: discCodeNo }),
217
+ })];
218
+ });
219
+ }); };
220
+ // 방문차량 등록
221
+ this.insertPreDiscountInfo = function (_a) {
222
+ var resources = _a.resources;
223
+ return __awaiter(_this, void 0, void 0, function () {
224
+ var _b, lotAreaNo, discCodeNo;
225
+ return __generator(this, function (_c) {
226
+ _b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
227
+ return [2 /*return*/, this.callAPI({
228
+ directory: 'insertPreDiscountInfo.do',
229
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
230
+ discCodeNo: discCodeNo }),
231
+ })];
232
+ });
233
+ });
234
+ };
235
+ // 방문차량 수정
236
+ this.updatePreDiscountInfo = function (_a) {
237
+ var resources = _a.resources;
238
+ return __awaiter(_this, void 0, void 0, function () {
239
+ var _b, lotAreaNo, discCodeNo;
240
+ return __generator(this, function (_c) {
241
+ _b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
242
+ return [2 /*return*/, this.callAPI({
243
+ directory: 'updatePreDiscountInfo.do',
244
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
245
+ discCodeNo: discCodeNo }),
246
+ })];
247
+ });
248
+ });
249
+ };
250
+ // 방문차량 삭제
251
+ this.deletePreDiscountInfo = function (_a) {
252
+ var resources = _a.resources;
253
+ return __awaiter(_this, void 0, void 0, function () {
254
+ var lotAreaNo;
255
+ return __generator(this, function (_b) {
256
+ lotAreaNo = this.lotAreaNo;
257
+ return [2 /*return*/, this.callAPI({
258
+ directory: 'deletePreDiscountInfo.do',
259
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo }),
260
+ })];
261
+ });
262
+ });
263
+ };
264
+ // 차량 조회 (요금 조회 대상)
265
+ this.getFeeCarSearch = function (_a) {
266
+ var resources = _a.resources;
267
+ return __awaiter(_this, void 0, void 0, function () {
268
+ var lotAreaNo;
269
+ return __generator(this, function (_b) {
270
+ lotAreaNo = this.lotAreaNo;
271
+ return [2 /*return*/, this.callAPI({
272
+ directory: 'getFeeCarSearch.do',
273
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo }),
274
+ })];
275
+ });
276
+ });
277
+ };
278
+ this.authenticator = authenticator;
279
+ this.redis = redis;
280
+ this.mutexLock = new mutex_1.default({
281
+ hashPrefix: 'RES_AMANO_MUTEX_',
282
+ mutexLockInterval: 50,
283
+ redis: redis,
284
+ });
285
+ }
286
+ AmanoKoreaAdapter.indexAccommodation = function (_a) {
287
+ var accommodationId = _a.accommodationId;
288
+ return "AUTH|AMANO-KOREA-API|" + accommodationId;
289
+ };
290
+ return AmanoKoreaAdapter;
291
+ }());
292
+ exports.default = AmanoKoreaAdapter;