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