whitelabel-db 1.0.16 → 1.0.18

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
@@ -5,5 +5,5 @@ export { Country } from './models/Country';
5
5
  export { Hotel } from './models/Hotel';
6
6
  export { User } from './models/User';
7
7
  export { Project } from './models/Project';
8
- export { Search } from './models/Search';
9
- export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, } from './libs/liteapi';
8
+ export { Booking } from './models/Booking';
9
+ export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, } from './libs/liteapi';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LiteApiClient = exports.Search = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = exports.connect = void 0;
3
+ exports.LiteApiClient = exports.Booking = exports.Project = exports.User = exports.Hotel = exports.Country = exports.City = exports.Agency = exports.connect = void 0;
4
4
  var database_1 = require("./libs/database");
5
5
  Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return database_1.connect; } });
6
6
  var Agency_1 = require("./models/Agency");
@@ -15,7 +15,7 @@ var User_1 = require("./models/User");
15
15
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return User_1.User; } });
16
16
  var Project_1 = require("./models/Project");
17
17
  Object.defineProperty(exports, "Project", { enumerable: true, get: function () { return Project_1.Project; } });
18
- var Search_1 = require("./models/Search");
19
- Object.defineProperty(exports, "Search", { enumerable: true, get: function () { return Search_1.Search; } });
18
+ var Booking_1 = require("./models/Booking");
19
+ Object.defineProperty(exports, "Booking", { enumerable: true, get: function () { return Booking_1.Booking; } });
20
20
  var liteapi_1 = require("./libs/liteapi");
21
21
  Object.defineProperty(exports, "LiteApiClient", { enumerable: true, get: function () { return liteapi_1.LiteApiClient; } });
@@ -17,7 +17,7 @@ const Project_1 = require("../models/Project");
17
17
  const Hotel_1 = require("../models/Hotel");
18
18
  const City_1 = require("../models/City");
19
19
  const Country_1 = require("../models/Country");
20
- const Search_1 = require("../models/Search");
20
+ const Booking_1 = require("../models/Booking");
21
21
  const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, function* () {
22
22
  const connection = new sequelize_typescript_1.Sequelize({
23
23
  dialect: 'postgres',
@@ -26,7 +26,7 @@ const connect = (connectionDetails) => __awaiter(void 0, void 0, void 0, functio
26
26
  password: connectionDetails.password,
27
27
  database: connectionDetails.dbname,
28
28
  logging: false,
29
- models: [User_1.User, Agency_1.Agency, Project_1.Project, Hotel_1.Hotel, City_1.City, Country_1.Country, Search_1.Search],
29
+ models: [User_1.User, Agency_1.Agency, Project_1.Project, Hotel_1.Hotel, City_1.City, Country_1.Country, Booking_1.Booking],
30
30
  });
31
31
  return connection
32
32
  .authenticate()
@@ -56,10 +56,91 @@ export interface FullRateAvailabilityResult {
56
56
  termsAndConditions: string;
57
57
  roomTypes: RoomType[];
58
58
  }
59
+ export interface PrebookRateRequest {
60
+ rateId: string;
61
+ payWithStripe?: boolean;
62
+ }
63
+ export interface PrebookRate {
64
+ prebookId: string;
65
+ hotelId: string;
66
+ currency: string;
67
+ termsAndConditions: string;
68
+ roomTypes: RoomType[];
69
+ msp: number;
70
+ commission: number;
71
+ price: number;
72
+ priceType: string;
73
+ priceDifferencePercent: number;
74
+ cancellationChanged: boolean;
75
+ boardChanged: boolean;
76
+ supplier: string;
77
+ supplierId: number;
78
+ transactionId: string;
79
+ clientSecret: string;
80
+ }
81
+ export interface GuestInfo {
82
+ guestFirstName: string;
83
+ guestLastName: string;
84
+ guestEmail: string;
85
+ }
86
+ export interface PaymentInfo {
87
+ method: string;
88
+ holderName?: string;
89
+ number?: string;
90
+ expireDate?: string;
91
+ cvc?: string;
92
+ transactionId?: string;
93
+ }
94
+ export interface CheckoutRequest {
95
+ guestInfo: GuestInfo;
96
+ payment: PaymentInfo;
97
+ prebookId: string;
98
+ }
99
+ export interface BookedRoom {
100
+ roomType: {
101
+ name: string;
102
+ };
103
+ adults: number;
104
+ children: number;
105
+ rate: {
106
+ maxOccupancy: number;
107
+ retailRate: RetailRate;
108
+ };
109
+ }
110
+ export interface BookingInfo {
111
+ bookingId: string;
112
+ clientReference: string;
113
+ supplierBookingId: string;
114
+ supplierBookingName: string;
115
+ supplier: string;
116
+ supplierId: number;
117
+ status: string;
118
+ hotelConfirmationCode: string;
119
+ checkin: string;
120
+ checkout: string;
121
+ hotel: {
122
+ hotelId: string;
123
+ name: string;
124
+ };
125
+ bookedRooms: BookedRoom[];
126
+ guestInfo: GuestInfo;
127
+ createdAt: string;
128
+ cancellationPolicies: CancellationPolicies;
129
+ price: number;
130
+ msp: number;
131
+ commission: number;
132
+ currency: string;
133
+ }
134
+ export interface BookingConfirmation {
135
+ prebookId: string;
136
+ transactionId: string;
137
+ }
59
138
  export declare class LiteApiClient {
60
139
  private apiKey;
61
140
  constructor(apiKey: string);
62
141
  getHotels(options: HotelsRequest): Promise<AvailabilityResult[]>;
63
142
  getHotelById(hotelId: string): Promise<AvailabilityResult>;
64
143
  getHotelsFullRate(options: HotelsRequest): Promise<FullRateAvailabilityResult[]>;
144
+ preBookedHotelRate(options: PrebookRateRequest): Promise<PrebookRate>;
145
+ bookHotelRate(options: CheckoutRequest): Promise<BookingInfo>;
65
146
  }
@@ -51,5 +51,31 @@ class LiteApiClient {
51
51
  })).data.data;
