@wix/auto_sdk_bookings_bookings 1.0.3 → 1.0.5
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/build/cjs/src/bookings-v2-booking-bookings.context.d.ts +17 -17
- package/build/cjs/src/bookings-v2-booking-bookings.context.js +17 -17
- package/build/cjs/src/bookings-v2-booking-bookings.context.js.map +1 -1
- package/build/cjs/src/bookings-v2-booking-bookings.http.d.ts +137 -134
- package/build/cjs/src/bookings-v2-booking-bookings.http.js +861 -858
- package/build/cjs/src/bookings-v2-booking-bookings.http.js.map +1 -1
- package/build/cjs/src/bookings-v2-booking-bookings.meta.d.ts +24 -24
- package/build/cjs/src/bookings-v2-booking-bookings.meta.js +125 -125
- package/build/cjs/src/bookings-v2-booking-bookings.meta.js.map +1 -1
- package/build/cjs/src/bookings-v2-booking-bookings.public.d.ts +192 -189
- package/build/cjs/src/bookings-v2-booking-bookings.public.js +84 -84
- package/build/cjs/src/bookings-v2-booking-bookings.public.js.map +1 -1
- package/build/cjs/src/bookings-v2-booking-bookings.types.d.ts +1310 -991
- package/build/cjs/src/bookings-v2-booking-bookings.types.js +3 -3
- package/build/cjs/src/bookings-v2-booking-bookings.types.js.map +1 -1
- package/build/cjs/src/bookings-v2-booking-bookings.universal.d.ts +2219 -1839
- package/build/cjs/src/bookings-v2-booking-bookings.universal.js +901 -898
- package/build/cjs/src/bookings-v2-booking-bookings.universal.js.map +1 -1
- package/build/es/src/bookings-v2-booking-bookings.context.d.ts +17 -17
- package/build/es/src/bookings-v2-booking-bookings.context.js +16 -16
- package/build/es/src/bookings-v2-booking-bookings.context.js.map +1 -1
- package/build/es/src/bookings-v2-booking-bookings.http.d.ts +137 -134
- package/build/es/src/bookings-v2-booking-bookings.http.js +837 -834
- package/build/es/src/bookings-v2-booking-bookings.http.js.map +1 -1
- package/build/es/src/bookings-v2-booking-bookings.meta.d.ts +24 -24
- package/build/es/src/bookings-v2-booking-bookings.meta.js +103 -103
- package/build/es/src/bookings-v2-booking-bookings.meta.js.map +1 -1
- package/build/es/src/bookings-v2-booking-bookings.public.d.ts +192 -189
- package/build/es/src/bookings-v2-booking-bookings.public.js +65 -65
- package/build/es/src/bookings-v2-booking-bookings.public.js.map +1 -1
- package/build/es/src/bookings-v2-booking-bookings.types.d.ts +1310 -991
- package/build/es/src/bookings-v2-booking-bookings.types.js +3 -3
- package/build/es/src/bookings-v2-booking-bookings.types.js.map +1 -1
- package/build/es/src/bookings-v2-booking-bookings.universal.d.ts +2219 -1839
- package/build/es/src/bookings-v2-booking-bookings.universal.js +855 -852
- package/build/es/src/bookings-v2-booking-bookings.universal.js.map +1 -1
- package/build/internal/cjs/src/bookings-v2-booking-bookings.context.d.ts +17 -17
- package/build/internal/cjs/src/bookings-v2-booking-bookings.context.js +17 -17
- package/build/internal/cjs/src/bookings-v2-booking-bookings.context.js.map +1 -1
- package/build/internal/cjs/src/bookings-v2-booking-bookings.http.d.ts +137 -134
- package/build/internal/cjs/src/bookings-v2-booking-bookings.http.js +861 -858
- package/build/internal/cjs/src/bookings-v2-booking-bookings.http.js.map +1 -1
- package/build/internal/cjs/src/bookings-v2-booking-bookings.meta.d.ts +24 -24
- package/build/internal/cjs/src/bookings-v2-booking-bookings.meta.js +125 -125
- package/build/internal/cjs/src/bookings-v2-booking-bookings.meta.js.map +1 -1
- package/build/internal/cjs/src/bookings-v2-booking-bookings.public.d.ts +192 -189
- package/build/internal/cjs/src/bookings-v2-booking-bookings.public.js +84 -84
- package/build/internal/cjs/src/bookings-v2-booking-bookings.public.js.map +1 -1
- package/build/internal/cjs/src/bookings-v2-booking-bookings.types.d.ts +1310 -991
- package/build/internal/cjs/src/bookings-v2-booking-bookings.types.js +3 -3
- package/build/internal/cjs/src/bookings-v2-booking-bookings.types.js.map +1 -1
- package/build/internal/cjs/src/bookings-v2-booking-bookings.universal.d.ts +2219 -1839
- package/build/internal/cjs/src/bookings-v2-booking-bookings.universal.js +901 -898
- package/build/internal/cjs/src/bookings-v2-booking-bookings.universal.js.map +1 -1
- package/build/internal/es/src/bookings-v2-booking-bookings.context.d.ts +17 -17
- package/build/internal/es/src/bookings-v2-booking-bookings.context.js +16 -16
- package/build/internal/es/src/bookings-v2-booking-bookings.context.js.map +1 -1
- package/build/internal/es/src/bookings-v2-booking-bookings.http.d.ts +137 -134
- package/build/internal/es/src/bookings-v2-booking-bookings.http.js +837 -834
- package/build/internal/es/src/bookings-v2-booking-bookings.http.js.map +1 -1
- package/build/internal/es/src/bookings-v2-booking-bookings.meta.d.ts +24 -24
- package/build/internal/es/src/bookings-v2-booking-bookings.meta.js +103 -103
- package/build/internal/es/src/bookings-v2-booking-bookings.meta.js.map +1 -1
- package/build/internal/es/src/bookings-v2-booking-bookings.public.d.ts +192 -189
- package/build/internal/es/src/bookings-v2-booking-bookings.public.js +65 -65
- package/build/internal/es/src/bookings-v2-booking-bookings.public.js.map +1 -1
- package/build/internal/es/src/bookings-v2-booking-bookings.types.d.ts +1310 -991
- package/build/internal/es/src/bookings-v2-booking-bookings.types.js +3 -3
- package/build/internal/es/src/bookings-v2-booking-bookings.types.js.map +1 -1
- package/build/internal/es/src/bookings-v2-booking-bookings.universal.d.ts +2219 -1839
- package/build/internal/es/src/bookings-v2-booking-bookings.universal.js +855 -852
- package/build/internal/es/src/bookings-v2-booking-bookings.universal.js.map +1 -1
- package/package.json +2 -2
|
@@ -39,16 +39,16 @@ export var BookingStatus;
|
|
|
39
39
|
BookingStatus["CREATED"] = "CREATED";
|
|
40
40
|
/**
|
|
41
41
|
* The merchant has confirmed the booking and it appears in the
|
|
42
|
-
* business calendar. Merchants can set up their services
|
|
42
|
+
* business calendar. Merchants can set up their *services*
|
|
43
43
|
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction))
|
|
44
44
|
* to automatically confirm all `PENDING` bookings.
|
|
45
45
|
*/
|
|
46
46
|
BookingStatus["CONFIRMED"] = "CONFIRMED";
|
|
47
47
|
/**
|
|
48
48
|
* The customer has canceled the booking. Depending on the relevant service's
|
|
49
|
-
*
|
|
49
|
+
* _policy snapshot_
|
|
50
50
|
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-policy-snapshots/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policy-snapshots/introduction))
|
|
51
|
-
* they may have to pay a
|
|
51
|
+
* they may have to pay a _cancellation fee_
|
|
52
52
|
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-fees/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/booking-fees/introduction)).
|
|
53
53
|
*/
|
|
54
54
|
BookingStatus["CANCELED"] = "CANCELED";
|
|
@@ -163,104 +163,65 @@ export var SortOrder;
|
|
|
163
163
|
SortOrder["DESC"] = "DESC";
|
|
164
164
|
})(SortOrder || (SortOrder = {}));
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
166
|
+
* Updates the booking `status` to `CONFIRMED`, `PENDING`, or `DECLINED` based
|
|
167
|
+
* on the `paymentStatus` you provide, double booking conflicts, and whether
|
|
168
|
+
* the service requires business approval.
|
|
167
169
|
*
|
|
170
|
+
* ## eCommerce checkout restriction
|
|
168
171
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @requiredField bookings.bookedEntity
|
|
176
|
-
* @requiredField bookings.bookedEntity.item
|
|
177
|
-
* @requiredField bookings.bookedEntity.item.slot
|
|
178
|
-
* @requiredField bookings.bookedEntity.item.slot.endDate
|
|
179
|
-
* @requiredField bookings.bookedEntity.item.slot.location.locationType
|
|
180
|
-
* @requiredField bookings.bookedEntity.item.slot.scheduleId
|
|
181
|
-
* @requiredField bookings.bookedEntity.item.slot.startDate
|
|
182
|
-
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_CREATE
|
|
183
|
-
* @permissionScope Manage Bookings
|
|
184
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
185
|
-
* @permissionScope Manage Bookings - all permissions
|
|
186
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
187
|
-
* @applicableIdentity APP
|
|
188
|
-
* @applicableIdentity VISITOR
|
|
189
|
-
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.CreateMultiServiceBooking
|
|
190
|
-
*/
|
|
191
|
-
export async function createMultiServiceBooking(bookings, options) {
|
|
192
|
-
// @ts-ignore
|
|
193
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
194
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
195
|
-
bookings: bookings,
|
|
196
|
-
participantNotification: options?.participantNotification,
|
|
197
|
-
sendSmsReminder: options?.sendSmsReminder,
|
|
198
|
-
flowControlSettings: options?.flowControlSettings,
|
|
199
|
-
returnFullEntity: options?.returnFullEntity,
|
|
200
|
-
multiServiceBookingType: options?.multiServiceBookingType,
|
|
201
|
-
});
|
|
202
|
-
const reqOpts = ambassadorWixBookingsV2Booking.createMultiServiceBooking(payload);
|
|
203
|
-
sideEffects?.onSiteCall?.();
|
|
204
|
-
try {
|
|
205
|
-
const result = await httpClient.request(reqOpts);
|
|
206
|
-
sideEffects?.onSuccess?.(result);
|
|
207
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
208
|
-
}
|
|
209
|
-
catch (err) {
|
|
210
|
-
const transformedError = sdkTransformError(err, {
|
|
211
|
-
spreadPathsToArguments: {},
|
|
212
|
-
explicitPathsToArguments: {
|
|
213
|
-
bookings: '$[0]',
|
|
214
|
-
participantNotification: '$[1].participantNotification',
|
|
215
|
-
sendSmsReminder: '$[1].sendSmsReminder',
|
|
216
|
-
flowControlSettings: '$[1].flowControlSettings',
|
|
217
|
-
returnFullEntity: '$[1].returnFullEntity',
|
|
218
|
-
multiServiceBookingType: '$[1].multiServiceBookingType',
|
|
219
|
-
},
|
|
220
|
-
singleArgumentUnchanged: false,
|
|
221
|
-
}, ['bookings', 'options']);
|
|
222
|
-
sideEffects?.onError?.(err);
|
|
223
|
-
throw transformedError;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Reschedules a multi-service booking.
|
|
172
|
+
* Call this method only when using a custom checkout page. Don't
|
|
173
|
+
* call it when using a *Wix eCommerce checkout*
|
|
174
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
|
|
175
|
+
* In such cases, Wix automatically updates the booking status based on
|
|
176
|
+
* the `paymentStatus` of the corresponding *Wix eCommerce order*
|
|
177
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
228
178
|
*
|
|
179
|
+
* ## New booking status
|
|
229
180
|
*
|
|
230
|
-
* The
|
|
231
|
-
*
|
|
181
|
+
* The booking `status` is set to `DECLINED` if both of the following conditions
|
|
182
|
+
* are met:
|
|
183
|
+
* + You provide `UNDEFINED`, `NOT_PAID`, `REFUNDED`, or `EXEMPT` as payment status.
|
|
184
|
+
* + There is a double booking conflict.
|
|
185
|
+
*
|
|
186
|
+
* If only one or none of these conditions is met, `status` is set to `PENDING`
|
|
187
|
+
* or `CONFIRMED` depending on whether the service requires business approval.
|
|
232
188
|
*
|
|
189
|
+
* ## Double bookings
|
|
233
190
|
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
191
|
+
* If there is a double booking conflict, but the booking has already been at least
|
|
192
|
+
* partially paid, the method still marks the booking as `PENDING` or `CONFIRMED`.
|
|
193
|
+
* Then, it also sets `doubleBooked` to `true`.
|
|
194
|
+
*
|
|
195
|
+
* ## Admin overwrites
|
|
196
|
+
*
|
|
197
|
+
* There are small but important differences in confirmation behavior if the
|
|
198
|
+
* booking was created with special `flowControlSettings`:
|
|
199
|
+
* + If the booking's `flowControlSettings.skipAvailabilityValidation` was set to
|
|
200
|
+
* `true`, the booking is never declined regardless of double booking conflicts.
|
|
201
|
+
* Instead, it's marked `CONFIRMED` or `PENDING`, depending on whether the
|
|
202
|
+
* service requires business approval.
|
|
203
|
+
* + If the booking's `flowControlSettings.skipBusinessConfirmation` was set to
|
|
204
|
+
* `true`, the booking skips `PENDING` status and is marked `CONFIRMED`
|
|
205
|
+
* immediately.
|
|
206
|
+
* @param bookingId - ID of the booking to confirm or decline.
|
|
237
207
|
* @public
|
|
238
|
-
* @
|
|
239
|
-
* @
|
|
240
|
-
* @requiredField rescheduleBookingsInfo
|
|
241
|
-
* @requiredField rescheduleBookingsInfo.bookingId
|
|
242
|
-
* @requiredField rescheduleBookingsInfo.revision
|
|
243
|
-
* @requiredField rescheduleBookingsInfo.slot
|
|
244
|
-
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_RESCHEDULE
|
|
208
|
+
* @requiredField bookingId
|
|
209
|
+
* @permissionId BOOKINGS.BOOKING_CONFIRM_OR_DECLINE
|
|
245
210
|
* @permissionScope Manage Bookings
|
|
246
211
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
247
212
|
* @permissionScope Manage Bookings - all permissions
|
|
248
213
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
249
214
|
* @applicableIdentity APP
|
|
250
|
-
* @
|
|
251
|
-
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.RescheduleMultiServiceBooking
|
|
215
|
+
* @fqn com.wixpress.bookings.confirmator.v2.Confirmator.ConfirmOrDeclineBooking
|
|
252
216
|
*/
|
|
253
|
-
export async function
|
|
217
|
+
export async function confirmOrDeclineBooking(bookingId, options) {
|
|
254
218
|
// @ts-ignore
|
|
255
|
-
const { httpClient, sideEffects } = arguments[
|
|
219
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
256
220
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
participantNotification: options?.participantNotification,
|
|
260
|
-
flowControlSettings: options?.flowControlSettings,
|
|
261
|
-
returnFullEntity: options?.returnFullEntity,
|
|
221
|
+
bookingId: bookingId,
|
|
222
|
+
paymentStatus: options?.paymentStatus,
|
|
262
223
|
});
|
|
263
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
224
|
+
const reqOpts = ambassadorWixBookingsV2Booking.confirmOrDeclineBooking(payload);
|
|
264
225
|
sideEffects?.onSiteCall?.();
|
|
265
226
|
try {
|
|
266
227
|
const result = await httpClient.request(reqOpts);
|
|
@@ -271,95 +232,43 @@ export async function rescheduleMultiServiceBooking(multiServiceBookingId, resch
|
|
|
271
232
|
const transformedError = sdkTransformError(err, {
|
|
272
233
|
spreadPathsToArguments: {},
|
|
273
234
|
explicitPathsToArguments: {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
participantNotification: '$[2].participantNotification',
|
|
277
|
-
flowControlSettings: '$[2].flowControlSettings',
|
|
278
|
-
returnFullEntity: '$[2].returnFullEntity',
|
|
235
|
+
bookingId: '$[0]',
|
|
236
|
+
paymentStatus: '$[1].paymentStatus',
|
|
279
237
|
},
|
|
280
238
|
singleArgumentUnchanged: false,
|
|
281
|
-
}, ['
|
|
239
|
+
}, ['bookingId', 'options']);
|
|
282
240
|
sideEffects?.onError?.(err);
|
|
283
241
|
throw transformedError;
|
|
284
242
|
}
|
|
285
243
|
}
|
|
286
244
|
/**
|
|
287
|
-
*
|
|
245
|
+
* Confirms or declines up to 300 bookings.
|
|
288
246
|
*
|
|
289
247
|
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* @
|
|
294
|
-
* @documentationMaturity preview
|
|
295
|
-
* @requiredField multiServiceBookingId
|
|
296
|
-
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_GET_AVAILABILITY
|
|
297
|
-
* @permissionScope Read Bookings - Public Data
|
|
298
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
299
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
300
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
301
|
-
* @permissionScope Manage Bookings
|
|
302
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
303
|
-
* @permissionScope Read Bookings - Including Participants
|
|
304
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
305
|
-
* @permissionScope Read Bookings - all read permissions
|
|
306
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
307
|
-
* @permissionScope Read Bookings Calendar Availability
|
|
308
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
|
|
309
|
-
* @permissionScope Manage Bookings - all permissions
|
|
310
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
311
|
-
* @applicableIdentity APP
|
|
312
|
-
* @applicableIdentity VISITOR
|
|
313
|
-
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.GetMultiServiceBookingAvailability
|
|
314
|
-
*/
|
|
315
|
-
export async function getMultiServiceBookingAvailability(multiServiceBookingId) {
|
|
316
|
-
// @ts-ignore
|
|
317
|
-
const { httpClient, sideEffects } = arguments[1];
|
|
318
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
319
|
-
multiServiceBookingId: multiServiceBookingId,
|
|
320
|
-
});
|
|
321
|
-
const reqOpts = ambassadorWixBookingsV2Booking.getMultiServiceBookingAvailability(payload);
|
|
322
|
-
sideEffects?.onSiteCall?.();
|
|
323
|
-
try {
|
|
324
|
-
const result = await httpClient.request(reqOpts);
|
|
325
|
-
sideEffects?.onSuccess?.(result);
|
|
326
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
327
|
-
}
|
|
328
|
-
catch (err) {
|
|
329
|
-
const transformedError = sdkTransformError(err, {
|
|
330
|
-
spreadPathsToArguments: {},
|
|
331
|
-
explicitPathsToArguments: { multiServiceBookingId: '$[0]' },
|
|
332
|
-
singleArgumentUnchanged: false,
|
|
333
|
-
}, ['multiServiceBookingId']);
|
|
334
|
-
sideEffects?.onError?.(err);
|
|
335
|
-
throw transformedError;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Cancels a multi-service booking and thus all its individual bookings.
|
|
340
|
-
* @param multiServiceBookingId - ID of the multi-service booking to cancel.
|
|
248
|
+
* See *Confirm Or Decline Booking*
|
|
249
|
+
* ([SDK](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking))
|
|
250
|
+
* for details about when a booking is confirmed or declined.
|
|
251
|
+
* @param details - Bookings to confirm or decline.
|
|
341
252
|
* @public
|
|
342
253
|
* @documentationMaturity preview
|
|
343
|
-
* @requiredField
|
|
344
|
-
* @
|
|
254
|
+
* @requiredField details
|
|
255
|
+
* @requiredField details.bookingId
|
|
256
|
+
* @permissionId BOOKINGS.BOOKING_CONFIRM_OR_DECLINE
|
|
345
257
|
* @permissionScope Manage Bookings
|
|
346
258
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
347
259
|
* @permissionScope Manage Bookings - all permissions
|
|
348
260
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
349
261
|
* @applicableIdentity APP
|
|
350
|
-
* @
|
|
351
|
-
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.CancelMultiServiceBooking
|
|
262
|
+
* @fqn com.wixpress.bookings.confirmator.v2.Confirmator.BulkConfirmOrDeclineBooking
|
|
352
263
|
*/
|
|
353
|
-
export async function
|
|
264
|
+
export async function bulkConfirmOrDeclineBooking(details, options) {
|
|
354
265
|
// @ts-ignore
|
|
355
266
|
const { httpClient, sideEffects } = arguments[2];
|
|
356
267
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
flowControlSettings: options?.flowControlSettings,
|
|
360
|
-
returnFullEntity: options?.returnFullEntity,
|
|
268
|
+
details: details,
|
|
269
|
+
returnEntity: options?.returnEntity,
|
|
361
270
|
});
|
|
362
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
271
|
+
const reqOpts = ambassadorWixBookingsV2Booking.bulkConfirmOrDeclineBooking(payload);
|
|
363
272
|
sideEffects?.onSiteCall?.();
|
|
364
273
|
try {
|
|
365
274
|
const result = await httpClient.request(reqOpts);
|
|
@@ -370,51 +279,155 @@ export async function cancelMultiServiceBooking(multiServiceBookingId, options)
|
|
|
370
279
|
const transformedError = sdkTransformError(err, {
|
|
371
280
|
spreadPathsToArguments: {},
|
|
372
281
|
explicitPathsToArguments: {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
flowControlSettings: '$[1].flowControlSettings',
|
|
376
|
-
returnFullEntity: '$[1].returnFullEntity',
|
|
282
|
+
details: '$[0]',
|
|
283
|
+
returnEntity: '$[1].returnEntity',
|
|
377
284
|
},
|
|
378
285
|
singleArgumentUnchanged: false,
|
|
379
|
-
}, ['
|
|
286
|
+
}, ['details', 'options']);
|
|
380
287
|
sideEffects?.onError?.(err);
|
|
381
288
|
throw transformedError;
|
|
382
289
|
}
|
|
383
290
|
}
|
|
384
291
|
/**
|
|
385
|
-
*
|
|
292
|
+
* Creates a booking.
|
|
386
293
|
*
|
|
387
294
|
*
|
|
388
|
-
*
|
|
295
|
+
* ## Appointment booking
|
|
389
296
|
*
|
|
390
|
-
*
|
|
297
|
+
* For appointment-based services, specify the relevant `slot` in
|
|
298
|
+
* `bookedEntity.slot`. We recommend specifying the complete
|
|
299
|
+
* `availabilityEntries.slot` returned in *Query Availability*
|
|
300
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
301
|
+
* in your call's request to avoid failed calls due to unavailability.
|
|
391
302
|
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
303
|
+
* ## Class session booking
|
|
304
|
+
*
|
|
305
|
+
* For class services, specify the relevant *event ID*
|
|
306
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/events/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction))
|
|
307
|
+
* as `bookedEntity.slot.eventId`.
|
|
308
|
+
* We recommend retrieving the event ID from *Query Availability's*
|
|
309
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
310
|
+
* `availabilityEntries.slot.eventId` to avoid failed calls due to unavailability.
|
|
311
|
+
* Specifying an event ID leads to automatic calculations of `slot.startDate`, `slot.endDate`,
|
|
312
|
+
* `slot.timezone`, `slot.resource`, and `slot.location`. All manually specified
|
|
313
|
+
* values are overridden.
|
|
314
|
+
*
|
|
315
|
+
* ## Course booking
|
|
316
|
+
*
|
|
317
|
+
* For course services, specify the course's schedule ID in `bookedEntity.schedule.scheduleId`.
|
|
318
|
+
* We recommend following [this sample flow](https://dev.wix.com/docs/rest/business-solutions/bookings/sample-booking-flows#book-a-course)
|
|
319
|
+
* to minimize failed calls due to unavailability.
|
|
320
|
+
*
|
|
321
|
+
* ## Related resources
|
|
322
|
+
*
|
|
323
|
+
* Specifying a `resource` triggers an availability check, resulting in a failed
|
|
324
|
+
* call if the resource is unavailable. Omitting a resource allows Wix Bookings
|
|
325
|
+
* to assign a resource belonging to the relevant type randomly when the merchant
|
|
326
|
+
* confirms the booking.
|
|
327
|
+
*
|
|
328
|
+
* ## Participant information
|
|
329
|
+
*
|
|
330
|
+
* You must specify either `participantsChoices` or `totalParticipants`.
|
|
331
|
+
* The call fails if the specified `participantsChoices` aren't among the supported
|
|
332
|
+
* _service options and variants_
|
|
333
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
|
|
334
|
+
*
|
|
335
|
+
* ## Notify customers
|
|
336
|
+
*
|
|
337
|
+
* You can specify a `participantNotification.message` for the customer that's send
|
|
338
|
+
* immediately. Ensure `participantNotification.notifyParticipants` is set to `true`
|
|
339
|
+
* to send the message.
|
|
340
|
+
*
|
|
341
|
+
* If you specify `{"sendSmsReminder": true}`, the customer receives an SMS 24 hours
|
|
342
|
+
* before the session starts. The phone number is taken from `contactDetails.phone`.
|
|
343
|
+
*
|
|
344
|
+
* ## Booking status
|
|
345
|
+
*
|
|
346
|
+
* Bookings default to the `CREATED` status, not affecting the business calendar
|
|
347
|
+
* or resource availability. You can specify a different status when the calling
|
|
348
|
+
* [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
|
|
349
|
+
* has `Manage Bookings` permissions.
|
|
350
|
+
*
|
|
351
|
+
* ## Payment options
|
|
352
|
+
*
|
|
353
|
+
* The specified `selectedPaymentOption` indicates how the customer intends to
|
|
354
|
+
* pay, allowing for later changes to a different method supported by the service.
|
|
355
|
+
*
|
|
356
|
+
* ## Payment status
|
|
357
|
+
*
|
|
358
|
+
* A booking is initially created with `{"paymentStatus": "UNDEFINED"}` regardless
|
|
359
|
+
* of the payment status specified in Create Booking. If a customer uses an
|
|
360
|
+
* _eCommerce checkout_
|
|
361
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)),
|
|
362
|
+
* Wix Bookings automatically syncs the booking's payment status from
|
|
363
|
+
* the corresponding *eCommerce order*
|
|
364
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
365
|
+
*
|
|
366
|
+
* If a booking doesn't have a corresponding eCommerce order, for example, since
|
|
367
|
+
* the customer didn't use the eCommerce checkout, you can update the booking's
|
|
368
|
+
* payment status with *Confirm Or Decline Booking*
|
|
369
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
|
|
370
|
+
*
|
|
371
|
+
* ## Booking form data
|
|
372
|
+
*
|
|
373
|
+
* When customers sign up for a service, they must fill out the booking form.
|
|
374
|
+
* To create a booking with a completed booking form, specify the relevant data in
|
|
375
|
+
* `formSubmission`. Ensure the values of the corresponding fields in
|
|
376
|
+
* `booking.contactDetails` and `formSubmission` are identical. If these values
|
|
377
|
+
* don't match, Create Booking fails. Therefore, we recommend specifying
|
|
378
|
+
* only `booking.contactDetails.contactId` when providing `formSubmission`.
|
|
379
|
+
*
|
|
380
|
+
* ## Admin overwrites
|
|
381
|
+
*
|
|
382
|
+
* There are small but important differences when you specify special
|
|
383
|
+
* `flowControlSettings`:
|
|
384
|
+
*
|
|
385
|
+
* - `{"skipAvailabilityValidation": true}`: The call succeeds
|
|
386
|
+
* regardless of availability. If you don't specify any resource, the call
|
|
387
|
+
* succeeds even if no resource of the relevant type is available.
|
|
388
|
+
* - `{"skipBusinessConfirmation": true}`: Automatically confirms `PENDING`
|
|
389
|
+
* bookings that require manual confirmation.
|
|
390
|
+
* - `{"skipSelectedPaymentOptionValidation": true}`: Allows customers to pay
|
|
391
|
+
* with payment methods that aren't supported for the service.
|
|
392
|
+
*
|
|
393
|
+
* When using special `flowControlSettings`, ensure you have sufficient
|
|
394
|
+
* permissions. If you encounter failed calls due to insufficient permissions,
|
|
395
|
+
* consider the following options:
|
|
396
|
+
*
|
|
397
|
+
* - **App developers** can use a higher
|
|
398
|
+
* [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
|
|
399
|
+
* such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
|
|
400
|
+
* - **Site developers** can utilize
|
|
401
|
+
* [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
|
|
402
|
+
*
|
|
403
|
+
* Granting additional permissions and using elevation permits method calls that
|
|
404
|
+
* would typically fail due to authorization checks. Therefore, you should use
|
|
405
|
+
* them intentionally and securely.
|
|
406
|
+
* @param booking - The booking to create.
|
|
394
407
|
* @public
|
|
395
|
-
* @
|
|
396
|
-
* @requiredField
|
|
397
|
-
* @
|
|
408
|
+
* @requiredField booking
|
|
409
|
+
* @requiredField booking.additionalFields._id
|
|
410
|
+
* @requiredField booking.bookedEntity
|
|
411
|
+
* @requiredField booking.bookedEntity.item
|
|
412
|
+
* @permissionId BOOKINGS.BOOKING_CREATE
|
|
398
413
|
* @permissionScope Manage Bookings
|
|
399
414
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
400
415
|
* @permissionScope Manage Bookings - all permissions
|
|
401
416
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
402
417
|
* @applicableIdentity APP
|
|
403
|
-
* @
|
|
418
|
+
* @applicableIdentity VISITOR
|
|
419
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.CreateBooking
|
|
404
420
|
*/
|
|
405
|
-
export async function
|
|
421
|
+
export async function createBooking(booking, options) {
|
|
406
422
|
// @ts-ignore
|
|
407
423
|
const { httpClient, sideEffects } = arguments[2];
|
|
408
424
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
409
|
-
|
|
410
|
-
markAsPendingBookingsInfo: options?.markAsPendingBookingsInfo,
|
|
425
|
+
booking: booking,
|
|
411
426
|
participantNotification: options?.participantNotification,
|
|
412
427
|
sendSmsReminder: options?.sendSmsReminder,
|
|
413
|
-
doubleBooked: options?.doubleBooked,
|
|
414
|
-
returnFullEntity: options?.returnFullEntity,
|
|
415
428
|
flowControlSettings: options?.flowControlSettings,
|
|
416
429
|
});
|
|
417
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
430
|
+
const reqOpts = ambassadorWixBookingsV2Booking.createBooking(payload);
|
|
418
431
|
sideEffects?.onSiteCall?.();
|
|
419
432
|
try {
|
|
420
433
|
const result = await httpClient.request(reqOpts);
|
|
@@ -425,54 +438,57 @@ export async function markMultiServiceBookingAsPending(multiServiceBookingId, op
|
|
|
425
438
|
const transformedError = sdkTransformError(err, {
|
|
426
439
|
spreadPathsToArguments: {},
|
|
427
440
|
explicitPathsToArguments: {
|
|
428
|
-
|
|
429
|
-
markAsPendingBookingsInfo: '$[1].markAsPendingBookingsInfo',
|
|
441
|
+
booking: '$[0]',
|
|
430
442
|
participantNotification: '$[1].participantNotification',
|
|
431
443
|
sendSmsReminder: '$[1].sendSmsReminder',
|
|
432
|
-
doubleBooked: '$[1].doubleBooked',
|
|
433
|
-
returnFullEntity: '$[1].returnFullEntity',
|
|
434
444
|
flowControlSettings: '$[1].flowControlSettings',
|
|
435
445
|
},
|
|
436
446
|
singleArgumentUnchanged: false,
|
|
437
|
-
}, ['
|
|
447
|
+
}, ['booking', 'options']);
|
|
438
448
|
sideEffects?.onError?.(err);
|
|
439
449
|
throw transformedError;
|
|
440
450
|
}
|
|
441
451
|
}
|
|
442
452
|
/**
|
|
443
|
-
*
|
|
453
|
+
* Creates up to 8 bookings.
|
|
444
454
|
*
|
|
445
455
|
*
|
|
446
|
-
*
|
|
456
|
+
* See *Create Booking*
|
|
457
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/create-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/create-booking))
|
|
458
|
+
* for more information.
|
|
447
459
|
*
|
|
448
|
-
*
|
|
460
|
+
* If any of the specified bookings is missing a required field the entire call
|
|
461
|
+
* fails.
|
|
449
462
|
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
463
|
+
* If you specify 1 or more unavailable bookings, the call succeeds
|
|
464
|
+
* while the unavailable bookings aren't created. Instead, they're counted as
|
|
465
|
+
* failures in the returned `bulkActionMetadata`.
|
|
466
|
+
* @param createBookingsInfo - Bookings to create.
|
|
467
|
+
*
|
|
468
|
+
* Max: 8 bookings
|
|
452
469
|
* @public
|
|
453
|
-
* @
|
|
454
|
-
* @requiredField
|
|
455
|
-
* @
|
|
470
|
+
* @requiredField createBookingsInfo
|
|
471
|
+
* @requiredField createBookingsInfo.booking
|
|
472
|
+
* @requiredField createBookingsInfo.booking.additionalFields._id
|
|
473
|
+
* @requiredField createBookingsInfo.booking.bookedEntity
|
|
474
|
+
* @requiredField createBookingsInfo.booking.bookedEntity.item
|
|
475
|
+
* @permissionId BOOKINGS.BOOKING_CREATE
|
|
456
476
|
* @permissionScope Manage Bookings
|
|
457
477
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
458
478
|
* @permissionScope Manage Bookings - all permissions
|
|
459
479
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
460
480
|
* @applicableIdentity APP
|
|
461
|
-
* @
|
|
481
|
+
* @applicableIdentity VISITOR
|
|
482
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.BulkCreateBooking
|
|
462
483
|
*/
|
|
463
|
-
export async function
|
|
484
|
+
export async function bulkCreateBooking(createBookingsInfo, options) {
|
|
464
485
|
// @ts-ignore
|
|
465
|
-
const { httpClient, sideEffects } = arguments[2];
|
|
466
|
-
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
467
|
-
|
|
468
|
-
confirmBookingsInfo: options?.confirmBookingsInfo,
|
|
469
|
-
participantNotification: options?.participantNotification,
|
|
470
|
-
sendSmsReminder: options?.sendSmsReminder,
|
|
471
|
-
doubleBooked: options?.doubleBooked,
|
|
486
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
487
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
488
|
+
createBookingsInfo: createBookingsInfo,
|
|
472
489
|
returnFullEntity: options?.returnFullEntity,
|
|
473
|
-
flowControlSettings: options?.flowControlSettings,
|
|
474
490
|
});
|
|
475
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
491
|
+
const reqOpts = ambassadorWixBookingsV2Booking.bulkCreateBooking(payload);
|
|
476
492
|
sideEffects?.onSiteCall?.();
|
|
477
493
|
try {
|
|
478
494
|
const result = await httpClient.request(reqOpts);
|
|
@@ -483,53 +499,103 @@ export async function confirmMultiServiceBooking(multiServiceBookingId, options)
|
|
|
483
499
|
const transformedError = sdkTransformError(err, {
|
|
484
500
|
spreadPathsToArguments: {},
|
|
485
501
|
explicitPathsToArguments: {
|
|
486
|
-
|
|
487
|
-
confirmBookingsInfo: '$[1].confirmBookingsInfo',
|
|
488
|
-
participantNotification: '$[1].participantNotification',
|
|
489
|
-
sendSmsReminder: '$[1].sendSmsReminder',
|
|
490
|
-
doubleBooked: '$[1].doubleBooked',
|
|
502
|
+
createBookingsInfo: '$[0]',
|
|
491
503
|
returnFullEntity: '$[1].returnFullEntity',
|
|
492
|
-
flowControlSettings: '$[1].flowControlSettings',
|
|
493
504
|
},
|
|
494
505
|
singleArgumentUnchanged: false,
|
|
495
|
-
}, ['
|
|
506
|
+
}, ['createBookingsInfo', 'options']);
|
|
496
507
|
sideEffects?.onError?.(err);
|
|
497
508
|
throw transformedError;
|
|
498
509
|
}
|
|
499
510
|
}
|
|
500
511
|
/**
|
|
501
|
-
*
|
|
512
|
+
* Reschedules an appointment booking to a different slot or a class booking to
|
|
513
|
+
* a different session.
|
|
502
514
|
*
|
|
503
515
|
*
|
|
504
|
-
*
|
|
516
|
+
* ## Course booking limitation
|
|
505
517
|
*
|
|
506
|
-
*
|
|
518
|
+
* You can't reschedule course bookings.
|
|
507
519
|
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
520
|
+
* ## Appointment sessions
|
|
521
|
+
*
|
|
522
|
+
* For appointments, the old session is removed from the business calendar
|
|
523
|
+
* while a new session is added. We recommend calling *Query Availability*
|
|
524
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
525
|
+
* first and specifying the entire retrieved `slot`.
|
|
526
|
+
*
|
|
527
|
+
* ## Class sessions
|
|
528
|
+
*
|
|
529
|
+
* For classes, the new session must be an existing session belonging to the
|
|
530
|
+
* same class. We recommend retrieving `availabilityEntries.slot.eventId`
|
|
531
|
+
* from *Query Availability*
|
|
532
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
533
|
+
* to avoid failed Reschedule Booking calls due to unavailability. Specify
|
|
534
|
+
* only `slot.eventId` instead of the entire `slot` object.
|
|
535
|
+
*
|
|
536
|
+
* ## Notify customers
|
|
537
|
+
*
|
|
538
|
+
* You can specify a `participantNotification.message` for the customer. To send
|
|
539
|
+
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
540
|
+
* as `true`.
|
|
541
|
+
*
|
|
542
|
+
* ## Admin overwrites
|
|
543
|
+
*
|
|
544
|
+
* There are small but important differences when you specify special
|
|
545
|
+
* `flowControlSettings`:
|
|
546
|
+
*
|
|
547
|
+
* - `{"ignoreReschedulePolicy": true}`: The call succeeds even if the
|
|
548
|
+
* service's `reschedulePolicy` doesn't allow it.
|
|
549
|
+
* - `{"skipAvailabilityValidation": true}`: The call succeeds even if
|
|
550
|
+
* the specified session, slot, or resource isn't available. If you don't
|
|
551
|
+
* specify any resource, the call succeeds even if no resource of the relevant
|
|
552
|
+
* type is available.
|
|
553
|
+
* - `{"skipBusinessConfirmation": true}`: Any `PENDING` booking is
|
|
554
|
+
* automatically confirmed even if the services requires the merchants's
|
|
555
|
+
* manual confirmation.
|
|
556
|
+
*
|
|
557
|
+
* When using special `flowControlSettings`, ensure you have sufficient
|
|
558
|
+
* permissions. If you encounter failed calls due to insufficient permissions,
|
|
559
|
+
* consider the following options:
|
|
560
|
+
*
|
|
561
|
+
* - **App developers** can use a higher
|
|
562
|
+
* [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
|
|
563
|
+
* such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
|
|
564
|
+
* - **Site developers** can utilize
|
|
565
|
+
* [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
|
|
566
|
+
*
|
|
567
|
+
* Granting additional permissions and using elevation permits method calls that
|
|
568
|
+
* would typically fail due to authorization checks. Therefore, you should use
|
|
569
|
+
* them intentionally and securely.
|
|
570
|
+
* @param bookingId - ID of the booking to reschedule.
|
|
571
|
+
* @param slot - New slot of the booking.
|
|
510
572
|
* @public
|
|
511
|
-
* @
|
|
512
|
-
* @requiredField
|
|
513
|
-
* @
|
|
573
|
+
* @requiredField bookingId
|
|
574
|
+
* @requiredField options.revision
|
|
575
|
+
* @requiredField slot
|
|
576
|
+
* @param options - An object representing the available options for rescheduling a booking.
|
|
577
|
+
* @permissionId BOOKINGS.BOOKING_RESCHEDULE
|
|
514
578
|
* @permissionScope Manage Bookings
|
|
515
579
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
516
580
|
* @permissionScope Manage Bookings - all permissions
|
|
517
581
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
518
582
|
* @applicableIdentity APP
|
|
519
|
-
* @
|
|
583
|
+
* @applicableIdentity MEMBER
|
|
584
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.RescheduleBooking
|
|
520
585
|
*/
|
|
521
|
-
export async function
|
|
586
|
+
export async function rescheduleBooking(bookingId, slot, options) {
|
|
522
587
|
// @ts-ignore
|
|
523
|
-
const { httpClient, sideEffects } = arguments[
|
|
588
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
524
589
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
525
|
-
|
|
526
|
-
|
|
590
|
+
bookingId: bookingId,
|
|
591
|
+
slot: slot,
|
|
592
|
+
revision: options?.revision,
|
|
527
593
|
participantNotification: options?.participantNotification,
|
|
528
|
-
doubleBooked: options?.doubleBooked,
|
|
529
|
-
returnFullEntity: options?.returnFullEntity,
|
|
530
594
|
flowControlSettings: options?.flowControlSettings,
|
|
595
|
+
totalParticipants: options?.totalParticipants,
|
|
596
|
+
participantsChoices: options?.participantsChoices,
|
|
531
597
|
});
|
|
532
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
598
|
+
const reqOpts = ambassadorWixBookingsV2Booking.rescheduleBooking(payload);
|
|
533
599
|
sideEffects?.onSiteCall?.();
|
|
534
600
|
try {
|
|
535
601
|
const result = await httpClient.request(reqOpts);
|
|
@@ -540,47 +606,103 @@ export async function declineMultiServiceBooking(multiServiceBookingId, options)
|
|
|
540
606
|
const transformedError = sdkTransformError(err, {
|
|
541
607
|
spreadPathsToArguments: {},
|
|
542
608
|
explicitPathsToArguments: {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
609
|
+
bookingId: '$[0]',
|
|
610
|
+
slot: '$[1]',
|
|
611
|
+
revision: '$[2].revision',
|
|
612
|
+
participantNotification: '$[2].participantNotification',
|
|
613
|
+
flowControlSettings: '$[2].flowControlSettings',
|
|
614
|
+
totalParticipants: '$[2].totalParticipants',
|
|
615
|
+
participantsChoices: '$[2].participantsChoices',
|
|
549
616
|
},
|
|
550
617
|
singleArgumentUnchanged: false,
|
|
551
|
-
}, ['
|
|
618
|
+
}, ['bookingId', 'slot', 'options']);
|
|
552
619
|
sideEffects?.onError?.(err);
|
|
553
620
|
throw transformedError;
|
|
554
621
|
}
|
|
555
622
|
}
|
|
556
623
|
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
624
|
+
* Updates the booking status to `CONFIRMED` and updates the relevant session's
|
|
625
|
+
* `participants.approvalStatus` to `APPROVED` without checking whether the relevant
|
|
626
|
+
* slot or schedule is still available.
|
|
627
|
+
*
|
|
628
|
+
* ## eCommerce checkout restriction
|
|
629
|
+
*
|
|
630
|
+
* Call this method only when using a custom checkout page. Don't
|
|
631
|
+
* call it when using a *Wix eCommerce checkout*
|
|
632
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
|
|
633
|
+
* In such cases, Wix automatically updates the booking status based on
|
|
634
|
+
* the `paymentStatus` of the corresponding *Wix eCommerce order*
|
|
635
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
636
|
+
*
|
|
637
|
+
* ## When to call Confirm Or Decline Booking instead
|
|
638
|
+
*
|
|
639
|
+
* Confirm Booking doesn't check whether a slot or schedule is still available. For
|
|
640
|
+
* these checks you can call *Confirm or Decline Booking*
|
|
641
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
|
|
642
|
+
*
|
|
643
|
+
* ## Original status validation
|
|
644
|
+
*
|
|
645
|
+
* You can only confirm bookings with a status of `PENDING`, `CREATED`, or
|
|
646
|
+
* `WAITING_LIST`.
|
|
647
|
+
*
|
|
648
|
+
* ## Double bookings
|
|
649
|
+
*
|
|
650
|
+
* Confirm Booking doesn't check whether a slot or schedule is still available.
|
|
651
|
+
* You can specify
|
|
652
|
+
*
|
|
653
|
+
* ```json
|
|
654
|
+
* {
|
|
655
|
+
* "flowControlSettings": {
|
|
656
|
+
* "checkAvailabilityValidation": true
|
|
657
|
+
* },
|
|
658
|
+
* "doubleBooked": true
|
|
659
|
+
* }
|
|
660
|
+
* ```
|
|
661
|
+
* to forcefully set the booking's `doubleBooked` flag to `true`, regardless of
|
|
662
|
+
* a potential double booking conflict. You must call with `Manage Bookings`
|
|
663
|
+
* permissions to do so. For the default flow control settings
|
|
664
|
+
* `{"checkAvailabilityValidation": false}`, the specified `doubleBooked` value
|
|
665
|
+
* is ignored.
|
|
666
|
+
*
|
|
667
|
+
* ## Payment status
|
|
668
|
+
*
|
|
669
|
+
* Also updates the booking's `paymentStatus`, if you specify a new payment
|
|
670
|
+
* status.
|
|
671
|
+
*
|
|
672
|
+
* ## Notify customers
|
|
673
|
+
*
|
|
674
|
+
* You can specify a `participantNotification.message` for the customer. To send
|
|
675
|
+
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
676
|
+
* as `true`.
|
|
677
|
+
* @param bookingId - ID of the booking to confirm.
|
|
678
|
+
* @param revision - Revision number, which increments by 1 each time the booking is updated.
|
|
679
|
+
* To prevent conflicting changes, the current revision must be passed when
|
|
680
|
+
* updating the booking.
|
|
559
681
|
* @public
|
|
560
|
-
* @
|
|
561
|
-
* @requiredField
|
|
562
|
-
* @
|
|
563
|
-
* @
|
|
564
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
682
|
+
* @requiredField bookingId
|
|
683
|
+
* @requiredField revision
|
|
684
|
+
* @param options - An object representing the available options for canceling a booking.
|
|
685
|
+
* @permissionId BOOKINGS.BOOKING_CONFIRM
|
|
565
686
|
* @permissionScope Manage Bookings
|
|
566
687
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
567
|
-
* @permissionScope Read Bookings - Including Participants
|
|
568
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
569
|
-
* @permissionScope Read Bookings - all read permissions
|
|
570
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
571
688
|
* @permissionScope Manage Bookings - all permissions
|
|
572
689
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
573
690
|
* @applicableIdentity APP
|
|
574
|
-
* @
|
|
575
|
-
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.BulkGetMultiServiceBookingAllowedActions
|
|
691
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.ConfirmBooking
|
|
576
692
|
*/
|
|
577
|
-
export async function
|
|
693
|
+
export async function confirmBooking(bookingId, revision, options) {
|
|
578
694
|
// @ts-ignore
|
|
579
|
-
const { httpClient, sideEffects } = arguments[
|
|
695
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
580
696
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
581
|
-
|
|
697
|
+
bookingId: bookingId,
|
|
698
|
+
revision: revision,
|
|
699
|
+
participantNotification: options?.participantNotification,
|
|
700
|
+
sendSmsReminder: options?.sendSmsReminder,
|
|
701
|
+
paymentStatus: options?.paymentStatus,
|
|
702
|
+
doubleBooked: options?.doubleBooked,
|
|
703
|
+
flowControlSettings: options?.flowControlSettings,
|
|
582
704
|
});
|
|
583
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
705
|
+
const reqOpts = ambassadorWixBookingsV2Booking.bookingsConfirmBooking(payload);
|
|
584
706
|
sideEffects?.onSiteCall?.();
|
|
585
707
|
try {
|
|
586
708
|
const result = await httpClient.request(reqOpts);
|
|
@@ -590,91 +712,139 @@ export async function bulkGetMultiServiceBookingAllowedActions(multiServiceBooki
|
|
|
590
712
|
catch (err) {
|
|
591
713
|
const transformedError = sdkTransformError(err, {
|
|
592
714
|
spreadPathsToArguments: {},
|
|
593
|
-
explicitPathsToArguments: {
|
|
715
|
+
explicitPathsToArguments: {
|
|
716
|
+
bookingId: '$[0]',
|
|
717
|
+
revision: '$[1]',
|
|
718
|
+
participantNotification: '$[2].participantNotification',
|
|
719
|
+
sendSmsReminder: '$[2].sendSmsReminder',
|
|
720
|
+
paymentStatus: '$[2].paymentStatus',
|
|
721
|
+
doubleBooked: '$[2].doubleBooked',
|
|
722
|
+
flowControlSettings: '$[2].flowControlSettings',
|
|
723
|
+
},
|
|
594
724
|
singleArgumentUnchanged: false,
|
|
595
|
-
}, ['
|
|
725
|
+
}, ['bookingId', 'revision', 'options']);
|
|
596
726
|
sideEffects?.onError?.(err);
|
|
597
727
|
throw transformedError;
|
|
598
728
|
}
|
|
599
729
|
}
|
|
600
730
|
/**
|
|
601
|
-
*
|
|
731
|
+
* Updates the extended fields for a booking.
|
|
602
732
|
*
|
|
603
733
|
*
|
|
604
|
-
* If you
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
*
|
|
608
|
-
* @param multiServiceBookingId - ID of the multi-service booking.
|
|
734
|
+
* If you specify an extended field `namespace` that doesn't exist yet, it's
|
|
735
|
+
* created.
|
|
736
|
+
*
|
|
737
|
+
* Learn more about [extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/about-backend-extensions#schema-plugin-extensions).
|
|
609
738
|
* @public
|
|
610
|
-
* @
|
|
611
|
-
* @requiredField
|
|
612
|
-
* @
|
|
613
|
-
* @
|
|
614
|
-
* @
|
|
739
|
+
* @requiredField _id
|
|
740
|
+
* @requiredField namespace
|
|
741
|
+
* @requiredField options
|
|
742
|
+
* @requiredField options.namespaceData
|
|
743
|
+
* @param _id - ID of the booking for which to update extended fields.
|
|
744
|
+
* @param namespace - [Namespace](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-reading-and-writing-schema-plugin-fields#namespaces) of the app for which to update extended fields.
|
|
745
|
+
* @param options - Options for updating the booking's extended fields.
|
|
746
|
+
* @permissionId BOOKINGS.BOOKING_UPDATE_EXTENDED_FIELDS
|
|
615
747
|
* @permissionScope Manage Bookings
|
|
616
748
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
617
|
-
* @permissionScope Read Bookings - Including Participants
|
|
618
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
619
|
-
* @permissionScope Read Bookings - all read permissions
|
|
620
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
621
|
-
* @permissionScope Read Bookings Calendar Availability
|
|
622
|
-
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
|
|
623
749
|
* @permissionScope Manage Bookings - all permissions
|
|
624
750
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
625
751
|
* @applicableIdentity APP
|
|
626
|
-
* @
|
|
627
|
-
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.GetMultiServiceBooking
|
|
752
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.UpdateExtendedFields
|
|
628
753
|
*/
|
|
629
|
-
export async function
|
|
754
|
+
export async function updateExtendedFields(_id, namespace, options) {
|
|
630
755
|
// @ts-ignore
|
|
631
|
-
const { httpClient, sideEffects } = arguments[
|
|
756
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
632
757
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
633
|
-
|
|
758
|
+
id: _id,
|
|
759
|
+
namespace: namespace,
|
|
760
|
+
namespaceData: options?.namespaceData,
|
|
634
761
|
});
|
|
635
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
762
|
+
const reqOpts = ambassadorWixBookingsV2Booking.updateExtendedFields(payload);
|
|
636
763
|
sideEffects?.onSiteCall?.();
|
|
637
764
|
try {
|
|
638
765
|
const result = await httpClient.request(reqOpts);
|
|
639
766
|
sideEffects?.onSuccess?.(result);
|
|
640
|
-
return renameKeysFromRESTResponseToSDKResponse(result.data)
|
|
641
|
-
?.multiServiceBooking;
|
|
767
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
642
768
|
}
|
|
643
769
|
catch (err) {
|
|
644
770
|
const transformedError = sdkTransformError(err, {
|
|
645
771
|
spreadPathsToArguments: {},
|
|
646
|
-
explicitPathsToArguments: {
|
|
772
|
+
explicitPathsToArguments: {
|
|
773
|
+
id: '$[0]',
|
|
774
|
+
namespace: '$[1]',
|
|
775
|
+
namespaceData: '$[2].namespaceData',
|
|
776
|
+
},
|
|
647
777
|
singleArgumentUnchanged: false,
|
|
648
|
-
}, ['
|
|
778
|
+
}, ['_id', 'namespace', 'options']);
|
|
649
779
|
sideEffects?.onError?.(err);
|
|
650
780
|
throw transformedError;
|
|
651
781
|
}
|
|
652
782
|
}
|
|
653
783
|
/**
|
|
654
|
-
*
|
|
784
|
+
* Updates the booking status to `DECLINED` and updates the relevant session's
|
|
785
|
+
* `participants.approvalStatus` to `DECLINED` without checking whether the relevant
|
|
786
|
+
* slot or schedule is still available.
|
|
655
787
|
*
|
|
656
788
|
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
789
|
+
* ## eCommerce checkout restriction
|
|
790
|
+
*
|
|
791
|
+
* Call this method only when using a custom checkout page. Don't
|
|
792
|
+
* call it when using a *Wix eCommerce checkout*
|
|
793
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
|
|
794
|
+
* In such cases, Wix automatically updates the booking status based on
|
|
795
|
+
* the `paymentStatus` of the corresponding *Wix eCommerce order*
|
|
796
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
797
|
+
*
|
|
798
|
+
* ## When to call Confirm Or Decline Booking instead
|
|
799
|
+
*
|
|
800
|
+
* The method doesn't check whether a slot or schedule is still available. For
|
|
801
|
+
* these checks you can call *Confirm or Decline Booking*
|
|
802
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
|
|
803
|
+
*
|
|
804
|
+
* ## Original status validation
|
|
805
|
+
*
|
|
806
|
+
* You can only decline bookings with a `status` of `PENDING`, `CREATED`, or
|
|
807
|
+
* `WAITING_LIST`.
|
|
808
|
+
*
|
|
809
|
+
* ## Payment status
|
|
810
|
+
*
|
|
811
|
+
* Also updates the booking's `paymentStatus`, if you specify a new payment
|
|
812
|
+
* status.
|
|
813
|
+
*
|
|
814
|
+
* ## Notify customers
|
|
815
|
+
*
|
|
816
|
+
* You can specify a `participantNotification.message` for the customer. To send
|
|
817
|
+
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
818
|
+
* as `true`.
|
|
819
|
+
* @param bookingId - ID of the booking to decline.
|
|
820
|
+
* @param revision - Revision number, which increments by 1 each time the booking is updated.
|
|
821
|
+
*
|
|
822
|
+
* To prevent conflicting changes, the current revision must be specified when
|
|
823
|
+
* declining the booking.
|
|
660
824
|
* @public
|
|
661
|
-
* @
|
|
662
|
-
* @requiredField
|
|
663
|
-
* @
|
|
664
|
-
* @
|
|
665
|
-
* @
|
|
666
|
-
* @
|
|
667
|
-
* @
|
|
825
|
+
* @requiredField bookingId
|
|
826
|
+
* @requiredField revision
|
|
827
|
+
* @param options - An object representing the available options for declining a booking.
|
|
828
|
+
* @permissionId BOOKINGS.BOOKING_DECLINE
|
|
829
|
+
* @permissionScope Manage Bookings
|
|
830
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
831
|
+
* @permissionScope Manage Bookings - all permissions
|
|
832
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
833
|
+
* @applicableIdentity APP
|
|
834
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.DeclineBooking
|
|
668
835
|
*/
|
|
669
|
-
export async function
|
|
836
|
+
export async function declineBooking(bookingId, revision, options) {
|
|
670
837
|
// @ts-ignore
|
|
671
|
-
const { httpClient, sideEffects } = arguments[
|
|
838
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
672
839
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
840
|
+
bookingId: bookingId,
|
|
841
|
+
revision: revision,
|
|
842
|
+
participantNotification: options?.participantNotification,
|
|
843
|
+
paymentStatus: options?.paymentStatus,
|
|
844
|
+
doubleBooked: options?.doubleBooked,
|
|
845
|
+
flowControlSettings: options?.flowControlSettings,
|
|
676
846
|
});
|
|
677
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
847
|
+
const reqOpts = ambassadorWixBookingsV2Booking.bookingsDeclineBooking(payload);
|
|
678
848
|
sideEffects?.onSiteCall?.();
|
|
679
849
|
try {
|
|
680
850
|
const result = await httpClient.request(reqOpts);
|
|
@@ -685,48 +855,89 @@ export async function addBookingsToMultiServiceBooking(multiServiceBookingId, op
|
|
|
685
855
|
const transformedError = sdkTransformError(err, {
|
|
686
856
|
spreadPathsToArguments: {},
|
|
687
857
|
explicitPathsToArguments: {
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
858
|
+
bookingId: '$[0]',
|
|
859
|
+
revision: '$[1]',
|
|
860
|
+
participantNotification: '$[2].participantNotification',
|
|
861
|
+
paymentStatus: '$[2].paymentStatus',
|
|
862
|
+
doubleBooked: '$[2].doubleBooked',
|
|
863
|
+
flowControlSettings: '$[2].flowControlSettings',
|
|
691
864
|
},
|
|
692
865
|
singleArgumentUnchanged: false,
|
|
693
|
-
}, ['
|
|
866
|
+
}, ['bookingId', 'revision', 'options']);
|
|
694
867
|
sideEffects?.onError?.(err);
|
|
695
868
|
throw transformedError;
|
|
696
869
|
}
|
|
697
870
|
}
|
|
698
871
|
/**
|
|
699
|
-
*
|
|
700
|
-
* removed bookings.
|
|
872
|
+
* Updates the booking status to `CANCELED`.
|
|
701
873
|
*
|
|
702
874
|
*
|
|
703
|
-
*
|
|
704
|
-
* the call's [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
|
|
705
|
-
* has read permissions are removed from the multi-service booking.
|
|
875
|
+
* ## Appointments
|
|
706
876
|
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
877
|
+
* For appointments, the corresponding event is removed from the Bookings
|
|
878
|
+
* calendar.
|
|
879
|
+
*
|
|
880
|
+
* ## Class and course bookings
|
|
881
|
+
*
|
|
882
|
+
* For class or course bookings, the relevant participants are removed
|
|
883
|
+
* from the class session or the course. However, the class session or course
|
|
884
|
+
* remain on the business calendar.
|
|
885
|
+
*
|
|
886
|
+
* ## Notify customers
|
|
887
|
+
*
|
|
888
|
+
* You can specify a `participantNotification.message` for the customer. To send
|
|
889
|
+
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
890
|
+
* as `true`.
|
|
891
|
+
*
|
|
892
|
+
* ## Admin overwrites
|
|
893
|
+
*
|
|
894
|
+
* There are small but important differences when you specify special
|
|
895
|
+
* `flowControlSettings`:
|
|
896
|
+
*
|
|
897
|
+
* - `{"ignoreCancellationPolicy": true}`: The call succeeds even if the
|
|
898
|
+
* service's `cancellationPolicy` doesn't allow it.
|
|
899
|
+
* - `{"withRefund": true}`: The customer is refunded even if the service's
|
|
900
|
+
* `refundPolicy` doesn't allow it.
|
|
901
|
+
* - `{"waiveCancellationFee": true}`: The customer doesn't have to pay
|
|
902
|
+
* the cancellation fee, even if the service's `cancellationPolicy` requires it.
|
|
903
|
+
*
|
|
904
|
+
* When using special `flowControlSettings`, ensure you have sufficient
|
|
905
|
+
* permissions. If you encounter failed calls due to insufficient permissions,
|
|
906
|
+
* consider the following options:
|
|
907
|
+
*
|
|
908
|
+
* - **App developers** can use a higher
|
|
909
|
+
* [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
|
|
910
|
+
* such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
|
|
911
|
+
* - **Site developers** can utilize
|
|
912
|
+
* [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
|
|
913
|
+
*
|
|
914
|
+
* Granting additional permissions and using elevation permits method calls that
|
|
915
|
+
* would typically fail due to authorization checks. Therefore, you should use
|
|
916
|
+
* them intentionally and securely.
|
|
917
|
+
* @param bookingId - ID of the booking to cancel.
|
|
710
918
|
* @public
|
|
711
|
-
* @
|
|
712
|
-
* @requiredField
|
|
713
|
-
* @
|
|
919
|
+
* @requiredField bookingId
|
|
920
|
+
* @requiredField options.revision
|
|
921
|
+
* @param options - An object representing the available options for canceling a booking.
|
|
922
|
+
* @permissionId BOOKINGS.BOOKING_CANCEL
|
|
714
923
|
* @permissionScope Manage Bookings
|
|
715
924
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
716
925
|
* @permissionScope Manage Bookings - all permissions
|
|
717
926
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
718
927
|
* @applicableIdentity APP
|
|
719
|
-
* @
|
|
928
|
+
* @applicableIdentity MEMBER
|
|
929
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.CancelBooking
|
|
720
930
|
*/
|
|
721
|
-
export async function
|
|
931
|
+
export async function cancelBooking(bookingId, options) {
|
|
722
932
|
// @ts-ignore
|
|
723
933
|
const { httpClient, sideEffects } = arguments[2];
|
|
724
934
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
935
|
+
bookingId: bookingId,
|
|
936
|
+
participantNotification: options?.participantNotification,
|
|
937
|
+
flowControlSettings: options?.flowControlSettings,
|
|
938
|
+
revision: options?.revision,
|
|
728
939
|
});
|
|
729
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
940
|
+
const reqOpts = ambassadorWixBookingsV2Booking.bookingsCancelBooking(payload);
|
|
730
941
|
sideEffects?.onSiteCall?.();
|
|
731
942
|
try {
|
|
732
943
|
const result = await httpClient.request(reqOpts);
|
|
@@ -737,154 +948,113 @@ export async function removeBookingsFromMultiServiceBooking(multiServiceBookingI
|
|
|
737
948
|
const transformedError = sdkTransformError(err, {
|
|
738
949
|
spreadPathsToArguments: {},
|
|
739
950
|
explicitPathsToArguments: {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
951
|
+
bookingId: '$[0]',
|
|
952
|
+
participantNotification: '$[1].participantNotification',
|
|
953
|
+
flowControlSettings: '$[1].flowControlSettings',
|
|
954
|
+
revision: '$[1].revision',
|
|
743
955
|
},
|
|
744
956
|
singleArgumentUnchanged: false,
|
|
745
|
-
}, ['
|
|
957
|
+
}, ['bookingId', 'options']);
|
|
746
958
|
sideEffects?.onError?.(err);
|
|
747
959
|
throw transformedError;
|
|
748
960
|
}
|
|
749
961
|
}
|
|
750
962
|
/**
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
* ## Appointment booking
|
|
755
|
-
*
|
|
756
|
-
* For appointment-based services, specify the relevant `slot` in
|
|
757
|
-
* `bookedEntity.slot`. We recommend specifying the complete
|
|
758
|
-
* `availabilityEntries.slot` returned in Query Availability
|
|
759
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
760
|
-
* in your call's request to avoid failed calls due to unavailability.
|
|
761
|
-
*
|
|
762
|
-
* ## Class session booking
|
|
763
|
-
*
|
|
764
|
-
* For class services, specify the relevant event ID
|
|
765
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/calendar/events/introduction) | [REST](https://dev.wix.com/docs/rest/business-management/calendar/events-v3/introduction))
|
|
766
|
-
* as `bookedEntity.slot.eventId`.
|
|
767
|
-
* We recommend retrieving the event ID from Query Availability's
|
|
768
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
769
|
-
* `availabilityEntries.slot.eventId` to avoid failed calls due to unavailability.
|
|
770
|
-
* Specifying an event ID leads to automatic calculations of `slot.startDate`, `slot.endDate`,
|
|
771
|
-
* `slot.timezone`, `slot.resource`, and `slot.location`. All manually specified
|
|
772
|
-
* values are overridden.
|
|
773
|
-
*
|
|
774
|
-
* ## Course booking
|
|
775
|
-
*
|
|
776
|
-
* For course services, specify the course's schedule ID in `bookedEntity.schedule.scheduleId`.
|
|
777
|
-
* We recommend following [this sample flow](https://dev.wix.com/docs/rest/business-solutions/bookings/sample-booking-flows#book-a-course)
|
|
778
|
-
* to minimize failed calls due to unavailability.
|
|
779
|
-
*
|
|
780
|
-
* ## Related resources
|
|
781
|
-
*
|
|
782
|
-
* Specifying a `resource` triggers an availability check, resulting in a failed
|
|
783
|
-
* call if the resource is unavailable. Omitting a resource allows Wix Bookings
|
|
784
|
-
* to assign a resource belonging to the relevant type randomly when the merchant
|
|
785
|
-
* confirms the booking.
|
|
786
|
-
*
|
|
787
|
-
* ## Participant information
|
|
788
|
-
*
|
|
789
|
-
* You must specify either `participantsChoices` or `totalParticipants`.
|
|
790
|
-
* The call fails if the specified `participantsChoices` aren't among the supported
|
|
791
|
-
* service options and variants
|
|
792
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
|
|
793
|
-
*
|
|
794
|
-
* ## Notify customers
|
|
795
|
-
*
|
|
796
|
-
* You can specify a `participantNotification.message` for the customer that's send
|
|
797
|
-
* immediately. Ensure `participantNotification.notifyParticipants` is set to `true`
|
|
798
|
-
* to send the message.
|
|
799
|
-
*
|
|
800
|
-
* If you specify `{"sendSmsReminder": true}`, the customer receives an SMS 24 hours
|
|
801
|
-
* before the session starts. The phone number is taken from `contactDetails.phone`.
|
|
802
|
-
*
|
|
803
|
-
* ## Booking status
|
|
804
|
-
*
|
|
805
|
-
* Bookings default to the `CREATED` status, not affecting the business calendar
|
|
806
|
-
* or resource availability. You can specify a different status when the calling
|
|
807
|
-
* [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
|
|
808
|
-
* has `Manage Bookings` permissions.
|
|
809
|
-
*
|
|
810
|
-
* ## Payment options
|
|
811
|
-
*
|
|
812
|
-
* The specified `selectedPaymentOption` indicates how the customer intends to
|
|
813
|
-
* pay, allowing for later changes to a different method supported by the service.
|
|
814
|
-
*
|
|
815
|
-
* ## Payment status
|
|
816
|
-
*
|
|
817
|
-
* A booking is initially created with `{"paymentStatus": "UNDEFINED"}` regardless
|
|
818
|
-
* of the payment status specified in Create Booking. If a customer uses an eCommerce
|
|
819
|
-
* checkout ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)),
|
|
820
|
-
* Wix Bookings automatically syncs the booking's payment status from
|
|
821
|
-
* the corresponding eCommerce order ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
822
|
-
*
|
|
823
|
-
* If a booking doesn't have a corresponding eCommerce order, for example, since
|
|
824
|
-
* the customer didn't use the eCommerce checkout, you can update the booking's
|
|
825
|
-
* payment status with Confirm Or Decline Booking
|
|
826
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
|
|
827
|
-
*
|
|
828
|
-
* ## Booking form data
|
|
829
|
-
*
|
|
830
|
-
* When customers sign up for a service, they must fill out the booking form.
|
|
831
|
-
* To create a booking with a completed booking form, specify the relevant data in
|
|
832
|
-
* `formSubmission`. Ensure the values of the corresponding fields in
|
|
833
|
-
* `booking.contactDetails` and `formSubmission` are identical. If these values
|
|
834
|
-
* don't match, Create Booking fails. Therefore, we recommend specifying
|
|
835
|
-
* only `booking.contactDetails.contactId` when providing `formSubmission`.
|
|
963
|
+
* Updates the number of participants for a class or course booking and changes
|
|
964
|
+
* the `totalNumberOfParticipants` for the relevant sessions.
|
|
836
965
|
*
|
|
837
|
-
* ## Admin overwrites
|
|
838
966
|
*
|
|
839
|
-
*
|
|
840
|
-
* `flowControlSettings`:
|
|
967
|
+
* ## Appointment limitation
|
|
841
968
|
*
|
|
842
|
-
*
|
|
843
|
-
* regardless of availability. If you don't specify any resource, the call
|
|
844
|
-
* succeeds even if no resource of the relevant type is available.
|
|
845
|
-
* - `{"skipBusinessConfirmation": true}`: Automatically confirms `PENDING`
|
|
846
|
-
* bookings that require manual confirmation.
|
|
847
|
-
* - `{"skipSelectedPaymentOptionValidation": true}`: Allows customers to pay
|
|
848
|
-
* with payment methods that aren't supported for the service.
|
|
969
|
+
* You can't update the number of participants for appointment bookings.
|
|
849
970
|
*
|
|
850
|
-
*
|
|
851
|
-
* permissions. If you encounter failed calls due to insufficient permissions,
|
|
852
|
-
* consider the following options:
|
|
971
|
+
* ## Participant information
|
|
853
972
|
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
* -
|
|
858
|
-
*
|
|
973
|
+
* You must specify either `participantsChoices` or `totalParticipants`.
|
|
974
|
+
* The call fails if the specified `participantsChoices` aren't among the
|
|
975
|
+
* supported *service options and variants*
|
|
976
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
|
|
977
|
+
* @param bookingId - ID of the booking to update the number of participants for.
|
|
978
|
+
* @public
|
|
979
|
+
* @requiredField bookingId
|
|
980
|
+
* @requiredField options.revision
|
|
981
|
+
* @permissionId BOOKINGS.NUMBER_OF_PARTICIPANTS_UPDATE
|
|
982
|
+
* @permissionScope Manage Bookings
|
|
983
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
984
|
+
* @permissionScope Manage Bookings - all permissions
|
|
985
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
986
|
+
* @applicableIdentity APP
|
|
987
|
+
* @fqn com.wixpress.bookings.bookings.v2.Bookings.UpdateNumberOfParticipants
|
|
988
|
+
*/
|
|
989
|
+
export async function updateNumberOfParticipants(bookingId, options) {
|
|
990
|
+
// @ts-ignore
|
|
991
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
992
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
993
|
+
bookingId: bookingId,
|
|
994
|
+
revision: options?.revision,
|
|
995
|
+
totalParticipants: options?.totalParticipants,
|
|
996
|
+
participantsChoices: options?.participantsChoices,
|
|
997
|
+
});
|
|
998
|
+
const reqOpts = ambassadorWixBookingsV2Booking.bookingsUpdateNumberOfParticipants(payload);
|
|
999
|
+
sideEffects?.onSiteCall?.();
|
|
1000
|
+
try {
|
|
1001
|
+
const result = await httpClient.request(reqOpts);
|
|
1002
|
+
sideEffects?.onSuccess?.(result);
|
|
1003
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1004
|
+
}
|
|
1005
|
+
catch (err) {
|
|
1006
|
+
const transformedError = sdkTransformError(err, {
|
|
1007
|
+
spreadPathsToArguments: {},
|
|
1008
|
+
explicitPathsToArguments: {
|
|
1009
|
+
bookingId: '$[0]',
|
|
1010
|
+
revision: '$[1].revision',
|
|
1011
|
+
totalParticipants: '$[1].totalParticipants',
|
|
1012
|
+
participantsChoices: '$[1].participantsChoices',
|
|
1013
|
+
},
|
|
1014
|
+
singleArgumentUnchanged: false,
|
|
1015
|
+
}, ['bookingId', 'options']);
|
|
1016
|
+
sideEffects?.onError?.(err);
|
|
1017
|
+
throw transformedError;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Creates a multi-service booking.
|
|
859
1022
|
*
|
|
860
|
-
*
|
|
861
|
-
*
|
|
862
|
-
*
|
|
863
|
-
* @param booking - The booking to create.
|
|
1023
|
+
*
|
|
1024
|
+
* See Create Booking for more information.
|
|
1025
|
+
* @param bookings - Single-service bookings to combine in a multi-service booking.
|
|
864
1026
|
* @public
|
|
865
|
-
* @
|
|
866
|
-
* @requiredField
|
|
867
|
-
* @requiredField
|
|
868
|
-
* @requiredField
|
|
869
|
-
* @
|
|
1027
|
+
* @documentationMaturity preview
|
|
1028
|
+
* @requiredField bookings
|
|
1029
|
+
* @requiredField bookings.additionalFields._id
|
|
1030
|
+
* @requiredField bookings.bookedEntity
|
|
1031
|
+
* @requiredField bookings.bookedEntity.item
|
|
1032
|
+
* @requiredField bookings.bookedEntity.item.slot
|
|
1033
|
+
* @requiredField bookings.bookedEntity.item.slot.endDate
|
|
1034
|
+
* @requiredField bookings.bookedEntity.item.slot.location.locationType
|
|
1035
|
+
* @requiredField bookings.bookedEntity.item.slot.scheduleId
|
|
1036
|
+
* @requiredField bookings.bookedEntity.item.slot.startDate
|
|
1037
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_CREATE
|
|
870
1038
|
* @permissionScope Manage Bookings
|
|
871
1039
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
872
1040
|
* @permissionScope Manage Bookings - all permissions
|
|
873
1041
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
874
1042
|
* @applicableIdentity APP
|
|
875
1043
|
* @applicableIdentity VISITOR
|
|
876
|
-
* @fqn com.wixpress.bookings.bookings.v2.
|
|
1044
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.CreateMultiServiceBooking
|
|
877
1045
|
*/
|
|
878
|
-
export async function
|
|
1046
|
+
export async function createMultiServiceBooking(bookings, options) {
|
|
879
1047
|
// @ts-ignore
|
|
880
1048
|
const { httpClient, sideEffects } = arguments[2];
|
|
881
1049
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
882
|
-
|
|
1050
|
+
bookings: bookings,
|
|
883
1051
|
participantNotification: options?.participantNotification,
|
|
884
1052
|
sendSmsReminder: options?.sendSmsReminder,
|
|
885
1053
|
flowControlSettings: options?.flowControlSettings,
|
|
1054
|
+
returnFullEntity: options?.returnFullEntity,
|
|
1055
|
+
multiServiceBookingType: options?.multiServiceBookingType,
|
|
886
1056
|
});
|
|
887
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1057
|
+
const reqOpts = ambassadorWixBookingsV2Booking.createMultiServiceBooking(payload);
|
|
888
1058
|
sideEffects?.onSiteCall?.();
|
|
889
1059
|
try {
|
|
890
1060
|
const result = await httpClient.request(reqOpts);
|
|
@@ -895,56 +1065,57 @@ export async function createBooking(booking, options) {
|
|
|
895
1065
|
const transformedError = sdkTransformError(err, {
|
|
896
1066
|
spreadPathsToArguments: {},
|
|
897
1067
|
explicitPathsToArguments: {
|
|
898
|
-
|
|
1068
|
+
bookings: '$[0]',
|
|
899
1069
|
participantNotification: '$[1].participantNotification',
|
|
900
1070
|
sendSmsReminder: '$[1].sendSmsReminder',
|
|
901
1071
|
flowControlSettings: '$[1].flowControlSettings',
|
|
1072
|
+
returnFullEntity: '$[1].returnFullEntity',
|
|
1073
|
+
multiServiceBookingType: '$[1].multiServiceBookingType',
|
|
902
1074
|
},
|
|
903
1075
|
singleArgumentUnchanged: false,
|
|
904
|
-
}, ['
|
|
1076
|
+
}, ['bookings', 'options']);
|
|
905
1077
|
sideEffects?.onError?.(err);
|
|
906
1078
|
throw transformedError;
|
|
907
1079
|
}
|
|
908
1080
|
}
|
|
909
1081
|
/**
|
|
910
|
-
*
|
|
911
|
-
*
|
|
1082
|
+
* Reschedules a multi-service booking.
|
|
912
1083
|
*
|
|
913
|
-
* See Create Booking ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/create-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/create-booking))
|
|
914
|
-
* for more information.
|
|
915
1084
|
*
|
|
916
|
-
*
|
|
917
|
-
*
|
|
1085
|
+
* The call fails if at least 1 individual booking can't be rescheduled due
|
|
1086
|
+
* the service being unavailable or a rescheduling policy violation.
|
|
918
1087
|
*
|
|
919
|
-
* If you specify 1 or more unavailable bookings, the call succeeds
|
|
920
|
-
* while the unavailable bookings aren't created. Instead, they're counted as
|
|
921
|
-
* failures in the returned `bulkActionMetadata`.
|
|
922
|
-
* @param createBookingsInfo - Bookings to create.
|
|
923
1088
|
*
|
|
924
|
-
*
|
|
1089
|
+
* See Reschedule Booking for more information.
|
|
1090
|
+
* @param multiServiceBookingId - ID of the multi service booking to reschedule.
|
|
1091
|
+
* @param rescheduleBookingsInfo - Information about the single-service bookings to reschedule.
|
|
925
1092
|
* @public
|
|
926
|
-
* @
|
|
927
|
-
* @requiredField
|
|
928
|
-
* @requiredField
|
|
929
|
-
* @requiredField
|
|
930
|
-
* @requiredField
|
|
931
|
-
* @
|
|
1093
|
+
* @documentationMaturity preview
|
|
1094
|
+
* @requiredField multiServiceBookingId
|
|
1095
|
+
* @requiredField rescheduleBookingsInfo
|
|
1096
|
+
* @requiredField rescheduleBookingsInfo.bookingId
|
|
1097
|
+
* @requiredField rescheduleBookingsInfo.revision
|
|
1098
|
+
* @requiredField rescheduleBookingsInfo.slot
|
|
1099
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_RESCHEDULE
|
|
932
1100
|
* @permissionScope Manage Bookings
|
|
933
1101
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
934
1102
|
* @permissionScope Manage Bookings - all permissions
|
|
935
1103
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
936
1104
|
* @applicableIdentity APP
|
|
937
|
-
* @applicableIdentity
|
|
938
|
-
* @fqn com.wixpress.bookings.bookings.v2.
|
|
1105
|
+
* @applicableIdentity MEMBER
|
|
1106
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.RescheduleMultiServiceBooking
|
|
939
1107
|
*/
|
|
940
|
-
export async function
|
|
1108
|
+
export async function rescheduleMultiServiceBooking(multiServiceBookingId, rescheduleBookingsInfo, options) {
|
|
941
1109
|
// @ts-ignore
|
|
942
|
-
const { httpClient, sideEffects } = arguments[
|
|
1110
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
943
1111
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
944
|
-
|
|
1112
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1113
|
+
rescheduleBookingsInfo: rescheduleBookingsInfo,
|
|
1114
|
+
participantNotification: options?.participantNotification,
|
|
1115
|
+
flowControlSettings: options?.flowControlSettings,
|
|
945
1116
|
returnFullEntity: options?.returnFullEntity,
|
|
946
1117
|
});
|
|
947
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1118
|
+
const reqOpts = ambassadorWixBookingsV2Booking.rescheduleMultiServiceBooking(payload);
|
|
948
1119
|
sideEffects?.onSiteCall?.();
|
|
949
1120
|
try {
|
|
950
1121
|
const result = await httpClient.request(reqOpts);
|
|
@@ -955,103 +1126,54 @@ export async function bulkCreateBooking(createBookingsInfo, options) {
|
|
|
955
1126
|
const transformedError = sdkTransformError(err, {
|
|
956
1127
|
spreadPathsToArguments: {},
|
|
957
1128
|
explicitPathsToArguments: {
|
|
958
|
-
|
|
959
|
-
|
|
1129
|
+
multiServiceBookingId: '$[0]',
|
|
1130
|
+
rescheduleBookingsInfo: '$[1]',
|
|
1131
|
+
participantNotification: '$[2].participantNotification',
|
|
1132
|
+
flowControlSettings: '$[2].flowControlSettings',
|
|
1133
|
+
returnFullEntity: '$[2].returnFullEntity',
|
|
960
1134
|
},
|
|
961
1135
|
singleArgumentUnchanged: false,
|
|
962
|
-
}, ['
|
|
1136
|
+
}, ['multiServiceBookingId', 'rescheduleBookingsInfo', 'options']);
|
|
963
1137
|
sideEffects?.onError?.(err);
|
|
964
1138
|
throw transformedError;
|
|
965
1139
|
}
|
|
966
1140
|
}
|
|
967
1141
|
/**
|
|
968
|
-
*
|
|
969
|
-
* a different session.
|
|
970
|
-
*
|
|
971
|
-
*
|
|
972
|
-
* ## Course booking limitation
|
|
973
|
-
*
|
|
974
|
-
* You can't reschedule course bookings.
|
|
975
|
-
*
|
|
976
|
-
* ## Appointment sessions
|
|
977
|
-
*
|
|
978
|
-
* For appointments, the old session is removed from the business calendar
|
|
979
|
-
* while a new session is added. We recommend calling Query Availability
|
|
980
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
981
|
-
* first and specifying the entire retrieved `slot`.
|
|
982
|
-
*
|
|
983
|
-
* ## Class sessions
|
|
984
|
-
*
|
|
985
|
-
* For classes, the new session must be an existing session belonging to the
|
|
986
|
-
* same class. We recommend retrieving `availabilityEntries.slot.eventId`
|
|
987
|
-
* from Query Availability
|
|
988
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/availability-calendar/query-availability) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/time-slots/availability-calendar/query-availability))
|
|
989
|
-
* to avoid failed Reschedule Booking calls due to unavailability. Specify
|
|
990
|
-
* only `slot.eventId` instead of the entire `slot` object.
|
|
991
|
-
*
|
|
992
|
-
* ## Notify customers
|
|
993
|
-
*
|
|
994
|
-
* You can specify a `participantNotification.message` for the customer. To send
|
|
995
|
-
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
996
|
-
* as `true`.
|
|
997
|
-
*
|
|
998
|
-
* ## Admin overwrites
|
|
999
|
-
*
|
|
1000
|
-
* There are small but important differences when you specify special
|
|
1001
|
-
* `flowControlSettings`:
|
|
1002
|
-
*
|
|
1003
|
-
* - `{"ignoreReschedulePolicy": true}`: The call succeeds even if the
|
|
1004
|
-
* service's `reschedulePolicy` doesn't allow it.
|
|
1005
|
-
* - `{"skipAvailabilityValidation": true}`: The call succeeds even if
|
|
1006
|
-
* the specified session, slot, or resource isn't available. If you don't
|
|
1007
|
-
* specify any resource, the call succeeds even if no resource of the relevant
|
|
1008
|
-
* type is available.
|
|
1009
|
-
* - `{"skipBusinessConfirmation": true}`: Any `PENDING` booking is
|
|
1010
|
-
* automatically confirmed even if the services requires the merchants's
|
|
1011
|
-
* manual confirmation.
|
|
1012
|
-
*
|
|
1013
|
-
* When using special `flowControlSettings`, ensure you have sufficient
|
|
1014
|
-
* permissions. If you encounter failed calls due to insufficient permissions,
|
|
1015
|
-
* consider the following options:
|
|
1142
|
+
* Retrieves a multi-service booking's availability.
|
|
1016
1143
|
*
|
|
1017
|
-
* - **App developers** can use a higher
|
|
1018
|
-
* [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
|
|
1019
|
-
* such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
|
|
1020
|
-
* - **Site developers** can utilize
|
|
1021
|
-
* [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
|
|
1022
1144
|
*
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
* @param bookingId - ID of the booking to reschedule.
|
|
1027
|
-
* @param slot - New slot of the booking.
|
|
1145
|
+
* Use List Multi Service Availability Time Slots to check availability for a
|
|
1146
|
+
* `SEQUENTIAL_BOOKINGS` multi-service booking.
|
|
1147
|
+
* @param multiServiceBookingId - ID of the multi-service booking to retrieve.
|
|
1028
1148
|
* @public
|
|
1029
|
-
* @
|
|
1030
|
-
* @requiredField
|
|
1031
|
-
* @
|
|
1032
|
-
* @
|
|
1033
|
-
* @
|
|
1149
|
+
* @documentationMaturity preview
|
|
1150
|
+
* @requiredField multiServiceBookingId
|
|
1151
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_GET_AVAILABILITY
|
|
1152
|
+
* @permissionScope Read Bookings - Public Data
|
|
1153
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1154
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
1155
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
1034
1156
|
* @permissionScope Manage Bookings
|
|
1035
1157
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1158
|
+
* @permissionScope Read Bookings - Including Participants
|
|
1159
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1160
|
+
* @permissionScope Read Bookings - all read permissions
|
|
1161
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1162
|
+
* @permissionScope Read Bookings Calendar Availability
|
|
1163
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
|
|
1036
1164
|
* @permissionScope Manage Bookings - all permissions
|
|
1037
1165
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1038
1166
|
* @applicableIdentity APP
|
|
1039
|
-
* @applicableIdentity
|
|
1040
|
-
* @fqn com.wixpress.bookings.bookings.v2.
|
|
1167
|
+
* @applicableIdentity VISITOR
|
|
1168
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.GetMultiServiceBookingAvailability
|
|
1041
1169
|
*/
|
|
1042
|
-
export async function
|
|
1170
|
+
export async function getMultiServiceBookingAvailability(multiServiceBookingId) {
|
|
1043
1171
|
// @ts-ignore
|
|
1044
|
-
const { httpClient, sideEffects } = arguments[
|
|
1172
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1045
1173
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1046
|
-
|
|
1047
|
-
slot: slot,
|
|
1048
|
-
revision: options?.revision,
|
|
1049
|
-
participantNotification: options?.participantNotification,
|
|
1050
|
-
flowControlSettings: options?.flowControlSettings,
|
|
1051
|
-
totalParticipants: options?.totalParticipants,
|
|
1052
|
-
participantsChoices: options?.participantsChoices,
|
|
1174
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1053
1175
|
});
|
|
1054
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1176
|
+
const reqOpts = ambassadorWixBookingsV2Booking.getMultiServiceBookingAvailability(payload);
|
|
1055
1177
|
sideEffects?.onSiteCall?.();
|
|
1056
1178
|
try {
|
|
1057
1179
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1061,104 +1183,38 @@ export async function rescheduleBooking(bookingId, slot, options) {
|
|
|
1061
1183
|
catch (err) {
|
|
1062
1184
|
const transformedError = sdkTransformError(err, {
|
|
1063
1185
|
spreadPathsToArguments: {},
|
|
1064
|
-
explicitPathsToArguments: {
|
|
1065
|
-
bookingId: '$[0]',
|
|
1066
|
-
slot: '$[1]',
|
|
1067
|
-
revision: '$[2].revision',
|
|
1068
|
-
participantNotification: '$[2].participantNotification',
|
|
1069
|
-
flowControlSettings: '$[2].flowControlSettings',
|
|
1070
|
-
totalParticipants: '$[2].totalParticipants',
|
|
1071
|
-
participantsChoices: '$[2].participantsChoices',
|
|
1072
|
-
},
|
|
1186
|
+
explicitPathsToArguments: { multiServiceBookingId: '$[0]' },
|
|
1073
1187
|
singleArgumentUnchanged: false,
|
|
1074
|
-
}, ['
|
|
1188
|
+
}, ['multiServiceBookingId']);
|
|
1075
1189
|
sideEffects?.onError?.(err);
|
|
1076
1190
|
throw transformedError;
|
|
1077
1191
|
}
|
|
1078
1192
|
}
|
|
1079
1193
|
/**
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1082
|
-
* slot or schedule is still available.
|
|
1083
|
-
*
|
|
1084
|
-
* ## eCommerce checkout restriction
|
|
1085
|
-
*
|
|
1086
|
-
* Call this method only when using a custom checkout page. Don't
|
|
1087
|
-
* call it when using a Wix eCommerce checkout
|
|
1088
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
|
|
1089
|
-
* In such cases, Wix automatically updates the booking status based on
|
|
1090
|
-
* the `paymentStatus` of the corresponding Wix eCommerce order
|
|
1091
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
1092
|
-
*
|
|
1093
|
-
* ## When to call Confirm Or Decline Booking instead
|
|
1094
|
-
*
|
|
1095
|
-
* Confirm Booking doesn't check whether a slot or schedule is still available. For
|
|
1096
|
-
* these checks you can call Confirm or Decline Booking
|
|
1097
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
|
|
1098
|
-
*
|
|
1099
|
-
* ## Original status validation
|
|
1100
|
-
*
|
|
1101
|
-
* You can only confirm bookings with a status of `PENDING`, `CREATED`, or
|
|
1102
|
-
* `WAITING_LIST`.
|
|
1103
|
-
*
|
|
1104
|
-
* ## Double bookings
|
|
1105
|
-
*
|
|
1106
|
-
* Confirm Booking doesn't check whether a slot or schedule is still available.
|
|
1107
|
-
* You can specify
|
|
1108
|
-
*
|
|
1109
|
-
* ```json
|
|
1110
|
-
* {
|
|
1111
|
-
* "flowControlSettings": {
|
|
1112
|
-
* "checkAvailabilityValidation": true
|
|
1113
|
-
* },
|
|
1114
|
-
* "doubleBooked": true
|
|
1115
|
-
* }
|
|
1116
|
-
* ```
|
|
1117
|
-
* to forcefully set the booking's `doubleBooked` flag to `true`, regardless of
|
|
1118
|
-
* a potential double booking conflict. You must call with `Manage Bookings`
|
|
1119
|
-
* permissions to do so. For the default flow control settings
|
|
1120
|
-
* `{"checkAvailabilityValidation": false}`, the specified `doubleBooked` value
|
|
1121
|
-
* is ignored.
|
|
1122
|
-
*
|
|
1123
|
-
* ## Payment status
|
|
1124
|
-
*
|
|
1125
|
-
* Also updates the booking's `paymentStatus`, if you specify a new payment
|
|
1126
|
-
* status.
|
|
1127
|
-
*
|
|
1128
|
-
* ## Notify customers
|
|
1129
|
-
*
|
|
1130
|
-
* You can specify a `participantNotification.message` for the customer. To send
|
|
1131
|
-
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
1132
|
-
* as `true`.
|
|
1133
|
-
* @param bookingId - ID of the booking to confirm.
|
|
1134
|
-
* @param revision - Revision number, which increments by 1 each time the booking is updated.
|
|
1135
|
-
* To prevent conflicting changes, the current revision must be passed when
|
|
1136
|
-
* updating the booking.
|
|
1194
|
+
* Cancels a multi-service booking and thus all its individual bookings.
|
|
1195
|
+
* @param multiServiceBookingId - ID of the multi-service booking to cancel.
|
|
1137
1196
|
* @public
|
|
1138
|
-
* @
|
|
1139
|
-
* @requiredField
|
|
1140
|
-
* @
|
|
1141
|
-
* @permissionId BOOKINGS.BOOKING_CONFIRM
|
|
1197
|
+
* @documentationMaturity preview
|
|
1198
|
+
* @requiredField multiServiceBookingId
|
|
1199
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_CANCEL
|
|
1142
1200
|
* @permissionScope Manage Bookings
|
|
1143
1201
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1144
1202
|
* @permissionScope Manage Bookings - all permissions
|
|
1145
1203
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1146
1204
|
* @applicableIdentity APP
|
|
1147
|
-
* @
|
|
1205
|
+
* @applicableIdentity MEMBER
|
|
1206
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.CancelMultiServiceBooking
|
|
1148
1207
|
*/
|
|
1149
|
-
export async function
|
|
1208
|
+
export async function cancelMultiServiceBooking(multiServiceBookingId, options) {
|
|
1150
1209
|
// @ts-ignore
|
|
1151
|
-
const { httpClient, sideEffects } = arguments[
|
|
1210
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1152
1211
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1153
|
-
|
|
1154
|
-
revision: revision,
|
|
1212
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1155
1213
|
participantNotification: options?.participantNotification,
|
|
1156
|
-
sendSmsReminder: options?.sendSmsReminder,
|
|
1157
|
-
paymentStatus: options?.paymentStatus,
|
|
1158
|
-
doubleBooked: options?.doubleBooked,
|
|
1159
1214
|
flowControlSettings: options?.flowControlSettings,
|
|
1215
|
+
returnFullEntity: options?.returnFullEntity,
|
|
1160
1216
|
});
|
|
1161
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1217
|
+
const reqOpts = ambassadorWixBookingsV2Booking.cancelMultiServiceBooking(payload);
|
|
1162
1218
|
sideEffects?.onSiteCall?.();
|
|
1163
1219
|
try {
|
|
1164
1220
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1169,53 +1225,51 @@ export async function confirmBooking(bookingId, revision, options) {
|
|
|
1169
1225
|
const transformedError = sdkTransformError(err, {
|
|
1170
1226
|
spreadPathsToArguments: {},
|
|
1171
1227
|
explicitPathsToArguments: {
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
paymentStatus: '$[2].paymentStatus',
|
|
1177
|
-
doubleBooked: '$[2].doubleBooked',
|
|
1178
|
-
flowControlSettings: '$[2].flowControlSettings',
|
|
1228
|
+
multiServiceBookingId: '$[0]',
|
|
1229
|
+
participantNotification: '$[1].participantNotification',
|
|
1230
|
+
flowControlSettings: '$[1].flowControlSettings',
|
|
1231
|
+
returnFullEntity: '$[1].returnFullEntity',
|
|
1179
1232
|
},
|
|
1180
1233
|
singleArgumentUnchanged: false,
|
|
1181
|
-
}, ['
|
|
1234
|
+
}, ['multiServiceBookingId', 'options']);
|
|
1182
1235
|
sideEffects?.onError?.(err);
|
|
1183
1236
|
throw transformedError;
|
|
1184
1237
|
}
|
|
1185
1238
|
}
|
|
1186
1239
|
/**
|
|
1187
|
-
* Updates the
|
|
1240
|
+
* Updates the status of a multi-service booking to `PENDING`.
|
|
1188
1241
|
*
|
|
1189
1242
|
*
|
|
1190
|
-
*
|
|
1191
|
-
* created.
|
|
1243
|
+
* Also updates the status of each of individual bookings within the multi-service booking to `PENDING`.
|
|
1192
1244
|
*
|
|
1193
|
-
*
|
|
1245
|
+
* The call fails if the status for at least a single individual booking can't be updated.
|
|
1246
|
+
*
|
|
1247
|
+
* See Mark Booking as Pending for more information.
|
|
1248
|
+
* @param multiServiceBookingId - ID of the multi-service booking to mark as `PENDING`.
|
|
1194
1249
|
* @public
|
|
1195
|
-
* @
|
|
1196
|
-
* @requiredField
|
|
1197
|
-
* @
|
|
1198
|
-
* @requiredField options.namespaceData
|
|
1199
|
-
* @param _id - ID of the booking for which to update extended fields.
|
|
1200
|
-
* @param namespace - [Namespace](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-reading-and-writing-schema-plugin-fields#namespaces) of the app for which to update extended fields.
|
|
1201
|
-
* @param options - Options for updating the booking's extended fields.
|
|
1202
|
-
* @permissionId BOOKINGS.BOOKING_UPDATE_EXTENDED_FIELDS
|
|
1250
|
+
* @documentationMaturity preview
|
|
1251
|
+
* @requiredField multiServiceBookingId
|
|
1252
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_MARK_AS_PENDING
|
|
1203
1253
|
* @permissionScope Manage Bookings
|
|
1204
1254
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1205
1255
|
* @permissionScope Manage Bookings - all permissions
|
|
1206
1256
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1207
1257
|
* @applicableIdentity APP
|
|
1208
|
-
* @fqn com.wixpress.bookings.bookings.v2.
|
|
1258
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.MarkMultiServiceBookingAsPending
|
|
1209
1259
|
*/
|
|
1210
|
-
export async function
|
|
1260
|
+
export async function markMultiServiceBookingAsPending(multiServiceBookingId, options) {
|
|
1211
1261
|
// @ts-ignore
|
|
1212
|
-
const { httpClient, sideEffects } = arguments[
|
|
1262
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1213
1263
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1264
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1265
|
+
markAsPendingBookingsInfo: options?.markAsPendingBookingsInfo,
|
|
1266
|
+
participantNotification: options?.participantNotification,
|
|
1267
|
+
sendSmsReminder: options?.sendSmsReminder,
|
|
1268
|
+
doubleBooked: options?.doubleBooked,
|
|
1269
|
+
returnFullEntity: options?.returnFullEntity,
|
|
1270
|
+
flowControlSettings: options?.flowControlSettings,
|
|
1217
1271
|
});
|
|
1218
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1272
|
+
const reqOpts = ambassadorWixBookingsV2Booking.markMultiServiceBookingAsPending(payload);
|
|
1219
1273
|
sideEffects?.onSiteCall?.();
|
|
1220
1274
|
try {
|
|
1221
1275
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1226,81 +1280,54 @@ export async function updateExtendedFields(_id, namespace, options) {
|
|
|
1226
1280
|
const transformedError = sdkTransformError(err, {
|
|
1227
1281
|
spreadPathsToArguments: {},
|
|
1228
1282
|
explicitPathsToArguments: {
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1283
|
+
multiServiceBookingId: '$[0]',
|
|
1284
|
+
markAsPendingBookingsInfo: '$[1].markAsPendingBookingsInfo',
|
|
1285
|
+
participantNotification: '$[1].participantNotification',
|
|
1286
|
+
sendSmsReminder: '$[1].sendSmsReminder',
|
|
1287
|
+
doubleBooked: '$[1].doubleBooked',
|
|
1288
|
+
returnFullEntity: '$[1].returnFullEntity',
|
|
1289
|
+
flowControlSettings: '$[1].flowControlSettings',
|
|
1232
1290
|
},
|
|
1233
1291
|
singleArgumentUnchanged: false,
|
|
1234
|
-
}, ['
|
|
1292
|
+
}, ['multiServiceBookingId', 'options']);
|
|
1235
1293
|
sideEffects?.onError?.(err);
|
|
1236
1294
|
throw transformedError;
|
|
1237
1295
|
}
|
|
1238
1296
|
}
|
|
1239
1297
|
/**
|
|
1240
|
-
* Updates the
|
|
1241
|
-
* `participants.approvalStatus` to `DECLINED` without checking whether the relevant
|
|
1242
|
-
* slot or schedule is still available.
|
|
1243
|
-
*
|
|
1244
|
-
*
|
|
1245
|
-
* ## eCommerce checkout restriction
|
|
1246
|
-
*
|
|
1247
|
-
* Call this method only when using a custom checkout page. Don't
|
|
1248
|
-
* call it when using a Wix eCommerce checkout
|
|
1249
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
|
|
1250
|
-
* In such cases, Wix automatically updates the booking status based on
|
|
1251
|
-
* the `paymentStatus` of the corresponding Wix eCommerce order
|
|
1252
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
1253
|
-
*
|
|
1254
|
-
* ## When to call Confirm Or Decline Booking instead
|
|
1255
|
-
*
|
|
1256
|
-
* The method doesn't check whether a slot or schedule is still available. For
|
|
1257
|
-
* these checks you can call Confirm or Decline Booking
|
|
1258
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/confirm-or-decline-booking) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/confirm-or-decline-booking)).
|
|
1259
|
-
*
|
|
1260
|
-
* ## Original status validation
|
|
1261
|
-
*
|
|
1262
|
-
* You can only decline bookings with a `status` of `PENDING`, `CREATED`, or
|
|
1263
|
-
* `WAITING_LIST`.
|
|
1264
|
-
*
|
|
1265
|
-
* ## Payment status
|
|
1298
|
+
* Updates the status of a multi-service booking to `CONFIRMED`.
|
|
1266
1299
|
*
|
|
1267
|
-
* Also updates the booking's `paymentStatus`, if you specify a new payment
|
|
1268
|
-
* status.
|
|
1269
1300
|
*
|
|
1270
|
-
*
|
|
1301
|
+
* Also updates the status of each of individual bookings within the multi-service booking to `CONFIRMED`.
|
|
1271
1302
|
*
|
|
1272
|
-
*
|
|
1273
|
-
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
1274
|
-
* as `true`.
|
|
1275
|
-
* @param bookingId - ID of the booking to decline.
|
|
1276
|
-
* @param revision - Revision number, which increments by 1 each time the booking is updated.
|
|
1303
|
+
* The call fails if the status for at least a single individual booking can't be updated.
|
|
1277
1304
|
*
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1305
|
+
* See Confirm Booking for more information.
|
|
1306
|
+
* @param multiServiceBookingId - ID of the multi-service booking to confirm its related bookings.
|
|
1280
1307
|
* @public
|
|
1281
|
-
* @
|
|
1282
|
-
* @requiredField
|
|
1283
|
-
* @
|
|
1284
|
-
* @permissionId BOOKINGS.BOOKING_DECLINE
|
|
1308
|
+
* @documentationMaturity preview
|
|
1309
|
+
* @requiredField multiServiceBookingId
|
|
1310
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_CONFIRM
|
|
1285
1311
|
* @permissionScope Manage Bookings
|
|
1286
1312
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1287
1313
|
* @permissionScope Manage Bookings - all permissions
|
|
1288
1314
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1289
1315
|
* @applicableIdentity APP
|
|
1290
|
-
* @fqn com.wixpress.bookings.bookings.v2.
|
|
1316
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.ConfirmMultiServiceBooking
|
|
1291
1317
|
*/
|
|
1292
|
-
export async function
|
|
1318
|
+
export async function confirmMultiServiceBooking(multiServiceBookingId, options) {
|
|
1293
1319
|
// @ts-ignore
|
|
1294
|
-
const { httpClient, sideEffects } = arguments[
|
|
1320
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1295
1321
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1296
|
-
|
|
1297
|
-
|
|
1322
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1323
|
+
confirmBookingsInfo: options?.confirmBookingsInfo,
|
|
1298
1324
|
participantNotification: options?.participantNotification,
|
|
1299
|
-
|
|
1325
|
+
sendSmsReminder: options?.sendSmsReminder,
|
|
1300
1326
|
doubleBooked: options?.doubleBooked,
|
|
1327
|
+
returnFullEntity: options?.returnFullEntity,
|
|
1301
1328
|
flowControlSettings: options?.flowControlSettings,
|
|
1302
1329
|
});
|
|
1303
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1330
|
+
const reqOpts = ambassadorWixBookingsV2Booking.confirmMultiServiceBooking(payload);
|
|
1304
1331
|
sideEffects?.onSiteCall?.();
|
|
1305
1332
|
try {
|
|
1306
1333
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1311,89 +1338,53 @@ export async function declineBooking(bookingId, revision, options) {
|
|
|
1311
1338
|
const transformedError = sdkTransformError(err, {
|
|
1312
1339
|
spreadPathsToArguments: {},
|
|
1313
1340
|
explicitPathsToArguments: {
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
participantNotification: '$[
|
|
1317
|
-
|
|
1318
|
-
doubleBooked: '$[
|
|
1319
|
-
|
|
1341
|
+
multiServiceBookingId: '$[0]',
|
|
1342
|
+
confirmBookingsInfo: '$[1].confirmBookingsInfo',
|
|
1343
|
+
participantNotification: '$[1].participantNotification',
|
|
1344
|
+
sendSmsReminder: '$[1].sendSmsReminder',
|
|
1345
|
+
doubleBooked: '$[1].doubleBooked',
|
|
1346
|
+
returnFullEntity: '$[1].returnFullEntity',
|
|
1347
|
+
flowControlSettings: '$[1].flowControlSettings',
|
|
1320
1348
|
},
|
|
1321
1349
|
singleArgumentUnchanged: false,
|
|
1322
|
-
}, ['
|
|
1350
|
+
}, ['multiServiceBookingId', 'options']);
|
|
1323
1351
|
sideEffects?.onError?.(err);
|
|
1324
1352
|
throw transformedError;
|
|
1325
1353
|
}
|
|
1326
1354
|
}
|
|
1327
1355
|
/**
|
|
1328
|
-
* Updates the booking
|
|
1329
|
-
*
|
|
1330
|
-
*
|
|
1331
|
-
* ## Appointments
|
|
1332
|
-
*
|
|
1333
|
-
* For appointments, the corresponding event is removed from the Bookings
|
|
1334
|
-
* calendar.
|
|
1335
|
-
*
|
|
1336
|
-
* ## Class and course bookings
|
|
1337
|
-
*
|
|
1338
|
-
* For class or course bookings, the relevant participants are removed
|
|
1339
|
-
* from the class session or the course. However, the class session or course
|
|
1340
|
-
* remain on the business calendar.
|
|
1341
|
-
*
|
|
1342
|
-
* ## Notify customers
|
|
1343
|
-
*
|
|
1344
|
-
* You can specify a `participantNotification.message` for the customer. To send
|
|
1345
|
-
* the message, you must also specify `participantNotification.notifyParticipants`
|
|
1346
|
-
* as `true`.
|
|
1347
|
-
*
|
|
1348
|
-
* ## Admin overwrites
|
|
1349
|
-
*
|
|
1350
|
-
* There are small but important differences when you specify special
|
|
1351
|
-
* `flowControlSettings`:
|
|
1356
|
+
* Updates the status of a multi-service booking to `DECLINED`.
|
|
1352
1357
|
*
|
|
1353
|
-
* - `{"ignoreCancellationPolicy": true}`: The call succeeds even if the
|
|
1354
|
-
* service's `cancellationPolicy` doesn't allow it.
|
|
1355
|
-
* - `{"withRefund": true}`: The customer is refunded even if the service's
|
|
1356
|
-
* `refundPolicy` doesn't allow it.
|
|
1357
|
-
* - `{"waiveCancellationFee": true}`: The customer doesn't have to pay
|
|
1358
|
-
* the cancellation fee, even if the service's `cancellationPolicy` requires it.
|
|
1359
1358
|
*
|
|
1360
|
-
*
|
|
1361
|
-
* permissions. If you encounter failed calls due to insufficient permissions,
|
|
1362
|
-
* consider the following options:
|
|
1359
|
+
* Also updates the status of each of individual bookings within the multi-service booking to `DECLINED`.
|
|
1363
1360
|
*
|
|
1364
|
-
*
|
|
1365
|
-
* [permission](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/about-permissions),
|
|
1366
|
-
* such as `MANAGE BOOKINGS - ALL PERMISSIONS`.
|
|
1367
|
-
* - **Site developers** can utilize
|
|
1368
|
-
* [elevation](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/authorization/elevation).
|
|
1361
|
+
* The call fails if the status for at least a single individual booking can't be updated.
|
|
1369
1362
|
*
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1372
|
-
* them intentionally and securely.
|
|
1373
|
-
* @param bookingId - ID of the booking to cancel.
|
|
1363
|
+
* See Decline Booking for more information.
|
|
1364
|
+
* @param multiServiceBookingId - ID of the multi service booking to decline.
|
|
1374
1365
|
* @public
|
|
1375
|
-
* @
|
|
1376
|
-
* @requiredField
|
|
1377
|
-
* @
|
|
1378
|
-
* @permissionId BOOKINGS.BOOKING_CANCEL
|
|
1366
|
+
* @documentationMaturity preview
|
|
1367
|
+
* @requiredField multiServiceBookingId
|
|
1368
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_DECLINE
|
|
1379
1369
|
* @permissionScope Manage Bookings
|
|
1380
1370
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1381
1371
|
* @permissionScope Manage Bookings - all permissions
|
|
1382
1372
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1383
1373
|
* @applicableIdentity APP
|
|
1384
|
-
* @
|
|
1385
|
-
* @fqn com.wixpress.bookings.bookings.v2.Bookings.CancelBooking
|
|
1374
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.DeclineMultiServiceBooking
|
|
1386
1375
|
*/
|
|
1387
|
-
export async function
|
|
1376
|
+
export async function declineMultiServiceBooking(multiServiceBookingId, options) {
|
|
1388
1377
|
// @ts-ignore
|
|
1389
1378
|
const { httpClient, sideEffects } = arguments[2];
|
|
1390
1379
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1391
|
-
|
|
1380
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1381
|
+
declineBookingsInfo: options?.declineBookingsInfo,
|
|
1392
1382
|
participantNotification: options?.participantNotification,
|
|
1383
|
+
doubleBooked: options?.doubleBooked,
|
|
1384
|
+
returnFullEntity: options?.returnFullEntity,
|
|
1393
1385
|
flowControlSettings: options?.flowControlSettings,
|
|
1394
|
-
revision: options?.revision,
|
|
1395
1386
|
});
|
|
1396
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1387
|
+
const reqOpts = ambassadorWixBookingsV2Booking.declineMultiServiceBooking(payload);
|
|
1397
1388
|
sideEffects?.onSiteCall?.();
|
|
1398
1389
|
try {
|
|
1399
1390
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1404,54 +1395,47 @@ export async function cancelBooking(bookingId, options) {
|
|
|
1404
1395
|
const transformedError = sdkTransformError(err, {
|
|
1405
1396
|
spreadPathsToArguments: {},
|
|
1406
1397
|
explicitPathsToArguments: {
|
|
1407
|
-
|
|
1398
|
+
multiServiceBookingId: '$[0]',
|
|
1399
|
+
declineBookingsInfo: '$[1].declineBookingsInfo',
|
|
1408
1400
|
participantNotification: '$[1].participantNotification',
|
|
1401
|
+
doubleBooked: '$[1].doubleBooked',
|
|
1402
|
+
returnFullEntity: '$[1].returnFullEntity',
|
|
1409
1403
|
flowControlSettings: '$[1].flowControlSettings',
|
|
1410
|
-
revision: '$[1].revision',
|
|
1411
1404
|
},
|
|
1412
1405
|
singleArgumentUnchanged: false,
|
|
1413
|
-
}, ['
|
|
1406
|
+
}, ['multiServiceBookingId', 'options']);
|
|
1414
1407
|
sideEffects?.onError?.(err);
|
|
1415
1408
|
throw transformedError;
|
|
1416
1409
|
}
|
|
1417
1410
|
}
|
|
1418
1411
|
/**
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1423
|
-
* ## Appointment limitation
|
|
1424
|
-
*
|
|
1425
|
-
* You can't update the number of participants for appointment bookings.
|
|
1426
|
-
*
|
|
1427
|
-
* ## Participant information
|
|
1428
|
-
*
|
|
1429
|
-
* You must specify either `participantsChoices` or `totalParticipants`.
|
|
1430
|
-
* The call fails if the specified `participantsChoices` aren't among the
|
|
1431
|
-
* supported service options and variants
|
|
1432
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/service-options-and-variants/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/service-options-and-variants/introduction)).
|
|
1433
|
-
* @param bookingId - ID of the booking to update the number of participants for.
|
|
1412
|
+
* Retrieves the allowed actions for a list of multi-service bookings.
|
|
1413
|
+
* @param multiServiceBookingIds - IDs of the multi-service bookings to retrieve allowed actions for.
|
|
1434
1414
|
* @public
|
|
1435
|
-
* @
|
|
1436
|
-
* @requiredField
|
|
1437
|
-
* @permissionId
|
|
1415
|
+
* @documentationMaturity preview
|
|
1416
|
+
* @requiredField multiServiceBookingIds
|
|
1417
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_GET_ALLOWED_ACTIONS
|
|
1418
|
+
* @permissionScope Read Bookings - Public Data
|
|
1419
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1438
1420
|
* @permissionScope Manage Bookings
|
|
1439
1421
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1422
|
+
* @permissionScope Read Bookings - Including Participants
|
|
1423
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1424
|
+
* @permissionScope Read Bookings - all read permissions
|
|
1425
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1440
1426
|
* @permissionScope Manage Bookings - all permissions
|
|
1441
1427
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1442
1428
|
* @applicableIdentity APP
|
|
1443
|
-
* @
|
|
1429
|
+
* @applicableIdentity VISITOR
|
|
1430
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.BulkGetMultiServiceBookingAllowedActions
|
|
1444
1431
|
*/
|
|
1445
|
-
export async function
|
|
1432
|
+
export async function bulkGetMultiServiceBookingAllowedActions(multiServiceBookingIds) {
|
|
1446
1433
|
// @ts-ignore
|
|
1447
|
-
const { httpClient, sideEffects } = arguments[
|
|
1434
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1448
1435
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1449
|
-
|
|
1450
|
-
revision: options?.revision,
|
|
1451
|
-
totalParticipants: options?.totalParticipants,
|
|
1452
|
-
participantsChoices: options?.participantsChoices,
|
|
1436
|
+
multiServiceBookingIds: multiServiceBookingIds,
|
|
1453
1437
|
});
|
|
1454
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1438
|
+
const reqOpts = ambassadorWixBookingsV2Booking.bulkGetMultiServiceBookingAllowedActions(payload);
|
|
1455
1439
|
sideEffects?.onSiteCall?.();
|
|
1456
1440
|
try {
|
|
1457
1441
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1461,78 +1445,91 @@ export async function updateNumberOfParticipants(bookingId, options) {
|
|
|
1461
1445
|
catch (err) {
|
|
1462
1446
|
const transformedError = sdkTransformError(err, {
|
|
1463
1447
|
spreadPathsToArguments: {},
|
|
1464
|
-
explicitPathsToArguments: {
|
|
1465
|
-
bookingId: '$[0]',
|
|
1466
|
-
revision: '$[1].revision',
|
|
1467
|
-
totalParticipants: '$[1].totalParticipants',
|
|
1468
|
-
participantsChoices: '$[1].participantsChoices',
|
|
1469
|
-
},
|
|
1448
|
+
explicitPathsToArguments: { multiServiceBookingIds: '$[0]' },
|
|
1470
1449
|
singleArgumentUnchanged: false,
|
|
1471
|
-
}, ['
|
|
1450
|
+
}, ['multiServiceBookingIds']);
|
|
1472
1451
|
sideEffects?.onError?.(err);
|
|
1473
1452
|
throw transformedError;
|
|
1474
1453
|
}
|
|
1475
1454
|
}
|
|
1476
1455
|
/**
|
|
1477
|
-
*
|
|
1478
|
-
* on the `paymentStatus` you provide, double booking conflicts, and whether
|
|
1479
|
-
* the service requires business approval.
|
|
1480
|
-
*
|
|
1481
|
-
* ## eCommerce checkout restriction
|
|
1482
|
-
*
|
|
1483
|
-
* Call this method only when using a custom checkout page. Don't
|
|
1484
|
-
* call it when using a *Wix eCommerce checkout*
|
|
1485
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/orders/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/checkout/introduction)).
|
|
1486
|
-
* In such cases, Wix automatically updates the booking status based on
|
|
1487
|
-
* the `paymentStatus` of the corresponding *Wix eCommerce order*
|
|
1488
|
-
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/checkout/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/orders/introduction)).
|
|
1489
|
-
*
|
|
1490
|
-
* ## New booking status
|
|
1491
|
-
*
|
|
1492
|
-
* The booking `status` is set to `DECLINED` if both of the following conditions
|
|
1493
|
-
* are met:
|
|
1494
|
-
* + You provide `UNDEFINED`, `NOT_PAID`, `REFUNDED`, or `EXEMPT` as payment status.
|
|
1495
|
-
* + There is a double booking conflict.
|
|
1496
|
-
*
|
|
1497
|
-
* If only one or none of these conditions is met, `status` is set to `PENDING`
|
|
1498
|
-
* or `CONFIRMED` depending on whether the service requires business approval.
|
|
1499
|
-
*
|
|
1500
|
-
* ## Double bookings
|
|
1501
|
-
*
|
|
1502
|
-
* If there is a double booking conflict, but the booking has already been at least
|
|
1503
|
-
* partially paid, the method still marks the booking as `PENDING` or `CONFIRMED`.
|
|
1504
|
-
* Then, it also sets `doubleBooked` to `true`.
|
|
1456
|
+
* Retrieves all single-service bookings belonging to a multi-service booking.
|
|
1505
1457
|
*
|
|
1506
|
-
* ## Admin overwrites
|
|
1507
1458
|
*
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
*
|
|
1512
|
-
*
|
|
1513
|
-
* service requires business approval.
|
|
1514
|
-
* + If the booking's `flowControlSettings.skipBusinessConfirmation` was set to
|
|
1515
|
-
* `true`, the booking skips `PENDING` status and is marked `CONFIRMED`
|
|
1516
|
-
* immediately.
|
|
1517
|
-
* @param bookingId - ID of the booking to confirm or decline.
|
|
1459
|
+
* If you call as an [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
|
|
1460
|
+
* who has permissions to read only part of the bookings,
|
|
1461
|
+
* only the permitted bookings are retrieved. The returned total number of
|
|
1462
|
+
* bookings includes also the bookings for which you don't have permissions.
|
|
1463
|
+
* @param multiServiceBookingId - ID of the multi-service booking.
|
|
1518
1464
|
* @public
|
|
1519
|
-
* @
|
|
1520
|
-
* @
|
|
1465
|
+
* @documentationMaturity preview
|
|
1466
|
+
* @requiredField multiServiceBookingId
|
|
1467
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_READ
|
|
1468
|
+
* @permissionScope Read Bookings - Public Data
|
|
1469
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC
|
|
1521
1470
|
* @permissionScope Manage Bookings
|
|
1522
1471
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1472
|
+
* @permissionScope Read Bookings - Including Participants
|
|
1473
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
1474
|
+
* @permissionScope Read Bookings - all read permissions
|
|
1475
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
1476
|
+
* @permissionScope Read Bookings Calendar Availability
|
|
1477
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-CALENDAR
|
|
1523
1478
|
* @permissionScope Manage Bookings - all permissions
|
|
1524
1479
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1525
1480
|
* @applicableIdentity APP
|
|
1526
|
-
* @
|
|
1481
|
+
* @returns Retrieved multi-service booking.
|
|
1482
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.GetMultiServiceBooking
|
|
1527
1483
|
*/
|
|
1528
|
-
export async function
|
|
1484
|
+
export async function getMultiServiceBooking(multiServiceBookingId) {
|
|
1485
|
+
// @ts-ignore
|
|
1486
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1487
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1488
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1489
|
+
});
|
|
1490
|
+
const reqOpts = ambassadorWixBookingsV2Booking.getMultiServiceBooking(payload);
|
|
1491
|
+
sideEffects?.onSiteCall?.();
|
|
1492
|
+
try {
|
|
1493
|
+
const result = await httpClient.request(reqOpts);
|
|
1494
|
+
sideEffects?.onSuccess?.(result);
|
|
1495
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data)
|
|
1496
|
+
?.multiServiceBooking;
|
|
1497
|
+
}
|
|
1498
|
+
catch (err) {
|
|
1499
|
+
const transformedError = sdkTransformError(err, {
|
|
1500
|
+
spreadPathsToArguments: {},
|
|
1501
|
+
explicitPathsToArguments: { multiServiceBookingId: '$[0]' },
|
|
1502
|
+
singleArgumentUnchanged: false,
|
|
1503
|
+
}, ['multiServiceBookingId']);
|
|
1504
|
+
sideEffects?.onError?.(err);
|
|
1505
|
+
throw transformedError;
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Adds a list of single-service bookings to a multi-service booking.
|
|
1510
|
+
*
|
|
1511
|
+
*
|
|
1512
|
+
* The call fails, if at least 1 of the specified booking is already part of a
|
|
1513
|
+
* multi-service booking.
|
|
1514
|
+
* @param multiServiceBookingId - ID of the multi-service booking.
|
|
1515
|
+
* @public
|
|
1516
|
+
* @documentationMaturity preview
|
|
1517
|
+
* @requiredField multiServiceBookingId
|
|
1518
|
+
* @requiredField options.bookings
|
|
1519
|
+
* @requiredField options.bookings.bookingId
|
|
1520
|
+
* @requiredField options.bookings.revision
|
|
1521
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_ADD_BOOKINGS
|
|
1522
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.AddBookingsToMultiServiceBooking
|
|
1523
|
+
*/
|
|
1524
|
+
export async function addBookingsToMultiServiceBooking(multiServiceBookingId, options) {
|
|
1529
1525
|
// @ts-ignore
|
|
1530
1526
|
const { httpClient, sideEffects } = arguments[2];
|
|
1531
1527
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1532
|
-
|
|
1533
|
-
|
|
1528
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1529
|
+
bookings: options?.bookings,
|
|
1530
|
+
returnFullEntity: options?.returnFullEntity,
|
|
1534
1531
|
});
|
|
1535
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1532
|
+
const reqOpts = ambassadorWixBookingsV2Booking.addBookingsToMultiServiceBooking(payload);
|
|
1536
1533
|
sideEffects?.onSiteCall?.();
|
|
1537
1534
|
try {
|
|
1538
1535
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1543,43 +1540,48 @@ export async function confirmOrDeclineBooking(bookingId, options) {
|
|
|
1543
1540
|
const transformedError = sdkTransformError(err, {
|
|
1544
1541
|
spreadPathsToArguments: {},
|
|
1545
1542
|
explicitPathsToArguments: {
|
|
1546
|
-
|
|
1547
|
-
|
|
1543
|
+
multiServiceBookingId: '$[0]',
|
|
1544
|
+
bookings: '$[1].bookings',
|
|
1545
|
+
returnFullEntity: '$[1].returnFullEntity',
|
|
1548
1546
|
},
|
|
1549
1547
|
singleArgumentUnchanged: false,
|
|
1550
|
-
}, ['
|
|
1548
|
+
}, ['multiServiceBookingId', 'options']);
|
|
1551
1549
|
sideEffects?.onError?.(err);
|
|
1552
1550
|
throw transformedError;
|
|
1553
1551
|
}
|
|
1554
1552
|
}
|
|
1555
1553
|
/**
|
|
1556
|
-
*
|
|
1554
|
+
* Removes single-service bookings from a multi-service booking and returns the
|
|
1555
|
+
* removed bookings.
|
|
1557
1556
|
*
|
|
1558
1557
|
*
|
|
1559
|
-
*
|
|
1560
|
-
*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1558
|
+
* If you specify an empty `bookings` array, all single-service bookings for which
|
|
1559
|
+
* the call's [identity](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)
|
|
1560
|
+
* has read permissions are removed from the multi-service booking.
|
|
1561
|
+
*
|
|
1562
|
+
* If the call would create a multi-service booking including only 1 single-service
|
|
1563
|
+
* booking, the multi-service booking is also deleted.
|
|
1564
|
+
* @param multiServiceBookingId - ID of the multi-service booking.
|
|
1563
1565
|
* @public
|
|
1564
1566
|
* @documentationMaturity preview
|
|
1565
|
-
* @requiredField
|
|
1566
|
-
* @
|
|
1567
|
-
* @permissionId BOOKINGS.BOOKING_CONFIRM_OR_DECLINE
|
|
1567
|
+
* @requiredField multiServiceBookingId
|
|
1568
|
+
* @permissionId MULTI_SERVICE_BOOKINGS.MULTI_SERVICE_BOOKING_REMOVE_BOOKINGS
|
|
1568
1569
|
* @permissionScope Manage Bookings
|
|
1569
1570
|
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
1570
1571
|
* @permissionScope Manage Bookings - all permissions
|
|
1571
1572
|
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
1572
1573
|
* @applicableIdentity APP
|
|
1573
|
-
* @fqn com.wixpress.bookings.
|
|
1574
|
+
* @fqn com.wixpress.bookings.bookings.v2.MultiServiceBookings.RemoveBookingsFromMultiServiceBooking
|
|
1574
1575
|
*/
|
|
1575
|
-
export async function
|
|
1576
|
+
export async function removeBookingsFromMultiServiceBooking(multiServiceBookingId, options) {
|
|
1576
1577
|
// @ts-ignore
|
|
1577
1578
|
const { httpClient, sideEffects } = arguments[2];
|
|
1578
1579
|
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1579
|
-
|
|
1580
|
-
|
|
1580
|
+
multiServiceBookingId: multiServiceBookingId,
|
|
1581
|
+
bookings: options?.bookings,
|
|
1582
|
+
returnFullEntity: options?.returnFullEntity,
|
|
1581
1583
|
});
|
|
1582
|
-
const reqOpts = ambassadorWixBookingsV2Booking.
|
|
1584
|
+
const reqOpts = ambassadorWixBookingsV2Booking.removeBookingsFromMultiServiceBooking(payload);
|
|
1583
1585
|
sideEffects?.onSiteCall?.();
|
|
1584
1586
|
try {
|
|
1585
1587
|
const result = await httpClient.request(reqOpts);
|
|
@@ -1590,11 +1592,12 @@ export async function bulkConfirmOrDeclineBooking(details, options) {
|
|
|
1590
1592
|
const transformedError = sdkTransformError(err, {
|
|
1591
1593
|
spreadPathsToArguments: {},
|
|
1592
1594
|
explicitPathsToArguments: {
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
+
multiServiceBookingId: '$[0]',
|
|
1596
|
+
bookings: '$[1].bookings',
|
|
1597
|
+
returnFullEntity: '$[1].returnFullEntity',
|
|
1595
1598
|
},
|
|
1596
1599
|
singleArgumentUnchanged: false,
|
|
1597
|
-
}, ['
|
|
1600
|
+
}, ['multiServiceBookingId', 'options']);
|
|
1598
1601
|
sideEffects?.onError?.(err);
|
|
1599
1602
|
throw transformedError;
|
|
1600
1603
|
}
|