@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,299 @@
|
|
|
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.calculatePrice = exports.previewPrice = exports.IdentityType = 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 ambassadorWixBookingsV2PriceInfo = __importStar(require("./bookings-v2-price-info-pricing.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 IdentityType;
|
|
152
|
+
(function (IdentityType) {
|
|
153
|
+
IdentityType["UNKNOWN"] = "UNKNOWN";
|
|
154
|
+
IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
155
|
+
IdentityType["MEMBER"] = "MEMBER";
|
|
156
|
+
IdentityType["WIX_USER"] = "WIX_USER";
|
|
157
|
+
IdentityType["APP"] = "APP";
|
|
158
|
+
})(IdentityType || (exports.IdentityType = IdentityType = {}));
|
|
159
|
+
/**
|
|
160
|
+
* Previews the base price for a set of line items belonging to the same
|
|
161
|
+
* service, before a booking is created. During the booking flow, additional
|
|
162
|
+
* taxes and fees may be added to the base price.
|
|
163
|
+
*
|
|
164
|
+
*
|
|
165
|
+
* ## Response
|
|
166
|
+
*
|
|
167
|
+
* The response includes each line item's individual preview price and the
|
|
168
|
+
* total of all line item preview prices. Note that the final price upon
|
|
169
|
+
* booking creation may differ from the preview price.
|
|
170
|
+
*
|
|
171
|
+
* ## Errors
|
|
172
|
+
*
|
|
173
|
+
* _Preview Price_ fails if:
|
|
174
|
+
*
|
|
175
|
+
* - You specify line items that belong to different *services*
|
|
176
|
+
* ([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)).
|
|
177
|
+
* - The site is using the *Bookings Pricing Integration SPI*
|
|
178
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)).
|
|
179
|
+
*
|
|
180
|
+
* ## When to call Calculate Price instead
|
|
181
|
+
*
|
|
182
|
+
* To retrieve the price of an existing booking, call *Calculate Price*
|
|
183
|
+
* ([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)).
|
|
184
|
+
* @param bookingLineItems - List of line items to preview the price for.
|
|
185
|
+
* @public
|
|
186
|
+
* @documentationMaturity preview
|
|
187
|
+
* @requiredField bookingLineItems
|
|
188
|
+
* @permissionId BOOKINGS.PRICE_PREVIEW
|
|
189
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
190
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
191
|
+
* @permissionScope Manage Bookings
|
|
192
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
193
|
+
* @permissionScope Read Bookings - Including Participants
|
|
194
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
195
|
+
* @permissionScope Read Bookings - all read permissions
|
|
196
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
197
|
+
* @permissionScope Manage Bookings - all permissions
|
|
198
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
199
|
+
* @applicableIdentity APP
|
|
200
|
+
* @applicableIdentity VISITOR
|
|
201
|
+
* @fqn com.wixpress.bookings.pricing.BookingsPricingService.PreviewPrice
|
|
202
|
+
*/
|
|
203
|
+
async function previewPrice(bookingLineItems) {
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
206
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
207
|
+
bookingLineItems: bookingLineItems,
|
|
208
|
+
});
|
|
209
|
+
const reqOpts = ambassadorWixBookingsV2PriceInfo.previewPrice(payload);
|
|
210
|
+
sideEffects?.onSiteCall?.();
|
|
211
|
+
try {
|
|
212
|
+
const result = await httpClient.request(reqOpts);
|
|
213
|
+
sideEffects?.onSuccess?.(result);
|
|
214
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
218
|
+
spreadPathsToArguments: {},
|
|
219
|
+
explicitPathsToArguments: { bookingLineItems: '$[0]' },
|
|
220
|
+
singleArgumentUnchanged: false,
|
|
221
|
+
}, ['bookingLineItems']);
|
|
222
|
+
sideEffects?.onError?.(err);
|
|
223
|
+
throw transformedError;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
exports.previewPrice = previewPrice;
|
|
227
|
+
/**
|
|
228
|
+
* Calculates the base price of a booking.
|
|
229
|
+
*
|
|
230
|
+
*
|
|
231
|
+
* The returned price serves as the foundation for charging the customer. During the
|
|
232
|
+
* _eCommerce checkout_
|
|
233
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction)),
|
|
234
|
+
* additional taxes and fees may be added to this base price.
|
|
235
|
+
*
|
|
236
|
+
* ## Price calculation method
|
|
237
|
+
*
|
|
238
|
+
* By default, Wix Bookings calculates a booking's price based on the relevant
|
|
239
|
+
* `serviceOptionsAndVariants.variants.values.price`
|
|
240
|
+
* ([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)).
|
|
241
|
+
* You must then specify either `booking.bookedEntity.slot.serviceId` or
|
|
242
|
+
* `booking.bookedEntity.schedule.scheduleId`.
|
|
243
|
+
*
|
|
244
|
+
* If the business uses the *Wix Bookings Pricing Integration service plugin*
|
|
245
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)),
|
|
246
|
+
* the returned `priceInfo` object reflects values received from the SPI implementor in
|
|
247
|
+
* _Calculate Price_
|
|
248
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/calculate-price)).
|
|
249
|
+
* In this case, it suffices to specify `booking.bookedEntity`.
|
|
250
|
+
*
|
|
251
|
+
* ## When to call Preview Price instead
|
|
252
|
+
*
|
|
253
|
+
* To estimate the price for multiple booking line items before the booking exists,
|
|
254
|
+
* call *Preview Price*
|
|
255
|
+
* ([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)).
|
|
256
|
+
* @param booking - _Booking_
|
|
257
|
+
* ([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))
|
|
258
|
+
* to calculate the base price for.
|
|
259
|
+
* @public
|
|
260
|
+
* @documentationMaturity preview
|
|
261
|
+
* @requiredField booking
|
|
262
|
+
* @permissionId BOOKINGS.PRICE_CALCULATE
|
|
263
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
264
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
265
|
+
* @permissionScope Manage Bookings
|
|
266
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
267
|
+
* @permissionScope Read Bookings - Including Participants
|
|
268
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
269
|
+
* @permissionScope Read Bookings - all read permissions
|
|
270
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
271
|
+
* @permissionScope Manage Bookings - all permissions
|
|
272
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
273
|
+
* @applicableIdentity APP
|
|
274
|
+
* @applicableIdentity VISITOR
|
|
275
|
+
* @fqn com.wixpress.bookings.pricing.BookingsPricingService.CalculatePrice
|
|
276
|
+
*/
|
|
277
|
+
async function calculatePrice(booking) {
|
|
278
|
+
// @ts-ignore
|
|
279
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
280
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ booking: booking });
|
|
281
|
+
const reqOpts = ambassadorWixBookingsV2PriceInfo.calculatePrice(payload);
|
|
282
|
+
sideEffects?.onSiteCall?.();
|
|
283
|
+
try {
|
|
284
|
+
const result = await httpClient.request(reqOpts);
|
|
285
|
+
sideEffects?.onSuccess?.(result);
|
|
286
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
287
|
+
}
|
|
288
|
+
catch (err) {
|
|
289
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
290
|
+
spreadPathsToArguments: {},
|
|
291
|
+
explicitPathsToArguments: { booking: '$[0]' },
|
|
292
|
+
singleArgumentUnchanged: false,
|
|
293
|
+
}, ['booking']);
|
|
294
|
+
sideEffects?.onError?.(err);
|
|
295
|
+
throw transformedError;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
exports.calculatePrice = calculatePrice;
|
|
299
|
+
//# 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,sEAAuF;AACvF,oFAGiD;AAEjD,2GAA6F;AAyU7F;;;;;GAKG;AACH,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,sEAA2C,CAAA;IAC3C,kEAAuC,CAAA;IACvC,kEAAuC,CAAA;AACzC,CAAC,EAJW,uBAAuB,uCAAvB,uBAAuB,QAIlC;AAgJD,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iDAAiC,CAAA;IACjC,6CAA6B,CAAA;IAC7B,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AA4JD,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,kDAAkD;IAClD,sCAAyB,CAAA;IACzB,iBAAiB;IACjB,oCAAuB,CAAA;IACvB,sGAAsG;IACtG,oCAAuB,CAAA;AACzB,CAAC,EAPW,SAAS,yBAAT,SAAS,QAOpB;AAED,sBAAsB;AACtB,IAAY,aAoCX;AApCD,WAAY,aAAa;IACvB;;;OAGG;IACH,oCAAmB,CAAA;IACnB;;;;;OAKG;IACH,wCAAuB,CAAA;IACvB;;;;;;OAMG;IACH,sCAAqB,CAAA;IACrB;;;OAGG;IACH,oCAAmB,CAAA;IACnB,6EAA6E;IAC7E,sCAAqB,CAAA;IACrB;;;;;;OAMG;IACH,8CAA6B,CAAA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AC5B,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,IAAA,gEAAuC,EAAC,MAAM,CAAC,IAAI,CAAE,CAAC;IAC/D,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,gBAAgB,GAAG,IAAA,gCAAiB,EACxC,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;AAxCD,wCAwCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/bookings-v2-price-info-pricing.context.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":"AAAA,cAAc,iDAAiD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/bookings-v2-price-info-pricing.universal.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../../index.typings.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/bookings-v2-price-info-pricing.meta.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../meta.ts"],"names":[],"mappings":"AAAA,cAAc,8CAA8C,CAAC"}
|
|
@@ -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,6 @@
|
|
|
1
|
+
import { previewPrice as publicPreviewPrice, calculatePrice as publicCalculatePrice, } from './bookings-v2-price-info-pricing.public.js';
|
|
2
|
+
import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
|
|
3
|
+
export const previewPrice = /*#__PURE__*/ createRESTModule(publicPreviewPrice);
|
|
4
|
+
export const calculatePrice = /*#__PURE__*/ createRESTModule(publicCalculatePrice);
|
|
5
|
+
export { MultiServiceBookingType, LocationType, ValueType, BookingStatus, PaymentStatus, SelectedPaymentOption, Platform, Actor, IdentityType, } from './bookings-v2-price-info-pricing.universal.js';
|
|
6
|
+
//# 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,OAAO,EACL,YAAY,IAAI,kBAAkB,EAClC,cAAc,IAAI,oBAAoB,GACvC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,CAAC,MAAM,YAAY,GAErB,aAAa,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,cAAc,GAEvB,aAAa,CAAC,gBAAgB,CAAC,oBAAoB,CAAC,CAAC;AAEzD,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,KAAK,EACL,YAAY,GACb,MAAM,+CAA+C,CAAC"}
|
|
@@ -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,179 @@
|
|
|
1
|
+
import { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';
|
|
2
|
+
import { transformRESTFloatToSDKFloat } from '@wix/sdk-runtime/transformations/float';
|
|
3
|
+
import { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';
|
|
4
|
+
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
|
|
5
|
+
import { resolveUrl } from '@wix/sdk-runtime/rest-modules';
|
|
6
|
+
function resolveComWixpressBookingsPricingBookingsPricingServiceUrl(opts) {
|
|
7
|
+
const domainToMappings = {
|
|
8
|
+
'manage._base_domain_': [
|
|
9
|
+
{
|
|
10
|
+
srcPath: '/_api/bookings-pricing',
|
|
11
|
+
destPath: '',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
srcPath: '/_api/bookings-pricing/v2/price',
|
|
15
|
+
destPath: '/v2/pricing',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
_: [
|
|
19
|
+
{
|
|
20
|
+
srcPath: '/_api/bookings-pricing',
|
|
21
|
+
destPath: '',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
srcPath: '/_api/bookings-pricing/v2/price',
|
|
25
|
+
destPath: '/v2/pricing',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
'www.wixapis.com': [
|
|
29
|
+
{
|
|
30
|
+
srcPath: '/bookings/v2/pricing/v2/pricing',
|
|
31
|
+
destPath: '/v2/pricing',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
srcPath: '/bookings/v2/pricing',
|
|
35
|
+
destPath: '/v2/pricing',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
40
|
+
}
|
|
41
|
+
const PACKAGE_NAME = '@wix/auto_sdk_bookings_pricing';
|
|
42
|
+
/**
|
|
43
|
+
* Previews the base price for a set of line items belonging to the same
|
|
44
|
+
* service, before a booking is created. During the booking flow, additional
|
|
45
|
+
* taxes and fees may be added to the base price.
|
|
46
|
+
*
|
|
47
|
+
*
|
|
48
|
+
* ## Response
|
|
49
|
+
*
|
|
50
|
+
* The response includes each line item's individual preview price and the
|
|
51
|
+
* total of all line item preview prices. Note that the final price upon
|
|
52
|
+
* booking creation may differ from the preview price.
|
|
53
|
+
*
|
|
54
|
+
* ## Errors
|
|
55
|
+
*
|
|
56
|
+
* _Preview Price_ fails if:
|
|
57
|
+
*
|
|
58
|
+
* - You specify line items that belong to different *services*
|
|
59
|
+
* ([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)).
|
|
60
|
+
* - The site is using the *Bookings Pricing Integration SPI*
|
|
61
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)).
|
|
62
|
+
*
|
|
63
|
+
* ## When to call Calculate Price instead
|
|
64
|
+
*
|
|
65
|
+
* To retrieve the price of an existing booking, call *Calculate Price*
|
|
66
|
+
* ([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)).
|
|
67
|
+
*/
|
|
68
|
+
export function previewPrice(payload) {
|
|
69
|
+
function __previewPrice({ host }) {
|
|
70
|
+
const serializedData = transformPaths(payload, [
|
|
71
|
+
{
|
|
72
|
+
transformFn: transformSDKFloatToRESTFloat,
|
|
73
|
+
paths: [{ path: 'bookingLineItems.pricePerParticipant' }],
|
|
74
|
+
},
|
|
75
|
+
]);
|
|
76
|
+
const metadata = {
|
|
77
|
+
entityFqdn: 'wix.bookings.v2.price_info',
|
|
78
|
+
method: 'POST',
|
|
79
|
+
methodFqn: 'com.wixpress.bookings.pricing.BookingsPricingService.PreviewPrice',
|
|
80
|
+
packageName: PACKAGE_NAME,
|
|
81
|
+
url: resolveComWixpressBookingsPricingBookingsPricingServiceUrl({
|
|
82
|
+
protoPath: '/v2/pricing/preview',
|
|
83
|
+
data: serializedData,
|
|
84
|
+
host,
|
|
85
|
+
}),
|
|
86
|
+
data: serializedData,
|
|
87
|
+
transformResponse: (payload) => transformPaths(payload, [
|
|
88
|
+
{
|
|
89
|
+
transformFn: transformRESTFloatToSDKFloat,
|
|
90
|
+
paths: [
|
|
91
|
+
{ path: 'priceInfo.calculatedPrice' },
|
|
92
|
+
{ path: 'priceInfo.deposit' },
|
|
93
|
+
{ path: 'priceInfo.bookingLineItems.pricePerParticipant' },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
]),
|
|
97
|
+
};
|
|
98
|
+
return metadata;
|
|
99
|
+
}
|
|
100
|
+
return __previewPrice;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Calculates the base price of a booking.
|
|
104
|
+
*
|
|
105
|
+
*
|
|
106
|
+
* The returned price serves as the foundation for charging the customer. During the
|
|
107
|
+
* _eCommerce checkout_
|
|
108
|
+
* ([SDK](https://dev.wix.com/docs/sdk/backend-modules/ecom/introduction) | [REST](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction)),
|
|
109
|
+
* additional taxes and fees may be added to this base price.
|
|
110
|
+
*
|
|
111
|
+
* ## Price calculation method
|
|
112
|
+
*
|
|
113
|
+
* By default, Wix Bookings calculates a booking's price based on the relevant
|
|
114
|
+
* `serviceOptionsAndVariants.variants.values.price`
|
|
115
|
+
* ([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)).
|
|
116
|
+
* You must then specify either `booking.bookedEntity.slot.serviceId` or
|
|
117
|
+
* `booking.bookedEntity.schedule.scheduleId`.
|
|
118
|
+
*
|
|
119
|
+
* If the business uses the *Wix Bookings Pricing Integration service plugin*
|
|
120
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/introduction)),
|
|
121
|
+
* the returned `priceInfo` object reflects values received from the SPI implementor in
|
|
122
|
+
* _Calculate Price_
|
|
123
|
+
* ([REST](https://dev.wix.com/docs/rest/business-solutions/bookings/pricing/pricing-integration-service-plugin/calculate-price)).
|
|
124
|
+
* In this case, it suffices to specify `booking.bookedEntity`.
|
|
125
|
+
*
|
|
126
|
+
* ## When to call Preview Price instead
|
|
127
|
+
*
|
|
128
|
+
* To estimate the price for multiple booking line items before the booking exists,
|
|
129
|
+
* call *Preview Price*
|
|
130
|
+
* ([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)).
|
|
131
|
+
*/
|
|
132
|
+
export function calculatePrice(payload) {
|
|
133
|
+
function __calculatePrice({ host }) {
|
|
134
|
+
const serializedData = transformPaths(payload, [
|
|
135
|
+
{
|
|
136
|
+
transformFn: transformSDKTimestampToRESTTimestamp,
|
|
137
|
+
paths: [
|
|
138
|
+
{ path: 'booking.createdDate' },
|
|
139
|
+
{ path: 'booking.startDate' },
|
|
140
|
+
{ path: 'booking.endDate' },
|
|
141
|
+
{ path: 'booking.updatedDate' },
|
|
142
|
+
{ path: 'booking.canceledDate' },
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
transformFn: transformSDKFloatToRESTFloat,
|
|
147
|
+
paths: [
|
|
148
|
+
{ path: 'booking.contactDetails.fullAddress.geocode.latitude' },
|
|
149
|
+
{ path: 'booking.contactDetails.fullAddress.geocode.longitude' },
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
]);
|
|
153
|
+
const metadata = {
|
|
154
|
+
entityFqdn: 'wix.bookings.v2.price_info',
|
|
155
|
+
method: 'POST',
|
|
156
|
+
methodFqn: 'com.wixpress.bookings.pricing.BookingsPricingService.CalculatePrice',
|
|
157
|
+
packageName: PACKAGE_NAME,
|
|
158
|
+
url: resolveComWixpressBookingsPricingBookingsPricingServiceUrl({
|
|
159
|
+
protoPath: '/v2/pricing/calculate',
|
|
160
|
+
data: serializedData,
|
|
161
|
+
host,
|
|
162
|
+
}),
|
|
163
|
+
data: serializedData,
|
|
164
|
+
transformResponse: (payload) => transformPaths(payload, [
|
|
165
|
+
{
|
|
166
|
+
transformFn: transformRESTFloatToSDKFloat,
|
|
167
|
+
paths: [
|
|
168
|
+
{ path: 'priceInfo.calculatedPrice' },
|
|
169
|
+
{ path: 'priceInfo.deposit' },
|
|
170
|
+
{ path: 'priceInfo.bookingLineItems.pricePerParticipant' },
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
]),
|
|
174
|
+
};
|
|
175
|
+
return metadata;
|
|
176
|
+
}
|
|
177
|
+
return __calculatePrice;
|
|
178
|
+
}
|
|
179
|
+
//# 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,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,E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,0DAA0D,CAAC;gBAC9D,SAAS,EAAE,uBAAuB;gBAClC,IAAI,EAAE,cAAc;gBACpB,IAAI;aACL,CAAC;YACF,IAAI,EAAE,cAAc;YACpB,iBAAiB,EAAE,CAAC,OAAY,EAAE,EAAE,CAClC,cAAc,CAAC,OAAO,EAAE;gBACtB;oBACE,WAAW,EAAE,4BAA4B;oBACzC,KAAK,EAAE;wBACL,EAAE,IAAI,EAAE,2BAA2B,EAAE;wBACrC,EAAE,IAAI,EAAE,mBAAmB,EAAE;wBAC7B,EAAE,IAAI,EAAE,gDAAgD,EAAE;qBAC3D;iBACF;aACF,CAAC;SACL,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as ambassadorWixBookingsV2PriceInfoTypes from './bookings-v2-price-info-pricing.types.js';
|
|
2
|
+
import * as ambassadorWixBookingsV2PriceInfoUniversalTypes from './bookings-v2-price-info-pricing.universal.js';
|
|
3
|
+
export type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
|
|
4
|
+
getUrl: (context: any) => string;
|
|
5
|
+
httpMethod: K;
|
|
6
|
+
path: string;
|
|
7
|
+
pathParams: M;
|
|
8
|
+
__requestType: T;
|
|
9
|
+
__originalRequestType: S;
|
|
10
|
+
__responseType: Q;
|
|
11
|
+
__originalResponseType: R;
|
|
12
|
+
};
|
|
13
|
+
export declare function previewPrice(): __PublicMethodMetaInfo<'POST', {}, ambassadorWixBookingsV2PriceInfoUniversalTypes.PreviewPriceRequest, ambassadorWixBookingsV2PriceInfoTypes.PreviewPriceRequest, ambassadorWixBookingsV2PriceInfoUniversalTypes.PreviewPriceResponse, ambassadorWixBookingsV2PriceInfoTypes.PreviewPriceResponse>;
|
|
14
|
+
export declare function calculatePrice(): __PublicMethodMetaInfo<'POST', {}, ambassadorWixBookingsV2PriceInfoUniversalTypes.CalculatePriceRequest, ambassadorWixBookingsV2PriceInfoTypes.CalculatePriceRequest, ambassadorWixBookingsV2PriceInfoUniversalTypes.CalculatePriceResponse, ambassadorWixBookingsV2PriceInfoTypes.CalculatePriceResponse>;
|