@wix/auto_sdk_bookings_pricing 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +18 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +18 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +18 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/cjs/src/bookings-v2-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 +60 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.http.js +185 -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/cjs/src/bookings-v2-price-info-pricing.public.d.ts +73 -0
- 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/cjs/src/bookings-v2-price-info-pricing.types.d.ts +773 -0
- 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 +869 -0
- package/build/cjs/src/bookings-v2-price-info-pricing.universal.js +298 -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 +60 -0
- package/build/es/src/bookings-v2-price-info-pricing.http.js +180 -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/es/src/bookings-v2-price-info-pricing.public.d.ts +73 -0
- 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/es/src/bookings-v2-price-info-pricing.types.d.ts +773 -0
- 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 +869 -0
- package/build/es/src/bookings-v2-price-info-pricing.universal.js +270 -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 +60 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.http.js +185 -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/cjs/src/bookings-v2-price-info-pricing.public.d.ts +73 -0
- 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/cjs/src/bookings-v2-price-info-pricing.types.d.ts +773 -0
- 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 +869 -0
- package/build/internal/cjs/src/bookings-v2-price-info-pricing.universal.js +298 -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 +60 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.http.js +180 -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/internal/es/src/bookings-v2-price-info-pricing.public.d.ts +73 -0
- 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/es/src/bookings-v2-price-info-pricing.types.d.ts +773 -0
- 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 +869 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.universal.js +270 -0
- package/build/internal/es/src/bookings-v2-price-info-pricing.universal.js.map +1 -0
- package/meta/package.json +3 -0
- package/package.json +52 -0
|
@@ -0,0 +1,298 @@
|
|
|
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 service
|
|
161
|
+
* before a potential booking is actually created.
|
|
162
|
+
*
|
|
163
|
+
*
|
|
164
|
+
*
|
|
165
|
+
* The returned price preview information about each line
|
|
166
|
+
* item's price and sums up each line item's price.
|
|
167
|
+
*
|
|
168
|
+
* The previewed price is not the actual price that will be used to charge the customer.
|
|
169
|
+
* `Preview Price` only estimates the base price by adding up the price
|
|
170
|
+
* of each line item before
|
|
171
|
+
* the booking is actually created.
|
|
172
|
+
*
|
|
173
|
+
* Use [`Calculate Price`](https://www.wix.com/velo/reference/wix-bookings-v2/pricing/calculateprice) to get the base price
|
|
174
|
+
* after the booking is created.
|
|
175
|
+
*
|
|
176
|
+
* Passing line items that belong to different services results in an error.
|
|
177
|
+
*
|
|
178
|
+
* ## Calculating the previewed price
|
|
179
|
+
*
|
|
180
|
+
* Wix Bookings has its own default pricing logic for previewing the price. You must
|
|
181
|
+
* pass the `serviceId` in the `slot`
|
|
182
|
+
* or `schedule` object to `previewPrice()`.
|
|
183
|
+
*
|
|
184
|
+
* You cannot call `previewPrice()` if you have customized Bookings pricing logic using the
|
|
185
|
+
* [BookingsCustomPricing](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/service-plugins-spis/bookings-custom-pricing/introduction) service plugin. Calling `previewPrice` if custom pricing
|
|
186
|
+
* logic has been implemented for the site results in an error.
|
|
187
|
+
* @param bookingLineItems - List of line items to preview the price for.
|
|
188
|
+
* @public
|
|
189
|
+
* @documentationMaturity preview
|
|
190
|
+
* @requiredField bookingLineItems
|
|
191
|
+
* @permissionId BOOKINGS.PRICE_PREVIEW
|
|
192
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
193
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
194
|
+
* @permissionScope Manage Bookings
|
|
195
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
196
|
+
* @permissionScope Read Bookings - Including Participants
|
|
197
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
198
|
+
* @permissionScope Read Bookings - all read permissions
|
|
199
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
200
|
+
* @permissionScope Manage Bookings - all permissions
|
|
201
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
202
|
+
* @applicableIdentity APP
|
|
203
|
+
* @applicableIdentity VISITOR
|
|
204
|
+
* @fqn com.wixpress.bookings.pricing.BookingsPricingService.PreviewPrice
|
|
205
|
+
*/
|
|
206
|
+
async function previewPrice(bookingLineItems) {
|
|
207
|
+
// @ts-ignore
|
|
208
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
209
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
210
|
+
bookingLineItems: bookingLineItems,
|
|
211
|
+
});
|
|
212
|
+
const reqOpts = ambassadorWixBookingsV2PriceInfo.previewPrice(payload);
|
|
213
|
+
sideEffects?.onSiteCall?.();
|
|
214
|
+
try {
|
|
215
|
+
const result = await httpClient.request(reqOpts);
|
|
216
|
+
sideEffects?.onSuccess?.(result);
|
|
217
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
218
|
+
}
|
|
219
|
+
catch (err) {
|
|
220
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
221
|
+
spreadPathsToArguments: {},
|
|
222
|
+
explicitPathsToArguments: { bookingLineItems: '$[0]' },
|
|
223
|
+
singleArgumentUnchanged: false,
|
|
224
|
+
}, ['bookingLineItems']);
|
|
225
|
+
sideEffects?.onError?.(err);
|
|
226
|
+
throw transformedError;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
exports.previewPrice = previewPrice;
|
|
230
|
+
/**
|
|
231
|
+
* Calculates the base price of a booking.
|
|
232
|
+
*
|
|
233
|
+
*
|
|
234
|
+
*
|
|
235
|
+
* You can call `calculatePrice()` after a booking is created. The returned calculated price includes information about each line
|
|
236
|
+
* item's price and the booking's total price.
|
|
237
|
+
*
|
|
238
|
+
* You can use `previewPrice()` to get the base price
|
|
239
|
+
* before a booking is created.
|
|
240
|
+
*
|
|
241
|
+
* The calculated price is the base price that will be used as a basis for charging the customer.
|
|
242
|
+
* During checkout, additional taxes
|
|
243
|
+
* and fees might be added to this base price.
|
|
244
|
+
*
|
|
245
|
+
* ## Calculating the price
|
|
246
|
+
*
|
|
247
|
+
* Wix Bookings has its own default pricing logic for calculating the price. When
|
|
248
|
+
* using Wix Bookings' default pricing logic, you must pass the `serviceId` in the `slot`
|
|
249
|
+
* or `schedule` object to `calculatePrice()`.
|
|
250
|
+
*
|
|
251
|
+
* Alternatively you can customize the pricing logic using the
|
|
252
|
+
* [BookingsCustomPricing](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/service-plugins-spis/bookings-custom-pricing/introduction) service plugin.
|
|
253
|
+
* If you integrate with a pricing provider, the customized pricing logic becomes
|
|
254
|
+
* the default logic. This means that, if the Custom Pricing service plugin is implemented,
|
|
255
|
+
* when calling `calculatePrice()`,
|
|
256
|
+
* the customized logic is used instead.
|
|
257
|
+
* @param booking - Booking to calculate the price for.
|
|
258
|
+
* @public
|
|
259
|
+
* @documentationMaturity preview
|
|
260
|
+
* @requiredField booking
|
|
261
|
+
* @permissionId BOOKINGS.PRICE_CALCULATE
|
|
262
|
+
* @permissionScope Manage Bookings Services and Settings
|
|
263
|
+
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
264
|
+
* @permissionScope Manage Bookings
|
|
265
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS
|
|
266
|
+
* @permissionScope Read Bookings - Including Participants
|
|
267
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS.READ-BOOKINGS-SENSITIVE
|
|
268
|
+
* @permissionScope Read Bookings - all read permissions
|
|
269
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.READ-BOOKINGS
|
|
270
|
+
* @permissionScope Manage Bookings - all permissions
|
|
271
|
+
* @permissionScopeId SCOPE.DC-BOOKINGS-MEGA.MANAGE-BOOKINGS
|
|
272
|
+
* @applicableIdentity APP
|
|
273
|
+
* @applicableIdentity VISITOR
|
|
274
|
+
* @fqn com.wixpress.bookings.pricing.BookingsPricingService.CalculatePrice
|
|
275
|
+
*/
|
|
276
|
+
async function calculatePrice(booking) {
|
|
277
|
+
// @ts-ignore
|
|
278
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
279
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({ booking: booking });
|
|
280
|
+
const reqOpts = ambassadorWixBookingsV2PriceInfo.calculatePrice(payload);
|
|
281
|
+
sideEffects?.onSiteCall?.();
|
|
282
|
+
try {
|
|
283
|
+
const result = await httpClient.request(reqOpts);
|
|
284
|
+
sideEffects?.onSuccess?.(result);
|
|
285
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
286
|
+
}
|
|
287
|
+
catch (err) {
|
|
288
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
289
|
+
spreadPathsToArguments: {},
|
|
290
|
+
explicitPathsToArguments: { booking: '$[0]' },
|
|
291
|
+
singleArgumentUnchanged: false,
|
|
292
|
+
}, ['booking']);
|
|
293
|
+
sideEffects?.onError?.(err);
|
|
294
|
+
throw transformedError;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
exports.calculatePrice = calculatePrice;
|
|
298
|
+
//# 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;AA4R7F;;;;;GAKG;AACH,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,sEAA2C,CAAA;IAC3C,kEAAuC,CAAA;IACvC,kEAAuC,CAAA;AACzC,CAAC,EAJW,uBAAuB,uCAAvB,uBAAuB,QAIlC;AA6HD,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,uCAAuB,CAAA;IACvB,iDAAiC,CAAA;IACjC,6CAA6B,CAAA;IAC7B,iCAAiB,CAAA;AACnB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AA6ID,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;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,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,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;AAjCD,wCAiCC"}
|
|
@@ -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';
|
package/build/es/meta.js
ADDED
|
@@ -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, CalculatePriceResponse, PreviewPriceResponseNonNullableFields, CalculatePriceResponseNonNullableFields, } 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,60 @@
|
|
|
1
|
+
import { RequestOptionsFactory } from '@wix/sdk-types';
|
|
2
|
+
/**
|
|
3
|
+
* Previews the base price for a set of line items belonging to the same service
|
|
4
|
+
* before a potential booking is actually created.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* The returned price preview information about each line
|
|
9
|
+
* item's price and sums up each line item's price.
|
|
10
|
+
*
|
|
11
|
+
* The previewed price is not the actual price that will be used to charge the customer.
|
|
12
|
+
* `Preview Price` only estimates the base price by adding up the price
|
|
13
|
+
* of each line item before
|
|
14
|
+
* the booking is actually created.
|
|
15
|
+
*
|
|
16
|
+
* Use [`Calculate Price`](https://www.wix.com/velo/reference/wix-bookings-v2/pricing/calculateprice) to get the base price
|
|
17
|
+
* after the booking is created.
|
|
18
|
+
*
|
|
19
|
+
* Passing line items that belong to different services results in an error.
|
|
20
|
+
*
|
|
21
|
+
* ## Calculating the previewed price
|
|
22
|
+
*
|
|
23
|
+
* Wix Bookings has its own default pricing logic for previewing the price. You must
|
|
24
|
+
* pass the `serviceId` in the `slot`
|
|
25
|
+
* or `schedule` object to `previewPrice()`.
|
|
26
|
+
*
|
|
27
|
+
* You cannot call `previewPrice()` if you have customized Bookings pricing logic using the
|
|
28
|
+
* [BookingsCustomPricing](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/service-plugins-spis/bookings-custom-pricing/introduction) service plugin. Calling `previewPrice` if custom pricing
|
|
29
|
+
* logic has been implemented for the site results in an error.
|
|
30
|
+
*/
|
|
31
|
+
export declare function previewPrice(payload: object): RequestOptionsFactory<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Calculates the base price of a booking.
|
|
34
|
+
*
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
* You can call `calculatePrice()` after a booking is created. The returned calculated price includes information about each line
|
|
38
|
+
* item's price and the booking's total price.
|
|
39
|
+
*
|
|
40
|
+
* You can use `previewPrice()` to get the base price
|
|
41
|
+
* before a booking is created.
|
|
42
|
+
*
|
|
43
|
+
* The calculated price is the base price that will be used as a basis for charging the customer.
|
|
44
|
+
* During checkout, additional taxes
|
|
45
|
+
* and fees might be added to this base price.
|
|
46
|
+
*
|
|
47
|
+
* ## Calculating the price
|
|
48
|
+
*
|
|
49
|
+
* Wix Bookings has its own default pricing logic for calculating the price. When
|
|
50
|
+
* using Wix Bookings' default pricing logic, you must pass the `serviceId` in the `slot`
|
|
51
|
+
* or `schedule` object to `calculatePrice()`.
|
|
52
|
+
*
|
|
53
|
+
* Alternatively you can customize the pricing logic using the
|
|
54
|
+
* [BookingsCustomPricing](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/service-plugins-spis/bookings-custom-pricing/introduction) service plugin.
|
|
55
|
+
* If you integrate with a pricing provider, the customized pricing logic becomes
|
|
56
|
+
* the default logic. This means that, if the Custom Pricing service plugin is implemented,
|
|
57
|
+
* when calling `calculatePrice()`,
|
|
58
|
+
* the customized logic is used instead.
|
|
59
|
+
*/
|
|
60
|
+
export declare function calculatePrice(payload: object): RequestOptionsFactory<any>;
|
|
@@ -0,0 +1,180 @@
|
|
|
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 service
|
|
44
|
+
* before a potential booking is actually created.
|
|
45
|
+
*
|
|
46
|
+
*
|
|
47
|
+
*
|
|
48
|
+
* The returned price preview information about each line
|
|
49
|
+
* item's price and sums up each line item's price.
|
|
50
|
+
*
|
|
51
|
+
* The previewed price is not the actual price that will be used to charge the customer.
|
|
52
|
+
* `Preview Price` only estimates the base price by adding up the price
|
|
53
|
+
* of each line item before
|
|
54
|
+
* the booking is actually created.
|
|
55
|
+
*
|
|
56
|
+
* Use [`Calculate Price`](https://www.wix.com/velo/reference/wix-bookings-v2/pricing/calculateprice) to get the base price
|
|
57
|
+
* after the booking is created.
|
|
58
|
+
*
|
|
59
|
+
* Passing line items that belong to different services results in an error.
|
|
60
|
+
*
|
|
61
|
+
* ## Calculating the previewed price
|
|
62
|
+
*
|
|
63
|
+
* Wix Bookings has its own default pricing logic for previewing the price. You must
|
|
64
|
+
* pass the `serviceId` in the `slot`
|
|
65
|
+
* or `schedule` object to `previewPrice()`.
|
|
66
|
+
*
|
|
67
|
+
* You cannot call `previewPrice()` if you have customized Bookings pricing logic using the
|
|
68
|
+
* [BookingsCustomPricing](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/service-plugins-spis/bookings-custom-pricing/introduction) service plugin. Calling `previewPrice` if custom pricing
|
|
69
|
+
* logic has been implemented for the site results in an error.
|
|
70
|
+
*/
|
|
71
|
+
export function previewPrice(payload) {
|
|
72
|
+
function __previewPrice({ host }) {
|
|
73
|
+
const serializedData = transformPaths(payload, [
|
|
74
|
+
{
|
|
75
|
+
transformFn: 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) => transformPaths(payload, [
|
|
91
|
+
{
|
|
92
|
+
transformFn: 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
|
+
/**
|
|
106
|
+
* Calculates the base price of a booking.
|
|
107
|
+
*
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
* You can call `calculatePrice()` after a booking is created. The returned calculated price includes information about each line
|
|
111
|
+
* item's price and the booking's total price.
|
|
112
|
+
*
|
|
113
|
+
* You can use `previewPrice()` to get the base price
|
|
114
|
+
* before a booking is created.
|
|
115
|
+
*
|
|
116
|
+
* The calculated price is the base price that will be used as a basis for charging the customer.
|
|
117
|
+
* During checkout, additional taxes
|
|
118
|
+
* and fees might be added to this base price.
|
|
119
|
+
*
|
|
120
|
+
* ## Calculating the price
|
|
121
|
+
*
|
|
122
|
+
* Wix Bookings has its own default pricing logic for calculating the price. When
|
|
123
|
+
* using Wix Bookings' default pricing logic, you must pass the `serviceId` in the `slot`
|
|
124
|
+
* or `schedule` object to `calculatePrice()`.
|
|
125
|
+
*
|
|
126
|
+
* Alternatively you can customize the pricing logic using the
|
|
127
|
+
* [BookingsCustomPricing](https://dev.wix.com/docs/velo/api-reference/wix-bookings-v2/service-plugins-spis/bookings-custom-pricing/introduction) service plugin.
|
|
128
|
+
* If you integrate with a pricing provider, the customized pricing logic becomes
|
|
129
|
+
* the default logic. This means that, if the Custom Pricing service plugin is implemented,
|
|
130
|
+
* when calling `calculatePrice()`,
|
|
131
|
+
* the customized logic is used instead.
|
|
132
|
+
*/
|
|
133
|
+
export function calculatePrice(payload) {
|
|
134
|
+
function __calculatePrice({ host }) {
|
|
135
|
+
const serializedData = transformPaths(payload, [
|
|
136
|
+
{
|
|
137
|
+
transformFn: transformSDKTimestampToRESTTimestamp,
|
|
138
|
+
paths: [
|
|
139
|
+
{ path: 'booking.createdDate' },
|
|
140
|
+
{ path: 'booking.startDate' },
|
|
141
|
+
{ path: 'booking.endDate' },
|
|
142
|
+
{ path: 'booking.updatedDate' },
|
|
143
|
+
{ path: 'booking.canceledDate' },
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
transformFn: transformSDKFloatToRESTFloat,
|
|
148
|
+
paths: [
|
|
149
|
+
{ path: 'booking.contactDetails.fullAddress.geocode.latitude' },
|
|
150
|
+
{ path: 'booking.contactDetails.fullAddress.geocode.longitude' },
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
]);
|
|
154
|
+
const metadata = {
|
|
155
|
+
entityFqdn: 'wix.bookings.v2.price_info',
|
|
156
|
+
method: 'POST',
|
|
157
|
+
methodFqn: 'com.wixpress.bookings.pricing.BookingsPricingService.CalculatePrice',
|
|
158
|
+
packageName: PACKAGE_NAME,
|
|
159
|
+
url: resolveComWixpressBookingsPricingBookingsPricingServiceUrl({
|
|
160
|
+
protoPath: '/v2/pricing/calculate',
|
|
161
|
+
data: serializedData,
|
|
162
|
+
host,
|
|
163
|
+
}),
|
|
164
|
+
data: serializedData,
|
|
165
|
+
transformResponse: (payload) => transformPaths(payload, [
|
|
166
|
+
{
|
|
167
|
+
transformFn: transformRESTFloatToSDKFloat,
|
|
168
|
+
paths: [
|
|
169
|
+
{ path: 'priceInfo.calculatedPrice' },
|
|
170
|
+
{ path: 'priceInfo.deposit' },
|
|
171
|
+
{ path: 'priceInfo.bookingLineItems.pricePerParticipant' },
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
]),
|
|
175
|
+
};
|
|
176
|
+
return metadata;
|
|
177
|
+
}
|
|
178
|
+
return __calculatePrice;
|
|
179
|
+
}
|
|
180
|
+
//# 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,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;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;gBACjC,QAAQ,EAAE,EAAE;aACb;YACD;gBACE,OAAO,EAAE,iCAAiC;gBAC1C,QAAQ,EAAE,aAAa;aACxB;SACF;QACD,iBAAiB,EAAE;YACjB;gBACE,OAAO,EAAE,iCAAiC;gBAC1C,QAAQ,EAAE,aAAa;aACxB;YACD;gBACE,OAAO,EAAE,sB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O;QACrC,MAAM,cAAc,GAAG,cAAc,CAAC,OAAO,EAAE;YAC7C;gBACE,WAAW,EAAE,oCAAoC;gBACjD,KAAK,EAAE;oBACL,EAAE,IAAI,EAAE,qBAAqB,EAAE;oBAC/B,EAAE,IAAI,EAAE,mBAAmB,EAAE;oBAC7B,EAAE,IAAI,EAAE,iBAAiB,EAAE;oBAC3B,EAAE,IAAI,EAAE,qBAAqB,EAAE;oBAC/B,EAAE,IAAI,EAAE,sBAAsB,EAAE;iBACjC;aACF;YACD;gBACE,WAAW,EAAE,4BAA4B;gBACzC,KAAK,EAAE;oBACL,EAAE,IAAI,EAAE,qDAAqD,EAAE;oBAC/D,EAAE,IAAI,EAAE,sDAAsD,EAAE;iBACjE;aACF;SACF,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG;YACf,UAAU,EAAE,4BAA4B;YACxC,MAAM,EAAE,MAAa;YACrB,SAAS,EACP,qEAAqE;YACvE,WAAW,EAAE,YAAY;YACzB,GAAG,EAAE,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 & ambassadorWixBookingsV2PriceInfoUniversalTypes.PreviewPriceResponseNonNullableFields, ambassadorWixBookingsV2PriceInfoTypes.PreviewPriceResponse & ambassadorWixBookingsV2PriceInfoTypes.PreviewPriceResponseNonNullableFields>;
|
|
14
|
+
export declare function calculatePrice(): __PublicMethodMetaInfo<'POST', {}, ambassadorWixBookingsV2PriceInfoUniversalTypes.CalculatePriceRequest, ambassadorWixBookingsV2PriceInfoTypes.CalculatePriceRequest, ambassadorWixBookingsV2PriceInfoUniversalTypes.CalculatePriceResponse & ambassadorWixBookingsV2PriceInfoUniversalTypes.CalculatePriceResponseNonNullableFields, ambassadorWixBookingsV2PriceInfoTypes.CalculatePriceResponse & ambassadorWixBookingsV2PriceInfoTypes.CalculatePriceResponseNonNullableFields>;
|