@wix/auto_sdk_bookings_bookings 1.0.0

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