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