whitelabel-db 1.0.10 → 1.0.12

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/README.md CHANGED
@@ -1,25 +1,25 @@
1
- # Whitelabel DB definition
2
-
3
- ### Deploy
4
-
5
- ```bash
6
- npm run build
7
- npm publish
8
- ```
9
-
10
- ### Local testing
11
-
12
- 1. Run below commands to create a tarball from a package.
13
-
14
- ```bash
15
- npm run build
16
- npm pack
17
- ```
18
-
19
- 2. Add tarball path in backend\package.json for whitelabel-db
20
-
21
- ```
22
- "whitelabel-db": "file:path/whitelabel-db/whitelabel-db-1.0.8.tgz"
23
- ```
24
-
25
- 3. Re-run the docker.
1
+ # Whitelabel DB definition
2
+
3
+ ### Deploy
4
+
5
+ ```bash
6
+ npm run build
7
+ npm publish
8
+ ```
9
+
10
+ ### Local testing
11
+
12
+ 1. Run below commands to create a tarball from a package.
13
+
14
+ ```bash
15
+ npm run build
16
+ npm pack
17
+ ```
18
+
19
+ 2. Add tarball path in backend\package.json for whitelabel-db
20
+
21
+ ```
22
+ "whitelabel-db": "file:path/whitelabel-db/whitelabel-db-1.0.8.tgz"
23
+ ```
24
+
25
+ 3. Re-run the docker.
package/dist/index.d.ts CHANGED
@@ -5,4 +5,4 @@ export { Country } from './models/Country';
5
5
  export { Hotel } from './models/Hotel';
6
6
  export { User } from './models/User';
7
7
  export { Project } from './models/Project';
8
- export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, } from './libs/liteapi';
8
+ export { LiteApiClient, HotelsRequest, AvailabilityResult, FullRateAvailabilityResult, RoomType, Rate, PrebookRateRequest, PrebookRate, CheckoutRequest, Booking, } from './libs/liteapi';
@@ -56,10 +56,91 @@ export interface FullRateAvailabilityResult {
56
56
  termsAndConditions: string;
57
57
  roomTypes: RoomType[];
58
58
  }
59
+ export interface PrebookRateRequest {
60
+ rateId: string;
61
+ payWithStripe?: boolean;
62
+ }
63
+ export interface PrebookRate {
64
+ prebookId: string;
65
+ hotelId: string;
66
+ currency: string;
67
+ termsAndConditions: string;
68
+ roomTypes: RoomType[];
69
+ msp: number;
70
+ commission: number;
71
+ price: number;
72
+ priceType: string;
73
+ priceDifferencePercent: number;
74
+ cancellationChanged: boolean;
75
+ boardChanged: boolean;
76
+ supplier: string;
77
+ supplierId: number;
78
+ transactionId: string;
79
+ clientSecret: string;
80
+ }
81
+ export interface GuestInfo {
82
+ guestFirstName: string;
83
+ guestLastName: string;
84
+ guestEmail: string;
85
+ }
86
+ export interface PaymentInfo {
87
+ method: string;
88
+ holderName?: string;
89
+ number?: string;
90
+ expireDate?: string;
91
+ cvc?: string;
92
+ transactionId?: string;
93
+ }
94
+ export interface CheckoutRequest {
95
+ guestInfo: GuestInfo;
96
+ payment: PaymentInfo;
97
+ prebookId: string;
98
+ }
99
+ export interface BookedRoom {
100
+ roomType: {
101
+ name: string;
102
+ };
103
+ adults: number;
104
+ children: number;
105
+ rate: {
106
+ maxOccupancy: number;
107
+ retailRate: RetailRate;
108
+ };
109
+ }
110
+ export interface Booking {
111
+ bookingId: string;
112
+ clientReference: string;
113
+ supplierBookingId: string;
114
+ supplierBookingName: string;
115
+ supplier: string;
116
+ supplierId: number;
117
+ status: string;
118
+ hotelConfirmationCode: string;
119
+ checkin: string;
120
+ checkout: string;
121
+ hotel: {
122
+ hotelId: string;
123
+ name: string;
124
+ };
125
+ bookedRooms: BookedRoom[];
126
+ guestInfo: GuestInfo;
127
+ createdAt: string;
128
+ cancellationPolicies: CancellationPolicies;
129
+ price: number;
130
+ msp: number;
131
+ commission: number;
132
+ currency: string;
133
+ }
134
+ export interface BookingConfirmation {
135
+ prebookId: string;
136
+ transactionId: string;
137
+ }
59
138
  export declare class LiteApiClient {
60
139
  private apiKey;
61
140
  constructor(apiKey: string);
62
141
  getHotels(options: HotelsRequest): Promise<AvailabilityResult[]>;
63
142
  getHotelById(hotelId: string): Promise<AvailabilityResult>;
64
143
  getHotelsFullRate(options: HotelsRequest): Promise<FullRateAvailabilityResult[]>;
144
+ preBookedHotelRate(options: PrebookRateRequest): Promise<PrebookRate>;
145
+ bookHotelRate(options: CheckoutRequest): Promise<Booking>;
65
146
  }
