@vulog/aima-booking 1.2.33 → 1.2.35
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 +103 -0
- package/dist/index.cjs +82 -6
- package/dist/index.d.cts +125 -1
- package/dist/index.d.mts +125 -1
- package/dist/index.mjs +77 -7
- package/package.json +3 -3
- package/src/getAdditionalDrivers.test.ts +61 -0
- package/src/getAdditionalDrivers.ts +23 -0
- package/src/getAvailableVehicles.test.ts +53 -0
- package/src/getBookingRequest.test.ts +72 -1
- package/src/getBookingRequest.ts +15 -1
- package/src/getDigitalContracts.test.ts +72 -0
- package/src/getDigitalContracts.ts +26 -0
- package/src/getSlaves.test.ts +60 -0
- package/src/getSlaves.ts +24 -0
- package/src/getSubscriptionsByUserId.test.ts +96 -0
- package/src/getSubscriptionsByUserId.ts +27 -0
- package/src/index.ts +11 -1
- package/src/submitCancellationRequest.test.ts +81 -0
- package/src/submitCancellationRequest.ts +38 -0
- package/src/types.ts +117 -0
package/README.md
CHANGED
|
@@ -139,6 +139,109 @@ Get a specific station by ID.
|
|
|
139
139
|
const station = await getStationById(client, 'station-id-here', ['OPEN_HOUR', 'INFO']);
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
+
### Vehicle Allocation
|
|
143
|
+
|
|
144
|
+
#### allocateVehicle
|
|
145
|
+
|
|
146
|
+
Allocate a vehicle to a booking request.
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
import { allocateVehicle } from '@vulog/aima-booking';
|
|
150
|
+
|
|
151
|
+
const result = await allocateVehicle(client, 'booking-request-uuid', 'vehicle-uuid', 'service-uuid');
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### deallocateVehicle
|
|
155
|
+
|
|
156
|
+
Deallocate a vehicle from a booking request.
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
import { deallocateVehicle } from '@vulog/aima-booking';
|
|
160
|
+
|
|
161
|
+
await deallocateVehicle(client, 'booking-request-uuid');
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Booking Actions
|
|
165
|
+
|
|
166
|
+
#### updateScheduleBooking
|
|
167
|
+
|
|
168
|
+
Update a scheduled booking.
|
|
169
|
+
|
|
170
|
+
```javascript
|
|
171
|
+
import { updateScheduleBooking } from '@vulog/aima-booking';
|
|
172
|
+
|
|
173
|
+
await updateScheduleBooking(client, 'booking-request-uuid', { endDate: '2024-02-15T00:00:00Z' });
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### cancelBookingRequest
|
|
177
|
+
|
|
178
|
+
Cancel a booking request.
|
|
179
|
+
|
|
180
|
+
```javascript
|
|
181
|
+
import { cancelBookingRequest } from '@vulog/aima-booking';
|
|
182
|
+
|
|
183
|
+
await cancelBookingRequest(client, 'booking-request-uuid');
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### triggerBRPayment / releaseBRPayment
|
|
187
|
+
|
|
188
|
+
Trigger or release payment for a booking request.
|
|
189
|
+
|
|
190
|
+
```javascript
|
|
191
|
+
import { triggerBRPayment, releaseBRPayment } from '@vulog/aima-booking';
|
|
192
|
+
|
|
193
|
+
await triggerBRPayment(client, 'booking-request-uuid');
|
|
194
|
+
await releaseBRPayment(client, 'booking-request-uuid');
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### getBookingRequestsByUserId
|
|
198
|
+
|
|
199
|
+
Get booking requests for a specific user.
|
|
200
|
+
|
|
201
|
+
```javascript
|
|
202
|
+
import { getBookingRequestsByUserId } from '@vulog/aima-booking';
|
|
203
|
+
|
|
204
|
+
const requests = await getBookingRequestsByUserId(client, 'user-uuid');
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Subscriptions
|
|
208
|
+
|
|
209
|
+
#### createSubscription
|
|
210
|
+
|
|
211
|
+
Create a new subscription booking request.
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
import { createSubscription } from '@vulog/aima-booking';
|
|
215
|
+
|
|
216
|
+
const subscription = await createSubscription(client, {
|
|
217
|
+
userId: 'user-uuid',
|
|
218
|
+
profileId: 'profile-uuid',
|
|
219
|
+
startDate: '2024-01-15T00:00:00Z',
|
|
220
|
+
endDate: '2024-07-15T00:00:00Z',
|
|
221
|
+
vehicleId: 'vehicle-uuid',
|
|
222
|
+
modelId: 372,
|
|
223
|
+
station: 'station-uuid',
|
|
224
|
+
serviceId: 'service-uuid',
|
|
225
|
+
// optional fields
|
|
226
|
+
pricingId: 'pricing-uuid',
|
|
227
|
+
notes: 'VIP client',
|
|
228
|
+
isRollingContract: false,
|
|
229
|
+
additionalDriverInvitations: ['driver@example.com'],
|
|
230
|
+
});
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Available Vehicles
|
|
234
|
+
|
|
235
|
+
#### getAvailableVehicles
|
|
236
|
+
|
|
237
|
+
Get available vehicles for booking.
|
|
238
|
+
|
|
239
|
+
```javascript
|
|
240
|
+
import { getAvailableVehicles } from '@vulog/aima-booking';
|
|
241
|
+
|
|
242
|
+
const vehicles = await getAvailableVehicles(client);
|
|
243
|
+
```
|
|
244
|
+
|
|
142
245
|
## Types
|
|
143
246
|
|
|
144
247
|
### BookingRequest
|
package/dist/index.cjs
CHANGED
|
@@ -172,6 +172,11 @@ const getSubscriptionBookingRequestById = async (client, id) => {
|
|
|
172
172
|
...data
|
|
173
173
|
}));
|
|
174
174
|
};
|
|
175
|
+
const getScheduledBookingById = async (client, bookingId) => {
|
|
176
|
+
const result = zod.z.string().trim().min(1).uuid().safeParse(bookingId);
|
|
177
|
+
if (!result.success) throw new TypeError("Invalid bookingId", { cause: result.error.issues });
|
|
178
|
+
return client.get(`/boapi/proxy/user/scheduledBooking/by-service/fleets/${client.clientOptions.fleetId}/bookingrequests/${bookingId}`).then(({ data }) => data);
|
|
179
|
+
};
|
|
175
180
|
//#endregion
|
|
176
181
|
//#region src/getAvailableVehicles.ts
|
|
177
182
|
/** ISO date-time without milliseconds (e.g. 2025-02-10T12:00:00Z or 2025-02-10T12:00:00+01:00). */
|
|
@@ -352,7 +357,7 @@ const deallocateVehicle = async (client, bookingRequestId, vehicleId) => {
|
|
|
352
357
|
};
|
|
353
358
|
//#endregion
|
|
354
359
|
//#region src/updateScheduleBooking.ts
|
|
355
|
-
const schema$
|
|
360
|
+
const schema$7 = zod.default.object({
|
|
356
361
|
id: zod.default.string(),
|
|
357
362
|
startDate: zod.default.string().refine((date) => !Number.isNaN(Date.parse(date)), { message: "Invalid date" }).optional(),
|
|
358
363
|
latitude: zod.default.number().min(-90).max(90).optional(),
|
|
@@ -374,7 +379,7 @@ const schema$2 = zod.default.object({
|
|
|
374
379
|
plannedReturnDate: zod.default.string().refine((date) => !Number.isNaN(Date.parse(date)), { message: "Invalid date" }).optional()
|
|
375
380
|
});
|
|
376
381
|
const updateScheduleBooking = async (client, bookingRequestId, updateData) => {
|
|
377
|
-
const result = schema$
|
|
382
|
+
const result = schema$7.safeParse({
|
|
378
383
|
id: bookingRequestId,
|
|
379
384
|
...updateData
|
|
380
385
|
});
|
|
@@ -410,9 +415,9 @@ const triggerBRPayment = async (client, bookingRequestId, body) => {
|
|
|
410
415
|
};
|
|
411
416
|
//#endregion
|
|
412
417
|
//#region src/getBookingRequestsByUserId.ts
|
|
413
|
-
const schema$
|
|
418
|
+
const schema$6 = zod.z.object({ userId: zod.z.string().trim().min(1).uuid() });
|
|
414
419
|
const getBookingRequestsByUserId = async (client, userId) => {
|
|
415
|
-
const result = schema$
|
|
420
|
+
const result = schema$6.safeParse({ userId });
|
|
416
421
|
if (!result.success) throw new TypeError("Invalid userId", { cause: result.error.issues });
|
|
417
422
|
return client.get(`/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/bookingrequests/users/${userId}`).then(({ data }) => data).catch((error) => {
|
|
418
423
|
if (error.formattedError?.status === 404) return [];
|
|
@@ -437,15 +442,80 @@ const releaseBRPayment = async (client, bookingRequestId, pspReference) => {
|
|
|
437
442
|
};
|
|
438
443
|
//#endregion
|
|
439
444
|
//#region src/cancelBookingRequest.ts
|
|
440
|
-
const schema = zod.default.object({ id: zod.default.string().uuid() });
|
|
445
|
+
const schema$5 = zod.default.object({ id: zod.default.string().uuid() });
|
|
441
446
|
const cancelBookingRequest = async (client, id) => {
|
|
442
|
-
const result = schema.safeParse({ id });
|
|
447
|
+
const result = schema$5.safeParse({ id });
|
|
443
448
|
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
444
449
|
return client.post(`/boapi/proxy/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/bookingrequests/cancel/${id}`, {}).then(({ data }) => data).catch((error) => {
|
|
445
450
|
throw new TypeError("Failed to cancel booking request", { cause: error });
|
|
446
451
|
});
|
|
447
452
|
};
|
|
448
453
|
//#endregion
|
|
454
|
+
//#region src/getDigitalContracts.ts
|
|
455
|
+
const schema$4 = zod.z.object({ bookingId: zod.z.string().trim().min(1) });
|
|
456
|
+
const getDigitalContracts = async (client, bookingId, status = "SIGNED") => {
|
|
457
|
+
const result = schema$4.safeParse({ bookingId });
|
|
458
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
459
|
+
return client.get(`/boapi/proxy/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/subscription/bookingrequests/${result.data.bookingId}/digitalContracts?status=${encodeURIComponent(status)}`).then(({ data }) => data);
|
|
460
|
+
};
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/getAdditionalDrivers.ts
|
|
463
|
+
const schema$3 = zod.z.object({ parentId: zod.z.string().trim().min(1) });
|
|
464
|
+
const getAdditionalDrivers = async (client, parentId) => {
|
|
465
|
+
const result = schema$3.safeParse({ parentId });
|
|
466
|
+
if (!result.success) throw new TypeError("Invalid parentId", { cause: result.error.issues });
|
|
467
|
+
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/bookingrequests/${parentId}/additionalDrivers`).then(({ data }) => data);
|
|
468
|
+
};
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/getSlaves.ts
|
|
471
|
+
const schema$2 = zod.z.object({
|
|
472
|
+
parentId: zod.z.string().trim().min(1),
|
|
473
|
+
status: zod.z.enum(["ONGOING, COMPLETED", "UPCOMING"])
|
|
474
|
+
});
|
|
475
|
+
const getSlaves = async (client, parentId, status) => {
|
|
476
|
+
const result = schema$2.safeParse({
|
|
477
|
+
parentId,
|
|
478
|
+
status
|
|
479
|
+
});
|
|
480
|
+
if (!result.success) throw new TypeError("Invalid bookingId", { cause: result.error.issues });
|
|
481
|
+
return client.get(`/boapi/proxy/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/subscription/bookingRequests/${parentId}/bookingRequestsSlave?bookingStatus=${status}`).then(({ data }) => data);
|
|
482
|
+
};
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/getSubscriptionsByUserId.ts
|
|
485
|
+
const schema$1 = zod.z.object({
|
|
486
|
+
userId: zod.z.string().trim().min(1).uuid(),
|
|
487
|
+
active: zod.z.boolean().optional().default(true)
|
|
488
|
+
});
|
|
489
|
+
const getSubscriptionsByUserId = async (client, userId, active = true) => {
|
|
490
|
+
const result = schema$1.safeParse({
|
|
491
|
+
userId,
|
|
492
|
+
active
|
|
493
|
+
});
|
|
494
|
+
if (!result.success) throw new TypeError("Invalid userId", { cause: result.error.issues });
|
|
495
|
+
return client.get(`/boapi/proxy/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/subscription/users/${userId}/${active ? "active" : "past"}`).then(({ data }) => data);
|
|
496
|
+
};
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region src/submitCancellationRequest.ts
|
|
499
|
+
const schema = zod.z.object({
|
|
500
|
+
bookingRequestId: zod.z.string().uuid(),
|
|
501
|
+
userId: zod.z.string().uuid()
|
|
502
|
+
});
|
|
503
|
+
const submitCancellationRequest = async (client, bookingRequestId, userId) => {
|
|
504
|
+
const result = schema.safeParse({
|
|
505
|
+
bookingRequestId,
|
|
506
|
+
userId
|
|
507
|
+
});
|
|
508
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
509
|
+
return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/bookingrequests/${bookingRequestId}/actions`, {
|
|
510
|
+
action: "EARLIER_CANCELLATION_REQUEST",
|
|
511
|
+
bookingStatusBO: "ONGOING",
|
|
512
|
+
status: "PENDING",
|
|
513
|
+
userId
|
|
514
|
+
}).then(({ data }) => data).catch((error) => {
|
|
515
|
+
throw new TypeError("Failed to submit cancellation request", { cause: error });
|
|
516
|
+
});
|
|
517
|
+
};
|
|
518
|
+
//#endregion
|
|
449
519
|
//#region src/createSubscription.ts
|
|
450
520
|
const createSubscriptionBodySchema = zod.z.object({
|
|
451
521
|
userId: zod.z.string().trim().min(1).uuid(),
|
|
@@ -479,17 +549,23 @@ exports.allocateVehicle = allocateVehicle;
|
|
|
479
549
|
exports.cancelBookingRequest = cancelBookingRequest;
|
|
480
550
|
exports.createSubscription = createSubscription;
|
|
481
551
|
exports.deallocateVehicle = deallocateVehicle;
|
|
552
|
+
exports.getAdditionalDrivers = getAdditionalDrivers;
|
|
482
553
|
exports.getAvailableVehicles = getAvailableVehicles;
|
|
483
554
|
exports.getBookingRequestById = getBookingRequestById;
|
|
484
555
|
exports.getBookingRequestByTrip = getBookingRequestByTrip;
|
|
485
556
|
exports.getBookingRequests = getBookingRequests;
|
|
486
557
|
exports.getBookingRequestsByUserId = getBookingRequestsByUserId;
|
|
558
|
+
exports.getDigitalContracts = getDigitalContracts;
|
|
487
559
|
exports.getSATBookingRequests = getSATBookingRequests;
|
|
488
560
|
exports.getScheduleBookingRequests = getScheduleBookingRequests;
|
|
561
|
+
exports.getScheduledBookingById = getScheduledBookingById;
|
|
562
|
+
exports.getSlaves = getSlaves;
|
|
489
563
|
exports.getStationById = getStationById;
|
|
490
564
|
exports.getStations = getStations;
|
|
491
565
|
exports.getSubscriptionBookingRequestById = getSubscriptionBookingRequestById;
|
|
492
566
|
exports.getSubscriptionBookingRequests = getSubscriptionBookingRequests;
|
|
567
|
+
exports.getSubscriptionsByUserId = getSubscriptionsByUserId;
|
|
493
568
|
exports.releaseBRPayment = releaseBRPayment;
|
|
569
|
+
exports.submitCancellationRequest = submitCancellationRequest;
|
|
494
570
|
exports.triggerBRPayment = triggerBRPayment;
|
|
495
571
|
exports.updateScheduleBooking = updateScheduleBooking;
|
package/dist/index.d.cts
CHANGED
|
@@ -209,6 +209,114 @@ type AvailableVehiclesResponse = {
|
|
|
209
209
|
stationId: string;
|
|
210
210
|
vehicles: Vehicle[];
|
|
211
211
|
};
|
|
212
|
+
type Slave = {
|
|
213
|
+
previous: string | null;
|
|
214
|
+
compositeStatus: string;
|
|
215
|
+
id: string;
|
|
216
|
+
startDate: string;
|
|
217
|
+
endDate: string;
|
|
218
|
+
profileId: string;
|
|
219
|
+
vehicleId: string;
|
|
220
|
+
modelId: number;
|
|
221
|
+
journeyId: string;
|
|
222
|
+
station: string;
|
|
223
|
+
status: string;
|
|
224
|
+
creationDate: string;
|
|
225
|
+
returnedDate: null;
|
|
226
|
+
serviceId: string;
|
|
227
|
+
pricingId: null;
|
|
228
|
+
plannedReturnDate: string | null;
|
|
229
|
+
cancellationDate: string | null;
|
|
230
|
+
rollingContract: boolean;
|
|
231
|
+
planDurationInMonths: number;
|
|
232
|
+
planName: string | null;
|
|
233
|
+
contractType: 'MVS' | 'SVS';
|
|
234
|
+
bookingReferenceId: string;
|
|
235
|
+
};
|
|
236
|
+
interface IFormatSlave extends Slave {
|
|
237
|
+
traveledDistance: number | null;
|
|
238
|
+
realStartDate?: string | null;
|
|
239
|
+
cancellationRequestOutDTO?: {
|
|
240
|
+
status: string;
|
|
241
|
+
action: string;
|
|
242
|
+
};
|
|
243
|
+
manualApproval: {
|
|
244
|
+
status: string;
|
|
245
|
+
action: string;
|
|
246
|
+
} | undefined;
|
|
247
|
+
from: 'ONGOING' | 'UPCOMING' | 'COMPLETED';
|
|
248
|
+
}
|
|
249
|
+
type Master = {
|
|
250
|
+
bookingReferenceId: string;
|
|
251
|
+
cancellationDate: string | null;
|
|
252
|
+
cityId: string | null;
|
|
253
|
+
contractType: 'MVS' | 'SVS';
|
|
254
|
+
creationDate: string;
|
|
255
|
+
customPrice: number | null;
|
|
256
|
+
deliveryAddress: string | null;
|
|
257
|
+
deliveryAddressAdditionalInfo: string | null;
|
|
258
|
+
deliveryCity: string | null;
|
|
259
|
+
deliveryPostalCode: string | null;
|
|
260
|
+
endDate: string;
|
|
261
|
+
fleetId: string;
|
|
262
|
+
id: string;
|
|
263
|
+
journeyId: string;
|
|
264
|
+
modelId: number;
|
|
265
|
+
parentId: string;
|
|
266
|
+
planDurationInMonths: number;
|
|
267
|
+
planName: string;
|
|
268
|
+
plannedReturnDate: string | null;
|
|
269
|
+
pricingId: string | null;
|
|
270
|
+
previous: string | null;
|
|
271
|
+
products: string[];
|
|
272
|
+
profileId: string;
|
|
273
|
+
returnedDate: string | null;
|
|
274
|
+
rollingContract: boolean;
|
|
275
|
+
serviceId: string;
|
|
276
|
+
startDate: string;
|
|
277
|
+
station: string;
|
|
278
|
+
status: string;
|
|
279
|
+
vehicleId: string;
|
|
280
|
+
userId: string;
|
|
281
|
+
};
|
|
282
|
+
interface IFormatSubscription extends Master {
|
|
283
|
+
slaves: {
|
|
284
|
+
ongoing: IFormatSlave[];
|
|
285
|
+
upcoming: IFormatSlave[];
|
|
286
|
+
completed: IFormatSlave[];
|
|
287
|
+
};
|
|
288
|
+
cancellationRequestStatus?: string;
|
|
289
|
+
}
|
|
290
|
+
type Contract = {
|
|
291
|
+
id: string;
|
|
292
|
+
status: 'SIGNED';
|
|
293
|
+
provider: 'DOCUSIGN';
|
|
294
|
+
creationDate: string;
|
|
295
|
+
profileId: string;
|
|
296
|
+
externalContractId: string;
|
|
297
|
+
type: string;
|
|
298
|
+
};
|
|
299
|
+
type AdditionalDriver = {
|
|
300
|
+
id: string;
|
|
301
|
+
fleetId: string;
|
|
302
|
+
bookingRequestId: string;
|
|
303
|
+
profileId: string;
|
|
304
|
+
updateDate: string;
|
|
305
|
+
invitationEmail: string;
|
|
306
|
+
profileStatus: string;
|
|
307
|
+
userId: string;
|
|
308
|
+
};
|
|
309
|
+
type BookingRequestSlave = {
|
|
310
|
+
id: string;
|
|
311
|
+
vehicleId: string;
|
|
312
|
+
modelId: number;
|
|
313
|
+
startDate: string;
|
|
314
|
+
endDate: string;
|
|
315
|
+
tripId: string;
|
|
316
|
+
parentId: string;
|
|
317
|
+
traveledDistance: number;
|
|
318
|
+
energyLevelEnd: number;
|
|
319
|
+
};
|
|
212
320
|
//#endregion
|
|
213
321
|
//#region src/getBookingRequests.d.ts
|
|
214
322
|
declare const BookingRequestStatusSchema: z.ZodEnum<["ALERT", "UPCOMING", "ONGOING", "COMPLETED", "CANCELLED", "PENDING_APPROVAL", "CONFIRMED", "PENDING", "LATE"]>;
|
|
@@ -253,6 +361,7 @@ declare const getSATBookingRequests: (client: Client, status: SATBookingRequestS
|
|
|
253
361
|
declare const getBookingRequestById: (client: Client, id: string) => Promise<BookingRequest>;
|
|
254
362
|
declare const getBookingRequestByTrip: (client: Client, tripId: string) => Promise<BookingRequest>;
|
|
255
363
|
declare const getSubscriptionBookingRequestById: (client: Client, id: string) => Promise<BookingRequest>;
|
|
364
|
+
declare const getScheduledBookingById: (client: Client, bookingId: string) => Promise<SATBookingRequest>;
|
|
256
365
|
//#endregion
|
|
257
366
|
//#region src/getAvailableVehicles.d.ts
|
|
258
367
|
declare const getAvailableVehicles: (client: Client, stationId: string, startDate: string) => Promise<AvailableVehiclesResponse>;
|
|
@@ -359,6 +468,21 @@ declare const releaseBRPayment: (client: Client, bookingRequestId: UUID, pspRefe
|
|
|
359
468
|
//#region src/cancelBookingRequest.d.ts
|
|
360
469
|
declare const cancelBookingRequest: (client: Client, id: string) => Promise<SATBookingRequest>;
|
|
361
470
|
//#endregion
|
|
471
|
+
//#region src/getDigitalContracts.d.ts
|
|
472
|
+
declare const getDigitalContracts: (client: Client, bookingId: string, status?: string) => Promise<Contract[]>;
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/getAdditionalDrivers.d.ts
|
|
475
|
+
declare const getAdditionalDrivers: (client: Client, parentId: string) => Promise<AdditionalDriver[]>;
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/getSlaves.d.ts
|
|
478
|
+
declare const getSlaves: (client: Client, parentId: string, status: string) => Promise<BookingRequestSlave[]>;
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/getSubscriptionsByUserId.d.ts
|
|
481
|
+
declare const getSubscriptionsByUserId: (client: Client, userId: string, active?: boolean) => Promise<Master[]>;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/submitCancellationRequest.d.ts
|
|
484
|
+
declare const submitCancellationRequest: (client: Client, bookingRequestId: string, userId: string) => Promise<SATBookingRequest>;
|
|
485
|
+
//#endregion
|
|
362
486
|
//#region src/createSubscription.d.ts
|
|
363
487
|
type CreateSubscriptionBody = {
|
|
364
488
|
userId: string;
|
|
@@ -384,4 +508,4 @@ type CreateSubscriptionBody = {
|
|
|
384
508
|
};
|
|
385
509
|
declare const createSubscription: (client: Client, body: CreateSubscriptionBody) => Promise<BookingRequest>;
|
|
386
510
|
//#endregion
|
|
387
|
-
export { AvailableVehiclesResponse, BRPaymentItem, BaseBookingRequest, BookingCredit, BookingRequest, type BookingRequestFilters, type BookingRequestStatus, type CreateSubscriptionBody, CustomPrice, DayOpeningHours, Days, GeoInfo, type Include, type IncludeStation, OpeningHours, PaymentReceipts, PreferredPaymentMethod, SATBookingRequest, type SATBookingRequestStatus, Service, ServiceInfo, type ServiceType, Station, Timetable, TriggerBRPaymentResponse, Vehicle, allocateVehicle, cancelBookingRequest, createSubscription, deallocateVehicle, getAvailableVehicles, getBookingRequestById, getBookingRequestByTrip, getBookingRequests, getBookingRequestsByUserId, getSATBookingRequests, getScheduleBookingRequests, getStationById, getStations, getSubscriptionBookingRequestById, getSubscriptionBookingRequests, releaseBRPayment, triggerBRPayment, updateScheduleBooking };
|
|
511
|
+
export { AdditionalDriver, AvailableVehiclesResponse, BRPaymentItem, BaseBookingRequest, BookingCredit, BookingRequest, type BookingRequestFilters, BookingRequestSlave, type BookingRequestStatus, Contract, type CreateSubscriptionBody, CustomPrice, DayOpeningHours, Days, GeoInfo, IFormatSlave, IFormatSubscription, type Include, type IncludeStation, Master, OpeningHours, PaymentReceipts, PreferredPaymentMethod, SATBookingRequest, type SATBookingRequestStatus, Service, ServiceInfo, type ServiceType, Slave, Station, Timetable, TriggerBRPaymentResponse, Vehicle, allocateVehicle, cancelBookingRequest, createSubscription, deallocateVehicle, getAdditionalDrivers, getAvailableVehicles, getBookingRequestById, getBookingRequestByTrip, getBookingRequests, getBookingRequestsByUserId, getDigitalContracts, getSATBookingRequests, getScheduleBookingRequests, getScheduledBookingById, getSlaves, getStationById, getStations, getSubscriptionBookingRequestById, getSubscriptionBookingRequests, getSubscriptionsByUserId, releaseBRPayment, submitCancellationRequest, triggerBRPayment, updateScheduleBooking };
|
package/dist/index.d.mts
CHANGED
|
@@ -209,6 +209,114 @@ type AvailableVehiclesResponse = {
|
|
|
209
209
|
stationId: string;
|
|
210
210
|
vehicles: Vehicle[];
|
|
211
211
|
};
|
|
212
|
+
type Slave = {
|
|
213
|
+
previous: string | null;
|
|
214
|
+
compositeStatus: string;
|
|
215
|
+
id: string;
|
|
216
|
+
startDate: string;
|
|
217
|
+
endDate: string;
|
|
218
|
+
profileId: string;
|
|
219
|
+
vehicleId: string;
|
|
220
|
+
modelId: number;
|
|
221
|
+
journeyId: string;
|
|
222
|
+
station: string;
|
|
223
|
+
status: string;
|
|
224
|
+
creationDate: string;
|
|
225
|
+
returnedDate: null;
|
|
226
|
+
serviceId: string;
|
|
227
|
+
pricingId: null;
|
|
228
|
+
plannedReturnDate: string | null;
|
|
229
|
+
cancellationDate: string | null;
|
|
230
|
+
rollingContract: boolean;
|
|
231
|
+
planDurationInMonths: number;
|
|
232
|
+
planName: string | null;
|
|
233
|
+
contractType: 'MVS' | 'SVS';
|
|
234
|
+
bookingReferenceId: string;
|
|
235
|
+
};
|
|
236
|
+
interface IFormatSlave extends Slave {
|
|
237
|
+
traveledDistance: number | null;
|
|
238
|
+
realStartDate?: string | null;
|
|
239
|
+
cancellationRequestOutDTO?: {
|
|
240
|
+
status: string;
|
|
241
|
+
action: string;
|
|
242
|
+
};
|
|
243
|
+
manualApproval: {
|
|
244
|
+
status: string;
|
|
245
|
+
action: string;
|
|
246
|
+
} | undefined;
|
|
247
|
+
from: 'ONGOING' | 'UPCOMING' | 'COMPLETED';
|
|
248
|
+
}
|
|
249
|
+
type Master = {
|
|
250
|
+
bookingReferenceId: string;
|
|
251
|
+
cancellationDate: string | null;
|
|
252
|
+
cityId: string | null;
|
|
253
|
+
contractType: 'MVS' | 'SVS';
|
|
254
|
+
creationDate: string;
|
|
255
|
+
customPrice: number | null;
|
|
256
|
+
deliveryAddress: string | null;
|
|
257
|
+
deliveryAddressAdditionalInfo: string | null;
|
|
258
|
+
deliveryCity: string | null;
|
|
259
|
+
deliveryPostalCode: string | null;
|
|
260
|
+
endDate: string;
|
|
261
|
+
fleetId: string;
|
|
262
|
+
id: string;
|
|
263
|
+
journeyId: string;
|
|
264
|
+
modelId: number;
|
|
265
|
+
parentId: string;
|
|
266
|
+
planDurationInMonths: number;
|
|
267
|
+
planName: string;
|
|
268
|
+
plannedReturnDate: string | null;
|
|
269
|
+
pricingId: string | null;
|
|
270
|
+
previous: string | null;
|
|
271
|
+
products: string[];
|
|
272
|
+
profileId: string;
|
|
273
|
+
returnedDate: string | null;
|
|
274
|
+
rollingContract: boolean;
|
|
275
|
+
serviceId: string;
|
|
276
|
+
startDate: string;
|
|
277
|
+
station: string;
|
|
278
|
+
status: string;
|
|
279
|
+
vehicleId: string;
|
|
280
|
+
userId: string;
|
|
281
|
+
};
|
|
282
|
+
interface IFormatSubscription extends Master {
|
|
283
|
+
slaves: {
|
|
284
|
+
ongoing: IFormatSlave[];
|
|
285
|
+
upcoming: IFormatSlave[];
|
|
286
|
+
completed: IFormatSlave[];
|
|
287
|
+
};
|
|
288
|
+
cancellationRequestStatus?: string;
|
|
289
|
+
}
|
|
290
|
+
type Contract = {
|
|
291
|
+
id: string;
|
|
292
|
+
status: 'SIGNED';
|
|
293
|
+
provider: 'DOCUSIGN';
|
|
294
|
+
creationDate: string;
|
|
295
|
+
profileId: string;
|
|
296
|
+
externalContractId: string;
|
|
297
|
+
type: string;
|
|
298
|
+
};
|
|
299
|
+
type AdditionalDriver = {
|
|
300
|
+
id: string;
|
|
301
|
+
fleetId: string;
|
|
302
|
+
bookingRequestId: string;
|
|
303
|
+
profileId: string;
|
|
304
|
+
updateDate: string;
|
|
305
|
+
invitationEmail: string;
|
|
306
|
+
profileStatus: string;
|
|
307
|
+
userId: string;
|
|
308
|
+
};
|
|
309
|
+
type BookingRequestSlave = {
|
|
310
|
+
id: string;
|
|
311
|
+
vehicleId: string;
|
|
312
|
+
modelId: number;
|
|
313
|
+
startDate: string;
|
|
314
|
+
endDate: string;
|
|
315
|
+
tripId: string;
|
|
316
|
+
parentId: string;
|
|
317
|
+
traveledDistance: number;
|
|
318
|
+
energyLevelEnd: number;
|
|
319
|
+
};
|
|
212
320
|
//#endregion
|
|
213
321
|
//#region src/getBookingRequests.d.ts
|
|
214
322
|
declare const BookingRequestStatusSchema: z.ZodEnum<["ALERT", "UPCOMING", "ONGOING", "COMPLETED", "CANCELLED", "PENDING_APPROVAL", "CONFIRMED", "PENDING", "LATE"]>;
|
|
@@ -253,6 +361,7 @@ declare const getSATBookingRequests: (client: Client, status: SATBookingRequestS
|
|
|
253
361
|
declare const getBookingRequestById: (client: Client, id: string) => Promise<BookingRequest>;
|
|
254
362
|
declare const getBookingRequestByTrip: (client: Client, tripId: string) => Promise<BookingRequest>;
|
|
255
363
|
declare const getSubscriptionBookingRequestById: (client: Client, id: string) => Promise<BookingRequest>;
|
|
364
|
+
declare const getScheduledBookingById: (client: Client, bookingId: string) => Promise<SATBookingRequest>;
|
|
256
365
|
//#endregion
|
|
257
366
|
//#region src/getAvailableVehicles.d.ts
|
|
258
367
|
declare const getAvailableVehicles: (client: Client, stationId: string, startDate: string) => Promise<AvailableVehiclesResponse>;
|
|
@@ -359,6 +468,21 @@ declare const releaseBRPayment: (client: Client, bookingRequestId: UUID, pspRefe
|
|
|
359
468
|
//#region src/cancelBookingRequest.d.ts
|
|
360
469
|
declare const cancelBookingRequest: (client: Client, id: string) => Promise<SATBookingRequest>;
|
|
361
470
|
//#endregion
|
|
471
|
+
//#region src/getDigitalContracts.d.ts
|
|
472
|
+
declare const getDigitalContracts: (client: Client, bookingId: string, status?: string) => Promise<Contract[]>;
|
|
473
|
+
//#endregion
|
|
474
|
+
//#region src/getAdditionalDrivers.d.ts
|
|
475
|
+
declare const getAdditionalDrivers: (client: Client, parentId: string) => Promise<AdditionalDriver[]>;
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/getSlaves.d.ts
|
|
478
|
+
declare const getSlaves: (client: Client, parentId: string, status: string) => Promise<BookingRequestSlave[]>;
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/getSubscriptionsByUserId.d.ts
|
|
481
|
+
declare const getSubscriptionsByUserId: (client: Client, userId: string, active?: boolean) => Promise<Master[]>;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/submitCancellationRequest.d.ts
|
|
484
|
+
declare const submitCancellationRequest: (client: Client, bookingRequestId: string, userId: string) => Promise<SATBookingRequest>;
|
|
485
|
+
//#endregion
|
|
362
486
|
//#region src/createSubscription.d.ts
|
|
363
487
|
type CreateSubscriptionBody = {
|
|
364
488
|
userId: string;
|
|
@@ -384,4 +508,4 @@ type CreateSubscriptionBody = {
|
|
|
384
508
|
};
|
|
385
509
|
declare const createSubscription: (client: Client, body: CreateSubscriptionBody) => Promise<BookingRequest>;
|
|
386
510
|
//#endregion
|
|
387
|
-
export { AvailableVehiclesResponse, BRPaymentItem, BaseBookingRequest, BookingCredit, BookingRequest, type BookingRequestFilters, type BookingRequestStatus, type CreateSubscriptionBody, CustomPrice, DayOpeningHours, Days, GeoInfo, type Include, type IncludeStation, OpeningHours, PaymentReceipts, PreferredPaymentMethod, SATBookingRequest, type SATBookingRequestStatus, Service, ServiceInfo, type ServiceType, Station, Timetable, TriggerBRPaymentResponse, Vehicle, allocateVehicle, cancelBookingRequest, createSubscription, deallocateVehicle, getAvailableVehicles, getBookingRequestById, getBookingRequestByTrip, getBookingRequests, getBookingRequestsByUserId, getSATBookingRequests, getScheduleBookingRequests, getStationById, getStations, getSubscriptionBookingRequestById, getSubscriptionBookingRequests, releaseBRPayment, triggerBRPayment, updateScheduleBooking };
|
|
511
|
+
export { AdditionalDriver, AvailableVehiclesResponse, BRPaymentItem, BaseBookingRequest, BookingCredit, BookingRequest, type BookingRequestFilters, BookingRequestSlave, type BookingRequestStatus, Contract, type CreateSubscriptionBody, CustomPrice, DayOpeningHours, Days, GeoInfo, IFormatSlave, IFormatSubscription, type Include, type IncludeStation, Master, OpeningHours, PaymentReceipts, PreferredPaymentMethod, SATBookingRequest, type SATBookingRequestStatus, Service, ServiceInfo, type ServiceType, Slave, Station, Timetable, TriggerBRPaymentResponse, Vehicle, allocateVehicle, cancelBookingRequest, createSubscription, deallocateVehicle, getAdditionalDrivers, getAvailableVehicles, getBookingRequestById, getBookingRequestByTrip, getBookingRequests, getBookingRequestsByUserId, getDigitalContracts, getSATBookingRequests, getScheduleBookingRequests, getScheduledBookingById, getSlaves, getStationById, getStations, getSubscriptionBookingRequestById, getSubscriptionBookingRequests, getSubscriptionsByUserId, releaseBRPayment, submitCancellationRequest, triggerBRPayment, updateScheduleBooking };
|