whitelabel-db 1.4.3 → 1.4.5

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.
package/dist/index.d.ts CHANGED
@@ -31,5 +31,5 @@ export { LoyaltyProgram } from './models/LoyaltyProgram';
31
31
  export { LoyaltyProgramTier } from './models/LoyaltyProgramTier';
32
32
  export { BookingLoyaltyRecord } from './models/BookingLoyaltyRecord';
33
33
  export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
34
- export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, GetHotelRequestV3, HotelDataV3, HotelImageV3, CheckinCheckoutTimesV3, LocationV3, FacilityV3, RoomV3, BedTypeV3, RoomAmenityV3, RoomPhotoV3, PolicyV3, AccessibilityV3, AccessibilityAttributesV3, AccessibilityDisabilitiesV3, AccessibilityDisabilityScoresV3, SentimentAnalysisV3, SentimentCategoryV3, SemanticSearchRequestV3, SemanticSearchHotelV3, ConversationalHotelRequestV3, ConversationalHotelResponseV3, InitiatePaymentIntentV3, FinalizePaymentRequestV3, FinalizePaymentResponseV3, } from './libs/liteapiv3';
34
+ export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, CancelBookingRequestV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, GetHotelRequestV3, HotelDataV3, HotelImageV3, CheckinCheckoutTimesV3, LocationV3, FacilityV3, RoomV3, BedTypeV3, RoomAmenityV3, RoomPhotoV3, PolicyV3, AccessibilityV3, AccessibilityAttributesV3, AccessibilityDisabilitiesV3, AccessibilityDisabilityScoresV3, SentimentAnalysisV3, SentimentCategoryV3, SemanticSearchRequestV3, SemanticSearchHotelV3, ConversationalHotelRequestV3, ConversationalHotelResponseV3, InitiatePaymentIntentV3, FinalizePaymentRequestV3, FinalizePaymentResponseV3, } from './libs/liteapiv3';
35
35
  export { LiteApiUser, LiteApiUserRequest } from './libs/liteapiuser';
@@ -13,6 +13,7 @@ export interface HotelsRequestV3 {
13
13
  guestNationality: string;
14
14
  rm?: boolean;
15
15
  trackingId?: string;
16
+ sessionId?: string;
16
17
  }
