@wix/auto_sdk_bookings_pricing 1.0.12 → 1.0.13
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-price-info-pricing.context.d.ts +6 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.context.js +18 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.context.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.http.d.ts +59 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.http.js +184 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.http.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.meta.d.ts +14 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.meta.js +66 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.meta.js.map +1 -0
- package/build/{internal/index.d.ts → cjs/src/bookings-v2-price-info-pricing.public.d.ts} +8 -11
- package/build/cjs/src/bookings-v2-price-info-pricing.public.js +28 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.public.js.map +1 -0
- package/build/{bookings-v2-price-info-pricing.universal-Ci_8AyL2.d.mts → cjs/src/bookings-v2-price-info-pricing.types.d.ts} +54 -56
- package/build/cjs/src/bookings-v2-price-info-pricing.types.js +133 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.types.js.map +1 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.universal.d.ts +1007 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.universal.js +299 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.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-price-info-pricing.context.d.ts +6 -0
- package/build/es/src/bookings-v2-price-info-pricing.context.js +6 -0
- package/build/es/src/bookings-v2-price-info-pricing.context.js.map +1 -0
- package/build/es/src/bookings-v2-price-info-pricing.http.d.ts +59 -0
- package/build/es/src/bookings-v2-price-info-pricing.http.js +179 -0
- package/build/es/src/bookings-v2-price-info-pricing.http.js.map +1 -0
- package/build/es/src/bookings-v2-price-info-pricing.meta.d.ts +14 -0
- package/build/es/src/bookings-v2-price-info-pricing.meta.js +38 -0
- package/build/es/src/bookings-v2-price-info-pricing.meta.js.map +1 -0
- package/build/{index.d.ts → es/src/bookings-v2-price-info-pricing.public.d.ts} +8 -11
- package/build/es/src/bookings-v2-price-info-pricing.public.js +14 -0
- package/build/es/src/bookings-v2-price-info-pricing.public.js.map +1 -0
- package/build/{bookings-v2-price-info-pricing.universal-Ci_8AyL2.d.ts → es/src/bookings-v2-price-info-pricing.types.d.ts} +54 -56
- package/build/es/src/bookings-v2-price-info-pricing.types.js +130 -0
- package/build/es/src/bookings-v2-price-info-pricing.types.js.map +1 -0
- package/build/es/src/bookings-v2-price-info-pricing.universal.d.ts +1007 -0
- package/build/es/src/bookings-v2-price-info-pricing.universal.js +271 -0
- package/build/es/src/bookings-v2-price-info-pricing.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-price-info-pricing.context.d.ts +6 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.context.js +18 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.context.js.map +1 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.http.d.ts +59 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.http.js +184 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.http.js.map +1 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.meta.d.ts +14 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.meta.js +66 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.meta.js.map +1 -0
- package/build/internal/{index.d.mts → cjs/src/bookings-v2-price-info-pricing.public.d.ts} +8 -11
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.public.js +28 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.public.js.map +1 -0
- package/build/internal/{bookings-v2-price-info-pricing.universal-Ci_8AyL2.d.ts → cjs/src/bookings-v2-price-info-pricing.types.d.ts} +54 -56
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.types.js +133 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.types.js.map +1 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.universal.d.ts +1007 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.universal.js +299 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.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-price-info-pricing.context.d.ts +6 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.context.js +6 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.context.js.map +1 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.http.d.ts +59 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.http.js +179 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.http.js.map +1 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.meta.d.ts +14 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.meta.js +38 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.meta.js.map +1 -0
- package/build/{index.d.mts → internal/es/src/bookings-v2-price-info-pricing.public.d.ts} +8 -11
- package/build/internal/es/src/bookings-v2-price-info-pricing.public.js +14 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.public.js.map +1 -0
- package/build/internal/{bookings-v2-price-info-pricing.universal-Ci_8AyL2.d.mts → es/src/bookings-v2-price-info-pricing.types.d.ts} +54 -56
- package/build/internal/es/src/bookings-v2-price-info-pricing.types.js +130 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.types.js.map +1 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.universal.d.ts +1007 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.universal.js +271 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.universal.js.map +1 -0
- package/package.json +11 -12
- package/build/index.js +0 -314
- package/build/index.js.map +0 -1
- package/build/index.mjs +0 -280
- package/build/index.mjs.map +0 -1
- package/build/internal/index.js +0 -314
- package/build/internal/index.js.map +0 -1
- package/build/internal/index.mjs +0 -280
- package/build/internal/index.mjs.map +0 -1
- package/build/internal/meta.d.mts +0 -793
- package/build/internal/meta.d.ts +0 -793
- package/build/internal/meta.js +0 -194
- package/build/internal/meta.js.map +0 -1
- package/build/internal/meta.mjs +0 -166
- package/build/internal/meta.mjs.map +0 -1
- package/build/meta.d.mts +0 -793
- package/build/meta.d.ts +0 -793
- package/build/meta.js +0 -194
- package/build/meta.js.map +0 -1
- package/build/meta.mjs +0 -166
- package/build/meta.mjs.map +0 -1
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
|
2
|
+
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
|
|
3
|
+
import * as ambassadorWixBookingsV2PriceInfo from './bookings-v2-price-info-pricing.http.js';
|
|
4
|
+
/**
|
|
5
|
+
* A multi-service booking is considered available if all individual bookings are available as returned from List Multi Service Availability Time Slots.
|
|
6
|
+
* Currently, `SEPARATE_BOOKINGS` and `PARALLEL_BOOKINGS` are not supported.
|
|
7
|
+
* Multi-service booking is available if each of its bookings is available separately.
|
|
8
|
+
* For `SEQUENTIAL_BOOKINGS`, see `List Multi Service Availability Time Slots` documentation.
|
|
9
|
+
*/
|
|
10
|
+
export var MultiServiceBookingType;
|
|
11
|
+
(function (MultiServiceBookingType) {
|
|
12
|
+
MultiServiceBookingType["SEQUENTIAL_BOOKINGS"] = "SEQUENTIAL_BOOKINGS";
|
|
13
|
+
MultiServiceBookingType["SEPARATE_BOOKINGS"] = "SEPARATE_BOOKINGS";
|
|
14
|
+
MultiServiceBookingType["PARALLEL_BOOKINGS"] = "PARALLEL_BOOKINGS";
|
|
15
|
+
})(MultiServiceBookingType || (MultiServiceBookingType = {}));
|
|
16
|
+
export var LocationType;
|
|
17
|
+
(function (LocationType) {
|
|
18
|
+
LocationType["UNDEFINED"] = "UNDEFINED";
|
|
19
|
+
LocationType["OWNER_BUSINESS"] = "OWNER_BUSINESS";
|
|
20
|
+
LocationType["OWNER_CUSTOM"] = "OWNER_CUSTOM";
|
|
21
|
+
LocationType["CUSTOM"] = "CUSTOM";
|
|
22
|
+
})(LocationType || (LocationType = {}));
|
|
23
|
+
export var ValueType;
|
|
24
|
+
(function (ValueType) {
|
|
25
|
+
/** Short text. This is the default value type. */
|
|
26
|
+
ValueType["SHORT_TEXT"] = "SHORT_TEXT";
|
|
27
|
+
/** Long text. */
|
|
28
|
+
ValueType["LONG_TEXT"] = "LONG_TEXT";
|
|
29
|
+
/** A text that represents the check box value. If selected the value is `true`, otherwise `false`. */
|
|
30
|
+
ValueType["CHECK_BOX"] = "CHECK_BOX";
|
|
31
|
+
})(ValueType || (ValueType = {}));
|
|
32
|
+
/** Booking status. */
|
|
33
|
+
export var BookingStatus;
|
|
34
|
+
(function (BookingStatus) {
|
|
35
|
+
/**
|
|
36
|
+
* The booking was created, but the customer hasn't completed the related
|
|
37
|
+
* eCommerce order yet.
|
|
38
|
+
*/
|
|
39
|
+
BookingStatus["CREATED"] = "CREATED";
|
|
40
|
+
/**
|
|
41
|
+
* The merchant has confirmed the booking and it appears in the
|
|
42
|
+
* business calendar. Merchants can set up their *services*
|
|
43
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/setup) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction))
|
|
44
|
+
* to automatically confirm all `PENDING` bookings.
|
|
45
|
+
*/
|
|
46
|
+
BookingStatus["CONFIRMED"] = "CONFIRMED";
|
|
47
|
+
/**
|
|
48
|
+
* The customer has canceled the booking. Depending on the relevant service's
|
|
49
|
+
* _policy snapshot_
|
|
50
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-policy-snapshots/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/policies/booking-policy-snapshots/introduction))
|
|
51
|
+
* they may have to pay a _cancellation fee_
|
|
52
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/booking-fees/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/booking-fees/introduction)).
|
|
53
|
+
*/
|
|
54
|
+
BookingStatus["CANCELED"] = "CANCELED";
|
|
55
|
+
/**
|
|
56
|
+
* The merchant must manually confirm the booking before it appears
|
|
57
|
+
* in the business calendar.
|
|
58
|
+
*/
|
|
59
|
+
BookingStatus["PENDING"] = "PENDING";
|
|
60
|
+
/** The merchant has declined the booking before the customer was charged. */
|
|
61
|
+
BookingStatus["DECLINED"] = "DECLINED";
|
|
62
|
+
/**
|
|
63
|
+
* The booking is on a waitlist.
|
|
64
|
+
* Currently, you can't call Register to Waitlist
|
|
65
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/waitlist/register-to-waitlist))
|
|
66
|
+
* for course or appointment bookings, even though this is supported in live sites.
|
|
67
|
+
* You can call Register to Waitlist only for class session bookings.
|
|
68
|
+
*/
|
|
69
|
+
BookingStatus["WAITING_LIST"] = "WAITING_LIST";
|
|
70
|
+
})(BookingStatus || (BookingStatus = {}));
|
|
71
|
+
/**
|
|
72
|
+
* Payment status.
|
|
73
|
+
* Automatically updated when using eCommerce checkout APIs.
|
|
74
|
+
*/
|
|
75
|
+
export var PaymentStatus;
|
|
76
|
+
(function (PaymentStatus) {
|
|
77
|
+
/** Undefined payment status. */
|
|
78
|
+
PaymentStatus["UNDEFINED"] = "UNDEFINED";
|
|
79
|
+
/** The booking isn't paid. */
|
|
80
|
+
PaymentStatus["NOT_PAID"] = "NOT_PAID";
|
|
81
|
+
/** The booking is fully paid. */
|
|
82
|
+
PaymentStatus["PAID"] = "PAID";
|
|
83
|
+
/** The booking is partially paid. */
|
|
84
|
+
PaymentStatus["PARTIALLY_PAID"] = "PARTIALLY_PAID";
|
|
85
|
+
/** The booking is refunded. */
|
|
86
|
+
PaymentStatus["REFUNDED"] = "REFUNDED";
|
|
87
|
+
/** The booking is free of charge. */
|
|
88
|
+
PaymentStatus["EXEMPT"] = "EXEMPT";
|
|
89
|
+
})(PaymentStatus || (PaymentStatus = {}));
|
|
90
|
+
/**
|
|
91
|
+
* Selected payment option.
|
|
92
|
+
*
|
|
93
|
+
* One of the payment options offered by the service.
|
|
94
|
+
* This field is set when the user selects an option during booking.
|
|
95
|
+
* If left undefined, the payment option is resolved by the service configuration on checkout.
|
|
96
|
+
*/
|
|
97
|
+
export var SelectedPaymentOption;
|
|
98
|
+
(function (SelectedPaymentOption) {
|
|
99
|
+
/** Undefined payment option. */
|
|
100
|
+
SelectedPaymentOption["UNDEFINED"] = "UNDEFINED";
|
|
101
|
+
/** Offline payment. */
|
|
102
|
+
SelectedPaymentOption["OFFLINE"] = "OFFLINE";
|
|
103
|
+
/** Online payment. */
|
|
104
|
+
SelectedPaymentOption["ONLINE"] = "ONLINE";
|
|
105
|
+
/** Payment using a Wix Pricing Plan. */
|
|
106
|
+
SelectedPaymentOption["MEMBERSHIP"] = "MEMBERSHIP";
|
|
107
|
+
/**
|
|
108
|
+
* Customers can pay only in person with a Wix Pricing Plan, while the Wix user
|
|
109
|
+
* must manually redeem the pricing plan in the dashboard.
|
|
110
|
+
*/
|
|
111
|
+
SelectedPaymentOption["MEMBERSHIP_OFFLINE"] = "MEMBERSHIP_OFFLINE";
|
|
112
|
+
})(SelectedPaymentOption || (SelectedPaymentOption = {}));
|
|
113
|
+
export var Platform;
|
|
114
|
+
(function (Platform) {
|
|
115
|
+
Platform["UNDEFINED_PLATFORM"] = "UNDEFINED_PLATFORM";
|
|
116
|
+
Platform["WEB"] = "WEB";
|
|
117
|
+
Platform["MOBILE_APP"] = "MOBILE_APP";
|
|
118
|
+
})(Platform || (Platform = {}));
|
|
119
|
+
export var Actor;
|
|
120
|
+
(function (Actor) {
|
|
121
|
+
Actor["UNDEFINED_ACTOR"] = "UNDEFINED_ACTOR";
|
|
122
|
+
Actor["BUSINESS"] = "BUSINESS";
|
|
123
|
+
Actor["CUSTOMER"] = "CUSTOMER";
|
|
124
|
+
})(Actor || (Actor = {}));
|
|
125
|
+
export var IdentityType;
|
|
126
|
+
(function (IdentityType) {
|
|
127
|
+
IdentityType["UNKNOWN"] = "UNKNOWN";
|
|
128
|
+
IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
129
|
+
IdentityType["MEMBER"] = "MEMBER";
|
|
130
|
+
IdentityType["WIX_USER"] = "WIX_USER";
|
|
131
|
+
IdentityType["APP"] = "APP";
|
|
132
|
+
})(IdentityType || (IdentityType = {}));
|
|
133
|
+
/**
|
|
134
|
+
* Previews the base price for a set of line items belonging to the same
|
|
135
|
+
* service, before a booking is created. During the booking flow, additional
|
|
136
|
+
* taxes and fees may be added to the base price.
|
|
137
|
+
*
|
|
138
|
+
*
|
|
139
|
+
* ## Response
|
|
140
|
+
*
|
|
141
|
+
* The response includes each line item's individual preview price and the
|
|
142
|
+
* total of all line item preview prices. Note that the final price upon
|
|
143
|
+
* booking creation may differ from the preview price.
|
|
144
|
+
*
|
|
145
|
+
* ## Errors
|
|
146
|
+
*
|
|
147
|
+
* _Preview Price_ fails if:
|
|
148
|
+
*
|
|
149
|
+
* - You specify line items that belong to different *services*
|
|
150
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction)).
|
|
151
|
+
* - The site is using the *Bookings Pricing Integration SPI*
|
|
152
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)).
|
|
153
|
+
*
|
|
154
|
+
* ## When to call Calculate Price instead
|
|
155
|
+
*
|
|
156
|
+
* To retrieve the price of an existing booking, call *Calculate Price*
|
|
157
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/pricing/calculate-price) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/calculate-price)).
|
|
158
|
+
* @param bookingLineItems - List of line items to preview the price for.
|
|
159
|
+
* @public
|
|
160
|
+
* @documentationMaturity preview
|
|
161
|
+
* @requiredField bookingLineItems
|
|
162
|
+
* @permissionId BOOKINGS.PRICE_PREVIEW
|
|
163
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
164
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
165
|
+
* @permissionScope Manage Bookings
|
|
166
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
167
|
+
* @permissionScope Read Bookings - Including Participants
|
|
168
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
169
|
+
* @permissionScope Read Bookings - all read permissions
|
|
170
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
171
|
+
* @permissionScope Manage Bookings - all permissions
|
|
172
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
173
|
+
* @applicableIdentity APP
|
|
174
|
+
* @applicableIdentity VISITOR
|
|
175
|
+
* @fqn com.wixpress.bookings.pricing.BookingsPricingService.PreviewPrice
|
|
176
|
+
*/
|
|
177
|
+
export async function previewPrice(bookingLineItems) {
|
|
178
|
+
// @ts-ignore
|
|
179
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
180
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
181
|
+
bookingLineItems: bookingLineItems,
|
|
182
|
+
});
|
|
183
|
+
const reqOpts = ambassadorWixBookingsV2PriceInfo.previewPrice(payload);
|
|
184
|
+
sideEffects?.onSiteCall?.();
|
|
185
|
+
try {
|
|
186
|
+
const result = await httpClient.request(reqOpts);
|
|
187
|
+
sideEffects?.onSuccess?.(result);
|
|
188
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
const transformedError = sdkTransformError(err, {
|
|
192
|
+
spreadPathsToArguments: {},
|
|
193
|
+
explicitPathsToArguments: { bookingLineItems: '$[0]' },
|
|
194
|
+
singleArgumentUnchanged: false,
|
|
195
|
+
}, ['bookingLineItems']);
|
|
196
|
+
sideEffects?.onError?.(err);
|
|
197
|
+
throw transformedError;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Calculates the base price of a booking.
|
|
202
|
+
*
|
|
203
|
+
*
|
|
204
|
+
* The returned price serves as the foundation for charging the customer. During the
|
|
205
|
+
* _eCommerce checkout_
|
|
206
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction)),
|
|
207
|
+
* additional taxes and fees may be added to this base price.
|
|
208
|
+
*
|
|
209
|
+
* ## Price calculation method
|
|
210
|
+
*
|
|
211
|
+
* By default, Wix Bookings calculates a booking's price based on the relevant
|
|
212
|
+
* `serviceOptionsAndVariants.variants.values.price`
|
|
213
|
+
* ([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)).
|
|
214
|
+
* You must then specify either `booking.bookedEntity.slot.serviceId` or
|
|
215
|
+
* `booking.bookedEntity.schedule.scheduleId`.
|
|
216
|
+
*
|
|
217
|
+
* If the business uses the *Wix Bookings Pricing Integration service plugin*
|
|
218
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)),
|
|
219
|
+
* the returned `priceInfo` object reflects values received from the SPI implementor in
|
|
220
|
+
* _Calculate Price_
|
|
221
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/calculate-price)).
|
|
222
|
+
* In this case, it suffices to specify `booking.bookedEntity`.
|
|
223
|
+
*
|
|
224
|
+
* ## When to call Preview Price instead
|
|
225
|
+
*
|
|
226
|
+
* To estimate the price for multiple booking line items before the booking exists,
|
|
227
|
+
* call *Preview Price*
|
|
228
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/pricing/preview-price) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/preview-price)).
|
|
229
|
+
* @param booking - _Booking_
|
|
230
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/bookings/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/bookings/bookings-writer-v2/introduction))
|
|
231
|
+
* to calculate the base price for.
|
|
232
|
+
* @public
|
|
233
|
+
* @documentationMaturity preview
|
|
234
|
+
* @requiredField booking
|
|
235
|
+
* @permissionId BOOKINGS.PRICE_CALCULATE
|
|
236
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
237
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
238
|
+
* @permissionScope Manage Bookings
|
|
239
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
240
|
+
* @permissionScope Read Bookings - Including Participants
|
|
241
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
242
|
+
* @permissionScope Read Bookings - all read permissions
|
|
243
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
244
|
+
* @permissionScope Manage Bookings - all permissions
|
|
245
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
246
|
+
* @applicableIdentity APP
|
|
247
|
+
* @applicableIdentity VISITOR
|
|
248
|
+
* @fqn com.wixpress.bookings.pricing.BookingsPricingService.CalculatePrice
|
|
249
|
+
*/
|
|
250
|
+
export async function calculatePrice(booking) {
|
|
251
|
+
// @ts-ignore
|
|
252
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
253
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ booking: booking });
|
|
254
|
+
const reqOpts = ambassadorWixBookingsV2PriceInfo.calculatePrice(payload);
|
|
255
|
+
sideEffects?.onSiteCall?.();
|
|
256
|
+
try {
|
|
257
|
+
const result = await httpClient.request(reqOpts);
|
|
258
|
+
sideEffects?.onSuccess?.(result);
|
|
259
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
260
|
+
}
|
|
261
|
+
catch (err) {
|
|
262
|
+
const transformedError = sdkTransformError(err, {
|
|
263
|
+
spreadPathsToArguments: {},
|
|
264
|
+
explicitPathsToArguments: { booking: '$[0]' },
|
|
265
|
+
singleArgumentUnchanged: false,
|
|
266
|
+
}, ['booking']);
|
|
267
|
+
sideEffects?.onError?.(err);
|
|
268
|
+
throw transformedError;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=bookings-v2-price-info-pricing.universal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-v2-price-info-pricing.universal.js","sourceRoot":"","sources":["../../../src/bookings-v2-price-info-pricing.universal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,EACL,qCAAqC,EACrC,uCAAuC,GACxC,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,gCAAgC,MAAM,0CAA0C,CAAC;AAyU7F;;;;;GAKG;AACH,MAAM,CAAN,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,sEAA2C,CAAA;IAC3C,kEAAuC,CAAA;IACvC,kEAAuC,CAAA;AACzC,CAAC,EAJW,uBAAuB,KAAvB,uBAAuB,QAIlC;AAgJD,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iDAAiC,CAAA;IACjC,6CAA6B,CAAA;IAC7B,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AA4JD,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,kDAAkD;IAClD,sCAAyB,CAAA;IACzB,iBAAiB;IACjB,oCAAuB,CAAA;IACvB,sGAAsG;IACtG,oCAAuB,CAAA;AACzB,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB;AAED,sBAAsB;AACtB,MAAM,CAAN,IAAY,aAoCX;AApCD,WAAY,aAAa;IACvB;;;OAGG;IACH,oCAAmB,CAAA;IACnB;;;;;OAKG;IACH,wCAAuB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AAM,OAAO,GAAG,qCAAqC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAE5E,MAAM,OAAO,GAAG,gCAAgC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAEzE,WAAW,EAAE,UAAU,EAAE,EAAE,CAAC;IAC5B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACjD,WAAW,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,CAAC;QAEjC,OAAO,uCAAuC,CAAC,MAAM,CAAC,IAAI,CAAE,CAAC;IAC/D,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,gBAAgB,GAAG,iBAAiB,CACxC,GAAG,EACH;YACE,sBAAsB,EAAE,EAAE;YAC1B,wBAAwB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;YAC7C,uBAAuB,EAAE,KAAK;SAC/B,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;QACF,WAAW,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;QAE5B,MAAM,gBAAgB,CAAC;IACzB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/bookings-v2-price-info-pricing.context.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/bookings-v2-price-info-pricing.context.js"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kFAAgE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/bookings-v2-price-info-pricing.universal.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/bookings-v2-price-info-pricing.universal.js"), exports);
|
|
18
|
+
//# sourceMappingURL=index.typings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../../index.typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oFAAkE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/bookings-v2-price-info-pricing.meta.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/bookings-v2-price-info-pricing.meta.js"), exports);
|
|
18
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../meta.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+EAA6D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { previewPrice as publicPreviewPrice, calculatePrice as publicCalculatePrice } from './bookings-v2-price-info-pricing.public.js';
|
|
2
|
+
import { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
3
|
+
export declare const previewPrice: MaybeContext<BuildRESTFunction<typeof publicPreviewPrice> & typeof publicPreviewPrice>;
|
|
4
|
+
export declare const calculatePrice: MaybeContext<BuildRESTFunction<typeof publicCalculatePrice> & typeof publicCalculatePrice>;
|
|
5
|
+
export { MultiServiceBookingType, LocationType, ValueType, BookingStatus, PaymentStatus, SelectedPaymentOption, Platform, Actor, IdentityType, } from './bookings-v2-price-info-pricing.universal.js';
|
|
6
|
+
export { PriceInfo, PriceInfoTotalPriceOneOf, BookingLineItem, ServiceChoice, ServiceChoiceChoiceOneOf, Duration, PriceDescriptionInfo, PreviewPriceRequest, PreviewPriceResponse, CalculatePriceRequest, Booking, BookingParticipantsInfoOneOf, BookedEntity, BookedEntityItemOneOf, BookedSlot, BookedResource, Location, BookedSchedule, ContactDetails, Address, AddressStreetOneOf, StreetAddress, AddressLocation, Subdivision, CustomFormField, BookingSource, ParticipantNotification, IdentificationData, IdentificationDataIdOneOf, FlowControlSettings, ExtendedFields, ParticipantChoices, ServiceChoices, MultiServiceBookingInfo, BookedAddOn, BookedAddOnAddOnInfoOneOf, CalculatePriceResponse, } from './bookings-v2-price-info-pricing.universal.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentityType = exports.Actor = exports.Platform = exports.SelectedPaymentOption = exports.PaymentStatus = exports.BookingStatus = exports.ValueType = exports.LocationType = exports.MultiServiceBookingType = exports.calculatePrice = exports.previewPrice = void 0;
|
|
4
|
+
const bookings_v2_price_info_pricing_public_js_1 = require("./bookings-v2-price-info-pricing.public.js");
|
|
5
|
+
const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
6
|
+
exports.previewPrice = (0, rest_modules_1.createRESTModule)(bookings_v2_price_info_pricing_public_js_1.previewPrice);
|
|
7
|
+
exports.calculatePrice = (0, rest_modules_1.createRESTModule)(bookings_v2_price_info_pricing_public_js_1.calculatePrice);
|
|
8
|
+
var bookings_v2_price_info_pricing_universal_js_1 = require("./bookings-v2-price-info-pricing.universal.js");
|
|
9
|
+
Object.defineProperty(exports, "MultiServiceBookingType", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.MultiServiceBookingType; } });
|
|
10
|
+
Object.defineProperty(exports, "LocationType", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.LocationType; } });
|
|
11
|
+
Object.defineProperty(exports, "ValueType", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.ValueType; } });
|
|
12
|
+
Object.defineProperty(exports, "BookingStatus", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.BookingStatus; } });
|
|
13
|
+
Object.defineProperty(exports, "PaymentStatus", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.PaymentStatus; } });
|
|
14
|
+
Object.defineProperty(exports, "SelectedPaymentOption", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.SelectedPaymentOption; } });
|
|
15
|
+
Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.Platform; } });
|
|
16
|
+
Object.defineProperty(exports, "Actor", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.Actor; } });
|
|
17
|
+
Object.defineProperty(exports, "IdentityType", { enumerable: true, get: function () { return bookings_v2_price_info_pricing_universal_js_1.IdentityType; } });
|
|
18
|
+
//# sourceMappingURL=bookings-v2-price-info-pricing.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-v2-price-info-pricing.context.js","sourceRoot":"","sources":["../../../../src/bookings-v2-price-info-pricing.context.ts"],"names":[],"mappings":";;;AAAA,yGAGoD;AACpD,gEAAiE;AAGpD,QAAA,YAAY,GAEP,IAAA,+BAAgB,EAAC,uDAAkB,CAAC,CAAC;AAC1C,QAAA,cAAc,GAET,IAAA,+BAAgB,EAAC,yDAAoB,CAAC,CAAC;AAEzD,6GAUuD;AATrD,sJAAA,uBAAuB,OAAA;AACvB,2IAAA,YAAY,OAAA;AACZ,wIAAA,SAAS,OAAA;AACT,4IAAA,aAAa,OAAA;AACb,4IAAA,aAAa,OAAA;AACb,oJAAA,qBAAqB,OAAA;AACrB,uIAAA,QAAQ,OAAA;AACR,oIAAA,KAAK,OAAA;AACL,2IAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { RequestOptionsFactory } from '@wix/sdk-types';
|
|
2
|
+
/**
|
|
3
|
+
* Previews the base price for a set of line items belonging to the same
|
|
4
|
+
* service, before a booking is created. During the booking flow, additional
|
|
5
|
+
* taxes and fees may be added to the base price.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* ## Response
|
|
9
|
+
*
|
|
10
|
+
* The response includes each line item's individual preview price and the
|
|
11
|
+
* total of all line item preview prices. Note that the final price upon
|
|
12
|
+
* booking creation may differ from the preview price.
|
|
13
|
+
*
|
|
14
|
+
* ## Errors
|
|
15
|
+
*
|
|
16
|
+
* _Preview Price_ fails if:
|
|
17
|
+
*
|
|
18
|
+
* - You specify line items that belong to different *services*
|
|
19
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction)).
|
|
20
|
+
* - The site is using the *Bookings Pricing Integration SPI*
|
|
21
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)).
|
|
22
|
+
*
|
|
23
|
+
* ## When to call Calculate Price instead
|
|
24
|
+
*
|
|
25
|
+
* To retrieve the price of an existing booking, call *Calculate Price*
|
|
26
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/pricing/calculate-price) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/calculate-price)).
|
|
27
|
+
*/
|
|
28
|
+
export declare function previewPrice(payload: object): RequestOptionsFactory<any>;
|
|
29
|
+
/**
|
|
30
|
+
* Calculates the base price of a booking.
|
|
31
|
+
*
|
|
32
|
+
*
|
|
33
|
+
* The returned price serves as the foundation for charging the customer. During the
|
|
34
|
+
* _eCommerce checkout_
|
|
35
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction)),
|
|
36
|
+
* additional taxes and fees may be added to this base price.
|
|
37
|
+
*
|
|
38
|
+
* ## Price calculation method
|
|
39
|
+
*
|
|
40
|
+
* By default, Wix Bookings calculates a booking's price based on the relevant
|
|
41
|
+
* `serviceOptionsAndVariants.variants.values.price`
|
|
42
|
+
* ([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)).
|
|
43
|
+
* You must then specify either `booking.bookedEntity.slot.serviceId` or
|
|
44
|
+
* `booking.bookedEntity.schedule.scheduleId`.
|
|
45
|
+
*
|
|
46
|
+
* If the business uses the *Wix Bookings Pricing Integration service plugin*
|
|
47
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)),
|
|
48
|
+
* the returned `priceInfo` object reflects values received from the SPI implementor in
|
|
49
|
+
* _Calculate Price_
|
|
50
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/calculate-price)).
|
|
51
|
+
* In this case, it suffices to specify `booking.bookedEntity`.
|
|
52
|
+
*
|
|
53
|
+
* ## When to call Preview Price instead
|
|
54
|
+
*
|
|
55
|
+
* To estimate the price for multiple booking line items before the booking exists,
|
|
56
|
+
* call *Preview Price*
|
|
57
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/pricing/preview-price) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/preview-price)).
|
|
58
|
+
*/
|
|
59
|
+
export declare function calculatePrice(payload: object): RequestOptionsFactory<any>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculatePrice = exports.previewPrice = void 0;
|
|
4
|
+
const float_1 = require("@wix/sdk-runtime/transformations/float");
|
|
5
|
+
const float_2 = require("@wix/sdk-runtime/transformations/float");
|
|
6
|
+
const timestamp_1 = require("@wix/sdk-runtime/transformations/timestamp");
|
|
7
|
+
const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
8
|
+
const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
9
|
+
function resolveComWixpressBookingsPricingBookingsPricingServiceUrl(opts) {
|
|
10
|
+
const domainToMappings = {
|
|
11
|
+
'manage._base_domain_': [
|
|
12
|
+
{
|
|
13
|
+
srcPath: '/_api/bookings-pricing',
|
|
14
|
+
destPath: '',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
srcPath: '/_api/bookings-pricing/v2/price',
|
|
18
|
+
destPath: '/v2/pricing',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
_: [
|
|
22
|
+
{
|
|
23
|
+
srcPath: '/_api/bookings-pricing',
|
|
24
|
+
destPath: '',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
srcPath: '/_api/bookings-pricing/v2/price',
|
|
28
|
+
destPath: '/v2/pricing',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
'www.wixapis.com': [
|
|
32
|
+
{
|
|
33
|
+
srcPath: '/bookings/v2/pricing/v2/pricing',
|
|
34
|
+
destPath: '/v2/pricing',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
srcPath: '/bookings/v2/pricing',
|
|
38
|
+
destPath: '/v2/pricing',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
return (0, rest_modules_1.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
43
|
+
}
|
|
44
|
+
const PACKAGE_NAME = '@wix/auto_sdk_bookings_pricing';
|
|
45
|
+
/**
|
|
46
|
+
* Previews the base price for a set of line items belonging to the same
|
|
47
|
+
* service, before a booking is created. During the booking flow, additional
|
|
48
|
+
* taxes and fees may be added to the base price.
|
|
49
|
+
*
|
|
50
|
+
*
|
|
51
|
+
* ## Response
|
|
52
|
+
*
|
|
53
|
+
* The response includes each line item's individual preview price and the
|
|
54
|
+
* total of all line item preview prices. Note that the final price upon
|
|
55
|
+
* booking creation may differ from the preview price.
|
|
56
|
+
*
|
|
57
|
+
* ## Errors
|
|
58
|
+
*
|
|
59
|
+
* _Preview Price_ fails if:
|
|
60
|
+
*
|
|
61
|
+
* - You specify line items that belong to different *services*
|
|
62
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/services/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction)).
|
|
63
|
+
* - The site is using the *Bookings Pricing Integration SPI*
|
|
64
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)).
|
|
65
|
+
*
|
|
66
|
+
* ## When to call Calculate Price instead
|
|
67
|
+
*
|
|
68
|
+
* To retrieve the price of an existing booking, call *Calculate Price*
|
|
69
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/pricing/calculate-price) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/calculate-price)).
|
|
70
|
+
*/
|
|
71
|
+
function previewPrice(payload) {
|
|
72
|
+
function __previewPrice({ host }) {
|
|
73
|
+
const serializedData = (0, transform_paths_1.transformPaths)(payload, [
|
|
74
|
+
{
|
|
75
|
+
transformFn: float_1.transformSDKFloatToRESTFloat,
|
|
76
|
+
paths: [{ path: 'bookingLineItems.pricePerParticipant' }],
|
|
77
|
+
},
|
|
78
|
+
]);
|
|
79
|
+
const metadata = {
|
|
80
|
+
entityFqdn: 'wix.bookings.v2.price_info',
|
|
81
|
+
method: 'POST',
|
|
82
|
+
methodFqn: 'com.wixpress.bookings.pricing.BookingsPricingService.PreviewPrice',
|
|
83
|
+
packageName: PACKAGE_NAME,
|
|
84
|
+
url: resolveComWixpressBookingsPricingBookingsPricingServiceUrl({
|
|
85
|
+
protoPath: '/v2/pricing/preview',
|
|
86
|
+
data: serializedData,
|
|
87
|
+
host,
|
|
88
|
+
}),
|
|
89
|
+
data: serializedData,
|
|
90
|
+
transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
|
|
91
|
+
{
|
|
92
|
+
transformFn: float_2.transformRESTFloatToSDKFloat,
|
|
93
|
+
paths: [
|
|
94
|
+
{ path: 'priceInfo.calculatedPrice' },
|
|
95
|
+
{ path: 'priceInfo.deposit' },
|
|
96
|
+
{ path: 'priceInfo.bookingLineItems.pricePerParticipant' },
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
]),
|
|
100
|
+
};
|
|
101
|
+
return metadata;
|
|
102
|
+
}
|
|
103
|
+
return __previewPrice;
|
|
104
|
+
}
|
|
105
|
+
exports.previewPrice = previewPrice;
|
|
106
|
+
/**
|
|
107
|
+
* Calculates the base price of a booking.
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
* The returned price serves as the foundation for charging the customer. During the
|
|
111
|
+
* _eCommerce checkout_
|
|
112
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction)),
|
|
113
|
+
* additional taxes and fees may be added to this base price.
|
|
114
|
+
*
|
|
115
|
+
* ## Price calculation method
|
|
116
|
+
*
|
|
117
|
+
* By default, Wix Bookings calculates a booking's price based on the relevant
|
|
118
|
+
* `serviceOptionsAndVariants.variants.values.price`
|
|
119
|
+
* ([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)).
|
|
120
|
+
* You must then specify either `booking.bookedEntity.slot.serviceId` or
|
|
121
|
+
* `booking.bookedEntity.schedule.scheduleId`.
|
|
122
|
+
*
|
|
123
|
+
* If the business uses the *Wix Bookings Pricing Integration service plugin*
|
|
124
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)),
|
|
125
|
+
* the returned `priceInfo` object reflects values received from the SPI implementor in
|
|
126
|
+
* _Calculate Price_
|
|
127
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/calculate-price)).
|
|
128
|
+
* In this case, it suffices to specify `booking.bookedEntity`.
|
|
129
|
+
*
|
|
130
|
+
* ## When to call Preview Price instead
|
|
131
|
+
*
|
|
132
|
+
* To estimate the price for multiple booking line items before the booking exists,
|
|
133
|
+
* call *Preview Price*
|
|
134
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/bookings/pricing/preview-price) | [REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-api/preview-price)).
|
|
135
|
+
*/
|
|
136
|
+
function calculatePrice(payload) {
|
|
137
|
+
function __calculatePrice({ host }) {
|
|
138
|
+
const serializedData = (0, transform_paths_1.transformPaths)(payload, [
|
|
139
|
+
{
|
|
140
|
+
transformFn: timestamp_1.transformSDKTimestampToRESTTimestamp,
|
|
141
|
+
paths: [
|
|
142
|
+
{ path: 'booking.createdDate' },
|
|
143
|
+
{ path: 'booking.startDate' },
|
|
144
|
+
{ path: 'booking.endDate' },
|
|
145
|
+
{ path: 'booking.updatedDate' },
|
|
146
|
+
{ path: 'booking.canceledDate' },
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
transformFn: float_1.transformSDKFloatToRESTFloat,
|
|
151
|
+
paths: [
|
|
152
|
+
{ path: 'booking.contactDetails.fullAddress.geocode.latitude' },
|
|
153
|
+
{ path: 'booking.contactDetails.fullAddress.geocode.longitude' },
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
]);
|
|
157
|
+
const metadata = {
|
|
158
|
+
entityFqdn: 'wix.bookings.v2.price_info',
|
|
159
|
+
method: 'POST',
|
|
160
|
+
methodFqn: 'com.wixpress.bookings.pricing.BookingsPricingService.CalculatePrice',
|
|
161
|
+
packageName: PACKAGE_NAME,
|
|
162
|
+
url: resolveComWixpressBookingsPricingBookingsPricingServiceUrl({
|
|
163
|
+
protoPath: '/v2/pricing/calculate',
|
|
164
|
+
data: serializedData,
|
|
165
|
+
host,
|
|
166
|
+
}),
|
|
167
|
+
data: serializedData,
|
|
168
|
+
transformResponse: (payload) => (0, transform_paths_1.transformPaths)(payload, [
|
|
169
|
+
{
|
|
170
|
+
transformFn: float_2.transformRESTFloatToSDKFloat,
|
|
171
|
+
paths: [
|
|
172
|
+
{ path: 'priceInfo.calculatedPrice' },
|
|
173
|
+
{ path: 'priceInfo.deposit' },
|
|
174
|
+
{ path: 'priceInfo.bookingLineItems.pricePerParticipant' },
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
]),
|
|
178
|
+
};
|
|
179
|
+
return metadata;
|
|
180
|
+
}
|
|
181
|
+
return __calculatePrice;
|
|
182
|
+
}
|
|
183
|
+
exports.calculatePrice = calculatePrice;
|
|
184
|
+
//# sourceMappingURL=bookings-v2-price-info-pricing.http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookings-v2-price-info-pricing.http.js","sourceRoot":"","sources":["../../../../src/bookings-v2-price-info-pricing.http.ts"],"names":[],"mappings":";;;AAAA,kEAAsF;AACtF,kEAAsF;AACtF,0EAAkG;AAClG,sFAAkF;AAClF,gEAA2D;AAI3D,SAAS,0DAA0D,CACjE,IAA8C;IAE9C,MAAM,gBAAgB,GAAG;QACvB,sBAAsB,EAAE;YACtB;gBACE,OAAO,EAAE,wBAAwB;gBACjC,QAAQ,EAAE,EAAE;aACb;YACD;gBACE,OAAO,EAAE,iCAAiC;gBAC1C,QAAQ,EAAE,aAAa;aACxB;SACF;QACD,CAAC,EAAE;YACD;gBACE,OAAO,EAAE,wBAAwB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