52
52
  });
53
53
  }
54
+ preBookedHotelRate(options) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ return (yield (0, axios_1.default)({
57
+ method: 'post',
58
+ url: `${baseUrl}/v2.0/rates/prebook`,
59
+ data: options,
60
+ headers: {
61
+ 'X-API-Key': this.apiKey,
62
+ 'content-type': 'application/json',
63
+ },
64
+ })).data.data;
65
+ });
66
+ }
67
+ bookHotelRate(options) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ return (yield (0, axios_1.default)({
70
+ method: 'post',
71
+ url: `${baseUrl}/v2.0/rates/book`,
72
+ data: options,
73
+ headers: {
74
+ 'X-API-Key': this.apiKey,
75
+ 'content-type': 'application/json',
76
+ },
77
+ })).data.data;
78
+ });
79
+ }
54
80
  }
55
81
  exports.LiteApiClient = LiteApiClient;
@@ -0,0 +1,9 @@
1
+ import { Model } from 'sequelize-typescript';
2
+ export declare class Booking extends Model<Partial<Booking>> {
3
+ id: string;
4
+ prebookId: string;
5
+ liteApiPrebookData?: object;
6
+ liteApiBookingData?: object;
7
+ bookingInputData?: object;
8
+ projectId?: string;
9
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Booking = void 0;
13
+ const sequelize_typescript_1 = require("sequelize-typescript");
14
+ let Booking = class Booking extends sequelize_typescript_1.Model {
15
+ };
16
+ exports.Booking = Booking;
17
+ __decorate([
18
+ (0, sequelize_typescript_1.IsUUID)(4),
19
+ sequelize_typescript_1.PrimaryKey,
20
+ (0, sequelize_typescript_1.Column)({
21
+ type: sequelize_typescript_1.DataType.UUID,
22
+ defaultValue: sequelize_typescript_1.DataType.UUIDV4,
23
+ }),
24
+ __metadata("design:type", String)
25
+ ], Booking.prototype, "id", void 0);
26
+ __decorate([
27
+ sequelize_typescript_1.Unique,
28
+ sequelize_typescript_1.Index,
29
+ (0, sequelize_typescript_1.Column)({
30
+ type: sequelize_typescript_1.DataType.STRING,
31
+ allowNull: false,
32
+ defaultValue: 0,
33
+ }),
34
+ __metadata("design:type", String)
35
+ ], Booking.prototype, "prebookId", void 0);
36
+ __decorate([
37
+ (0, sequelize_typescript_1.Column)({
38
+ type: sequelize_typescript_1.DataType.JSONB,
39
+ allowNull: false,
40
+ defaultValue: {},
41
+ }),
42
+ __metadata("design:type", Object)
43
+ ], Booking.prototype, "liteApiPrebookData", void 0);
44
+ __decorate([
45
+ (0, sequelize_typescript_1.Column)({
46
+ type: sequelize_typescript_1.DataType.JSONB,
47
+ allowNull: false,
48
+ defaultValue: {},
49
+ }),
50
+ __metadata("design:type", Object)
51
+ ], Booking.prototype, "liteApiBookingData", void 0);
52
+ __decorate([
53
+ (0, sequelize_typescript_1.Column)({
54
+ type: sequelize_typescript_1.DataType.JSONB,
55
+ allowNull: false,
56
+ defaultValue: {},
57
+ }),
58
+ __metadata("design:type", Object)
59
+ ], Booking.prototype, "bookingInputData", void 0);
60
+ __decorate([
61
+ (0, sequelize_typescript_1.Column)({
62
+ type: sequelize_typescript_1.DataType.UUID,
63
+ allowNull: false,
64
+ }),
65
+ __metadata("design:type", String)
66
+ ], Booking.prototype, "projectId", void 0);
67
+ exports.Booking = Booking = __decorate([
68
+ (0, sequelize_typescript_1.Table)({
69
+ tableName: 'booking',
70
+ })
71
+ ], Booking);
@@ -28,4 +28,43 @@ export declare class Hotel extends Model<Partial<Hotel>> {
28
28
  hotelImages: HotelImage[];
29
29
  hotelFacilities: string[];
30
30
  rate: AvailabilityResult;
31
+ phone: string;
32
+ rating: number;
33
+ facilities: {
34
+ id: number;
35
+ name: string;
36
+ }[];
37
+ policies: {
38
+ type: string;
39
+ name: string;
40
+ description: string;
41
+ }[];
42
+ rooms: {
43
+ id: number;
44
+ name: string;
45
+ description: string;
46
+ size: number;
47
+ adults: number;
48
+ children: number;
49
+ occupancy: number;
50
+ photos: {
51
+ url: string;
52
+ caption: string;
53
+ }[];
54
+ room_amenities: {
55
+ id: number;
56
+ name: string;
57
+ }[];
58
+ }[];
59
+ reviewsCount: number;
60
+ reviews: {
61
+ average_score: number;
62
+ name: string;
63
+ date: string;
64
+ headline: string;
65
+ language: string;
66
+ country: string;
67
+ pros: string;
68
+ cons: string;
69
+ }[];
31
70
  }
@@ -127,6 +127,57 @@ __decorate([
127
127
  }),
128
128
  __metadata("design:type", Array)
129
129
  ], Hotel.prototype, "hotelFacilities", void 0);
