@vendit-dev/thirdparty-adapters 0.7.19 → 0.7.21

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.
@@ -107,7 +107,7 @@ export type VenditPaymentInfoInput = {
107
107
  };
108
108
  export declare abstract class ExternalChannelManager {
109
109
  abstract getRoomTypes(): Promise<ExternalRoomType[]>;
110
- abstract getReservations(input?: unknown): Promise<ExternalReservation[] | undefined>;
110
+ abstract getReservations(input?: unknown, options?: Record<string, unknown>): Promise<ExternalReservation[] | undefined>;
111
111
  abstract updateStocks(input?: unknown): Promise<boolean>;
112
112
  abstract updatePricePlans(input?: unknown): Promise<boolean>;
113
113
  }
@@ -5,11 +5,14 @@ export declare class TlLincoln implements ExternalChannelManager {
5
5
  private readonly systemId;
6
6
  private readonly pmsUserId;
7
7
  private readonly pmsPassword;
8
- constructor({ credentials, apiHost }: {
8
+ constructor({ credentials, apiHost, }: {
9
9
  credentials: TlLincolnCredentials;
10
10
  apiHost?: string;
11
11
  });
12
- getReservations(input?: TlLincolnReservationRequestInput, mergedReservations?: ExternalReservation[]): Promise<ExternalReservation[] | undefined>;
12
+ getReservations(input?: TlLincolnReservationRequestInput, options?: {
13
+ mergedReservations?: ExternalReservation[];
14
+ isDevelopment?: boolean;
15
+ }): Promise<ExternalReservation[] | undefined>;
13
16
  getRoomTypes(): Promise<ExternalRoomType[]>;
14
17
  updatePricePlans<TRequest>(): Promise<boolean>;
15
18
  updateStocks(input: ExternalChannelManagerUpdateStockRequest[]): Promise<boolean>;
@@ -1,5 +1,5 @@
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';
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";
3
3
  interface CommonRequest {
4
4
  systemId: string;
5
5
  pmsUserId: string;
@@ -36,11 +36,11 @@ function jsonToXml(json) {
36
36
  };
37
37
  var builder = new fast_xml_parser_1.XMLBuilder(options);
38
38
  var xmlContent = {
39
- 'soapenv:Envelope': {
40
- '@_xmlns:soapenv': 'http://schemas.xmlsoap.org/soap/envelope/',
41
- '@_xmlns:pms': json.pmsUrl,
42
- 'soapenv:Body': {
43
- 'pms:execute': {
39
+ "soapenv:Envelope": {
40
+ "@_xmlns:soapenv": "http://schemas.xmlsoap.org/soap/envelope/",
41
+ "@_xmlns:pms": json.pmsUrl,
42
+ "soapenv:Body": {
43
+ "pms:execute": {
44
44
  arg0: __assign({ commonRequest: __assign({}, json.commonRequest) }, json.request),
45
45
  },
46
46
  },
@@ -53,7 +53,7 @@ function xmlToJson(xml) {
53
53
  // &#xD; 문자는 제거하고 파싱합니다.
54
54
  try {
55
55
  var parser = new fast_xml_parser_1.XMLParser();
56
- return parser.parse(xml.replace(/&#xD;/g, ''));
56
+ return parser.parse(xml.replace(/&#xD;/g, ""));
57
57
  }
58
58
  catch (e) {
59
59
  console.error("xmlToJson failed: ".concat(e));
@@ -63,46 +63,46 @@ function xmlToJson(xml) {
63
63
  exports.xmlToJson = xmlToJson;
64
64
  function getReservationStatusFromDataClassification(dataClassification) {
65
65
  switch (dataClassification) {
66
- case 'NewBookReport':
67
- case 'ModificationReport':
68
- return 'RESERVED';
69
- case 'CancellationReport':
70
- return 'CANCELLED';
66
+ case "NewBookReport":
67
+ case "ModificationReport":
68
+ return "RESERVED";
69
+ case "CancellationReport":
70
+ return "CANCELLED";
71
71
  default:
72
- return 'RESERVED';
72
+ return "RESERVED";
73
73
  }
74
74
  }
75
75
  exports.getReservationStatusFromDataClassification = getReservationStatusFromDataClassification;
76
76
  function getExternalReservationTypeFromDataClassification(dataClassification) {
77
77
  switch (dataClassification) {
78
- case 'NewBookReport':
79
- return 'CREATED';
80
- case 'ModificationReport':
81
- return 'UPDATED';
82
- case 'CancellationReport':
83
- return 'CANCELLED';
78
+ case "NewBookReport":
79
+ return "CREATED";
80
+ case "ModificationReport":
81
+ return "UPDATED";
82
+ case "CancellationReport":
83
+ return "CANCELLED";
84
84
  default:
85
- return 'CREATED';
85
+ return "CREATED";
86
86
  }
87
87
  }
88
88
  exports.getExternalReservationTypeFromDataClassification = getExternalReservationTypeFromDataClassification;
89
89
  var getSpecificMealConditionText = function (_specificType) {
90
90
  switch (_specificType) {
91
- case 'IncludingBreakfast':
92
- return ['조식'];
93
- case 'IncludingLunch':
94
- return ['중식'];
95
- case 'IncludingDinner':
96
- return ['석식'];
97
- case 'IncludingLunchAndDinner':
98
- return ['중식', '석식'];
99
- case 'IncludingBreakfastAndLunch':
100
- return ['조식', '중식'];
101
- case 'IncludingBreakfastAndDinner':
102
- return ['조식', '석식'];
103
- case 'IncludingBreakfastAndLunchAndDinner':
104
- return ['조식', '중식', '석식'];
105
- case 'None Specified':
91
+ case "IncludingBreakfast":
92
+ return ["조식"];
93
+ case "IncludingLunch":
94
+ return ["중식"];
95
+ case "IncludingDinner":
96
+ return ["석식"];
97
+ case "IncludingLunchAndDinner":
98
+ return ["중식", "석식"];
99
+ case "IncludingBreakfastAndLunch":
100
+ return ["조식", "중식"];
101
+ case "IncludingBreakfastAndDinner":
102
+ return ["조식", "석식"];
103
+ case "IncludingBreakfastAndLunchAndDinner":
104
+ return ["조식", "중식", "석식"];
105
+ case "None Specified":
106
106
  return [];
107
107
  default:
108
108
  return [];
@@ -110,12 +110,12 @@ var getSpecificMealConditionText = function (_specificType) {
110
110
  };
111
111
  var getMealConditionText = function (_mealCondition) {
112
112
  switch (_mealCondition) {
113
- case '1night2meals':
114
- return '1박2식';
115
- case '1nightBreakfast':
116
- return '1박조식';
113
+ case "1night2meals":
114
+ return "1박2식";
115
+ case "1nightBreakfast":
116
+ return "1박조식";
117
117
  default:
118
- return '조식 없음';
118
+ return "조식 없음";
119
119
  }
120
120
  };
121
121
  function groupByRoomWithTotalCounts(roomAndRoomRateInformations, totalRoomCount) {
@@ -143,57 +143,44 @@ function groupByRoomWithTotalCounts(roomAndRoomRateInformations, totalRoomCount)
143
143
  var formattedNameForMealCondition = function (mealCondition, specificMealCondition) {
144
144
  var _a;
145
145
  return "".concat(getMealConditionText(mealCondition)).concat(((_a = getSpecificMealConditionText(specificMealCondition)) === null || _a === void 0 ? void 0 : _a.length) > 0
146
- ? "(".concat(getSpecificMealConditionText(specificMealCondition).join(', '), ")")
147
- : '');
146
+ ? "(".concat(getSpecificMealConditionText(specificMealCondition).join(", "), ")")
147
+ : "");
148
148
  };
149
149
  exports.formattedNameForMealCondition = formattedNameForMealCondition;
150
150
  var formattedPaxCountText = function (roomInformation, genderDivision) {
151
- if ('RoomPaxMaleCount' in roomInformation) {
151
+ if ("RoomPaxMaleCount" in roomInformation) {
152
152
  var _a = roomInformation, _b = _a.RoomPaxMaleCount, RoomPaxMaleCount = _b === void 0 ? 0 : _b, _c = _a.RoomPaxFemaleCount, RoomPaxFemaleCount = _c === void 0 ? 0 : _c, _d = _a.RoomChildA70Count, RoomChildA70Count = _d === void 0 ? 0 : _d, _e = _a.RoomChildB50Count, RoomChildB50Count = _e === void 0 ? 0 : _e, _f = _a.RoomChildC30Count, RoomChildC30Count = _f === void 0 ? 0 : _f, _g = _a.RoomChildDNoneCount, RoomChildDNoneCount = _g === void 0 ? 0 : _g, _h = _a.RoomChildOtherCount, RoomChildOtherCount = _h === void 0 ? 0 : _h;
153
153
  return "".concat([
154
154
  genderDivision
155
155
  ? "\uB0A8 ".concat(RoomPaxMaleCount, "\uBA85, \uC5EC ").concat(RoomPaxFemaleCount, "\uBA85")
156
156
  : "\uC131\uC778 ".concat(RoomPaxMaleCount + RoomPaxFemaleCount, "\uBA85"),
157
- RoomChildA70Count ? "\uD559\uC0DD ".concat(RoomChildA70Count, "\uBA85") : '',
157
+ RoomChildA70Count ? "\uD559\uC0DD ".concat(RoomChildA70Count, "\uBA85") : "",
158
158
  RoomChildB50Count || RoomChildC30Count || RoomChildOtherCount
159
159
  ? "\uC544\uB3D9 ".concat(RoomChildB50Count + RoomChildC30Count + RoomChildOtherCount, "\uBA85")
160
- : '',
161
- RoomChildDNoneCount ? "\uC720\uC544 ".concat(RoomChildDNoneCount, "\uBA85") : '',
160
+ : "",
161
+ RoomChildDNoneCount ? "\uC720\uC544 ".concat(RoomChildDNoneCount, "\uBA85") : "",
162
162
  ]
163
163
  .filter(Boolean)
164
- .join(', '));
164
+ .join(", "));
165
165
  }
166
166
  var _j = roomInformation, _k = _j.TotalPaxMaleCount, TotalPaxMaleCount = _k === void 0 ? 0 : _k, _l = _j.TotalPaxFemaleCount, TotalPaxFemaleCount = _l === void 0 ? 0 : _l, _m = _j.TotalChildA70Count, TotalChildA70Count = _m === void 0 ? 0 : _m, _o = _j.TotalChildB50Count, TotalChildB50Count = _o === void 0 ? 0 : _o, _p = _j.TotalChildC30Count, TotalChildC30Count = _p === void 0 ? 0 : _p, _q = _j.TotalChildDNoneCount, TotalChildDNoneCount = _q === void 0 ? 0 : _q, _r = _j.TotalChildOtherCount, TotalChildOtherCount = _r === void 0 ? 0 : _r;
167
167
  return "".concat([
168
168
  genderDivision
169
169
  ? "\uB0A8 ".concat(TotalPaxMaleCount, "\uBA85, \uC5EC ").concat(TotalPaxFemaleCount, "\uBA85")
170
170
  : "\uC131\uC778 ".concat(TotalPaxMaleCount + TotalPaxFemaleCount, "\uBA85"),
171
- TotalChildA70Count ? "\uD559\uC0DD ".concat(TotalChildA70Count, "\uBA85") : '',
171
+ TotalChildA70Count ? "\uD559\uC0DD ".concat(TotalChildA70Count, "\uBA85") : "",
172
172
  TotalChildB50Count || TotalChildC30Count || TotalChildOtherCount
173
173
  ? "\uC544\uB3D9 ".concat(TotalChildB50Count + TotalChildC30Count + TotalChildOtherCount, "\uBA85")
174
- : '',
175
- TotalChildDNoneCount ? "\uC720\uC544 ".concat(TotalChildDNoneCount, "\uBA85") : '',
174
+ : "",
175
+ TotalChildDNoneCount ? "\uC720\uC544 ".concat(TotalChildDNoneCount, "\uBA85") : "",
176
176
  ]
177
177
  .filter(Boolean)
178
- .join(', '));
178
+ .join(", "));
179
179
  };
180
180
  exports.formattedPaxCountText = formattedPaxCountText;
181
181
  function formatPhoneNumber(text) {
182
- var onlyNumberText = text === null || text === void 0 ? void 0 : text.replace(/[^0-9]/g, '');
183
- var safeNumberRegex = /^050{1}[0-9]{9}$/;
184
- // +로 시작하는 경우 처리
185
- if (text === null || text === void 0 ? void 0 : text.startsWith('+')) {
186
- // +82로 시작하는 경우
187
- if (text.startsWith('+82')) {
188
- return onlyNumberText ? "0".concat(onlyNumberText.slice(3)) : '';
189
- }
190
- // 그 외 국제번호의 경우
191
- return text.replace(/[+\s]/g, '');
192
- }
193
- if (safeNumberRegex.test(onlyNumberText || '')) {
194
- return onlyNumberText;
195
- }
196
- return onlyNumberText ? "010".concat(onlyNumberText.slice(-8)) : '';
182
+ var onlyNumberText = text === null || text === void 0 ? void 0 : text.replace(/[^+0-9]/g, "");
183
+ return onlyNumberText;
197
184
  }
198
185
  var makePaymentInfo = function (_a) {
199
186
  var datas = _a.datas, basicRateInformation = _a.basicRateInformation, basicInformation = _a.basicInformation, reservationType = _a.reservationType, OptionList = _a.OptionList;
@@ -214,16 +201,16 @@ var makePaymentInfo = function (_a) {
214
201
  (_b = paymentInput.segments) === null || _b === void 0 ? void 0 : _b.push({
215
202
  amount: roomAmount,
216
203
  servedAt: RoomRateInformation.RoomDate,
217
- referenceType: 'RESERVATION',
204
+ referenceType: "RESERVATION",
218
205
  referenceSubType: reservationType,
219
206
  });
220
- if (basicInformation.MealCondition !== 'Other' &&
221
- basicInformation.MealCondition !== 'WithoutMeal') {
207
+ if (basicInformation.MealCondition !== "Other" &&
208
+ basicInformation.MealCondition !== "WithoutMeal") {
222
209
  paymentInput.amount += (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomServiceFee) || 0;
223
210
  (_c = paymentInput.segments) === null || _c === void 0 ? void 0 : _c.push({
224
211
  amount: (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomServiceFee) || 0,
225
212
  servedAt: RoomRateInformation.RoomDate,
226
- referenceType: 'SERVICE',
213
+ referenceType: "SERVICE",
227
214
  referenceSubType: (0, exports.formattedNameForMealCondition)(basicInformation.MealCondition, basicInformation.SpecificMealCondition),
228
215
  });
229
216
  }
@@ -231,47 +218,47 @@ var makePaymentInfo = function (_a) {
231
218
  (_d = paymentInput.segments) === null || _d === void 0 ? void 0 : _d.push.apply(_d, OptionList.map(function (option) { return ({
232
219
  amount: 0,
233
220
  servedAt: option.OptionDate,
234
- referenceType: 'SERVICE',
221
+ referenceType: "SERVICE",
235
222
  referenceSubType: option.Name,
236
223
  }); }));
237
224
  }
238
225
  return Object.assign(paymentInput, {
239
226
  reservationType: reservationType,
240
- type: 'platform',
227
+ type: "platform",
241
228
  externalRoomTypeCode: datas[0].RoomInformation.NetRmTypeGroupCode,
242
229
  externalRoomTypeName: datas[0].RoomInformation.RoomTypeName,
243
230
  useStartAt: "".concat(datas[0].RoomRateInformation.RoomDate).concat((basicInformation === null || basicInformation === void 0 ? void 0 : basicInformation.CheckInTime)
244
231
  ? " ".concat(basicInformation === null || basicInformation === void 0 ? void 0 : basicInformation.CheckInTime)
245
- : ''),
232
+ : ""),
246
233
  });
247
234
  }, {
248
235
  amount: 0,
249
236
  commissionAmount: 0,
250
- reservationType: 'lodge',
237
+ reservationType: "lodge",
251
238
  segments: [],
252
- externalRoomTypeCode: '',
253
- externalRoomTypeName: '',
254
- type: 'platform',
255
- useStartAt: '',
239
+ externalRoomTypeCode: "",
240
+ externalRoomTypeName: "",
241
+ type: "platform",
242
+ useStartAt: "",
256
243
  });
257
244
  };
258
245
  var refineReservationData = function (infoTravelXML) {
259
246
  var _a, _b;
260
247
  var _c = infoTravelXML.AllotmentBookingReport, TransactionType = _c.TransactionType, RisaplsInformation = _c.RisaplsInformation, BasicInformation = _c.BasicInformation, BasicRateInformation = _c.BasicRateInformation, SalesOfficeInformation = _c.SalesOfficeInformation;
261
- var _d = TransactionType.DataID.split('-'), ID = _d[0], REVISION = _d[1];
248
+ var _d = TransactionType.DataID.split("-"), ID = _d[0], REVISION = _d[1];
262
249
  var isGroupReservation = BasicInformation.TotalRoomCount > 1;
263
250
  var RisaplsCommonInformation = RisaplsInformation.RisaplsCommonInformation, AgentNativeInformation = RisaplsInformation.AgentNativeInformation;
264
251
  var RoomAndRoomRateInformation = RisaplsCommonInformation.RoomAndRoomRateInformation, Allotment = RisaplsCommonInformation.Allotment, Member = RisaplsCommonInformation.Member, OtherInfo = RisaplsCommonInformation.OtherInfo, Basic = RisaplsCommonInformation.Basic, BasicRate = RisaplsCommonInformation.BasicRate, Option = RisaplsCommonInformation.Option;
265
252
  var isFullyPaid = !!((_a = AgentNativeInformation === null || AgentNativeInformation === void 0 ? void 0 : AgentNativeInformation.Extendmytrip) === null || _a === void 0 ? void 0 : _a.SettlementDiv) &&
266
253
  !((_b = AgentNativeInformation === null || AgentNativeInformation === void 0 ? void 0 : AgentNativeInformation.Extend) === null || _b === void 0 ? void 0 : _b.AmountClaimed) &&
267
- (BasicRateInformation === null || BasicRateInformation === void 0 ? void 0 : BasicRateInformation.Payment) !== 'Hotel Collect';
254
+ (BasicRateInformation === null || BasicRateInformation === void 0 ? void 0 : BasicRateInformation.Payment) !== "Hotel Collect";
268
255
  var roomAndRoomRateInformations = (0, tl_lincoln_types_1.makeArray)(RoomAndRoomRateInformation);
269
256
  var groupedRooms = groupByRoomWithTotalCounts(roomAndRoomRateInformations, BasicInformation.TotalRoomCount);
270
257
  var status = getReservationStatusFromDataClassification(TransactionType.DataClassification);
271
- var useStartAt = "".concat(BasicInformation.CheckInDate).concat((BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckInTime) ? " ".concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckInTime) : '');
258
+ var useStartAt = "".concat(BasicInformation.CheckInDate).concat((BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckInTime) ? " ".concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckInTime) : "");
272
259
  var useExpireAt = "".concat((0, moment_1.default)(BasicInformation.CheckInDate)
273
- .add(BasicInformation.Nights, 'days')
274
- .format('YYYY-MM-DD')).concat((BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckOutTime) ? " ".concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckOutTime) : '');
260
+ .add(BasicInformation.Nights, "days")
261
+ .format("YYYY-MM-DD")).concat((BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckOutTime) ? " ".concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckOutTime) : "");
275
262
  var PointDiscountList = [];
276
263
  if (BasicRate === null || BasicRate === void 0 ? void 0 : BasicRate.PointsDiscountList) {
277
264
  PointDiscountList = (0, tl_lincoln_types_1.makeArray)(BasicRate.PointsDiscountList);
@@ -289,22 +276,22 @@ var refineReservationData = function (infoTravelXML) {
289
276
  (Member === null || Member === void 0 ? void 0 : Member.UserName) ||
290
277
  "".concat(BasicInformation.GuestOrGroupNameKanjiName), " ").concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.PackagePlanName, "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.GuestRequest)
291
278
  ? "[\uC694\uCCAD\uC0AC\uD56D]\n".concat(OtherInfo.GuestRequest)
292
- : '', "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.AdditionalInformation)
279
+ : "", "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.AdditionalInformation)
293
280
  ? "[\uCD94\uAC00\uC815\uBCF4]\n".concat(OtherInfo.AdditionalInformation)
294
- : '', "\n").concat((0, exports.formattedPaxCountText)(BasicInformation), "\n[\uACB0\uC81C\uC815\uBCF4]\n\uC9C0\uBD88\uC218\uB2E8: ").concat(BasicRateInformation.Payment || '정보 없음', "\n").concat(BasicRateInformation.Payment === 'CreditCard'
281
+ : "", "\n").concat((0, exports.formattedPaxCountText)(BasicInformation), "\n[\uACB0\uC81C\uC815\uBCF4]\n\uC9C0\uBD88\uC218\uB2E8: ").concat(BasicRateInformation.Payment || "정보 없음", "\n").concat(BasicRateInformation.Payment === "CreditCard"
295
282
  ? "\uCE74\uB4DC\uC0AC\uBA85: ".concat(BasicRateInformation.CreditCardAuthority, "\n\uCE74\uB4DC\uBC88\uD638: ").concat(BasicRateInformation.CreditCardNumber, "\n\uC720\uD6A8\uAE30\uAC04: ").concat(BasicRateInformation.ExpireDate, "\n\uC18C\uC9C0\uC790\uBA85: ").concat(BasicRateInformation.CardHolderName, "\n\uC774\uC804 \uCDE8\uC18C\uAE08\uC561: ").concat(BasicRateInformation.CancellationCharge, "\n")
296
- : '', "\n\uC218\uC218\uB8CC\uC728: ").concat(BasicRateInformation.CommissionPercentage
283
+ : "", "\n\uC218\uC218\uB8CC\uC728: ").concat(BasicRateInformation.CommissionPercentage
297
284
  ? "".concat(BasicRateInformation.CommissionPercentage, "%")
298
- : '정보 없음', "\n\uC218\uC218\uB8CC \uCD1D\uC561: ").concat(BasicRateInformation.TotalAccommodationCommissionAmount
285
+ : "정보 없음", "\n\uC218\uC218\uB8CC \uCD1D\uC561: ").concat(BasicRateInformation.TotalAccommodationCommissionAmount
299
286
  ? "".concat(BasicRateInformation.TotalAccommodationCommissionAmount, "\uC6D0")
300
- : '정보 없음', "\n[\uD560\uC778\uC815\uBCF4]\n").concat((PointDiscountList === null || PointDiscountList === void 0 ? void 0 : PointDiscountList.length) > 0
301
- ? "".concat(PointDiscountList.map(function (point) { return "".concat(point.PointsDiscountName, ": ").concat(point.PointsDiscount); }).join('\n'))
302
- : ''),
303
- status: 'reserved',
304
- phone: formatPhoneNumber("".concat((Member === null || Member === void 0 ? void 0 : Member.UserTel) || Basic.PhoneNumber || '')),
287
+ : "정보 없음", "\n[\uD560\uC778\uC815\uBCF4]\n").concat((PointDiscountList === null || PointDiscountList === void 0 ? void 0 : PointDiscountList.length) > 0
288
+ ? "".concat(PointDiscountList.map(function (point) { return "".concat(point.PointsDiscountName, ": ").concat(point.PointsDiscount); }).join("\n"))
289
+ : ""),
290
+ status: "reserved",
291
+ phone: formatPhoneNumber("".concat((Member === null || Member === void 0 ? void 0 : Member.UserTel) || Basic.PhoneNumber || "")),
305
292
  useExpireAt: useExpireAt,
306
293
  useStartAt: useStartAt,
307
- platform: tl_lincoln_ota_1.TL_LINCOLN_TO_VENDIT_OTA_MAP[(SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) || 'ANONYMOUS'] || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName),
294
+ platform: tl_lincoln_ota_1.TL_LINCOLN_TO_VENDIT_OTA_MAP[(SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) || "ANONYMOUS"] || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName),
308
295
  externalPlatformCode: SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCode,
309
296
  externalPlatformName: (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) ||
310
297
  (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeName),
@@ -318,11 +305,11 @@ var refineReservationData = function (infoTravelXML) {
318
305
  });
319
306
  var reservationType = Number(Allotment.UseDiv) === 1 &&
320
307
  BasicInformation.CheckInDate === BasicInformation.CheckOutDate
321
- ? 'rent'
322
- : 'lodge';
308
+ ? "rent"
309
+ : "lodge";
323
310
  var CheckInDate = roomsSortedByDate[0].RoomRateInformation.RoomDate;
324
311
  var CheckOutDate = (_a = (0, moment_1.default)(CheckInDate)
325
- .add(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.Nights, 'days')) === null || _a === void 0 ? void 0 : _a.format('YYYY-MM-DD');
312
+ .add(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.Nights, "days")) === null || _a === void 0 ? void 0 : _a.format("YYYY-MM-DD");
326
313
  var OptionList = Option ? (0, tl_lincoln_types_1.makeArray)(Option) : [];
327
314
  var DepositList = (BasicRate === null || BasicRate === void 0 ? void 0 : BasicRate.DepositList) && (0, tl_lincoln_types_1.makeArray)(BasicRate.DepositList);
328
315
  var paymentInfo = makePaymentInfo({
@@ -335,10 +322,10 @@ var refineReservationData = function (infoTravelXML) {
335
322
  return {
336
323
  useStartAt: "".concat(CheckInDate).concat((BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckInTime)
337
324
  ? " ".concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckInTime)
338
- : ''),
325
+ : ""),
339
326
  useExpireAt: "".concat(CheckOutDate).concat((BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckOutTime)
340
327
  ? " ".concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckOutTime)
341
- : ''),
328
+ : ""),
342
329
  sleeps: isGroupReservation
343
330
  ? (BasicInformation.GrandTotalPaxCount || 0) /
344
331
  BasicInformation.TotalRoomCount ||
@@ -346,30 +333,30 @@ var refineReservationData = function (infoTravelXML) {
346
333
  : (_d = (_c = roomsSortedByDate[0]) === null || _c === void 0 ? void 0 : _c.RoomInformation) === null || _d === void 0 ? void 0 : _d.PerRoomPaxCount,
347
334
  guestName: "".concat(BasicInformation.GuestOrGroupNameSingleByte ||
348
335
  BasicInformation.GuestOrGroupNameKanjiName ||
349
- 'Anonymous').concat(isGroupReservation ? " ".concat(index + 1) : ''),
336
+ "Anonymous").concat(isGroupReservation ? " ".concat(index + 1) : ""),
350
337
  externalPlatformCode: SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCode,
351
338
  externalPlatformName: (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) ||
352
339
  (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeName),
353
- cmsOtaNumber: "".concat(BasicInformation.TravelAgencyBookingNumber).concat(isGroupReservation ? "v".concat(index + 1) : ''),
340
+ cmsOtaNumber: "".concat(BasicInformation.TravelAgencyBookingNumber).concat(isGroupReservation ? "v".concat(index + 1) : ""),
354
341
  cmsProductName: roomsSortedByDate[0].RoomInformation.RoomTypeName ||
355
342
  BasicInformation.PackagePlanName,
356
- platform: tl_lincoln_ota_1.TL_LINCOLN_TO_VENDIT_OTA_MAP[(SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) || 'ANONYMOUS'] || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName),
357
- otaNumber: "".concat(tl_lincoln_ota_1.TL_LINCOLN_TO_VENDIT_OTA_MAP[(SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) || 'ANONYMOUS'] || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName), "|").concat((_e = "".concat(BasicInformation.TravelAgencyBookingNumber)) === null || _e === void 0 ? void 0 : _e.slice(-4)),
343
+ platform: tl_lincoln_ota_1.TL_LINCOLN_TO_VENDIT_OTA_MAP[(SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) || "ANONYMOUS"] || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName),
344
+ otaNumber: "".concat(tl_lincoln_ota_1.TL_LINCOLN_TO_VENDIT_OTA_MAP[(SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) || "ANONYMOUS"] || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName), "|").concat((_e = "".concat(BasicInformation.TravelAgencyBookingNumber)) === null || _e === void 0 ? void 0 : _e.slice(-4)),
358
345
  externalRoomTypeCode: roomsSortedByDate[0].RoomInformation.NetRmTypeGroupCode,
359
346
  externalRoomTypeName: roomsSortedByDate[0].RoomInformation.RoomTypeName,
360
347
  type: reservationType,
361
- phone: formatPhoneNumber("".concat((Member === null || Member === void 0 ? void 0 : Member.UserTel) || Basic.PhoneNumber || '')),
348
+ phone: formatPhoneNumber("".concat((Member === null || Member === void 0 ? void 0 : Member.UserTel) || Basic.PhoneNumber || "")),
362
349
  status: status,
363
350
  memoContent: "".concat((Member === null || Member === void 0 ? void 0 : Member.UserKana) ||
364
351
  (Member === null || Member === void 0 ? void 0 : Member.UserName) ||
365
352
  "".concat(BasicInformation.GuestOrGroupNameKanjiName), " ").concat(roomsSortedByDate[0].RoomInformation.RoomTypeName ||
366
353
  BasicInformation.PackagePlanName, "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.GuestRequest)
367
354
  ? "[\uC694\uCCAD\uC0AC\uD56D]\n".concat(OtherInfo.GuestRequest)
368
- : '', "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.AdditionalInformation)
355
+ : "", "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.AdditionalInformation)
369
356
  ? "[\uCD94\uAC00\uC815\uBCF4]\n".concat(OtherInfo.AdditionalInformation)
370
- : '', "\n[\uC778\uC6D0\uC815\uBCF4]\n").concat((0, exports.formattedPaxCountText)(roomsSortedByDate[0].RoomInformation), "\n").concat((OptionList === null || OptionList === void 0 ? void 0 : OptionList.length) > 0
371
- ? "[\uC635\uC158]\n".concat(OptionList.map(function (option) { return "".concat(option.Name, ": ").concat(option.OptionCount, "(").concat(option.OptionDate, ")"); }).join('\n'))
372
- : ''),
357
+ : "", "\n[\uC778\uC6D0\uC815\uBCF4]\n").concat((0, exports.formattedPaxCountText)(roomsSortedByDate[0].RoomInformation), "\n").concat((OptionList === null || OptionList === void 0 ? void 0 : OptionList.length) > 0
358
+ ? "[\uC635\uC158]\n".concat(OptionList.map(function (option) { return "".concat(option.Name, ": ").concat(option.OptionCount, "(").concat(option.OptionDate, ")"); }).join("\n"))
359
+ : ""),
373
360
  paymentInfo: Object.assign(paymentInfo, !isFullyPaid && {
374
361
  amount: (DepositList === null || DepositList === void 0 ? void 0 : DepositList.reduce(function (acc, deposit) { return acc + ((deposit === null || deposit === void 0 ? void 0 : deposit.DepositAmount) || 0); }, 0)) || 0,
375
362
  isFullyPaid: false,
@@ -385,7 +372,7 @@ exports.refineReservationData = refineReservationData;
385
372
  var withAsyncBandwidth = function (array, asyncMapper, _a) {
386
373
  var _b = _a === void 0 ? {} : _a, _c = _b.bandwidth, bandwidth = _c === void 0 ? 5 : _c;
387
374
  if (bandwidth < 2)
388
- throw new Error('Bandwidth must bigger than 1');
375
+ throw new Error("Bandwidth must bigger than 1");
389
376
  var entries = __spreadArray([], array, true);
390
377
  var chainedResponses = new Array(bandwidth)
391
378
  .fill(undefined)
@@ -77,22 +77,23 @@ var TlLincoln = /** @class */ (function () {
77
77
  this.pmsUserId = credentials.pmsUserId;
78
78
  this.pmsPassword = credentials.pmsPassword;
79
79
  }
80
- TlLincoln.prototype.getReservations = function (input, mergedReservations) {
81
- if (mergedReservations === void 0) { mergedReservations = []; }
80
+ TlLincoln.prototype.getReservations = function (input, options) {
81
+ var _a;
82
82
  return __awaiter(this, void 0, void 0, function () {
83
- var continueFetching, result, reservations, _a, isSuccess, errorDescription, failureReason, _b, bookingInfoList, configurationSettings, refinedArrayReservationList;
84
- return __generator(this, function (_c) {
85
- switch (_c.label) {
83
+ var continueFetching, result, reservations, _b, isSuccess, errorDescription, failureReason, _c, bookingInfoList, configurationSettings, refinedArrayReservationList;
84
+ return __generator(this, function (_d) {
85
+ switch (_d.label) {
86
86
  case 0:
87
87
  continueFetching = true;
88
- result = __spreadArray([], mergedReservations, true);
89
- _c.label = 1;
88
+ result = __spreadArray([], ((_a = options === null || options === void 0 ? void 0 : options.mergedReservations) !== null && _a !== void 0 ? _a : []), true);
89
+ _d.label = 1;
90
90
  case 1:
91
- if (!continueFetching) return [3 /*break*/, 4];
91
+ if (!continueFetching) return [3 /*break*/, 5];
92
92
  return [4 /*yield*/, this.bookingInfoOutputService(input)];
93
93
  case 2:
94
- reservations = _c.sent();
95
- _a = reservations['S:Envelope']['S:Body']['ns2:executeResponse'].return.commonResponse, isSuccess = _a.isSuccess, errorDescription = _a.errorDescription, failureReason = _a.failureReason;
94
+ reservations = _d.sent();
95
+ _b = reservations['S:Envelope']['S:Body']['ns2:executeResponse'].return
96
+ .commonResponse, isSuccess = _b.isSuccess, errorDescription = _b.errorDescription, failureReason = _b.failureReason;
96
97
  if (!isSuccess) {
97
98
  throw new externalChannelManager_type_1.ExternalChannelManagerError({
98
99
  message: "Failed to load Reservations - ".concat(errorDescription, ": ").concat(failureReason),
@@ -100,18 +101,21 @@ var TlLincoln = /** @class */ (function () {
100
101
  description: errorDescription,
101
102
  });
102
103
  }
103
- _b = reservations['S:Envelope']['S:Body']['ns2:executeResponse'].return, bookingInfoList = _b.bookingInfoList, configurationSettings = _b.configurationSettings;
104
+ _c = reservations['S:Envelope']['S:Body']['ns2:executeResponse'].return, bookingInfoList = _c.bookingInfoList, configurationSettings = _c.configurationSettings;
104
105
  refinedArrayReservationList = (0, tl_lincoln_types_1.makeArray)(bookingInfoList);
105
- if (!(configurationSettings === null || configurationSettings === void 0 ? void 0 : configurationSettings.outputId)) {
106
+ if (!(options === null || options === void 0 ? void 0 : options.isDevelopment) && !(configurationSettings === null || configurationSettings === void 0 ? void 0 : configurationSettings.outputId)) {
106
107
  throw new externalChannelManager_type_1.ExternalChannelManagerError({
107
108
  message: 'Failed to load Reservations - outputId is not found',
108
109
  code: 'outputId is not found',
109
110
  description: 'outputId is not found',
110
111
  });
111
112
  }
113
+ if (!(!(options === null || options === void 0 ? void 0 : options.isDevelopment) && (configurationSettings === null || configurationSettings === void 0 ? void 0 : configurationSettings.outputId))) return [3 /*break*/, 4];
112
114
  return [4 /*yield*/, this.outputCompleteService(configurationSettings === null || configurationSettings === void 0 ? void 0 : configurationSettings.outputId)];
113
115
  case 3:
114
- _c.sent();
116
+ _d.sent();
117
+ _d.label = 4;
118
+ case 4:
115
119
  result = refinedArrayReservationList.reduce(function (acc, reservation) {
116
120
  if (reservation === null || reservation === void 0 ? void 0 : reservation.infoTravelXML) {
117
121
  var refinedData = (0, tl_lincoln_helper_1.refineReservationData)((0, tl_lincoln_helper_1.xmlToJson)(reservation.infoTravelXML));
@@ -122,7 +126,7 @@ var TlLincoln = /** @class */ (function () {
122
126
  // 다음 페이지가 있는지 여부 확인: 100개면 추가 호출이 필요하다고 가정
123
127
  continueFetching = refinedArrayReservationList.length === 100;
124
128
  return [3 /*break*/, 1];
125
- case 4: return [2 /*return*/, result];
129
+ case 5: return [2 /*return*/, result];
126
130
  }
127
131
  });
128
132
  });
@@ -135,8 +139,10 @@ var TlLincoln = /** @class */ (function () {
135
139
  case 0: return [4 /*yield*/, this.netRoomTypeMasterSearchService()];
136
140
  case 1:
137
141
  result = _c.sent();
138
- if (!result['S:Envelope']['S:Body']['ns2:executeResponse'].return.commonResponse.isSuccess) {
139
- _a = result['S:Envelope']['S:Body']['ns2:executeResponse'].return.commonResponse, errorDescription = _a.errorDescription, failureReason = _a.failureReason;
142
+ if (!result['S:Envelope']['S:Body']['ns2:executeResponse'].return
143
+ .commonResponse.isSuccess) {
144
+ _a = result['S:Envelope']['S:Body']['ns2:executeResponse'].return
145
+ .commonResponse, errorDescription = _a.errorDescription, failureReason = _a.failureReason;
140
146
  throw new externalChannelManager_type_1.ExternalChannelManagerError({
141
147
  message: "Failed to load RoomTypes - ".concat(errorDescription, ": ").concat(failureReason),
142
148
  code: failureReason,
@@ -145,7 +151,9 @@ var TlLincoln = /** @class */ (function () {
145
151
  }
146
152
  _b = result['S:Envelope']['S:Body']['ns2:executeResponse'].return, rmTypeList = _b.rmTypeList, netRmTypeGroupList = _b.netRmTypeGroupList, netAgtRmTypeList = _b.netAgtRmTypeList;
147
153
  aggregateRoomTypeGroups = function (rmTypeCode) {
148
- var groups = (0, tl_lincoln_types_1.isArray)(netRmTypeGroupList) ? netRmTypeGroupList.filter(function (group) { return group.rmTypeCode === rmTypeCode; }) : [netRmTypeGroupList];
154
+ var groups = (0, tl_lincoln_types_1.isArray)(netRmTypeGroupList)
155
+ ? netRmTypeGroupList.filter(function (group) { return group.rmTypeCode === rmTypeCode; })
156
+ : [netRmTypeGroupList];
149
157
  return groups.map(function (group) { return ({
150
158
  groupCode: group.netRmTypeGroupCode,
151
159
  groupName: group.netRmTypeGroupName,
@@ -153,7 +161,9 @@ var TlLincoln = /** @class */ (function () {
153
161
  }); });
154
162
  };
155
163
  aggregateAgentRoomTypeGroups = function (rmTypeCode) {
156
- var groups = (0, tl_lincoln_types_1.isArray)(netAgtRmTypeList) ? netAgtRmTypeList.filter(function (group) { return group.rmTypeCode === rmTypeCode; }) : [netAgtRmTypeList];
164
+ var groups = (0, tl_lincoln_types_1.isArray)(netAgtRmTypeList)
165
+ ? netAgtRmTypeList.filter(function (group) { return group.rmTypeCode === rmTypeCode; })
166
+ : [netAgtRmTypeList];
157
167
  return groups.map(function (group) { return ({
158
168
  agentRoomTypeCode: group.netAgtRmTypeCode,
159
169
  agentRoomTypeName: group.netAgtRmTypeName,
@@ -161,17 +171,21 @@ var TlLincoln = /** @class */ (function () {
161
171
  rmTypeCode: group.rmTypeCode,
162
172
  }); });
163
173
  };
164
- return [2 /*return*/, (0, tl_lincoln_types_1.isArray)(rmTypeList) ? rmTypeList.map(function (roomType) { return ({
165
- roomTypeCode: roomType.rmTypeCode,
166
- roomTypeName: roomType.rmTypeName,
167
- groups: aggregateRoomTypeGroups(roomType.rmTypeCode),
168
- agentRoomTypes: aggregateAgentRoomTypeGroups(roomType.rmTypeCode),
169
- }); }) : [{
170
- roomTypeCode: rmTypeList.rmTypeCode,
171
- roomTypeName: rmTypeList.rmTypeName,
172
- groups: aggregateRoomTypeGroups(rmTypeList.rmTypeCode),
173
- agentRoomTypes: aggregateAgentRoomTypeGroups(rmTypeList.rmTypeCode),
174
- }]];
174
+ return [2 /*return*/, (0, tl_lincoln_types_1.isArray)(rmTypeList)
175
+ ? rmTypeList.map(function (roomType) { return ({
176
+ roomTypeCode: roomType.rmTypeCode,
177
+ roomTypeName: roomType.rmTypeName,
178
+ groups: aggregateRoomTypeGroups(roomType.rmTypeCode),
179
+ agentRoomTypes: aggregateAgentRoomTypeGroups(roomType.rmTypeCode),
180
+ }); })
181
+ : [
182
+ {
183
+ roomTypeCode: rmTypeList.rmTypeCode,
184
+ roomTypeName: rmTypeList.rmTypeName,
185
+ groups: aggregateRoomTypeGroups(rmTypeList.rmTypeCode),
186
+ agentRoomTypes: aggregateAgentRoomTypeGroups(rmTypeList.rmTypeCode),
187
+ },
188
+ ]];
175
189
  }
176
190
  });
177
191
  });
@@ -195,8 +209,10 @@ var TlLincoln = /** @class */ (function () {
195
209
  return [4 /*yield*/, this.netStockAdjustmentService(refinedData)];
196
210
  case 2:
197
211
  result = _b.sent();
198
- if (!result['S:Envelope']['S:Body']['ns2:executeResponse'].return.commonResponse.isSuccess) {
199
- _a = result['S:Envelope']['S:Body']['ns2:executeResponse'].return.commonResponse, errorDescription = _a.errorDescription, failureReason = _a.failureReason;
212
+ if (!result['S:Envelope']['S:Body']['ns2:executeResponse'].return
213
+ .commonResponse.isSuccess) {
214
+ _a = result['S:Envelope']['S:Body']['ns2:executeResponse'].return
215
+ .commonResponse, errorDescription = _a.errorDescription, failureReason = _a.failureReason;
200
216
  throw new externalChannelManager_type_1.ExternalChannelManagerError({
201
217
  message: "Failed to update RoomType stocks - ".concat(errorDescription, ": ").concat(failureReason),
202
218
  code: failureReason,
@@ -221,7 +237,9 @@ var TlLincoln = /** @class */ (function () {
221
237
  netRmTypeGroupCode: input.roomTypeCode,
222
238
  adjustmentProcedureCode: tl_lincoln_types_1.AdjustmentProcedureCode.NET_ROOM_TYPE_GROUP_CODE,
223
239
  // stock이 0이 아니더라도 salesStatus를 START 하지 않을 수도 있음
224
- salesStatus: stock.stock === 0 ? tl_lincoln_types_1.AdjustmentSaleStatus.STOP : tl_lincoln_types_1.AdjustmentSaleStatus.START,
240
+ salesStatus: stock.stock === 0
241
+ ? tl_lincoln_types_1.AdjustmentSaleStatus.STOP
242
+ : tl_lincoln_types_1.AdjustmentSaleStatus.START,
225
243
  remainingCount: "".concat(stock.stock),
226
244
  requestId: _this.generateEightByteId(),
227
245
  }); });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendit-dev/thirdparty-adapters",
3
- "version": "0.7.19",
3
+ "version": "0.7.21",
4
4
  "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {