whitelabel-db 1.3.4 → 1.3.6
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 +22 -0
- package/dist/libs/liteapiv3.js +25 -0
- package/dist/migrations/034-add-bookings-payment-data.d.ts +3 -0
- package/dist/migrations/034-add-bookings-payment-data.js +45 -0
- package/dist/models/Booking.d.ts +1 -0
- package/dist/models/Booking.js +8 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,5 +30,5 @@ export { LoyaltyProgram } from './models/LoyaltyProgram';
|
|
|
30
30
|
export { LoyaltyProgramTier } from './models/LoyaltyProgramTier';
|
|
31
31
|
export { BookingLoyaltyRecord } from './models/BookingLoyaltyRecord';
|
|
32
32
|
export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, BookingInfo, CancelBooking, } from './libs/liteapi';
|
|
33
|
-
export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, GetHotelRequestV3, HotelDataV3, HotelImageV3, CheckinCheckoutTimesV3, LocationV3, FacilityV3, RoomV3, BedTypeV3, RoomAmenityV3, RoomPhotoV3, PolicyV3, AccessibilityV3, AccessibilityAttributesV3, AccessibilityDisabilitiesV3, AccessibilityDisabilityScoresV3, SentimentAnalysisV3, SentimentCategoryV3, SemanticSearchRequestV3, SemanticSearchHotelV3, ConversationalHotelRequestV3, ConversationalHotelResponseV3, } from './libs/liteapiv3';
|
|
33
|
+
export { LiteApiClientV3, HotelsRequestV3, AvailabilityResultV3, FullRateAvailabilityResultV3, RoomTypeV3, RateV3, PrebookRateRequestV3, PrebookRateV3, CheckoutRequestV3, BookingInfoV3, CancelBookingV3, BookedRoomV3, OccupancyV3, GuestV3, GuestBookingV3, PromoCodeRequest, PromoCodeResponse, EsimplyPackage, Addon, AddonResponse, GetHotelRequestV3, HotelDataV3, HotelImageV3, CheckinCheckoutTimesV3, LocationV3, FacilityV3, RoomV3, BedTypeV3, RoomAmenityV3, RoomPhotoV3, PolicyV3, AccessibilityV3, AccessibilityAttributesV3, AccessibilityDisabilitiesV3, AccessibilityDisabilityScoresV3, SentimentAnalysisV3, SentimentCategoryV3, SemanticSearchRequestV3, SemanticSearchHotelV3, ConversationalHotelRequestV3, ConversationalHotelResponseV3, InitiatePaymentIntentV3, FinalizePaymentRequestV3, FinalizePaymentResponseV3, } from './libs/liteapiv3';
|
|
34
34
|
export { LiteApiUser, LiteApiUserRequest } from './libs/liteapiuser';
|
package/dist/libs/liteapiv3.d.ts
CHANGED
|
@@ -299,6 +299,26 @@ export interface CancelBookingV3 {
|
|
|
299
299
|
refund_amount: number;
|
|
300
300
|
currency: string;
|
|
301
301
|
}
|
|
302
|
+
export interface InitiatePaymentIntentV3 {
|
|
303
|
+
amount: number;
|
|
304
|
+
bookingId: string;
|
|
305
|
+
clientSecret: string;
|
|
306
|
+
currency: string;
|
|
307
|
+
transactionId: string;
|
|
308
|
+
}
|
|
309
|
+
export type FinalizePaymentRequestV3 = {
|
|
310
|
+
method: 'CREDIT';
|
|
311
|
+
} | {
|
|
312
|
+
method: 'THIRD_PARTY';
|
|
313
|
+
token: string;
|
|
314
|
+
} | {
|
|
315
|
+
method: 'TRANSACTION_ID';
|
|
316
|
+
transactionId: string;
|
|
317
|
+
};
|
|
318
|
+
export interface FinalizePaymentResponseV3 {
|
|
319
|
+
bookingId: string;
|
|
320
|
+
paymentStatus: string;
|
|
321
|
+
}
|
|
302
322
|
export interface GuestV3 {
|
|
303
323
|
id: number;
|
|
304
324
|
email: string;
|
|
@@ -623,6 +643,8 @@ export declare class LiteApiClientV3 {
|
|
|
623
643
|
preBookedHotelRate(options: PrebookRateRequestV3): Promise<PrebookRateV3>;
|
|
624
644
|
bookHotelRate(options: CheckoutRequestV3): Promise<BookingInfoV3>;
|
|
625
645
|
cancelBooking(bookingId: string): Promise<CancelBookingV3>;
|
|
646
|
+
initiatePaymentIntent(bookingId: string): Promise<InitiatePaymentIntentV3>;
|
|
647
|
+
finalizePayment(bookingId: string, data: FinalizePaymentRequestV3): Promise<FinalizePaymentResponseV3>;
|
|
626
648
|
getBooking(bookingId: string, key?: string): Promise<BookingInfoV3>;
|
|
627
649
|
getPrebook(prebookId: string, key?: string): Promise<PrebookRateV3>;
|
|
628
650
|
getGuests(): Promise<GuestV3[]>;
|
package/dist/libs/liteapiv3.js
CHANGED
|
@@ -118,6 +118,31 @@ class LiteApiClientV3 {
|
|
|
118
118
|
})).data.data;
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
+
initiatePaymentIntent(bookingId) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
return (yield (0, axios_1.default)({
|
|
124
|
+
method: 'post',
|
|
125
|
+
url: `${this.bookingBaseUrl}/v3.0/bookings/${bookingId}/payments/initiate`,
|
|
126
|
+
headers: {
|
|
127
|
+
'X-API-Key': this.apiKey,
|
|
128
|
+
'content-type': 'application/json',
|
|
129
|
+
},
|
|
130
|
+
})).data.data;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
finalizePayment(bookingId, data) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
return (yield (0, axios_1.default)({
|
|
136
|
+
method: 'post',
|
|
137
|
+
url: `${this.bookingBaseUrl}/v3.0/bookings/${bookingId}/payments`,
|
|
138
|
+
data,
|
|
139
|
+
headers: {
|
|
140
|
+
'X-API-Key': this.apiKey,
|
|
141
|
+
'content-type': 'application/json',
|
|
142
|
+
},
|
|
143
|
+
})).data.data;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
121
146
|
getBooking(bookingId, key) {
|
|
122
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
148
|
return (yield (0, axios_1.default)({
|
|
@@ -0,0 +1,45 @@
|
|
|
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 paymentData column to bookings table.
|
|
14
|
+
const sequelize_1 = require("sequelize");
|
|
15
|
+
const up = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
const tableDescription = yield queryInterface.describeTable('bookings');
|
|
18
|
+
const existingColumns = Object.keys(tableDescription);
|
|
19
|
+
if (existingColumns.includes('paymentData')) {
|
|
20
|
+
console.log('paymentData column already exists, skipping migration.');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
yield queryInterface.addColumn('bookings', 'paymentData', {
|
|
24
|
+
type: sequelize_1.DataTypes.JSONB,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
defaultValue: {},
|
|
27
|
+
});
|
|
28
|
+
console.log('paymentData column added successfully.');
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('Error while adding paymentData column:', error.message);
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
exports.up = up;
|
|
36
|
+
const down = (queryInterface) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
try {
|
|
38
|
+
yield queryInterface.removeColumn('bookings', 'paymentData');
|
|
39
|
+
console.log('paymentData column removed successfully.');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Error while removing paymentData column:', error.message);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
exports.down = down;
|
package/dist/models/Booking.d.ts
CHANGED
package/dist/models/Booking.js
CHANGED
|
@@ -59,6 +59,14 @@ __decorate([
|
|
|
59
59
|
}),
|
|
60
60
|
__metadata("design:type", Object)
|
|
61
61
|
], Booking.prototype, "bookingInputData", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, sequelize_typescript_1.Column)({
|
|
64
|
+
type: sequelize_typescript_1.DataType.JSONB,
|
|
65
|
+
allowNull: false,
|
|
66
|
+
defaultValue: {},
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], Booking.prototype, "paymentData", void 0);
|
|
62
70
|
__decorate([
|
|
63
71
|
(0, sequelize_typescript_1.ForeignKey)(() => Project_1.Project),
|
|
64
72
|
sequelize_typescript_1.Index,
|