whitelabel-db 1.1.12 → 1.1.14

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
@@ -11,5 +11,5 @@ export { HotelTranslation } from './models/HotelTranslation';
11
11
  export { Guest } from './models/Guest';
12
12
  export { HotelAccessibility } from './models/HotelAccessibility';
13
13
  export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
14
- export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, } from './libs/liteapiv3';
14
+ export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, VoucherRequest, VoucherResponse, } from './libs/liteapiv3';
15
15
  export { LiteApiUser, LiteApiUserRequest } from './libs/liteapiuser';
@@ -201,10 +201,66 @@ export interface CancelBookingV3 {
201
201
  refund_amount: number;
202
202
  currency: string;
203
203
  }
204
+ export interface GuestV3 {
205
+ id: number;
206
+ email: string;
207
+ firstName: string;
208
+ lastName: string;
209
+ phoneNumber: string;
210
+ points: number;
211
+ bookings: string[];
212
+ createdAt: string;
213
+ updatedAt: string;
214
+ deletedAt: string;
215
+ }
216
+ export interface GuestBookingV3 {
217
+ id: number;
218
+ guestID: number;
219
+ bookingID: string;
220
+ points: number;
221
+ cashbackRateUsed: number;
222
+ expirationDate: string;
223
+ createdAt: string;
224
+ updatedAt: string;
225
+ deletedAt: string;
226
+ }
227
+ export interface VoucherResponse {
228
+ id: number;
229
+ voucher_code: string;
230
+ discount_type: string;
231
+ discount_value: number;
232
+ minimum_spend: number;
233
+ maximum_discount_amount: number;
234
+ currency: string;
235
+ validity_start: string;
236
+ validity_end: string;
237
+ usages_limit: number;
238
+ status: string;
239
+ created_at: string;
240
+ updated_at: string;
241
+ deleted_at: string | null;
242
+ user_id: number;
243
+ terms_and_conditions: string | null;
244
+ }
245
+ export interface VoucherRequest {
246
+ voucher_code: string;
247
+ discount_type: string;
248
+ discount_value: number;
249
+ minimum_spend: number;
250
+ maximum_discount_amount: number;
251
+ currency: string;
252
+ validity_start: string;
253
+ validity_end: string;
254
+ usages_limit: number;
255
+ status: string;
256
+ user_id: number;
257
+ terms_and_conditions: string | null;
258
+ }
204
259
  export declare class LiteApiClientV3 {
205
260
  private apiKey;
206
261
  private baseUrl;
207
262
  private bookingBaseUrl;
263
+ private voucherBaseUrl;
208
264
  constructor(apiKey: string, useProduction?: boolean);
209
265
  getHotels(options: HotelsRequestV3): Promise<AvailabilityResultV3[]>;
210
266
  getHotelById(hotelId: string): Promise<AvailabilityResultV3>;
@@ -212,4 +268,9 @@ export declare class LiteApiClientV3 {
212
268
  preBookedHotelRate(options: PrebookRateRequestV3): Promise<PrebookRateV3>;
213
269
  bookHotelRate(options: CheckoutRequestV3): Promise<BookingInfoV3>;
214
270
  cancelBooking(bookingId: string): Promise<CancelBookingV3>;
271
+ getGuests(): Promise<GuestV3[]>;
272
+ getGuest(guestId: number): Promise<GuestV3>;
273
+ getGuestBookings(guestId: number): Promise<GuestBookingV3[]>;
274
+ createVoucher(data: VoucherRequest): Promise<VoucherResponse>;
275
+ getVouchers(): Promise<VoucherResponse[]>;
215
276
  }
@@ -23,6 +23,9 @@ class LiteApiClientV3 {
23
23
  this.bookingBaseUrl = useProduction
24
24
  ? 'https://book.liteapi.travel'
25
25
  : 'https://book.dev.liteapi.travel';
26
+ this.voucherBaseUrl = useProduction
27
+ ? 'https://da.liteapi.travel'
28
+ : 'https://da.dev.liteapi.travel';
26
29
  }
27
30
  getHotels(options) {
28
31
  return __awaiter(this, void 0, void 0, function* () {
@@ -96,5 +99,58 @@ class LiteApiClientV3 {
96
99
  })).data.data;
97
100
  });
98
101
  }
102
+ getGuests() {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ return (yield (0, axios_1.default)({
105
+ url: `${this.baseUrl}/v3.0/guests`,
106
+ headers: {
107
+ 'X-API-Key': this.apiKey,
108
+ },
109
+ })).data.data;
110
+ });
111
+ }
112
+ getGuest(guestId) {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ return (yield (0, axios_1.default)({
115
+ url: `${this.baseUrl}/v3.0/guests/${guestId}`,
116
+ headers: {
117
+ 'X-API-Key': this.apiKey,
118
+ },
119
+ })).data.data;
120
+ });
121
+ }
122
+ getGuestBookings(guestId) {
123
+ return __awaiter(this, void 0, void 0, function* () {
124
+ return (yield (0, axios_1.default)({
125
+ url: `${this.baseUrl}/v3.0/guests/${guestId}/bookings`,
126
+ headers: {
127
+ 'X-API-Key': this.apiKey,
128
+ },
129
+ })).data.data;
130
+ });
131
+ }
132
+ createVoucher(data) {
133
+ return __awaiter(this, void 0, void 0, function* () {
134
+ return (yield (0, axios_1.default)({
135
+ method: 'post',
136
+ url: `${this.voucherBaseUrl}/vouchers`,
137
+ data,
138
+ headers: {
139
+ 'X-API-Key': this.apiKey,
140
+ 'content-type': 'application/json',
141
+ },
142
+ })).data.voucher;
143
+ });
144
+ }
145
+ getVouchers() {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ return (yield (0, axios_1.default)({
148
+ url: `${this.voucherBaseUrl}/vouchers`,
149
+ headers: {
150
+ 'X-API-Key': this.apiKey,
151
+ },
152
+ })).data.vouchers;
153
+ });
154
+ }
99
155
  }
100
156
  exports.LiteApiClientV3 = LiteApiClientV3;
@@ -1,5 +1,6 @@
1
1
  import { Model } from 'sequelize-typescript';
2
2
  import { Project } from './Project';
3
+ import { VoucherResponse } from '../libs/liteapiv3';
3
4
  export declare class Guest extends Model<Partial<Guest>> {
4
5
  id: string;
5
6
  firstName: string;
@@ -11,6 +12,7 @@ export declare class Guest extends Model<Partial<Guest>> {
11
12
  socialId: string;
12
13
  socialProvider: string;
13
14
  isVerified: boolean;
15
+ vouchers: VoucherResponse[];
14
16
  project?: Project;
15
17
  static checkEmail(email: string, projectId: string): Promise<void>;
16
18
  generateSession(secret: string): string;
@@ -116,6 +116,13 @@ __decorate([
116
116
  }),
117
117
  __metadata("design:type", Boolean)
118
118
  ], Guest.prototype, "isVerified", void 0);
119
+ __decorate([
120
+ (0, sequelize_typescript_1.Column)({
121
+ type: sequelize_typescript_1.DataType.ARRAY(sequelize_typescript_1.DataType.JSONB),
122
+ allowNull: true,
123
+ }),
124
+ __metadata("design:type", Array)
125
+ ], Guest.prototype, "vouchers", void 0);
119
126
  __decorate([
120
127
  (0, sequelize_typescript_1.BelongsTo)(() => Project_1.Project),
121
128
  __metadata("design:type", Project_1.Project)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",