whitelabel-db 1.1.80 → 1.1.81

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
@@ -15,5 +15,5 @@ export { Referral } from './models/Referral';
15
15
  export { Feedback } from './models/Feedback';
16
16
  export { HotelRate } from './models/HotelRate';
17
17
  export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
18
- export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, VoucherRequest, VoucherResponse, EsimplyPackage, Addon, AddonResponse, } from './libs/liteapiv3';
18
+ export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, } from './libs/liteapiv3';
19
19
  export { LiteApiUser, LiteApiUserRequest } from './libs/liteapiuser';
@@ -318,7 +318,7 @@ export interface GuestBookingV3 {
318
318
  updatedAt: string;
319
319
  deletedAt: string;
320
320
  }
321
- export interface VoucherResponse {
321
+ export interface PromoCodeResponse {
322
322
  id: number;
323
323
  voucher_code: string;
324
324
  discount_type: string;
@@ -337,7 +337,7 @@ export interface VoucherResponse {
337
337
  terms_and_conditions: string | null;
338
338
  category?: string;
339
339
  }
340
- export interface VoucherRequest {
340
+ export interface PromoCodeRequest {
341
341
  voucher_code: string;
342
342
  discount_type: string;
343
343
  discount_value: number;
@@ -380,8 +380,12 @@ export declare class LiteApiClientV3 {
380
380
  getGuests(): Promise<GuestV3[]>;
381
381
  getGuest(guestId: number): Promise<GuestV3>;
382
382
  getGuestBookings(guestId: number): Promise<GuestBookingV3[]>;
383
- createVoucher(data: VoucherRequest): Promise<VoucherResponse>;
384
- getVouchers(): Promise<VoucherResponse[]>;
383
+ createPromoCode(data: PromoCodeRequest): Promise<PromoCodeResponse>;
384
+ getPromoCodes(): Promise<PromoCodeResponse[]>;
385
+ updatePromoCode(data: PromoCodeRequest, promoCodeId: number): Promise<string>;
386
+ getPromoCode(promoCodeId: number): Promise<PromoCodeResponse>;
387
+ updatePromoCodeStatus(promoCodeId: number, status: 'active' | 'inactive'): Promise<string>;
388
+ deletePromoCode(promoCodeId: number): Promise<string>;
385
389
  getEsimplyPackages(options: {
386
390
  countryCode: string;
387
391
  }): Promise<EsimplyPackage[]>;
@@ -393,5 +397,5 @@ export declare class LiteApiClientV3 {
393
397
  points: number;
394
398
  currency: string;
395
399
  guestId: number;
396
- }): Promise<VoucherResponse>;
400
+ }): Promise<PromoCodeResponse>;
397
401
  }
@@ -160,7 +160,8 @@ class LiteApiClientV3 {
160
160
  })).data.data;
161
161
  });
162
162
  }
163
- createVoucher(data) {
163
+ // VOUCHERS STARTS HERE
164
+ createPromoCode(data) {
164
165
  return __awaiter(this, void 0, void 0, function* () {
165
166
  return (yield (0, axios_1.default)({
166
167
  method: 'post',
@@ -173,7 +174,7 @@ class LiteApiClientV3 {
173
174
  })).data.voucher;
174
175
  });
175
176
  }
176
- getVouchers() {
177
+ getPromoCodes() {
177
178
  return __awaiter(this, void 0, void 0, function* () {
178
179
  return (yield (0, axios_1.default)({
179
180
  url: `${this.voucherBaseUrl}/vouchers`,
@@ -183,6 +184,54 @@ class LiteApiClientV3 {
183
184
  })).data.vouchers;
184
185
  });
185
186
  }
187
+ updatePromoCode(data, promoCodeId) {
188
+ return __awaiter(this, void 0, void 0, function* () {
189
+ return (yield (0, axios_1.default)({
190
+ method: 'put',
191
+ url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}`,
192
+ data,
193
+ headers: {
194
+ 'X-API-Key': this.apiKey,
195
+ 'content-type': 'application/json',
196
+ },
197
+ })).data.message;
198
+ });
199
+ }
200
+ getPromoCode(promoCodeId) {
201
+ return __awaiter(this, void 0, void 0, function* () {
202
+ return (yield (0, axios_1.default)({
203
+ url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}`,
204
+ headers: {
205
+ 'X-API-Key': this.apiKey,
206
+ },
207
+ })).data.voucher;
208
+ });
209
+ }
210
+ updatePromoCodeStatus(promoCodeId, status) {
211
+ return __awaiter(this, void 0, void 0, function* () {
212
+ return (yield (0, axios_1.default)({
213
+ method: 'put',
214
+ url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}/status`,
215
+ data: { status },
216
+ headers: {
217
+ 'X-API-Key': this.apiKey,
218
+ 'content-type': 'application/json',
219
+ },
220
+ })).data.message;
221
+ });
222
+ }
223
+ deletePromoCode(promoCodeId) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ return (yield (0, axios_1.default)({
226
+ method: 'delete',
227
+ url: `${this.voucherBaseUrl}/vouchers/${promoCodeId}`,
228
+ headers: {
229
+ 'X-API-Key': this.apiKey,
230
+ },
231
+ })).data.message;
232
+ });
233
+ }
234
+ // VOUCHERS ENDS HERE
186
235
  getEsimplyPackages(options) {
187
236
  return __awaiter(this, void 0, void 0, function* () {
188
237
  return (yield (0, axios_1.default)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whitelabel-db",
3
- "version": "1.1.80",
3
+ "version": "1.1.81",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",