@vulog/aima-booking 1.2.32 → 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 +26 -1
- package/dist/index.d.mts +26 -1
- 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
|
@@ -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
|
@@ -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';
|