17
18
  export interface AvailabilityResultV3 {
18
19
  hotelId: string;
@@ -113,6 +114,7 @@ export interface PrebookRateRequestV3 {
113
114
  useOwnSecretKey?: boolean;
114
115
  };
115
116
  trackingId?: string;
117
+ sessionId?: string;
116
118
  voucherCode?: string;
117
119
  addons: Addon[];
118
120
  clientReference?: string;
@@ -190,6 +192,7 @@ export interface CheckoutRequestV3 {
190
192
  holder: UserV3;
191
193
  guests: GuestsRequestV3[];
192
194
  trackingId?: string;
195
+ sessionId?: string;
193
196
  }
194
197
  export interface BookedRoomV3 {
195
198
  roomType: {
@@ -292,6 +295,10 @@ export interface BookingConfirmationV3 {
292
295
  prebookId: string;
293
296
  transactionId: string;
294
297
  }
298
+ export interface CancelBookingRequestV3 {
299
+ trackingId?: string;
300
+ sessionId?: string;
301
+ }
295
302
  export interface CancelBookingV3 {
296
303
  bookingId: string;
297
304
  status: string;
@@ -306,7 +313,7 @@ export interface InitiatePaymentIntentV3 {
306
313
  currency: string;
307
314
  transactionId: string;
308
315
  }
309
- export type FinalizePaymentRequestV3 = {
316
+ export type FinalizePaymentRequestV3 = ({
310
317
  method: 'CREDIT';
311
318
  } | {
312
319
  method: 'THIRD_PARTY';
@@ -314,6 +321,9 @@ export type FinalizePaymentRequestV3 = {
314
321
  } | {
315
322
  method: 'TRANSACTION_ID';
316
323
  transactionId: string;
324
+ }) & {
325
+ trackingId?: string;
326
+ sessionId?: string;
317
327
  };
318
328
  export interface FinalizePaymentResponseV3 {
319
329
  bookingId: string;
@@ -642,8 +652,11 @@ export declare class LiteApiClientV3 {
642
652
  getHotelsFullRate(options: HotelsRequestV3): Promise<FullRateAvailabilityResultV3[]>;
643
653
  preBookedHotelRate(options: PrebookRateRequestV3): Promise<PrebookRateV3>;
644
654
  bookHotelRate(options: CheckoutRequestV3): Promise<BookingInfoV3>;
645
- cancelBooking(bookingId: string): Promise<CancelBookingV3>;
646
- initiatePaymentIntent(bookingId: string): Promise<InitiatePaymentIntentV3>;
655
+ cancelBooking(bookingId: string, options?: CancelBookingRequestV3): Promise<CancelBookingV3>;
656
+ initiatePaymentIntent(bookingId: string, options?: {
657
+ trackingId?: string;
658
+ sessionId?: string;
659
+ }): Promise<InitiatePaymentIntentV3>;
647
660
  finalizePayment(bookingId: string, data: FinalizePaymentRequestV3): Promise<FinalizePaymentResponseV3>;
648
661
  getBooking(bookingId: string, key?: string): Promise<BookingInfoV3>;
649
662
  getPrebook(prebookId: string, key?: string): Promise<PrebookRateV3>;
@@ -106,11 +106,12 @@ class LiteApiClientV3 {
106
106
  })).data.data;
107
107
  });
108
108
  }
109
- cancelBooking(bookingId) {
109
+ cancelBooking(bookingId, options) {
110
110
  return __awaiter(this, void 0, void 0, function* () {
111
111
  return (yield (0, axios_1.default)({
112
112
  method: 'put',
113
113
  url: `${this.bookingBaseUrl}/v3.0/bookings/${bookingId}`,
114
+ data: options,
114
115
  headers: {
115
116
  'X-API-Key': this.apiKey,
116
117
  'content-type': 'application/json',
@@ -118,11 +119,12 @@ class LiteApiClientV3 {
118
119
  })).data.data;
119
120
  });
120
121
  }
121
- initiatePaymentIntent(bookingId) {
122
+ initiatePaymentIntent(bookingId, options) {
122
123
  return __awaiter(this, void 0, void 0, function* () {
123
124
  return (yield (0, axios_1.default)({
124
125
  method: 'post',
125
126
  url: `${this.bookingBaseUrl}/v3.0/bookings/${bookingId}/payments/initiate`,
127
+ data: options,
126
128
  headers: {
127
129
  'X-API-Key': this.apiKey,
128
130
  'content-type': 'application/json',
@@ -0,0 +1,3 @@
1
+ import { QueryInterface } from 'sequelize';
2
+ export declare const up: (queryInterface: QueryInterface) => Promise<void>;
3
+ export declare const down: (queryInterface: QueryInterface) => Promise<void>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.down = exports.up = void 0;
13
+ // Purpose: Add cancelledAt column to bookings table.
14
+ const sequelize_1 = require("sequelize");
15
+ const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
16
+ try {
17
+ const tableDescription = yield queryInterface.describeTable('bookings');
18
+ const existingColumns = Object.keys(tableDescription);
19
+ if (existingColumns.includes('cancelledAt')) {
20
+ console.log('cancelledAt column already exists, skipping migration.');
21
+ return;
22
+ }
23
+ yield queryInterface.addColumn('bookings', 'cancelledAt', {
24
+ type: sequelize_1.DataTypes.DATE,
25
+ allowNull: true,
26
+ });
27
+ console.log('cancelledAt column added successfully.');
28
+ }
29
+ catch (error) {
30
+ console.error('Error while adding cancelledAt column:', error.message);
31
+ throw error;
32
+ }
33
+ });
34
+ exports.up = up;
35
+ const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
36
+ try {
37
+ yield queryInterface.removeColumn('bookings', 'cancelledAt');
38
+ console.log('cancelledAt column removed successfully.');
39
+ }
40
+ catch (error) {
41
+ console.error('Error while removing cancelledAt column:', error.message);
42
+ }
43
+ });
44
+ exports.down = down;
@@ -0,0 +1,3 @@
1
+ import { QueryInterface } from 'sequelize';
2
+ export declare const up: (queryInterface: QueryInterface) => Promise<void>;
3
+ export declare const down: (queryInterface: QueryInterface) => Promise<void>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.down = exports.up = void 0;
13
+ const sequelize_1 = require("sequelize");
14
+ const TABLE_NAME = 'flight_bookings';
15
+ const TICKETED_EMAIL_SENT_COLUMN = 'ticketedEmailSent';
16
+ const CANCELLED_EMAIL_SENT_COLUMN = 'cancelledEmailSent';
17
+ const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
18
+ const tableDescription = yield queryInterface.describeTable(TABLE_NAME);
19
+ const existingColumns = Object.keys(tableDescription);
20
+ if (!existingColumns.includes(TICKETED_EMAIL_SENT_COLUMN)) {
21
+ yield queryInterface.addColumn(TABLE_NAME, TICKETED_EMAIL_SENT_COLUMN, {
22
+ type: sequelize_1.DataTypes.BOOLEAN,
23
+ allowNull: false,
24
+ defaultValue: false,
25
+ });
26
+ }
27
+ if (!existingColumns.includes(CANCELLED_EMAIL_SENT_COLUMN)) {
28
+ yield queryInterface.addColumn(TABLE_NAME, CANCELLED_EMAIL_SENT_COLUMN, {
29
+ type: sequelize_1.DataTypes.BOOLEAN,
30
+ allowNull: false,
31
+ defaultValue: false,
32
+ });
33
+ }
34
+ });
35
+ exports.up = up;
36
+ const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
37
+ const tableDescription = yield queryInterface.describeTable(TABLE_NAME);
38
+ const existingColumns = Object.keys(tableDescription);
39
+ if (existingColumns.includes(TICKETED_EMAIL_SENT_COLUMN)) {
40
+ yield queryInterface.removeColumn(TABLE_NAME, TICKETED_EMAIL_SENT_COLUMN);
41
+ }
42
+ if (existingColumns.includes(CANCELLED_EMAIL_SENT_COLUMN)) {
43
+ yield queryInterface.removeColumn(TABLE_NAME, CANCELLED_EMAIL_SENT_COLUMN);
44
+ }
45
+ });
46
+ exports.down = down;
@@ -23,6 +23,7 @@ export declare class Booking extends Model<Partial<Booking>> {
23
23
  otpExpiresAt?: Date;
24
24
  cancellationType?: string;
25
25
  lastCancellationDate?: Date;
26
+ cancelledAt?: Date;
26
27
  paymentMethod?: string;
27
28
  refundStatus?: string;
28
29
  source?: string;
@@ -170,6 +170,13 @@ __decorate([
170
170
  }),
171
171
  __metadata("design:type", Date)
172
172
  ], Booking.prototype, "lastCancellationDate", void 0);
173
+ __decorate([
174
+ (0, sequelize_typescript_1.Column)({
175
+ type: sequelize_typescript_1.DataType.DATE,
176
+ allowNull: true,
177
+ }),
178
+ __metadata("design:type", Date)
179
+ ], Booking.prototype, "cancelledAt", void 0);
173
180
  __decorate([
174
181
  (0, sequelize_typescript_1.Column)({
175
182
  type: sequelize_typescript_1.DataType.STRING,
@@ -5,6 +5,8 @@ export declare class FlightBooking extends Model<Partial<FlightBooking>> {
5
5
  bookingId: string;
6
6
  projectId: string;
7
7
  project?: Project;
8
+ ticketedEmailSent: boolean;
9
+ cancelledEmailSent: boolean;
8
10
  createdAt: Date;
9
11
  updatedAt: Date;
10
12
  }
@@ -44,6 +44,22 @@ __decorate([
44
44
  (0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
45
45
  __metadata("design:type", Project_1.Project)
46
46
  ], FlightBooking.prototype, "project", void 0);
47
+ __decorate([
48
+ (0, sequelize_typescript_1.Column)({
49
+ type: sequelize_typescript_1.DataType.BOOLEAN,
50
+ allowNull: false,
51
+ defaultValue: false,
52
+ }),
53
+ __metadata("design:type", Boolean)
54
+ ], FlightBooking.prototype, "ticketedEmailSent", void 0);
55
+ __decorate([
56
+ (0, sequelize_typescript_1.Column)({
57
+ type: sequelize_typescript_1.DataType.BOOLEAN,
58
+ allowNull: false,
59
+ defaultValue: false,
60
+ }),
61
+ __metadata("design:type", Boolean)
62
+ ], FlightBooking.prototype, "cancelledEmailSent", void 0);
47
63
  __decorate([
48
64
  (0, sequelize_typescript_1.Column)({
49
65
  type: sequelize_typescript_1.DataType.DATE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",