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

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,287 @@
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, apiHost = _a.apiHost;
59
- this.API_HOST = 'http://deploy.amanopark.co.kr:9099';
60
- this.TEST_SERVER_URL = 'http://106.10.44.103:9948';
61
- this.PROVIDER_KEY = 'AmanoKorea';
62
- // base64
63
- this.authorization = '';
64
- this.dateFormat = 'YYYYMMDDHHmmss';
65
- this.defaultPreDiscountInfo = {
66
- lotAreaNo: 20,
67
- registUserId: '0101*0201',
68
- registUserName: '홍길동',
69
- preDiscountId: 1,
70
- discCodeNo: 99,
71
- carNo: '23가8823',
72
- dcCount: 0,
73
- startDtm: '20200917000000',
74
- endDtm: '20200917235959',
75
- dongcode: '101',
76
- hocode: '201',
77
- memo: '방문차량수정요청',
78
- mobile: '',
79
- };
80
- this.parseJSONSafe = function (str) {
81
- try {
82
- return JSON.parse(str);
83
- }
84
- catch (e) {
85
- console.log('parseJSONSafe', e);
86
- return false;
87
- }
88
- };
89
- this.checkAmanoKoreaIntegration = function (_a) {
90
- var accommodationId = _a.accommodationId;
91
- return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
92
- switch (_b.label) {
93
- case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
94
- case 1: return [2 /*return*/, !!(_b.sent())];
95
- }
96
- }); });
97
- };
98
- this.getAccommodationAuthInfo = function (_a) {
99
- var accommodationId = _a.accommodationId;
100
- return __awaiter(_this, void 0, void 0, function () {
101
- var existingAuth, lockId, lockHash, newAuth, parsedCredential, err_1;
102
- return __generator(this, function (_b) {
103
- switch (_b.label) {
104
- case 0: return [4 /*yield*/, this.redis.get(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }))];
105
- case 1:
106
- existingAuth = _b.sent();
107
- if (existingAuth) {
108
- if (existingAuth === 'NOT_FOUND') {
109
- return [2 /*return*/, false];
110
- }
111
- return [2 /*return*/, this.parseJSONSafe(existingAuth)];
112
- }
113
- lockId = "AMANO-HKEY|" + accommodationId;
114
- return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
115
- case 2:
116
- lockHash = _b.sent();
117
- return [4 /*yield*/, this.redis.get(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }))];
118
- case 3:
119
- existingAuth = _b.sent();
120
- _b.label = 4;
121
- case 4:
122
- _b.trys.push([4, 9, 10, 12]);
123
- if (existingAuth) {
124
- return [2 /*return*/, this.parseJSONSafe(existingAuth)];
125
- }
126
- return [4 /*yield*/, this.authenticator.getThirdPartyCredential({
127
- accommodationId: accommodationId,
128
- provider: this.PROVIDER_KEY,
129
- })];
130
- case 5:
131
- newAuth = _b.sent();
132
- if (!(!newAuth || !(newAuth === null || newAuth === void 0 ? void 0 : newAuth.credential))) return [3 /*break*/, 7];
133
- return [4 /*yield*/, this.redis.set(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
134
- case 6:
135
- _b.sent();
136
- return [2 /*return*/, false];
137
- case 7:
138
- parsedCredential = this.parseJSONSafe(newAuth.credential);
139
- if (parsedCredential === null || parsedCredential === void 0 ? void 0 : parsedCredential.authorization) {
140
- this.setAuthorization(parsedCredential.authorization);
141
- }
142
- else {
143
- throw new Error('Authorization is not found');
144
- }
145
- return [4 /*yield*/, this.redis.set(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }), newAuth.credential, 'EX', 60 * 5)];
146
- case 8:
147
- _b.sent();
148
- return [2 /*return*/, parsedCredential];
149
- case 9:
150
- err_1 = _b.sent();
151
- console.log(err_1);
152
- throw err_1;
153
- case 10: return [4 /*yield*/, this.mutexLock.unlockMutexLock(lockId, lockHash)];
154
- case 11:
155
- _b.sent();
156
- return [7 /*endfinally*/];
157
- case 12: return [2 /*return*/];
158
- }
159
- });
160
- });
161
- };
162
- this.setAuthorization = function (_a) {
163
- var authorization = _a.authorization;
164
- _this.authorization = "Basic " + authorization;
165
- };
166
- this.callAPI = function (_a) {
167
- var directory = _a.directory, resources = _a.resources;
168
- return __awaiter(_this, void 0, void 0, function () {
169
- var fetchResult, fetchResultJson, data, err_2;
170
- return __generator(this, function (_b) {
171
- switch (_b.label) {
172
- case 0:
173
- _b.trys.push([0, 3, , 4]);
174
- return [4 /*yield*/, node_fetch_1.default(this.API_HOST + "/interop/" + directory, {
175
- method: 'POST',
176
- headers: {
177
- 'Content-Type': 'application/json',
178
- Authorization: this.authorization,
179
- },
180
- body: JSON.stringify(__assign({}, resources)),
181
- })];
182
- case 1:
183
- fetchResult = _b.sent();
184
- return [4 /*yield*/, fetchResult.json()];
185
- case 2:
186
- fetchResultJson = _b.sent();
187
- console.log('fetchResultJson', fetchResultJson);
188
- data = fetchResultJson.data;
189
- return [2 /*return*/, data];
190
- case 3:
191
- err_2 = _b.sent();
192
- console.error('err', err_2);
193
- return [2 /*return*/, err_2];
194
- case 4: return [2 /*return*/];
195
- }
196
- });
197
- });
198
- };
199
- this.syncTimeToMCS = function () { return __awaiter(_this, void 0, void 0, function () {
200
- var fetchRes, fetchResJson;
201
- return __generator(this, function (_a) {
202
- switch (_a.label) {
203
- case 0: return [4 /*yield*/, node_fetch_1.default("" + 'http://deploy.amanopark.co.kr:9848/getTime', {
204
- method: 'POST',
205
- headers: {
206
- 'Content-Type': 'application/json',
207
- Authorization: this.authorization,
208
- },
209
- body: JSON.stringify({}),
210
- })];
211
- case 1:
212
- fetchRes = _a.sent();
213
- return [4 /*yield*/, fetchRes.json()];
214
- case 2:
215
- fetchResJson = _a.sent();
216
- return [2 /*return*/, fetchResJson];
217
- }
218
- });
219
- }); };
220
- // 방문차량 등록 내역 조회
221
- this.getPreDiscountListInfo = function (resources) { return __awaiter(_this, void 0, void 0, function () {
222
- return __generator(this, function (_a) {
223
- return [2 /*return*/, this.callAPI({
224
- directory: 'getPreDiscountListInfo.do',
225
- resources: resources,
226
- })];
227
- });
228
- }); };
229
- // 방문차량 등록
230
- this.insertPreDiscountInfo = function (_a) {
231
- var _b = _a.resources, resources = _b === void 0 ? _this.defaultPreDiscountInfo : _b;
232
- return __awaiter(_this, void 0, void 0, function () {
233
- return __generator(this, function (_c) {
234
- return [2 /*return*/, this.callAPI({
235
- directory: 'insertPreDiscountInfo.do',
236
- resources: resources,
237
- })];
238
- });
239
- });
240
- };
241
- // 방문차량 수정
242
- this.updatePreDiscountInfo = function (_a) {
243
- var _b = _a.resources, resources = _b === void 0 ? _this.defaultPreDiscountInfo : _b;
244
- return __awaiter(_this, void 0, void 0, function () {
245
- return __generator(this, function (_c) {
246
- return [2 /*return*/, this.callAPI({
247
- directory: 'updatePreDiscountInfo.do',
248
- resources: resources,
249
- })];
250
- });
251
- });
252
- };
253
- // 방문차량 삭제
254
- this.deletePreDiscountInfo = function (_a) {
255
- var _b = _a.resources, resources = _b === void 0 ? { lotAreaNo: 20, registUserId: '0101*0201', preDiscountId: 1 } : _b;
256
- return __awaiter(_this, void 0, void 0, function () {
257
- return __generator(this, function (_c) {
258
- return [2 /*return*/, this.callAPI({
259
- directory: 'deletePreDiscountInfo.do',
260
- resources: resources,
261
- })];
262
- });
263
- });
264
- };
265
- // 차량 조회 (요금 조회 대상)
266
- this.getFeeCarSearch = function (_a) {
267
- var _b = _a.resources, resources = _b === void 0 ? { lotAreaNo: 20, eqpmNo: 1, carNo4Dight: '1234' } : _b;
268
- return __awaiter(_this, void 0, void 0, function () {
269
- return __generator(this, function (_c) {
270
- return [2 /*return*/, this.callAPI({
271
- directory: 'getFeeCarSearch.do',
272
- resources: resources,
273
- })];
274
- });
275
- });
276
- };
277
- this.authenticator = authenticator;
278
- this.API_HOST = apiHost;
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.PROVIDER_KEY = 'AmanoKorea';
60
+ // base64
61
+ this.authorization = '';
62
+ this.dateFormat = 'YYYYMMDDHHmmss';
63
+ this.lotAreaNo = 20;
64
+ this.discCodeNo = 99;
65
+ this.parseJSONSafe = function (str) {
66
+ try {
67
+ return JSON.parse(str);
68
+ }
69
+ catch (e) {
70
+ console.log('parseJSONSafe', e);
71
+ return false;
72
+ }
73
+ };
74
+ this.checkAmanoKoreaIntegration = function (_a) {
75
+ var accommodationId = _a.accommodationId;
76
+ return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_b) {
77
+ switch (_b.label) {
78
+ case 0: return [4 /*yield*/, this.getAccommodationAuthInfo({ accommodationId: accommodationId })];
79
+ case 1: return [2 /*return*/, !!(_b.sent())];
80
+ }
81
+ }); });
82
+ };
83
+ this.getAccommodationAuthInfo = function (_a) {
84
+ var accommodationId = _a.accommodationId;
85
+ return __awaiter(_this, void 0, void 0, function () {
86
+ var existingAuth, lockId, lockHash, parsedCredential_1, newAuth, parsedCredential, err_1;
87
+ return __generator(this, function (_b) {
88
+ switch (_b.label) {
89
+ case 0: return [4 /*yield*/, this.redis.get(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }))];
90
+ case 1:
91
+ existingAuth = _b.sent();
92
+ console.log('🚀 ~ file: amanoKorea.ts:113 ~ AmanoKoreaAdapter ~ existingAuth:', existingAuth);
93
+ if (existingAuth) {
94
+ if (existingAuth === 'NOT_FOUND') {
95
+ return [2 /*return*/, false];
96
+ }
97
+ return [2 /*return*/, this.parseJSONSafe(existingAuth)];
98
+ }
99
+ lockId = "AMANO-HKEY|" + accommodationId;
100
+ return [4 /*yield*/, this.mutexLock.getMutexLock(lockId)];
101
+ case 2:
102
+ lockHash = _b.sent();
103
+ return [4 /*yield*/, this.redis.get(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }))];
104
+ case 3:
105
+ existingAuth = _b.sent();
106
+ _b.label = 4;
107
+ case 4:
108
+ _b.trys.push([4, 9, 10, 12]);
109
+ if (existingAuth) {
110
+ parsedCredential_1 = this.parseJSONSafe(existingAuth);
111
+ if (parsedCredential_1 === null || parsedCredential_1 === void 0 ? void 0 : parsedCredential_1.authorization) {
112
+ this.setAuthorization(parsedCredential_1.authorization);
113
+ this.API_HOST = parsedCredential_1.apiHost;
114
+ }
115
+ return [2 /*return*/, this.parseJSONSafe(existingAuth)];
116
+ }
117
+ return [4 /*yield*/, this.authenticator.getThirdPartyCredential({
118
+ accommodationId: accommodationId,
119
+ provider: this.PROVIDER_KEY,
120
+ })];
121
+ case 5:
122
+ newAuth = _b.sent();
123
+ if (!(!newAuth || !(newAuth === null || newAuth === void 0 ? void 0 : newAuth.credential))) return [3 /*break*/, 7];
124
+ return [4 /*yield*/, this.redis.set(AmanoKoreaAdapter.indexAccommodation({ accommodationId: accommodationId }), 'NOT_FOUND', 'EX', 60 * 5)];
125
+ case 6:
126
+ _b.sent();
127
+ return [2 /*return*/, false];
128
+ case 7:
129
+ parsedCredential = this.parseJSONSafe(newAuth.credential);
130
+ if (parsedCredential === null || parsedCredential === void 0 ? void 0 : parsedCredential.authorization) {
131
+ this.setAuthorization(parsedCredential.authorization);
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 8:
139
+ _b.sent();
140
+ return [2 /*return*/, parsedCredential];
141
+ case 9:
142
+ err_1 = _b.sent();
143
+ console.log(err_1);
144
+ throw err_1;
145
+ case 10: return [4 /*yield*/, this.mutexLock.unlockMutexLock(lockId, lockHash)];
146
+ case 11:
147
+ _b.sent();
148
+ return [7 /*endfinally*/];
149
+ case 12: return [2 /*return*/];
150
+ }
151
+ });
152
+ });
153
+ };
154
+ this.setAuthorization = function (_a) {
155
+ var authorization = _a.authorization;
156
+ _this.authorization = "Basic " + 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, data, err_2;
162
+ return __generator(this, function (_b) {
163
+ switch (_b.label) {
164
+ case 0:
165
+ _b.trys.push([0, 3, , 4]);
166
+ return [4 /*yield*/, node_fetch_1.default(this.API_HOST + "/interop/" + directory, {
167
+ method: 'POST',
168
+ headers: {
169
+ 'Content-Type': 'application/json',
170
+ Authorization: this.authorization,
171
+ },
172
+ body: JSON.stringify(__assign({}, resources)),
173
+ })];
174
+ case 1:
175
+ fetchResult = _b.sent();
176
+ return [4 /*yield*/, fetchResult.json()];
177
+ case 2:
178
+ fetchResultJson = _b.sent();
179
+ console.log('fetchResultJson', fetchResultJson);
180
+ data = fetchResultJson.data;
181
+ return [2 /*return*/, data];
182
+ case 3:
183
+ err_2 = _b.sent();
184
+ console.error('err', err_2);
185
+ return [2 /*return*/, err_2];
186
+ case 4: return [2 /*return*/];
187
+ }
188
+ });
189
+ });
190
+ };
191
+ // syncTimeToMCS = async (): Promise<string> => {
192
+ // const fetchRes = await fetch(
193
+ // `${'http://deploy.amanopark.co.kr:9848/getTime'}`,
194
+ // {
195
+ // method: 'POST',
196
+ // headers: {
197
+ // 'Content-Type': 'application/json',
198
+ // Authorization: this.authorization,
199
+ // },
200
+ // body: JSON.stringify({}),
201
+ // },
202
+ // );
203
+ // const fetchResJson = await fetchRes.json();
204
+ // return fetchResJson;
205
+ // };
206
+ // 방문차량 등록 내역 조회
207
+ this.getPreDiscountListInfo = function (resources) { return __awaiter(_this, void 0, void 0, function () {
208
+ return __generator(this, function (_a) {
209
+ return [2 /*return*/, this.callAPI({
210
+ directory: 'getPreDiscountListInfo.do',
211
+ resources: resources,
212
+ })];
213
+ });
214
+ }); };
215
+ // 방문차량 등록
216
+ this.insertPreDiscountInfo = function (_a) {
217
+ var resources = _a.resources;
218
+ return __awaiter(_this, void 0, void 0, function () {
219
+ var _b, lotAreaNo, discCodeNo;
220
+ return __generator(this, function (_c) {
221
+ _b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
222
+ return [2 /*return*/, this.callAPI({
223
+ directory: 'insertPreDiscountInfo.do',
224
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
225
+ discCodeNo: discCodeNo }),
226
+ })];
227
+ });
228
+ });
229
+ };
230
+ // 방문차량 수정
231
+ this.updatePreDiscountInfo = function (_a) {
232
+ var resources = _a.resources;
233
+ return __awaiter(_this, void 0, void 0, function () {
234
+ var _b, lotAreaNo, discCodeNo;
235
+ return __generator(this, function (_c) {
236
+ _b = this, lotAreaNo = _b.lotAreaNo, discCodeNo = _b.discCodeNo;
237
+ return [2 /*return*/, this.callAPI({
238
+ directory: 'updatePreDiscountInfo.do',
239
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo,
240
+ discCodeNo: discCodeNo }),
241
+ })];
242
+ });
243
+ });
244
+ };
245
+ // 방문차량 삭제
246
+ this.deletePreDiscountInfo = function (_a) {
247
+ var resources = _a.resources;
248
+ return __awaiter(_this, void 0, void 0, function () {
249
+ var lotAreaNo;
250
+ return __generator(this, function (_b) {
251
+ lotAreaNo = this.lotAreaNo;
252
+ return [2 /*return*/, this.callAPI({
253
+ directory: 'deletePreDiscountInfo.do',
254
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo }),
255
+ })];
256
+ });
257
+ });
258
+ };
259
+ // 차량 조회 (요금 조회 대상)
260
+ this.getFeeCarSearch = function (_a) {
261
+ var resources = _a.resources;
262
+ return __awaiter(_this, void 0, void 0, function () {
263
+ var lotAreaNo;
264
+ return __generator(this, function (_b) {
265
+ lotAreaNo = this.lotAreaNo;
266
+ return [2 /*return*/, this.callAPI({
267
+ directory: 'getFeeCarSearch.do',
268
+ resources: __assign(__assign({}, resources), { lotAreaNo: lotAreaNo }),
269
+ })];
270
+ });
271
+ });
272
+ };
273
+ this.authenticator = authenticator;
274
+ this.redis = redis;
275
+ this.mutexLock = new mutex_1.default({
276
+ hashPrefix: 'RES_AMANO_MUTEX_',
277
+ mutexLockInterval: 50,
278
+ redis: redis,
279
+ });
280
+ }
281
+ AmanoKoreaAdapter.indexAccommodation = function (_a) {
282
+ var accommodationId = _a.accommodationId;
283
+ return "AUTH|AMANO-KOREA-API|" + accommodationId;
284
+ };
285
+ return AmanoKoreaAdapter;
286
+ }());
287
+ exports.default = AmanoKoreaAdapter;