@vendit-dev/thirdparty-adapters 0.7.26 → 0.7.27

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.
@@ -124,9 +124,9 @@ function groupByRoomWithTotalCounts(roomAndRoomRateInformations, totalRoomCount)
124
124
  var RoomTypeCode = curr.RoomInformation.RoomTypeCode, RoomDate = curr.RoomRateInformation.RoomDate;
125
125
  var existingRooms = acc.find(function (groupedRoom) {
126
126
  var _a, _b;
127
- return groupedRoom.length > 0 &&
128
- ((_b = (_a = groupedRoom[0]) === null || _a === void 0 ? void 0 : _a.RoomInformation) === null || _b === void 0 ? void 0 : _b.RoomTypeCode) === RoomTypeCode &&
129
- !groupedRoom.some(function (room) { return room.RoomRateInformation.RoomDate === RoomDate; });
127
+ return groupedRoom.length > 0
128
+ && ((_b = (_a = groupedRoom[0]) === null || _a === void 0 ? void 0 : _a.RoomInformation) === null || _b === void 0 ? void 0 : _b.RoomTypeCode) === RoomTypeCode
129
+ && !groupedRoom.some(function (room) { return room.RoomRateInformation.RoomDate === RoomDate; });
130
130
  });
131
131
  if (existingRooms) {
132
132
  existingRooms.push(curr);
@@ -199,17 +199,17 @@ function formatPhoneNumber(text) {
199
199
  return onlyNumberText;
200
200
  }
201
201
  var makePaymentInfo = function (_a) {
202
- var datas = _a.datas, basicInformation = _a.basicInformation, reservationType = _a.reservationType, OptionList = _a.OptionList;
203
- return datas.reduce(function (paymentInput, _a) {
202
+ var datas = _a.datas, basicInformation = _a.basicInformation, reservationType = _a.reservationType, OptionList = _a.OptionList, PointDiscountList = _a.PointDiscountList;
203
+ var paymentInfo = datas.reduce(function (paymentInput, _a) {
204
204
  var _b, _c, _d, _e;
205
205
  var RoomInfo = _a.RoomInformation, RoomRateInformation = _a.RoomRateInformation;
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);
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);
213
213
  paymentInput.amount += roomAmount;
214
214
  (_c = paymentInput.segments) === null || _c === void 0 ? void 0 : _c.push({
215
215
  amount: roomAmount,
@@ -217,8 +217,8 @@ var makePaymentInfo = function (_a) {
217
217
  referenceType: 'RESERVATION',
218
218
  referenceSubType: reservationType,
219
219
  });
220
- if (basicInformation.MealCondition !== 'Other' &&
221
- basicInformation.MealCondition !== 'WithoutMeal') {
220
+ if (basicInformation.MealCondition !== 'Other'
221
+ && basicInformation.MealCondition !== 'WithoutMeal') {
222
222
  paymentInput.amount += (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomServiceFee) || 0;
223
223
  (_d = paymentInput.segments) === null || _d === void 0 ? void 0 : _d.push({
224
224
  amount: (RoomRateInformation === null || RoomRateInformation === void 0 ? void 0 : RoomRateInformation.TotalPerRoomServiceFee) || 0,
@@ -254,6 +254,12 @@ var makePaymentInfo = function (_a) {
254
254
  type: 'platform',
255
255
  useStartAt: '',
256
256
  });
257
+ if (PointDiscountList && (PointDiscountList === null || PointDiscountList === void 0 ? void 0 : PointDiscountList.length) > 0) {
258
+ paymentInfo.amount -= PointDiscountList.reduce(function (acc, point) { return acc + point.PointsDiscount; }, 0);
259
+ // auto segment 로 생성되도록 처리
260
+ paymentInfo.segments = [];
261
+ }
262
+ return paymentInfo;
257
263
  };
258
264
  var refineReservationData = function (infoTravelXML) {
259
265
  var _a, _b;
@@ -262,9 +268,9 @@ var refineReservationData = function (infoTravelXML) {
262
268
  var isGroupReservation = BasicInformation.TotalRoomCount > 1;
263
269
  var RisaplsCommonInformation = RisaplsInformation.RisaplsCommonInformation, AgentNativeInformation = RisaplsInformation.AgentNativeInformation;
264
270
  var RoomAndRoomRateInformation = RisaplsCommonInformation.RoomAndRoomRateInformation, Allotment = RisaplsCommonInformation.Allotment, Member = RisaplsCommonInformation.Member, OtherInfo = RisaplsCommonInformation.OtherInfo, Basic = RisaplsCommonInformation.Basic, BasicRate = RisaplsCommonInformation.BasicRate, Option = RisaplsCommonInformation.Option;
265
- var isFullyPaid = !!((_a = AgentNativeInformation === null || AgentNativeInformation === void 0 ? void 0 : AgentNativeInformation.Extendmytrip) === null || _a === void 0 ? void 0 : _a.SettlementDiv) &&
266
- !((_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';
271
+ var isFullyPaid = !!((_a = AgentNativeInformation === null || AgentNativeInformation === void 0 ? void 0 : AgentNativeInformation.Extendmytrip) === null || _a === void 0 ? void 0 : _a.SettlementDiv)
272
+ && !((_b = AgentNativeInformation === null || AgentNativeInformation === void 0 ? void 0 : AgentNativeInformation.Extend) === null || _b === void 0 ? void 0 : _b.AmountClaimed)
273
+ && (BasicRateInformation === null || BasicRateInformation === void 0 ? void 0 : BasicRateInformation.Payment) !== 'Hotel Collect';
268
274
  var roomAndRoomRateInformations = (0, tl_lincoln_types_1.makeArray)(RoomAndRoomRateInformation);
269
275
  var groupedRooms = groupByRoomWithTotalCounts(roomAndRoomRateInformations, BasicInformation.TotalRoomCount);
270
276
  var status = getReservationStatusFromDataClassification(TransactionType.DataClassification);
@@ -285,9 +291,9 @@ var refineReservationData = function (infoTravelXML) {
285
291
  name: BasicInformation.GuestOrGroupNameKanjiName,
286
292
  email: Member === null || Member === void 0 ? void 0 : Member.UserMailAddr,
287
293
  reservedBy: SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName,
288
- memo: "".concat((Member === null || Member === void 0 ? void 0 : Member.UserKana) ||
289
- (Member === null || Member === void 0 ? void 0 : Member.UserName) ||
290
- "".concat(BasicInformation.GuestOrGroupNameKanjiName), " ").concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.PackagePlanName, "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.GuestRequest)
294
+ memo: "".concat((Member === null || Member === void 0 ? void 0 : Member.UserKana)
295
+ || (Member === null || Member === void 0 ? void 0 : Member.UserName)
296
+ || "".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
297
  ? "[\uC694\uCCAD\uC0AC\uD56D]\n".concat(OtherInfo.GuestRequest)
292
298
  : '', "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.AdditionalInformation)
293
299
  ? "[\uCD94\uAC00\uC815\uBCF4]\n".concat(OtherInfo.AdditionalInformation)
@@ -306,18 +312,18 @@ var refineReservationData = function (infoTravelXML) {
306
312
  useStartAt: useStartAt,
307
313
  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
314
  externalPlatformCode: SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCode,
309
- externalPlatformName: (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) ||
310
- (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeName),
315
+ externalPlatformName: (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName)
316
+ || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeName),
311
317
  },
312
318
  reservations: groupedRooms.map(function (key, index) {
313
319
  var _a, _b, _c, _d;
314
320
  var datas = groupedRooms[index];
315
321
  var roomsSortedByDate = datas.sort(function (a, b) {
316
- return new Date(a.RoomRateInformation.RoomDate).valueOf() -
317
- new Date(b.RoomRateInformation.RoomDate).valueOf();
322
+ return new Date(a.RoomRateInformation.RoomDate).valueOf()
323
+ - new Date(b.RoomRateInformation.RoomDate).valueOf();
318
324
  });
319
- var reservationType = Number(Allotment.UseDiv) === 1 &&
320
- BasicInformation.CheckInDate === BasicInformation.CheckOutDate
325
+ var reservationType = Number(Allotment.UseDiv) === 1
326
+ && BasicInformation.CheckInDate === BasicInformation.CheckOutDate
321
327
  ? 'rent'
322
328
  : 'lodge';
323
329
  var CheckInDate = roomsSortedByDate[0].RoomRateInformation.RoomDate;
@@ -330,6 +336,7 @@ var refineReservationData = function (infoTravelXML) {
330
336
  basicInformation: BasicInformation,
331
337
  reservationType: reservationType,
332
338
  OptionList: OptionList,
339
+ PointDiscountList: PointDiscountList,
333
340
  });
334
341
  return {
335
342
  useStartAt: "".concat(CheckInDate).concat((BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckInTime)
@@ -339,19 +346,19 @@ var refineReservationData = function (infoTravelXML) {
339
346
  ? " ".concat(BasicInformation === null || BasicInformation === void 0 ? void 0 : BasicInformation.CheckOutTime)
340
347
  : ''),
341
348
  sleeps: isGroupReservation
342
- ? (BasicInformation.GrandTotalPaxCount || 0) /
343
- BasicInformation.TotalRoomCount ||
344
- ((_b = datas[0].RoomInformation) === null || _b === void 0 ? void 0 : _b.PerRoomPaxCount)
349
+ ? (BasicInformation.GrandTotalPaxCount || 0)
350
+ / BasicInformation.TotalRoomCount
351
+ || ((_b = datas[0].RoomInformation) === null || _b === void 0 ? void 0 : _b.PerRoomPaxCount)
345
352
  : (_d = (_c = roomsSortedByDate[0]) === null || _c === void 0 ? void 0 : _c.RoomInformation) === null || _d === void 0 ? void 0 : _d.PerRoomPaxCount,
346
- guestName: "".concat(BasicInformation.GuestOrGroupNameSingleByte ||
347
- BasicInformation.GuestOrGroupNameKanjiName ||
348
- 'Anonymous').concat(isGroupReservation ? " ".concat(index + 1) : ''),
353
+ guestName: "".concat(BasicInformation.GuestOrGroupNameSingleByte
354
+ || BasicInformation.GuestOrGroupNameKanjiName
355
+ || 'Anonymous').concat(isGroupReservation ? " ".concat(index + 1) : ''),
349
356
  externalPlatformCode: SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCode,
350
- externalPlatformName: (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName) ||
351
- (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeName),
357
+ externalPlatformName: (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeCompanyName)
358
+ || (SalesOfficeInformation === null || SalesOfficeInformation === void 0 ? void 0 : SalesOfficeInformation.SalesOfficeName),
352
359
  cmsOtaNumber: "".concat(BasicInformation.TravelAgencyBookingNumber).concat(isGroupReservation ? "v".concat(index + 1) : ''),
353
- cmsProductName: roomsSortedByDate[0].RoomInformation.RoomTypeName ||
354
- BasicInformation.PackagePlanName,
360
+ cmsProductName: roomsSortedByDate[0].RoomInformation.RoomTypeName
361
+ || BasicInformation.PackagePlanName,
355
362
  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),
356
363
  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("".concat(BasicInformation.TravelAgencyBookingNumber)),
357
364
  externalRoomTypeCode: roomsSortedByDate[0].RoomInformation.NetRmTypeGroupCode,
@@ -359,10 +366,10 @@ var refineReservationData = function (infoTravelXML) {
359
366
  type: reservationType,
360
367
  phone: formatPhoneNumber("".concat((Member === null || Member === void 0 ? void 0 : Member.UserTel) || Basic.PhoneNumber || '')),
361
368
  status: status,
362
- memoContent: "".concat((Member === null || Member === void 0 ? void 0 : Member.UserKana) ||
363
- (Member === null || Member === void 0 ? void 0 : Member.UserName) ||
364
- "".concat(BasicInformation.GuestOrGroupNameKanjiName), " ").concat(roomsSortedByDate[0].RoomInformation.RoomTypeName ||
365
- BasicInformation.PackagePlanName, "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.GuestRequest)
369
+ memoContent: "".concat((Member === null || Member === void 0 ? void 0 : Member.UserKana)
370
+ || (Member === null || Member === void 0 ? void 0 : Member.UserName)
371
+ || "".concat(BasicInformation.GuestOrGroupNameKanjiName), " ").concat(roomsSortedByDate[0].RoomInformation.RoomTypeName
372
+ || BasicInformation.PackagePlanName, "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.GuestRequest)
366
373
  ? "[\uC694\uCCAD\uC0AC\uD56D]\n".concat(OtherInfo.GuestRequest)
367
374
  : '', "\n").concat((OtherInfo === null || OtherInfo === void 0 ? void 0 : OtherInfo.AdditionalInformation)
368
375
  ? "[\uCD94\uAC00\uC815\uBCF4]\n".concat(OtherInfo.AdditionalInformation)
@@ -372,8 +379,8 @@ var refineReservationData = function (infoTravelXML) {
372
379
  paymentInfo: Object.assign(paymentInfo, !isFullyPaid && {
373
380
  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,
374
381
  isFullyPaid: false,
375
- outstandingAmount: paymentInfo.amount -
376
- ((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),
382
+ outstandingAmount: paymentInfo.amount
383
+ - ((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),
377
384
  }),
378
385
  };
379
386
  }),
@@ -47,7 +47,7 @@ export interface BookingInfoList {
47
47
  bookEdaban: number;
48
48
  }
49
49
  export interface InfoTravelXML {
50
- '?xml'?: Xml;
50
+ '?xml'?: Xml | string;
51
51
  AllotmentBookingReport: AllotmentBookingReport;
52
52
  }
53
53
  export interface AllotmentBookingReport {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendit-dev/thirdparty-adapters",
3
- "version": "0.7.26",
3
+ "version": "0.7.27",
4
4
  "description": "Third party adapters between v-cloud and other PMS/CMS providers.",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -9,7 +9,9 @@
9
9
  "npm-login": "npm login",
10
10
  "publish": "npm publish"
11
11
  },
12
- "keywords": ["vendit"],
12
+ "keywords": [
13
+ "vendit"
14
+ ],
13
15
  "author": "Vendit <dev@vendit.co.kr> (https://vendit.co.kr)",
14
16
  "license": "MIT",
15
17
  "devDependencies": {