whitelabel-db 1.1.80 → 1.1.82
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 +1 -1
- package/dist/libs/liteapiv3.d.ts +9 -5
- package/dist/libs/liteapiv3.js +51 -2
- package/dist/migrations/013-add-bookings-payment.d.ts +3 -0
- package/dist/migrations/013-add-bookings-payment.js +48 -0
- package/dist/models/Booking.d.ts +3 -0
- package/dist/models/Booking.js +21 -0
- package/package.json +1 -1
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,
|
|
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';
|
package/dist/libs/liteapiv3.d.ts
CHANGED
|
@@ -318,7 +318,7 @@ export interface GuestBookingV3 {
|
|
|
318
318
|
updatedAt: string;
|
|
319
319
|
deletedAt: string;
|
|
320
320
|
}
|
|
321
|
-
export interface
|
|
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
|
|
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
|
-
|
|
384
|
-
|
|
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<
|
|
400
|
+
}): Promise<PromoCodeResponse>;
|
|
397
401
|
}
|
package/dist/libs/liteapiv3.js
CHANGED
|
@@ -160,7 +160,8 @@ class LiteApiClientV3 {
|
|
|
160
160
|
})).data.data;
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
|
|
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
|
-
|
|
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)({
|
|
@@ -0,0 +1,48 @@
|
|
|
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 paymentMethod and refundStatus columns to bookings table.
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const columns = [
|
|
16
|
+
{ name: 'paymentMethod', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
17
|
+
{ name: 'paymentProvider', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
18
|
+
{ name: 'refundStatus', type: sequelize_1.DataTypes.STRING, allowNull: true },
|
|
19
|
+
];
|
|
20
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
// Add all columns in parallel
|
|
23
|
+
yield Promise.all(columns.map((column) => queryInterface.addColumn('bookings', column.name, {
|
|
24
|
+
type: column.type,
|
|
25
|
+
allowNull: column.allowNull,
|
|
26
|
+
})));
|
|
27
|
+
console.log('All columns added successfully.');
|
|
28
|
+
console.log('All columns added successfully.');
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('Error while adding columns:', error.message);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
exports.up = up;
|
|
35
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
try {
|
|
37
|
+
// Remove columns
|
|
38
|
+
for (const column of columns.reverse()) {
|
|
39
|
+
console.log(`Removing column: ${column.name}`);
|
|
40
|
+
yield queryInterface.removeColumn('bookings', column.name);
|
|
41
|
+
}
|
|
42
|
+
console.log('All columns removed successfully.');
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error('Error while removing columns:', error.message);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
exports.down = down;
|
package/dist/models/Booking.d.ts
CHANGED
package/dist/models/Booking.js
CHANGED
|
@@ -162,6 +162,27 @@ __decorate([
|
|
|
162
162
|
}),
|
|
163
163
|
__metadata("design:type", Date)
|
|
164
164
|
], Booking.prototype, "lastCancellationDate", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
(0, sequelize_typescript_1.Column)({
|
|
167
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
168
|
+
allowNull: true,
|
|
169
|
+
}),
|
|
170
|
+
__metadata("design:type", String)
|
|
171
|
+
], Booking.prototype, "paymentMethod", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, sequelize_typescript_1.Column)({
|
|
174
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
175
|
+
allowNull: true,
|
|
176
|
+
}),
|
|
177
|
+
__metadata("design:type", String)
|
|
178
|
+
], Booking.prototype, "refundStatus", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
(0, sequelize_typescript_1.Column)({
|
|
181
|
+
type: sequelize_typescript_1.DataType.STRING,
|
|
182
|
+
allowNull: true,
|
|
183
|
+
}),
|
|
184
|
+
__metadata("design:type", String)
|
|
185
|
+
], Booking.prototype, "paymentProvider", void 0);
|
|
165
186
|
exports.Booking = Booking = __decorate([
|
|
166
187
|
(0, sequelize_typescript_1.Table)({
|
|
167
188
|
tableName: 'bookings',
|