@vulog/aima-booking 1.2.31 → 1.2.33
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.cjs +30 -0
- package/dist/index.d.cts +30 -5
- package/dist/index.d.mts +30 -5
- package/dist/index.mjs +30 -1
- package/package.json +3 -3
- package/src/createSubscription.ts +64 -0
- package/src/index.ts +2 -0
package/dist/index.cjs
CHANGED
|
@@ -446,8 +446,38 @@ const cancelBookingRequest = async (client, id) => {
|
|
|
446
446
|
});
|
|
447
447
|
};
|
|
448
448
|
//#endregion
|
|
449
|
+
//#region src/createSubscription.ts
|
|
450
|
+
const createSubscriptionBodySchema = zod.z.object({
|
|
451
|
+
userId: zod.z.string().trim().min(1).uuid(),
|
|
452
|
+
profileId: zod.z.string().trim().min(1).uuid(),
|
|
453
|
+
startDate: zod.z.string().trim().min(1),
|
|
454
|
+
endDate: zod.z.string().trim().min(1),
|
|
455
|
+
vehicleId: zod.z.string().trim().min(1).uuid(),
|
|
456
|
+
modelId: zod.z.number().int().positive(),
|
|
457
|
+
station: zod.z.string().trim().min(1).uuid(),
|
|
458
|
+
serviceId: zod.z.string().trim().min(1).uuid(),
|
|
459
|
+
pricingId: zod.z.string().optional(),
|
|
460
|
+
productList: zod.z.array(zod.z.string()).optional(),
|
|
461
|
+
deliveryAddress: zod.z.string().optional(),
|
|
462
|
+
deliveryAddressAdditionalInfo: zod.z.string().optional(),
|
|
463
|
+
deliveryCity: zod.z.string().optional(),
|
|
464
|
+
deliveryPostalCode: zod.z.string().optional(),
|
|
465
|
+
plannedReturnDate: zod.z.string().optional(),
|
|
466
|
+
notes: zod.z.string().optional(),
|
|
467
|
+
isRollingContract: zod.z.boolean().optional(),
|
|
468
|
+
parentId: zod.z.string().optional(),
|
|
469
|
+
bookingReferenceId: zod.z.string().optional(),
|
|
470
|
+
additionalDriverInvitations: zod.z.array(zod.z.string().email()).optional()
|
|
471
|
+
});
|
|
472
|
+
const createSubscription = async (client, body) => {
|
|
473
|
+
const result = createSubscriptionBodySchema.safeParse(body);
|
|
474
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
475
|
+
return client.post(`/boapi/proxy/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/subscription/bookingrequests`, result.data).then(({ data }) => data);
|
|
476
|
+
};
|
|
477
|
+
//#endregion
|
|
449
478
|
exports.allocateVehicle = allocateVehicle;
|
|
450
479
|
exports.cancelBookingRequest = cancelBookingRequest;
|
|
480
|
+
exports.createSubscription = createSubscription;
|
|
451
481
|
exports.deallocateVehicle = deallocateVehicle;
|
|
452
482
|
exports.getAvailableVehicles = getAvailableVehicles;
|
|
453
483
|
exports.getBookingRequestById = getBookingRequestById;
|
package/dist/index.d.cts
CHANGED
|
@@ -297,22 +297,22 @@ declare const triggerBRPaymentSchema: z$1.ZodObject<{
|
|
|
297
297
|
}>, "many">>;
|
|
298
298
|
profileId: z$1.ZodString;
|
|
299
299
|
}, "strip", z$1.ZodTypeAny, {
|
|
300
|
+
profileId: string;
|
|
300
301
|
scope: "RENTAL" | "DEPOSIT";
|
|
301
302
|
online: boolean;
|
|
302
303
|
amountType: "FIXED" | "PERCENTAGE";
|
|
303
304
|
amountValue: number;
|
|
304
|
-
profileId: string;
|
|
305
305
|
requiresActionReturnURL?: string | undefined;
|
|
306
306
|
preferredPaymentMethods?: {
|
|
307
307
|
pspReference: string;
|
|
308
308
|
amount: number;
|
|
309
309
|
}[] | undefined;
|
|
310
310
|
}, {
|
|
311
|
+
profileId: string;
|
|
311
312
|
scope: "RENTAL" | "DEPOSIT";
|
|
312
313
|
online: boolean;
|
|
313
314
|
amountType: "FIXED" | "PERCENTAGE";
|
|
314
315
|
amountValue: number;
|
|
315
|
-
profileId: string;
|
|
316
316
|
requiresActionReturnURL?: string | undefined;
|
|
317
317
|
preferredPaymentMethods?: {
|
|
318
318
|
pspReference: string;
|
|
@@ -322,11 +322,11 @@ declare const triggerBRPaymentSchema: z$1.ZodObject<{
|
|
|
322
322
|
}, "strip", z$1.ZodTypeAny, {
|
|
323
323
|
bookingRequestId: string;
|
|
324
324
|
body: {
|
|
325
|
+
profileId: string;
|
|
325
326
|
scope: "RENTAL" | "DEPOSIT";
|
|
326
327
|
online: boolean;
|
|
327
328
|
amountType: "FIXED" | "PERCENTAGE";
|
|
328
329
|
amountValue: number;
|
|
329
|
-
profileId: string;
|
|
330
330
|
requiresActionReturnURL?: string | undefined;
|
|
331
331
|
preferredPaymentMethods?: {
|
|
332
332
|
pspReference: string;
|
|
@@ -336,11 +336,11 @@ declare const triggerBRPaymentSchema: z$1.ZodObject<{
|
|
|
336
336
|
}, {
|
|
337
337
|
bookingRequestId: string;
|
|
338
338
|
body: {
|
|
339
|
+
profileId: string;
|
|
339
340
|
scope: "RENTAL" | "DEPOSIT";
|
|
340
341
|
online: boolean;
|
|
341
342
|
amountType: "FIXED" | "PERCENTAGE";
|
|
342
343
|
amountValue: number;
|
|
343
|
-
profileId: string;
|
|
344
344
|
requiresActionReturnURL?: string | undefined;
|
|
345
345
|
preferredPaymentMethods?: {
|
|
346
346
|
pspReference: string;
|
|
@@ -359,4 +359,29 @@ declare const releaseBRPayment: (client: Client, bookingRequestId: UUID, pspRefe
|
|
|
359
359
|
//#region src/cancelBookingRequest.d.ts
|
|
360
360
|
declare const cancelBookingRequest: (client: Client, id: string) => Promise<SATBookingRequest>;
|
|
361
361
|
//#endregion
|
|
362
|
-
|
|
362
|
+
//#region src/createSubscription.d.ts
|
|
363
|
+
type CreateSubscriptionBody = {
|
|
364
|
+
userId: string;
|
|
365
|
+
profileId: string;
|
|
366
|
+
startDate: string;
|
|
367
|
+
endDate: string;
|
|
368
|
+
vehicleId: string;
|
|
369
|
+
modelId: number;
|
|
370
|
+
station: string;
|
|
371
|
+
serviceId: string;
|
|
372
|
+
pricingId?: string;
|
|
373
|
+
productList?: string[];
|
|
374
|
+
deliveryAddress?: string;
|
|
375
|
+
deliveryAddressAdditionalInfo?: string;
|
|
376
|
+
deliveryCity?: string;
|
|
377
|
+
deliveryPostalCode?: string;
|
|
378
|
+
plannedReturnDate?: string;
|
|
379
|
+
notes?: string;
|
|
380
|
+
isRollingContract?: boolean;
|
|
381
|
+
parentId?: string;
|
|
382
|
+
bookingReferenceId?: string;
|
|
383
|
+
additionalDriverInvitations?: string[];
|
|
384
|
+
};
|
|
385
|
+
declare const createSubscription: (client: Client, body: CreateSubscriptionBody) => Promise<BookingRequest>;
|
|
386
|
+
//#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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -297,22 +297,22 @@ declare const triggerBRPaymentSchema: z$1.ZodObject<{
|
|
|
297
297
|
}>, "many">>;
|
|
298
298
|
profileId: z$1.ZodString;
|
|
299
299
|
}, "strip", z$1.ZodTypeAny, {
|
|
300
|
+
profileId: string;
|
|
300
301
|
scope: "RENTAL" | "DEPOSIT";
|
|
301
302
|
online: boolean;
|
|
302
303
|
amountType: "FIXED" | "PERCENTAGE";
|
|
303
304
|
amountValue: number;
|
|
304
|
-
profileId: string;
|
|
305
305
|
requiresActionReturnURL?: string | undefined;
|
|
306
306
|
preferredPaymentMethods?: {
|
|
307
307
|
pspReference: string;
|
|
308
308
|
amount: number;
|
|
309
309
|
}[] | undefined;
|
|
310
310
|
}, {
|
|
311
|
+
profileId: string;
|
|
311
312
|
scope: "RENTAL" | "DEPOSIT";
|
|
312
313
|
online: boolean;
|
|
313
314
|
amountType: "FIXED" | "PERCENTAGE";
|
|
314
315
|
amountValue: number;
|
|
315
|
-
profileId: string;
|
|
316
316
|
requiresActionReturnURL?: string | undefined;
|
|
317
317
|
preferredPaymentMethods?: {
|
|
318
318
|
pspReference: string;
|
|
@@ -322,11 +322,11 @@ declare const triggerBRPaymentSchema: z$1.ZodObject<{
|
|
|
322
322
|
}, "strip", z$1.ZodTypeAny, {
|
|
323
323
|
bookingRequestId: string;
|
|
324
324
|
body: {
|
|
325
|
+
profileId: string;
|
|
325
326
|
scope: "RENTAL" | "DEPOSIT";
|
|
326
327
|
online: boolean;
|
|
327
328
|
amountType: "FIXED" | "PERCENTAGE";
|
|
328
329
|
amountValue: number;
|
|
329
|
-
profileId: string;
|
|
330
330
|
requiresActionReturnURL?: string | undefined;
|
|
331
331
|
preferredPaymentMethods?: {
|
|
332
332
|
pspReference: string;
|
|
@@ -336,11 +336,11 @@ declare const triggerBRPaymentSchema: z$1.ZodObject<{
|
|
|
336
336
|
}, {
|
|
337
337
|
bookingRequestId: string;
|
|
338
338
|
body: {
|
|
339
|
+
profileId: string;
|
|
339
340
|
scope: "RENTAL" | "DEPOSIT";
|
|
340
341
|
online: boolean;
|
|
341
342
|
amountType: "FIXED" | "PERCENTAGE";
|
|
342
343
|
amountValue: number;
|
|
343
|
-
profileId: string;
|
|
344
344
|
requiresActionReturnURL?: string | undefined;
|
|
345
345
|
preferredPaymentMethods?: {
|
|
346
346
|
pspReference: string;
|
|
@@ -359,4 +359,29 @@ declare const releaseBRPayment: (client: Client, bookingRequestId: UUID, pspRefe
|
|
|
359
359
|
//#region src/cancelBookingRequest.d.ts
|
|
360
360
|
declare const cancelBookingRequest: (client: Client, id: string) => Promise<SATBookingRequest>;
|
|
361
361
|
//#endregion
|
|
362
|
-
|
|
362
|
+
//#region src/createSubscription.d.ts
|
|
363
|
+
type CreateSubscriptionBody = {
|
|
364
|
+
userId: string;
|
|
365
|
+
profileId: string;
|
|
366
|
+
startDate: string;
|
|
367
|
+
endDate: string;
|
|
368
|
+
vehicleId: string;
|
|
369
|
+
modelId: number;
|
|
370
|
+
station: string;
|
|
371
|
+
serviceId: string;
|
|
372
|
+
pricingId?: string;
|
|
373
|
+
productList?: string[];
|
|
374
|
+
deliveryAddress?: string;
|
|
375
|
+
deliveryAddressAdditionalInfo?: string;
|
|
376
|
+
deliveryCity?: string;
|
|
377
|
+
deliveryPostalCode?: string;
|
|
378
|
+
plannedReturnDate?: string;
|
|
379
|
+
notes?: string;
|
|
380
|
+
isRollingContract?: boolean;
|
|
381
|
+
parentId?: string;
|
|
382
|
+
bookingReferenceId?: string;
|
|
383
|
+
additionalDriverInvitations?: string[];
|
|
384
|
+
};
|
|
385
|
+
declare const createSubscription: (client: Client, body: CreateSubscriptionBody) => Promise<BookingRequest>;
|
|
386
|
+
//#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 };
|
package/dist/index.mjs
CHANGED
|
@@ -422,4 +422,33 @@ const cancelBookingRequest = async (client, id) => {
|
|
|
422
422
|
});
|
|
423
423
|
};
|
|
424
424
|
//#endregion
|
|
425
|
-
|
|
425
|
+
//#region src/createSubscription.ts
|
|
426
|
+
const createSubscriptionBodySchema = z.object({
|
|
427
|
+
userId: z.string().trim().min(1).uuid(),
|
|
428
|
+
profileId: z.string().trim().min(1).uuid(),
|
|
429
|
+
startDate: z.string().trim().min(1),
|
|
430
|
+
endDate: z.string().trim().min(1),
|
|
431
|
+
vehicleId: z.string().trim().min(1).uuid(),
|
|
432
|
+
modelId: z.number().int().positive(),
|
|
433
|
+
station: z.string().trim().min(1).uuid(),
|
|
434
|
+
serviceId: z.string().trim().min(1).uuid(),
|
|
435
|
+
pricingId: z.string().optional(),
|
|
436
|
+
productList: z.array(z.string()).optional(),
|
|
437
|
+
deliveryAddress: z.string().optional(),
|
|
438
|
+
deliveryAddressAdditionalInfo: z.string().optional(),
|
|
439
|
+
deliveryCity: z.string().optional(),
|
|
440
|
+
deliveryPostalCode: z.string().optional(),
|
|
441
|
+
plannedReturnDate: z.string().optional(),
|
|
442
|
+
notes: z.string().optional(),
|
|
443
|
+
isRollingContract: z.boolean().optional(),
|
|
444
|
+
parentId: z.string().optional(),
|
|
445
|
+
bookingReferenceId: z.string().optional(),
|
|
446
|
+
additionalDriverInvitations: z.array(z.string().email()).optional()
|
|
447
|
+
});
|
|
448
|
+
const createSubscription = async (client, body) => {
|
|
449
|
+
const result = createSubscriptionBodySchema.safeParse(body);
|
|
450
|
+
if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
|
|
451
|
+
return client.post(`/boapi/proxy/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/subscription/bookingrequests`, result.data).then(({ data }) => data);
|
|
452
|
+
};
|
|
453
|
+
//#endregion
|
|
454
|
+
export { allocateVehicle, cancelBookingRequest, createSubscription, deallocateVehicle, getAvailableVehicles, getBookingRequestById, getBookingRequestByTrip, getBookingRequests, getBookingRequestsByUserId, getSATBookingRequests, getScheduleBookingRequests, getStationById, getStations, getSubscriptionBookingRequestById, getSubscriptionBookingRequests, releaseBRPayment, triggerBRPayment, updateScheduleBooking };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-booking",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.33",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.cts",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"author": "Vulog",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vulog/aima-client": "1.2.
|
|
36
|
-
"@vulog/aima-core": "1.2.
|
|
35
|
+
"@vulog/aima-client": "1.2.33",
|
|
36
|
+
"@vulog/aima-core": "1.2.33"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"es-toolkit": "^1.39.9",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
import { BookingRequest } from './types';
|
|
5
|
+
|
|
6
|
+
export type CreateSubscriptionBody = {
|
|
7
|
+
userId: string;
|
|
8
|
+
profileId: string;
|
|
9
|
+
startDate: string;
|
|
10
|
+
endDate: string;
|
|
11
|
+
vehicleId: string;
|
|
12
|
+
modelId: number;
|
|
13
|
+
station: string;
|
|
14
|
+
serviceId: string;
|
|
15
|
+
pricingId?: string;
|
|
16
|
+
productList?: string[];
|
|
17
|
+
deliveryAddress?: string;
|
|
18
|
+
deliveryAddressAdditionalInfo?: string;
|
|
19
|
+
deliveryCity?: string;
|
|
20
|
+
deliveryPostalCode?: string;
|
|
21
|
+
plannedReturnDate?: string;
|
|
22
|
+
notes?: string;
|
|
23
|
+
isRollingContract?: boolean;
|
|
24
|
+
parentId?: string;
|
|
25
|
+
bookingReferenceId?: string;
|
|
26
|
+
additionalDriverInvitations?: string[];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const createSubscriptionBodySchema = z.object({
|
|
30
|
+
userId: z.string().trim().min(1).uuid(),
|
|
31
|
+
profileId: z.string().trim().min(1).uuid(),
|
|
32
|
+
startDate: z.string().trim().min(1),
|
|
33
|
+
endDate: z.string().trim().min(1),
|
|
34
|
+
vehicleId: z.string().trim().min(1).uuid(),
|
|
35
|
+
modelId: z.number().int().positive(),
|
|
36
|
+
station: z.string().trim().min(1).uuid(),
|
|
37
|
+
serviceId: z.string().trim().min(1).uuid(),
|
|
38
|
+
pricingId: z.string().optional(),
|
|
39
|
+
productList: z.array(z.string()).optional(),
|
|
40
|
+
deliveryAddress: z.string().optional(),
|
|
41
|
+
deliveryAddressAdditionalInfo: z.string().optional(),
|
|
42
|
+
deliveryCity: z.string().optional(),
|
|
43
|
+
deliveryPostalCode: z.string().optional(),
|
|
44
|
+
plannedReturnDate: z.string().optional(),
|
|
45
|
+
notes: z.string().optional(),
|
|
46
|
+
isRollingContract: z.boolean().optional(),
|
|
47
|
+
parentId: z.string().optional(),
|
|
48
|
+
bookingReferenceId: z.string().optional(),
|
|
49
|
+
additionalDriverInvitations: z.array(z.string().email()).optional(),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const createSubscription = async (client: Client, body: CreateSubscriptionBody): Promise<BookingRequest> => {
|
|
53
|
+
const result = createSubscriptionBodySchema.safeParse(body);
|
|
54
|
+
if (!result.success) {
|
|
55
|
+
throw new TypeError('Invalid args', { cause: result.error.issues });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return client
|
|
59
|
+
.post<BookingRequest>(
|
|
60
|
+
`/boapi/proxy/user/scheduledBooking/fleets/${client.clientOptions.fleetId}/subscription/bookingrequests`,
|
|
61
|
+
result.data
|
|
62
|
+
)
|
|
63
|
+
.then(({ data }) => data);
|
|
64
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -16,3 +16,5 @@ export { triggerBRPayment } from './triggerBRPayment';
|
|
|
16
16
|
export { getBookingRequestsByUserId } from './getBookingRequestsByUserId';
|
|
17
17
|
export { releaseBRPayment } from './releaseBRPayment';
|
|
18
18
|
export { cancelBookingRequest } from './cancelBookingRequest';
|
|
19
|
+
export { createSubscription } from './createSubscription';
|
|
20
|
+
export type { CreateSubscriptionBody } from './createSubscription';
|