@wix/auto_sdk_bookings_bookings 1.0.14 → 1.0.16

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