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