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