@vendit-dev/thirdparty-adapters 0.7.23 → 0.7.25

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.
@@ -0,0 +1,17 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll": "explicit",
6
+ "source.organizeImports": "explicit"
7
+ },
8
+ "editor.tabSize": 2,
9
+ "editor.indentSize": "tabSize",
10
+ "editor.insertSpaces": true,
11
+ "editor.detectIndentation": false,
12
+ "editor.formatOnSaveMode": "modifications",
13
+ "prettier.singleQuote": true,
14
+ "prettier.trailingComma": "all",
15
+ "prettier.arrowParens": "avoid",
16
+ "prettier.useEditorConfig": true
17
+ }
@@ -50,6 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
50
50
  return (mod && mod.__esModule) ? mod : { "default": mod };
51
51
  };
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
+ var node_https_1 = require("node:https");
53
54
  var node_fetch_1 = __importDefault(require("node-fetch"));
54
55
  var mutex_1 = __importDefault(require("../utils/mutex"));
55
56
  var AmanoKoreaAdapter = /** @class */ (function () {
@@ -159,11 +160,16 @@ var AmanoKoreaAdapter = /** @class */ (function () {
159
160
  this.callAPI = function (_a) {
160
161
  var directory = _a.directory, resources = _a.resources;
161
162
  return __awaiter(_this, void 0, void 0, function () {
162
- var fetchResult, fetchResultJson, err_2;
163
+ var agent, fetchResult, fetchResultJson, err_2;
163
164
  return __generator(this, function (_b) {
164
165
  switch (_b.label) {
165
166
  case 0:
166
- _b.trys.push([0, 3, , 4]);
167
+ agent = new node_https_1.Agent({
168
+ rejectUnauthorized: false,
169
+ });
170
+ _b.label = 1;
171
+ case 1:
172
+ _b.trys.push([1, 4, , 5]);
167
173
  return [4 /*yield*/, (0, node_fetch_1.default)("".concat(this.API_HOST, ":").concat(this.API_PORT, "/interop/").concat(directory), {
168
174
  method: 'POST',
169
175
  headers: {
@@ -171,37 +177,23 @@ var AmanoKoreaAdapter = /** @class */ (function () {
171
177
  Authorization: this.authorization,
172
178
  },
173
179
  body: JSON.stringify(__assign({}, resources)),
180
+ agent: agent,
174
181
  })];
175
- case 1:
182
+ case 2:
176
183
  fetchResult = _b.sent();
177
184
  return [4 /*yield*/, (fetchResult === null || fetchResult === void 0 ? void 0 : fetchResult.json())];
178
- case 2:
185
+ case 3:
179
186
  fetchResultJson = _b.sent();
180
187
  return [2 /*return*/, fetchResultJson];
181
- case 3:
188
+ case 4:
182
189
  err_2 = _b.sent();
183
190
  console.error('err', err_2);
184
191
  return [2 /*return*/, err_2];
185
- case 4: return [2 /*return*/];
192
+ case 5: return [2 /*return*/];
186
193
  }
187
194
  });
188
195
  });
189
196
  };
190
- // syncTimeToMCS = async (): Promise<string> => {
191
- // const fetchRes = await fetch(
192
- // `${'http://deploy.amanopark.co.kr:9848/getTime'}`,
193
- // {
194
- // method: 'POST',
195
- // headers: {
196
- // 'Content-Type': 'application/json',
197
- // Authorization: this.authorization,
198
- // },
199
- // body: JSON.stringify({}),
200
- // },
201
- // );
202
- // const fetchResJson = await fetchRes.json();
203
- // return fetchResJson;
204
- // };
205
197
  // 방문차량 등록 내역 조회
206
198
  this.getPreDiscountListInfo = function (resources) { return __awaiter(_this, void 0, void 0, function () {
207
199
  var _a, lotAreaNo, discCodeNo;
@@ -1,5 +1,5 @@
1
1
  import type { ExternalReservation, ExternalReservationType, ReservationStatus } from './externalChannelManager.type';
2
- import { type BasicInformation as TBasicInformation, type DataClassificationType, type InfoTravelXML, type MealConditionType, type RoomInformation, type SpecificMealConditionType } from './tl-lincoln.types';
2
+ import { type DataClassificationType, type InfoTravelXML, type MealConditionType, type RoomInformation, type SpecificMealConditionType, type BasicInformation as TBasicInformation } from './tl-lincoln.types';
3
3
  interface CommonRequest {
4
4
  systemId: string;
5
5
  pmsUserId: string;
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.withAsyncBandwidth = exports.refineReservationData = exports.formattedPaxCountText = exports.formattedNameForMealCondition = exports.getExternalReservationTypeFromDataClassification = exports.getReservationStatusFromDataClassification = exports.xmlToJson = exports.jsonToXml = void 0;
27
27
  var fast_xml_parser_1 = require("fast-xml-parser");
28
28
  var moment_1 = __importDefault(require("moment"));
29
- var tl_lincoln_types_1 = require("./tl-lincoln.types");
30
29
  var tl_lincoln_ota_1 = require("../../types/tl-lincoln.ota");
30
+ var tl_lincoln_types_1 = require("./tl-lincoln.types");
31
31
  function jsonToXml(json) {
32
32
  var options = {
33
33
  ignoreAttributes: false,
@@ -199,22 +199,19 @@ function formatPhoneNumber(text) {
199
199
  return onlyNumberText;
200
200
  }
201
201
  var makePaymentInfo = function (_a) {
202
- var datas = _a.datas, basicRateInformation = _a.basicRateInformation, basicInformation = _a.basicInformation, reservationType = _a.reservationType, OptionList = _a.OptionList;
202
+ var datas = _a.datas, basicInformation = _a.basicInformation, reservationType = _a.reservationType, OptionList = _a.OptionList;
203
203
  return datas.reduce(function (paymentInput, _a) {
204
- var _b, _c, _d;
204
+ var _b, _c, _d, _e;
205
205
  var RoomInfo = _a.RoomInformation, RoomRateInformation = _a.RoomRateInformation;
206
- var roomAmount = (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomRate) ||
207
- ((RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.PerMaleRate) || 0) *
208
- (RoomInfo.RoomPaxMaleCount || 0) +
209
- ((RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.PerFemaleRate) ||
210
- (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.PerMaleRate) ||
211
- 0) *
212
- (RoomInfo.RoomPaxFemaleCount || 0) ||
213
- (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomRate) ||
214
- basicRateInformation.TotalAccommodationCharge ||
215
- 0;
206
+ var roomAmount = (_b = RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomRate) !== null && _b !== void 0 ? _b : (((RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.PerMaleRate) || 0) *
207
+ (RoomInfo.RoomPaxMaleCount || 0) +
208
+ ((RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.PerFemaleRate) ||
209
+ (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.PerMaleRate) ||
210
+ 0) *
211
+ (RoomInfo.RoomPaxFemaleCount || 0) ||
212
+ 0);
216
213
  paymentInput.amount += roomAmount;
217
- (_b = paymentInput.segments) === null || _b === void 0 ? void 0 : _b.push({
214
+ (_c = paymentInput.segments) === null || _c === void 0 ? void 0 : _c.push({
218
215
  amount: roomAmount,
219
216
  servedAt: RoomRateInformation.RoomDate,
220
217
  referenceType: 'RESERVATION',
@@ -223,7 +220,7 @@ var makePaymentInfo = function (_a) {
223
220
  if (basicInformation.MealCondition !== 'Other' &&
224
221
  basicInformation.MealCondition !== 'WithoutMeal') {
225
222
  paymentInput.amount += (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomServiceFee) || 0;
226
- (_c = paymentInput.segments) === null || _c === void 0 ? void 0 : _c.push({
223
+ (_d = paymentInput.segments) === null || _d === void 0 ? void 0 : _d.push({
227
224
  amount: (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomServiceFee) || 0,
228
225
  servedAt: RoomRateInformation.RoomDate,
229
226
  referenceType: 'SERVICE',
@@ -231,7 +228,7 @@ var makePaymentInfo = function (_a) {
231
228
  });
232
229
  }
233
230
  if ((OptionList === null || OptionList === void 0 ? void 0 : OptionList.length) > 0) {
234
- (_d = paymentInput.segments) === null || _d === void 0 ? void 0 : _d.push.apply(_d, OptionList.map(function (option) { return ({
231
+ (_e = paymentInput.segments) === null || _e === void 0 ? void 0 : _e.push.apply(_e, OptionList.map(function (option) { return ({
235
232
  amount: 0,
236
233
  servedAt: option.OptionDate,
237
234
  referenceType: 'SERVICE',
@@ -330,7 +327,6 @@ var refineReservationData = function (infoTravelXML) {
330
327
  var DepositList = (BasicRate === null || BasicRate === void 0 ? void 0 : BasicRate.DepositList) && (0, tl_lincoln_types_1.makeArray)(BasicRate.DepositList);
331
328
  var paymentInfo = makePaymentInfo({
332
329
  datas: datas,
333
- basicRateInformation: BasicRateInformation,
334
330
  basicInformation: BasicInformation,
335
331
  reservationType: reservationType,
336
332
  OptionList: OptionList,
@@ -60,9 +60,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
62
  exports.TlLincoln = void 0;
63
+ var moment_1 = __importDefault(require("moment"));
63
64
  /* eslint-disable no-await-in-loop */
64
65
  var node_fetch_1 = __importDefault(require("node-fetch"));
65
- var moment_1 = __importDefault(require("moment"));
66
66
  var externalChannelManager_type_1 = require("./externalChannelManager.type");
67
67
  var tl_lincoln_helper_1 = require("./tl-lincoln.helper");
68
68
  var tl_lincoln_types_1 = require("./tl-lincoln.types");
package/package.json CHANGED
@@ -1,52 +1,50 @@
1
1
  {
2
- "name": "@vendit-dev/thirdparty-adapters",
3
- "version": "0.7.23",
4
- "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
- "main": "lib/index.js",
6
- "scripts": {
7
- "build": "tsc",
8
- "dev": "node ./test/tl-lincoln.test.js",
9
- "npm-login": "npm login",
10
- "publish": "npm publish"
11
- },
12
- "keywords": [
13
- "vendit"
14
- ],
15
- "author": "Vendit <dev@vendit.co.kr> (https://vendit.co.kr)",
16
- "license": "MIT",
17
- "devDependencies": {
18
- "@babel/cli": "^7.10.5",
19
- "@babel/core": "^7.10.5",
20
- "@babel/node": "^7.10.5",
21
- "@babel/plugin-proposal-class-properties": "^7.10.4",
22
- "@babel/plugin-proposal-optional-chaining": "^7.10.4",
23
- "@babel/preset-env": "^7.10.4",
24
- "@babel/preset-flow": "^7.10.4",
25
- "@types/ioredis": "^5.0.0",
26
- "@types/node": "^20.4.5",
27
- "@types/node-fetch": "^2.6.1",
28
- "@types/npm": "^7.19.1",
29
- "@types/sequelize": "^4.28.15",
30
- "@types/tedious": "^4.0.9",
31
- "@types/validator": "^13.7.17",
32
- "@typescript-eslint/eslint-plugin": "^3.6.1",
33
- "@typescript-eslint/parser": "^3.6.1",
34
- "@vendit-dev/utility-modules": "^0.20.1",
35
- "babel-eslint": "^10.1.0",
36
- "babel-plugin-module-resolver": "^4.0.0",
37
- "cross-env": "^7.0.2",
38
- "eslint": "^7.4.0",
39
- "eslint-config-airbnb-base": "^13.1.0",
40
- "eslint-plugin-import": "^2.16.0",
41
- "typescript": "4.9.3"
42
- },
43
- "dependencies": {
44
- "fast-xml-parser": "^4.4.0",
45
- "moment": "^2.29.2",
46
- "node-fetch": "2",
47
- "npm": "6",
48
- "sequelize": "^6.32.1",
49
- "tedious": "6.2.1",
50
- "uuid": "^8.3.2"
51
- }
2
+ "name": "@vendit-dev/thirdparty-adapters",
3
+ "version": "0.7.25",
4
+ "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
+ "main": "lib/index.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "dev": "node ./test/tl-lincoln.test.js",
9
+ "npm-login": "npm login",
10
+ "publish": "npm publish"
11
+ },
12
+ "keywords": ["vendit"],
13
+ "author": "Vendit <dev@vendit.co.kr> (https://vendit.co.kr)",
14
+ "license": "MIT",
15
+ "devDependencies": {
16
+ "@babel/cli": "^7.10.5",
17
+ "@babel/core": "^7.10.5",
18
+ "@babel/node": "^7.10.5",
19
+ "@babel/plugin-proposal-class-properties": "^7.10.4",
20
+ "@babel/plugin-proposal-optional-chaining": "^7.10.4",
21
+ "@babel/preset-env": "^7.10.4",
22
+ "@babel/preset-flow": "^7.10.4",
23
+ "@types/ioredis": "^5.0.0",
24
+ "@types/node": "^20.4.5",
25
+ "@types/node-fetch": "^2.6.1",
26
+ "@types/npm": "^7.19.1",
27
+ "@types/sequelize": "^4.28.15",
28
+ "@types/tedious": "^4.0.9",
29
+ "@types/validator": "^13.7.17",
30
+ "@typescript-eslint/eslint-plugin": "^3.6.1",
31
+ "@typescript-eslint/parser": "^3.6.1",
32
+ "@vendit-dev/utility-modules": "^0.20.1",
33
+ "babel-eslint": "^10.1.0",
34
+ "babel-plugin-module-resolver": "^4.0.0",
35
+ "cross-env": "^7.0.2",
36
+ "eslint": "^7.4.0",
37
+ "eslint-config-airbnb-base": "^13.1.0",
38
+ "eslint-plugin-import": "^2.16.0",
39
+ "typescript": "4.9.3"
40
+ },
41
+ "dependencies": {
42
+ "fast-xml-parser": "^4.4.0",
43
+ "moment": "^2.29.2",
44
+ "node-fetch": "2",
45
+ "npm": "6",
46
+ "sequelize": "^6.32.1",
47
+ "tedious": "6.2.1",
48
+ "uuid": "^8.3.2"
49
+ }
52
50
  }