@wix/auto_sdk_bookings_bookings 1.0.4 → 1.0.6

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