@@ -51,5 +51,31 @@ class LiteApiClient {
51
51
  })).data.data;
52
52
  });
53
53
  }
54
+ preBookedHotelRate(options) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ return (yield (0, axios_1.default)({
57
+ method: 'post',
58
+ url: `${baseUrl}/v2.0/rates/prebook`,
59
+ data: options,
60
+ headers: {
61
+ 'X-API-Key': this.apiKey,
62
+ 'content-type': 'application/json',
63
+ },
64
+ })).data.data;
65
+ });
66
+ }
67
+ bookHotelRate(options) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ return (yield (0, axios_1.default)({
70
+ method: 'post',
71
+ url: `${baseUrl}/v2.0/rates/book`,
72
+ data: options,
73
+ headers: {
74
+ 'X-API-Key': this.apiKey,
75
+ 'content-type': 'application/json',
76
+ },
77
+ })).data.data;
78
+ });
79
+ }
54
80
  }
55
81
  exports.LiteApiClient = LiteApiClient;
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
- {
2
- "name": "whitelabel-db",
3
- "version": "1.0.10",
4
- "description": "",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "start": "node dist/index.js",
9
- "start:dev": "ts-node src/index.ts",
10
- "build": "tsc"
11
- },
12
- "author": "",
13
- "license": "ISC",
14
- "devDependencies": {
15
- "@types/jsonwebtoken": "^9.0.4",
16
- "@types/node": "^20.8.9",
17
- "@types/shuffle-array": "^1.0.3",
18
- "axios": "^1.5.1",
19
- "eslint": "^8.51.0",
20
- "eslint-config-prettier": "^9.0.0",
21
- "eslint-plugin-prettier": "^5.0.1",
22
- "ts-node": "^10.9.1",
23
- "typescript": "^5.2.2"
24
- },
25
- "dependencies": {
26
- "@aws-sdk/client-sqs": "^3.438.0",
27
- "@sentry/node": "^7.74.1",
28
- "@typescript-eslint/eslint-plugin": "^6.8.0",
29
- "@typescript-eslint/parser": "^6.8.0",
30
- "api": "^6.1.1",
31
- "jsonwebtoken": "^9.0.2",
32
- "pg": "^8.11.3",
33
- "pg-hstore": "^2.3.4",
34
- "promise-limit": "^2.7.0",
35
- "reflect-metadata": "^0.1.13",
36
- "sequelize": "^6.33.0",
37
- "sequelize-typescript": "^2.1.5",
38
- "shuffle-array": "^1.0.1",
39
- "sqs-consumer": "^7.4.0"
40
- },
41
- "files": [
42
- "/dist"
43
- ]
44
- }
1
+ {
2
+ "name": "whitelabel-db",
3
+ "version": "1.0.12",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "start": "node dist/index.js",
9
+ "start:dev": "ts-node src/index.ts",
10
+ "build": "tsc"
11
+ },
12
+ "author": "",
13
+ "license": "ISC",
14
+ "devDependencies": {
15
+ "@types/jsonwebtoken": "^9.0.4",
16
+ "@types/node": "^20.8.9",
17
+ "@types/shuffle-array": "^1.0.3",
18
+ "axios": "^1.5.1",
19
+ "eslint": "^8.51.0",
20
+ "eslint-config-prettier": "^9.0.0",
21
+ "eslint-plugin-prettier": "^5.0.1",
22
+ "ts-node": "^10.9.1",
23
+ "typescript": "^5.2.2"
24
+ },
25
+ "dependencies": {
26
+ "@aws-sdk/client-sqs": "^3.438.0",
27
+ "@sentry/node": "^7.74.1",
28
+ "@typescript-eslint/eslint-plugin": "^6.8.0",
29
+ "@typescript-eslint/parser": "^6.8.0",
30
+ "api": "^6.1.1",
31
+ "jsonwebtoken": "^9.0.2",
32
+ "pg": "^8.11.3",
33
+ "pg-hstore": "^2.3.4",
34
+ "promise-limit": "^2.7.0",
35
+ "reflect-metadata": "^0.1.13",
36
+ "sequelize": "^6.33.0",
37
+ "sequelize-typescript": "^2.1.5",
38
+ "shuffle-array": "^1.0.1",
39
+ "sqs-consumer": "^7.4.0"
40
+ },
41
+ "files": [
42
+ "/dist"
43
+ ]
44
+ }