whitelabel-db 1.1.13 → 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, GuestV3, GuestBookingV3, } 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';
@@ -224,10 +224,43 @@ export interface GuestBookingV3 {
224
224
  updatedAt: string;
225
225
  deletedAt: string;
226
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
+ }
227
259
  export declare class LiteApiClientV3 {
228
260
  private apiKey;
229
261
  private baseUrl;
230
262
  private bookingBaseUrl;
263
+ private voucherBaseUrl;
231
264
  constructor(apiKey: string, useProduction?: boolean);
232
265
  getHotels(options: HotelsRequestV3): Promise<AvailabilityResultV3[]>;
233
266
  getHotelById(hotelId: string): Promise<AvailabilityResultV3>;
@@ -238,4 +271,6 @@ export declare class LiteApiClientV3 {
238
271
  getGuests(): Promise<GuestV3[]>;
239
272
  getGuest(guestId: number): Promise<GuestV3>;
240
273
  getGuestBookings(guestId: number): Promise<GuestBookingV3[]>;
274
+ createVoucher(data: VoucherRequest): Promise<VoucherResponse>;
275
+ getVouchers(): Promise<VoucherResponse[]>;
241
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* () {
@@ -126,5 +129,28 @@ class LiteApiClientV3 {
126
129
  })).data.data;
127
130
  });
128
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
+ }
129
155
  }
130
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.13",
3
+ "version": "1.1.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",