130
+ __decorate([
131
+ (0, sequelize_typescript_1.Column)({
132
+ type: sequelize_typescript_1.DataType.STRING(32),
133
+ allowNull: false,
134
+ }),
135
+ __metadata("design:type", String)
136
+ ], Hotel.prototype, "phone", void 0);
137
+ __decorate([
138
+ (0, sequelize_typescript_1.Column)({
139
+ type: sequelize_typescript_1.DataType.INTEGER,
140
+ allowNull: false,
141
+ defaultValue: 0,
142
+ }),
143
+ __metadata("design:type", Number)
144
+ ], Hotel.prototype, "rating", void 0);
145
+ __decorate([
146
+ (0, sequelize_typescript_1.Column)({
147
+ type: sequelize_typescript_1.DataType.JSONB,
148
+ allowNull: true,
149
+ }),
150
+ __metadata("design:type", Array)
151
+ ], Hotel.prototype, "facilities", void 0);
152
+ __decorate([
153
+ (0, sequelize_typescript_1.Column)({
154
+ type: sequelize_typescript_1.DataType.JSONB,
155
+ allowNull: true,
156
+ }),
157
+ __metadata("design:type", Array)
158
+ ], Hotel.prototype, "policies", void 0);
159
+ __decorate([
160
+ (0, sequelize_typescript_1.Column)({
161
+ type: sequelize_typescript_1.DataType.JSONB,
162
+ allowNull: true,
163
+ }),
164
+ __metadata("design:type", Array)
165
+ ], Hotel.prototype, "rooms", void 0);
166
+ __decorate([
167
+ (0, sequelize_typescript_1.Column)({
168
+ type: sequelize_typescript_1.DataType.INTEGER,
169
+ allowNull: false,
170
+ defaultValue: 0,
171
+ }),
172
+ __metadata("design:type", Number)
173
+ ], Hotel.prototype, "reviewsCount", void 0);
174
+ __decorate([
175
+ (0, sequelize_typescript_1.Column)({
176
+ type: sequelize_typescript_1.DataType.JSONB,
177
+ allowNull: true,
178
+ }),
179
+ __metadata("design:type", Array)
180
+ ], Hotel.prototype, "reviews", void 0);
130
181
  exports.Hotel = Hotel = __decorate([
131
182
  (0, sequelize_typescript_1.Table)({
132
183
  tableName: 'static_hotels',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",