@wix/pricing-plans 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 +2 -0
- package/build/cjs/index.js +25 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-order.http.d.ts +105 -0
- package/build/cjs/src/pricing-plans-v2-order.http.js +751 -0
- package/build/cjs/src/pricing-plans-v2-order.http.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-order.public.d.ts +17 -0
- package/build/cjs/src/pricing-plans-v2-order.public.js +95 -0
- package/build/cjs/src/pricing-plans-v2-order.public.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-order.types.d.ts +1071 -0
- package/build/cjs/src/pricing-plans-v2-order.types.js +133 -0
- package/build/cjs/src/pricing-plans-v2-order.types.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-order.universal.d.ts +1346 -0
- package/build/cjs/src/pricing-plans-v2-order.universal.js +962 -0
- package/build/cjs/src/pricing-plans-v2-order.universal.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-plan.http.d.ts +44 -0
- package/build/cjs/src/pricing-plans-v2-plan.http.js +453 -0
- package/build/cjs/src/pricing-plans-v2-plan.http.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-plan.public.d.ts +16 -0
- package/build/cjs/src/pricing-plans-v2-plan.public.js +82 -0
- package/build/cjs/src/pricing-plans-v2-plan.public.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-plan.types.d.ts +357 -0
- package/build/cjs/src/pricing-plans-v2-plan.types.js +35 -0
- package/build/cjs/src/pricing-plans-v2-plan.types.js.map +1 -0
- package/build/cjs/src/pricing-plans-v2-plan.universal.d.ts +554 -0
- package/build/cjs/src/pricing-plans-v2-plan.universal.js +728 -0
- package/build/cjs/src/pricing-plans-v2-plan.universal.js.map +1 -0
- package/build/es/index.d.ts +2 -0
- package/build/es/index.js +3 -0
- package/build/es/index.js.map +1 -0
- package/build/es/src/pricing-plans-v2-order.http.d.ts +105 -0
- package/build/es/src/pricing-plans-v2-order.http.js +735 -0
- package/build/es/src/pricing-plans-v2-order.http.js.map +1 -0
- package/build/es/src/pricing-plans-v2-order.public.d.ts +17 -0
- package/build/es/src/pricing-plans-v2-order.public.js +68 -0
- package/build/es/src/pricing-plans-v2-order.public.js.map +1 -0
- package/build/es/src/pricing-plans-v2-order.types.d.ts +1071 -0
- package/build/es/src/pricing-plans-v2-order.types.js +130 -0
- package/build/es/src/pricing-plans-v2-order.types.js.map +1 -0
- package/build/es/src/pricing-plans-v2-order.universal.d.ts +1346 -0
- package/build/es/src/pricing-plans-v2-order.universal.js +927 -0
- package/build/es/src/pricing-plans-v2-order.universal.js.map +1 -0
- package/build/es/src/pricing-plans-v2-plan.http.d.ts +44 -0
- package/build/es/src/pricing-plans-v2-plan.http.js +438 -0
- package/build/es/src/pricing-plans-v2-plan.http.js.map +1 -0
- package/build/es/src/pricing-plans-v2-plan.public.d.ts +16 -0
- package/build/es/src/pricing-plans-v2-plan.public.js +63 -0
- package/build/es/src/pricing-plans-v2-plan.public.js.map +1 -0
- package/build/es/src/pricing-plans-v2-plan.types.d.ts +357 -0
- package/build/es/src/pricing-plans-v2-plan.types.js +32 -0
- package/build/es/src/pricing-plans-v2-plan.types.js.map +1 -0
- package/build/es/src/pricing-plans-v2-plan.universal.d.ts +554 -0
- package/build/es/src/pricing-plans-v2-plan.universal.js +694 -0
- package/build/es/src/pricing-plans-v2-plan.universal.js.map +1 -0
- package/package.json +37 -0
@@ -0,0 +1,735 @@
|
|
1
|
+
import { toURLSearchParams } from '@wix/metro-runtime';
|
2
|
+
import { serializer } from '@wix/metro-runtime/ambassador';
|
3
|
+
import { resolveUrl } from '@wix/metro-runtime';
|
4
|
+
const _cancellation = { requestedDate: 'google.protobuf.Timestamp' };
|
5
|
+
const _cancelOrderRequest = {};
|
6
|
+
const _cancelOrderResponse = {};
|
7
|
+
const _createOfflineOrderRequest = { startDate: 'google.protobuf.Timestamp' };
|
8
|
+
const _createOfflineOrderResponse = { order: '_order' };
|
9
|
+
const _currentCycle = {
|
10
|
+
startedDate: 'google.protobuf.Timestamp',
|
11
|
+
endedDate: 'google.protobuf.Timestamp',
|
12
|
+
};
|
13
|
+
const _getOfflineOrderPreviewRequest = {
|
14
|
+
startDate: 'google.protobuf.Timestamp',
|
15
|
+
};
|
16
|
+
const _getOfflineOrderPreviewResponse = { order: '_order' };
|
17
|
+
const _getOrderRequest = {};
|
18
|
+
const _getOrderResponse = { order: '_order' };
|
19
|
+
const _getPricePreviewRequest = {};
|
20
|
+
const _getPricePreviewResponse = {};
|
21
|
+
const _listOrdersRequest = {};
|
22
|
+
const _listOrdersResponse = { orders: '_order' };
|
23
|
+
const _markAsPaidRequest = {};
|
24
|
+
const _markAsPaidResponse = {};
|
25
|
+
const _memberGetOrderRequest = {};
|
26
|
+
const _memberGetOrderResponse = { order: '_order' };
|
27
|
+
const _memberListOrdersRequest = {};
|
28
|
+
const _memberListOrdersResponse = { orders: '_order' };
|
29
|
+
const _order = {
|
30
|
+
startDate: 'google.protobuf.Timestamp',
|
31
|
+
endDate: 'google.protobuf.Timestamp',
|
32
|
+
earliestEndDate: 'google.protobuf.Timestamp',
|
33
|
+
createdDate: 'google.protobuf.Timestamp',
|
34
|
+
updatedDate: 'google.protobuf.Timestamp',
|
35
|
+
cancellation: '_cancellation',
|
36
|
+
pausePeriods: '_pausePeriod',
|
37
|
+
currentCycle: '_currentCycle',
|
38
|
+
cycles: '_orderCycle',
|
39
|
+
};
|
40
|
+
const _orderCycle = {
|
41
|
+
startedDate: 'google.protobuf.Timestamp',
|
42
|
+
endedDate: 'google.protobuf.Timestamp',
|
43
|
+
};
|
44
|
+
const _pauseOrderRequest = {};
|
45
|
+
const _pauseOrderResponse = {};
|
46
|
+
const _pausePeriod = {
|
47
|
+
pauseDate: 'google.protobuf.Timestamp',
|
48
|
+
resumeDate: 'google.protobuf.Timestamp',
|
49
|
+
};
|
50
|
+
const _postponeEndDateRequest = { endDate: 'google.protobuf.Timestamp' };
|
51
|
+
const _postponeEndDateResponse = {};
|
52
|
+
const _requestCancellationRequest = {};
|
53
|
+
const _requestCancellationResponse = {};
|
54
|
+
const _resumeOrderRequest = {};
|
55
|
+
const _resumeOrderResponse = {};
|
56
|
+
function resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl(opts) {
|
57
|
+
const domainToMappings = {
|
58
|
+
'api._api_base_domain_': [
|
59
|
+
{
|
60
|
+
srcPath: '/membership-api',
|
61
|
+
destPath: '',
|
62
|
+
},
|
63
|
+
{
|
64
|
+
srcPath: '/paid-plans',
|
65
|
+
destPath: '',
|
66
|
+
},
|
67
|
+
{
|
68
|
+
srcPath: '/_api/paid-plans',
|
69
|
+
destPath: '',
|
70
|
+
},
|
71
|
+
],
|
72
|
+
'www._base_domain_': [
|
73
|
+
{
|
74
|
+
srcPath: '/_api/paid-plans',
|
75
|
+
destPath: '',
|
76
|
+
},
|
77
|
+
],
|
78
|
+
'forums.wixapps.net': [
|
79
|
+
{
|
80
|
+
srcPath: '/_api/paid-plans',
|
81
|
+
destPath: '',
|
82
|
+
},
|
83
|
+
],
|
84
|
+
'editor._base_domain_': [
|
85
|
+
{
|
86
|
+
srcPath: '/_api/paid-plans',
|
87
|
+
destPath: '',
|
88
|
+
},
|
89
|
+
],
|
90
|
+
'blocks._base_domain_': [
|
91
|
+
{
|
92
|
+
srcPath: '/_api/paid-plans',
|
93
|
+
destPath: '',
|
94
|
+
},
|
95
|
+
],
|
96
|
+
'create.editorx': [
|
97
|
+
{
|
98
|
+
srcPath: '/_api/paid-plans',
|
99
|
+
destPath: '',
|
100
|
+
},
|
101
|
+
],
|
102
|
+
_: [
|
103
|
+
{
|
104
|
+
srcPath: '/_api/paid-plans',
|
105
|
+
destPath: '',
|
106
|
+
},
|
107
|
+
{
|
108
|
+
srcPath: '/pricing-plans/v2/checkout',
|
109
|
+
destPath: '/v2/checkout',
|
110
|
+
},
|
111
|
+
],
|
112
|
+
'*.wixapps.net': [
|
113
|
+
{
|
114
|
+
srcPath: '/_api/paid-plans',
|
115
|
+
destPath: '',
|
116
|
+
},
|
117
|
+
],
|
118
|
+
'*.pub.wix-code.com': [
|
119
|
+
{
|
120
|
+
srcPath: '/_api/paid-plans',
|
121
|
+
destPath: '',
|
122
|
+
},
|
123
|
+
],
|
124
|
+
'*.dev.wix-code.com': [
|
125
|
+
{
|
126
|
+
srcPath: '/_api/paid-plans',
|
127
|
+
destPath: '',
|
128
|
+
},
|
129
|
+
],
|
130
|
+
'manage._base_domain_': [
|
131
|
+
{
|
132
|
+
srcPath: '/_api/paid-plans',
|
133
|
+
destPath: '',
|
134
|
+
},
|
135
|
+
{
|
136
|
+
srcPath: '/_api/pricing-plans',
|
137
|
+
destPath: '',
|
138
|
+
},
|
139
|
+
],
|
140
|
+
'forums._base_domain_': [
|
141
|
+
{
|
142
|
+
srcPath: '/_api/paid-plans',
|
143
|
+
destPath: '',
|
144
|
+
},
|
145
|
+
],
|
146
|
+
'editor-flow.wixapps.net': [
|
147
|
+
{
|
148
|
+
srcPath: '/_api/paid-plans',
|
149
|
+
destPath: '',
|
150
|
+
},
|
151
|
+
],
|
152
|
+
'www.wixapis.com': [
|
153
|
+
{
|
154
|
+
srcPath: '/pricing-plans/v2/plans',
|
155
|
+
destPath: '/v2/plans',
|
156
|
+
},
|
157
|
+
{
|
158
|
+
srcPath: '/pricing-plans/v2/checkout',
|
159
|
+
destPath: '/v2/checkout',
|
160
|
+
},
|
161
|
+
{
|
162
|
+
srcPath: '/pricing-plans/v2/orders',
|
163
|
+
destPath: '/v2/orders',
|
164
|
+
},
|
165
|
+
],
|
166
|
+
'editor.wixapps.net': [
|
167
|
+
{
|
168
|
+
srcPath: '/_api/paid-plans',
|
169
|
+
destPath: '',
|
170
|
+
},
|
171
|
+
],
|
172
|
+
};
|
173
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
174
|
+
}
|
175
|
+
function resolveComWixpressMembershipV2OrdersCheckoutServiceUrl(opts) {
|
176
|
+
const domainToMappings = {
|
177
|
+
'api._api_base_domain_': [
|
178
|
+
{
|
179
|
+
srcPath: '/membership-api',
|
180
|
+
destPath: '',
|
181
|
+
},
|
182
|
+
{
|
183
|
+
srcPath: '/paid-plans',
|
184
|
+
destPath: '',
|
185
|
+
},
|
186
|
+
{
|
187
|
+
srcPath: '/_api/paid-plans',
|
188
|
+
destPath: '',
|
189
|
+
},
|
190
|
+
],
|
191
|
+
'www._base_domain_': [
|
192
|
+
{
|
193
|
+
srcPath: '/_api/paid-plans',
|
194
|
+
destPath: '',
|
195
|
+
},
|
196
|
+
],
|
197
|
+
'forums.wixapps.net': [
|
198
|
+
{
|
199
|
+
srcPath: '/_api/paid-plans',
|
200
|
+
destPath: '',
|
201
|
+
},
|
202
|
+
],
|
203
|
+
'editor._base_domain_': [
|
204
|
+
{
|
205
|
+
srcPath: '/_api/paid-plans',
|
206
|
+
destPath: '',
|
207
|
+
},
|
208
|
+
],
|
209
|
+
'blocks._base_domain_': [
|
210
|
+
{
|
211
|
+
srcPath: '/_api/paid-plans',
|
212
|
+
destPath: '',
|
213
|
+
},
|
214
|
+
],
|
215
|
+
'create.editorx': [
|
216
|
+
{
|
217
|
+
srcPath: '/_api/paid-plans',
|
218
|
+
destPath: '',
|
219
|
+
},
|
220
|
+
],
|
221
|
+
_: [
|
222
|
+
{
|
223
|
+
srcPath: '/_api/paid-plans',
|
224
|
+
destPath: '',
|
225
|
+
},
|
226
|
+
{
|
227
|
+
srcPath: '/pricing-plans/v2/checkout',
|
228
|
+
destPath: '/v2/checkout',
|
229
|
+
},
|
230
|
+
],
|
231
|
+
'*.wixapps.net': [
|
232
|
+
{
|
233
|
+
srcPath: '/_api/paid-plans',
|
234
|
+
destPath: '',
|
235
|
+
},
|
236
|
+
],
|
237
|
+
'*.pub.wix-code.com': [
|
238
|
+
{
|
239
|
+
srcPath: '/_api/paid-plans',
|
240
|
+
destPath: '',
|
241
|
+
},
|
242
|
+
],
|
243
|
+
'*.dev.wix-code.com': [
|
244
|
+
{
|
245
|
+
srcPath: '/_api/paid-plans',
|
246
|
+
destPath: '',
|
247
|
+
},
|
248
|
+
],
|
249
|
+
'manage._base_domain_': [
|
250
|
+
{
|
251
|
+
srcPath: '/_api/paid-plans',
|
252
|
+
destPath: '',
|
253
|
+
},
|
254
|
+
{
|
255
|
+
srcPath: '/_api/pricing-plans',
|
256
|
+
destPath: '',
|
257
|
+
},
|
258
|
+
],
|
259
|
+
'forums._base_domain_': [
|
260
|
+
{
|
261
|
+
srcPath: '/_api/paid-plans',
|
262
|
+
destPath: '',
|
263
|
+
},
|
264
|
+
],
|
265
|
+
'editor-flow.wixapps.net': [
|
266
|
+
{
|
267
|
+
srcPath: '/_api/paid-plans',
|
268
|
+
destPath: '',
|
269
|
+
},
|
270
|
+
],
|
271
|
+
'www.wixapis.com': [
|
272
|
+
{
|
273
|
+
srcPath: '/pricing-plans/v2/plans',
|
274
|
+
destPath: '/v2/plans',
|
275
|
+
},
|
276
|
+
{
|
277
|
+
srcPath: '/pricing-plans/v2/checkout',
|
278
|
+
destPath: '/v2/checkout',
|
279
|
+
},
|
280
|
+
{
|
281
|
+
srcPath: '/pricing-plans/v2/orders',
|
282
|
+
destPath: '/v2/orders',
|
283
|
+
},
|
284
|
+
],
|
285
|
+
'editor.wixapps.net': [
|
286
|
+
{
|
287
|
+
srcPath: '/_api/paid-plans',
|
288
|
+
destPath: '',
|
289
|
+
},
|
290
|
+
],
|
291
|
+
};
|
292
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
293
|
+
}
|
294
|
+
function resolveComWixpressMembershipV2OrdersMemberMemberOrdersServiceUrl(opts) {
|
295
|
+
const domainToMappings = {
|
296
|
+
'*.dev.wix-code.com': [
|
297
|
+
{
|
298
|
+
srcPath: '/_api/pricing-plans-member-orders',
|
299
|
+
destPath: '',
|
300
|
+
},
|
301
|
+
{
|
302
|
+
srcPath: '/_api/pricing-plans/v2/member',
|
303
|
+
destPath: '/v2/member',
|
304
|
+
},
|
305
|
+
],
|
306
|
+
'*.pub.wix-code.com': [
|
307
|
+
{
|
308
|
+
srcPath: '/_api/pricing-plans-member-orders',
|
309
|
+
destPath: '',
|
310
|
+
},
|
311
|
+
{
|
312
|
+
srcPath: '/_api/pricing-plans/v2/member',
|
313
|
+
destPath: '/v2/member',
|
314
|
+
},
|
315
|
+
],
|
316
|
+
'www.wixapis.com': [
|
317
|
+
{
|
318
|
+
srcPath: '/pricing-plans/v2/member',
|
319
|
+
destPath: '/v2/member',
|
320
|
+
},
|
321
|
+
],
|
322
|
+
'www._base_domain_': [
|
323
|
+
{
|
324
|
+
srcPath: '/_api/pricing-plans/v2/member',
|
325
|
+
destPath: '/v2/member',
|
326
|
+
},
|
327
|
+
],
|
328
|
+
_: [
|
329
|
+
{
|
330
|
+
srcPath: '/_api/pricing-plans/v2/member',
|
331
|
+
destPath: '/v2/member',
|
332
|
+
},
|
333
|
+
],
|
334
|
+
'manage._base_domain_': [
|
335
|
+
{
|
336
|
+
srcPath: '/_api/pricing-plans/v2/member',
|
337
|
+
destPath: '/v2/member',
|
338
|
+
},
|
339
|
+
],
|
340
|
+
'editor.wixapps.net': [
|
341
|
+
{
|
342
|
+
srcPath: '/_api/pricing-plans/v2/member',
|
343
|
+
destPath: '/v2/member',
|
344
|
+
},
|
345
|
+
],
|
346
|
+
};
|
347
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
348
|
+
}
|
349
|
+
/** Retrieves an order by ID. */
|
350
|
+
export function memberGetOrder(payload) {
|
351
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_memberGetOrderRequest, {});
|
352
|
+
const { fromJSON: fromRes } = serializer(_memberGetOrderResponse, {
|
353
|
+
_cancellation,
|
354
|
+
_currentCycle,
|
355
|
+
_order,
|
356
|
+
_orderCycle,
|
357
|
+
_pausePeriod,
|
358
|
+
});
|
359
|
+
function __memberGetOrder({ host }) {
|
360
|
+
const serializedData = toReq(payload);
|
361
|
+
const metadata = {
|
362
|
+
method: 'GET',
|
363
|
+
url: resolveComWixpressMembershipV2OrdersMemberMemberOrdersServiceUrl({
|
364
|
+
protoPath: '/v2/member/orders/{id}',
|
365
|
+
data: serializedData,
|
366
|
+
host,
|
367
|
+
}),
|
368
|
+
params: toURLSearchParams(serializedData),
|
369
|
+
transformResponse: fromRes,
|
370
|
+
};
|
371
|
+
return metadata;
|
372
|
+
}
|
373
|
+
__memberGetOrder.fromReq = fromReq;
|
374
|
+
return __memberGetOrder;
|
375
|
+
}
|
376
|
+
/** Returns orders for currently logged in member. */
|
377
|
+
export function memberListOrders(payload) {
|
378
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_memberListOrdersRequest, {});
|
379
|
+
const { fromJSON: fromRes } = serializer(_memberListOrdersResponse, {
|
380
|
+
_cancellation,
|
381
|
+
_currentCycle,
|
382
|
+
_order,
|
383
|
+
_orderCycle,
|
384
|
+
_pausePeriod,
|
385
|
+
});
|
386
|
+
function __memberListOrders({ host }) {
|
387
|
+
const serializedData = toReq(payload);
|
388
|
+
const metadata = {
|
389
|
+
method: 'GET',
|
390
|
+
url: resolveComWixpressMembershipV2OrdersMemberMemberOrdersServiceUrl({
|
391
|
+
protoPath: '/v2/member/orders',
|
392
|
+
data: serializedData,
|
393
|
+
host,
|
394
|
+
}),
|
395
|
+
params: toURLSearchParams(serializedData),
|
396
|
+
transformResponse: fromRes,
|
397
|
+
};
|
398
|
+
return metadata;
|
399
|
+
}
|
400
|
+
__memberListOrders.fromReq = fromReq;
|
401
|
+
return __memberListOrders;
|
402
|
+
}
|
403
|
+
/**
|
404
|
+
* Cancels an order. Recurring orders can be canceled either immediately or at the next payment date.
|
405
|
+
* One time orders can only be canceled immediately.
|
406
|
+
*/
|
407
|
+
export function requestCancellation(payload) {
|
408
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_requestCancellationRequest, {});
|
409
|
+
const { fromJSON: fromRes } = serializer(_requestCancellationResponse, {});
|
410
|
+
function __requestCancellation({ host }) {
|
411
|
+
const serializedData = toReq(payload);
|
412
|
+
const metadata = {
|
413
|
+
method: 'POST',
|
414
|
+
url: resolveComWixpressMembershipV2OrdersMemberMemberOrdersServiceUrl({
|
415
|
+
protoPath: '/v2/member/orders/{id}/cancel',
|
416
|
+
data: serializedData,
|
417
|
+
host,
|
418
|
+
}),
|
419
|
+
data: serializedData,
|
420
|
+
transformResponse: fromRes,
|
421
|
+
};
|
422
|
+
return metadata;
|
423
|
+
}
|
424
|
+
__requestCancellation.fromReq = fromReq;
|
425
|
+
return __requestCancellation;
|
426
|
+
}
|
427
|
+
/**
|
428
|
+
* Creates an order for a buyer who purchased the plan with an offline transaction.
|
429
|
+
*
|
430
|
+
* An offline order is handled off of the Wix site and is marked as `offline` in `type`. If a pricing plan
|
431
|
+
* has a limit on the amount of purchases per buyer, that limit is ignored for offline orders.
|
432
|
+
* Tax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
|
433
|
+
*
|
434
|
+
* Handle payment for an offline order in 1 of 2 ways:
|
435
|
+
* + When creating the order, select `true` in the `paid` request parameter.
|
436
|
+
* + After creation, use [Mark As Paid to mark the order as paid](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/mark-as-paid).
|
437
|
+
*/
|
438
|
+
export function createOfflineOrder(payload) {
|
439
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_createOfflineOrderRequest, {});
|
440
|
+
const { fromJSON: fromRes } = serializer(_createOfflineOrderResponse, {
|
441
|
+
_cancellation,
|
442
|
+
_currentCycle,
|
443
|
+
_order,
|
444
|
+
_orderCycle,
|
445
|
+
_pausePeriod,
|
446
|
+
});
|
447
|
+
function __createOfflineOrder({ host }) {
|
448
|
+
const serializedData = toReq(payload);
|
449
|
+
const metadata = {
|
450
|
+
method: 'POST',
|
451
|
+
url: resolveComWixpressMembershipV2OrdersCheckoutServiceUrl({
|
452
|
+
protoPath: '/v2/checkout/orders/offline',
|
453
|
+
data: serializedData,
|
454
|
+
host,
|
455
|
+
}),
|
456
|
+
data: serializedData,
|
457
|
+
transformResponse: fromRes,
|
458
|
+
};
|
459
|
+
return metadata;
|
460
|
+
}
|
461
|
+
__createOfflineOrder.fromReq = fromReq;
|
462
|
+
return __createOfflineOrder;
|
463
|
+
}
|
464
|
+
/**
|
465
|
+
* Performs a dry run of a purchase and provides an order preview.
|
466
|
+
*
|
467
|
+
* The preview uses the same logic as purchasing a plan, but the preview is not saved. Because an order is not actually
|
468
|
+
* created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters
|
469
|
+
* (`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
|
470
|
+
* <br>
|
471
|
+
* If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview.
|
472
|
+
* But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then
|
473
|
+
* `purchaseLimitExceeded` will return as `true`.
|
474
|
+
*
|
475
|
+
* To get a general price preview for a plan that's not buyer-specific, use [Get Price Preview](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/get-price-preview).
|
476
|
+
*/
|
477
|
+
export function getOfflineOrderPreview(payload) {
|
478
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_getOfflineOrderPreviewRequest, {});
|
479
|
+
const { fromJSON: fromRes } = serializer(_getOfflineOrderPreviewResponse, {
|
480
|
+
_cancellation,
|
481
|
+
_currentCycle,
|
482
|
+
_order,
|
483
|
+
_orderCycle,
|
484
|
+
_pausePeriod,
|
485
|
+
});
|
486
|
+
function __getOfflineOrderPreview({ host }) {
|
487
|
+
const serializedData = toReq(payload);
|
488
|
+
const metadata = {
|
489
|
+
method: 'POST',
|
490
|
+
url: resolveComWixpressMembershipV2OrdersCheckoutServiceUrl({
|
491
|
+
protoPath: '/v2/checkout/orders/preview-offline',
|
492
|
+
data: serializedData,
|
493
|
+
host,
|
494
|
+
}),
|
495
|
+
data: serializedData,
|
496
|
+
transformResponse: fromRes,
|
497
|
+
};
|
498
|
+
return metadata;
|
499
|
+
}
|
500
|
+
__getOfflineOrderPreview.fromReq = fromReq;
|
501
|
+
return __getOfflineOrderPreview;
|
502
|
+
}
|
503
|
+
/**
|
504
|
+
* Retrieves a plan's pricing.
|
505
|
+
*
|
506
|
+
* The price preview uses the same logic as purchasing a plan, but the preview is not saved. Tax is only applied if
|
507
|
+
* the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection). The price is returned
|
508
|
+
* in the [pricing model](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models) format used for orders.
|
509
|
+
*
|
510
|
+
* Buyers do not have to be logged in to preview the price, as such, the details returned are not buyer-specific. To
|
511
|
+
* generate a preview of a purchase for a specific buyer, use [Get Offline Order Preview](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/get-offline-order-preview).
|
512
|
+
*/
|
513
|
+
export function getPricePreview(payload) {
|
514
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_getPricePreviewRequest, {});
|
515
|
+
const { fromJSON: fromRes } = serializer(_getPricePreviewResponse, {});
|
516
|
+
function __getPricePreview({ host }) {
|
517
|
+
const serializedData = toReq(payload);
|
518
|
+
const metadata = {
|
519
|
+
method: 'POST',
|
520
|
+
url: resolveComWixpressMembershipV2OrdersCheckoutServiceUrl({
|
521
|
+
protoPath: '/v2/checkout/orders/price-preview',
|
522
|
+
data: serializedData,
|
523
|
+
host,
|
524
|
+
}),
|
525
|
+
data: serializedData,
|
526
|
+
transformResponse: fromRes,
|
527
|
+
};
|
528
|
+
return metadata;
|
529
|
+
}
|
530
|
+
__getPricePreview.fromReq = fromReq;
|
531
|
+
return __getPricePreview;
|
532
|
+
}
|
533
|
+
/** Retrieves an order by ID. */
|
534
|
+
export function managementGetOrder(payload) {
|
535
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_getOrderRequest, {});
|
536
|
+
const { fromJSON: fromRes } = serializer(_getOrderResponse, {
|
537
|
+
_cancellation,
|
538
|
+
_currentCycle,
|
539
|
+
_order,
|
540
|
+
_orderCycle,
|
541
|
+
_pausePeriod,
|
542
|
+
});
|
543
|
+
function __managementGetOrder({ host }) {
|
544
|
+
const serializedData = toReq(payload);
|
545
|
+
const metadata = {
|
546
|
+
method: 'GET',
|
547
|
+
url: resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl({
|
548
|
+
protoPath: '/v2/orders/{id}',
|
549
|
+
data: serializedData,
|
550
|
+
host,
|
551
|
+
}),
|
552
|
+
params: toURLSearchParams(serializedData),
|
553
|
+
transformResponse: fromRes,
|
554
|
+
};
|
555
|
+
return metadata;
|
556
|
+
}
|
557
|
+
__managementGetOrder.fromReq = fromReq;
|
558
|
+
return __managementGetOrder;
|
559
|
+
}
|
560
|
+
/**
|
561
|
+
* Retrieves a list of orders and details, given the provided sorting and filtering.
|
562
|
+
*
|
563
|
+
* By default, this endpoint will retrieve all orders and return them sorted by `createdDate` in `DESC`, descending order.
|
564
|
+
* `sort.fieldName` supports `endDate` and `createdDate` fields and defaults to `ASC`, ascending order.
|
565
|
+
*/
|
566
|
+
export function managementListOrders(payload) {
|
567
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_listOrdersRequest, {});
|
568
|
+
const { fromJSON: fromRes } = serializer(_listOrdersResponse, {
|
569
|
+
_cancellation,
|
570
|
+
_currentCycle,
|
571
|
+
_order,
|
572
|
+
_orderCycle,
|
573
|
+
_pausePeriod,
|
574
|
+
});
|
575
|
+
function __managementListOrders({ host }) {
|
576
|
+
const serializedData = toReq(payload);
|
577
|
+
const metadata = {
|
578
|
+
method: 'GET',
|
579
|
+
url: resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl({
|
580
|
+
protoPath: '/v2/orders',
|
581
|
+
data: serializedData,
|
582
|
+
host,
|
583
|
+
}),
|
584
|
+
params: toURLSearchParams(serializedData),
|
585
|
+
transformResponse: fromRes,
|
586
|
+
};
|
587
|
+
return metadata;
|
588
|
+
}
|
589
|
+
__managementListOrders.fromReq = fromReq;
|
590
|
+
return __managementListOrders;
|
591
|
+
}
|
592
|
+
/**
|
593
|
+
* Extends the duration of a pricing plan order by postponing the order's `endDate`.
|
594
|
+
*
|
595
|
+
* New `endDate` must be later than the order's current `endDate`. Can't postpone orders that are unlimited.
|
596
|
+
* Can't postpone an order while it is [`PAUSED`](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/pause-order).
|
597
|
+
*/
|
598
|
+
export function postponeEndDate(payload) {
|
599
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_postponeEndDateRequest, {});
|
600
|
+
const { fromJSON: fromRes } = serializer(_postponeEndDateResponse, {});
|
601
|
+
function __postponeEndDate({ host }) {
|
602
|
+
const serializedData = toReq(payload);
|
603
|
+
const metadata = {
|
604
|
+
method: 'PATCH',
|
605
|
+
url: resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl({
|
606
|
+
protoPath: '/v2/orders/{id}',
|
607
|
+
data: serializedData,
|
608
|
+
host,
|
609
|
+
}),
|
610
|
+
data: serializedData,
|
611
|
+
transformResponse: fromRes,
|
612
|
+
};
|
613
|
+
return metadata;
|
614
|
+
}
|
615
|
+
__postponeEndDate.fromReq = fromReq;
|
616
|
+
return __postponeEndDate;
|
617
|
+
}
|
618
|
+
/**
|
619
|
+
* Cancels an existing order.
|
620
|
+
*
|
621
|
+
* For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
|
622
|
+
* For orders with one-time payments, a cancellation can only be set for `IMMEDIATELY`.
|
623
|
+
*
|
624
|
+
* #### Canceling during the free trial period.
|
625
|
+
*
|
626
|
+
* When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end
|
627
|
+
* of the free trial period and they will not be billed. The buyer may continue using the benefits until the end
|
628
|
+
* of the free trial period.
|
629
|
+
*
|
630
|
+
* When a site owner cancels an ordered plan during the free trial period, they choose to apply the cancellation
|
631
|
+
* `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`. Canceling `IMMEDIATELY` will end the subscription for the buyer
|
632
|
+
* immediately, even during the free trial period and the buyer won't be billed. Canceling at the
|
633
|
+
* `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period.
|
634
|
+
* Then, the subscription ends and the buyer is not billed.
|
635
|
+
*/
|
636
|
+
export function cancelOrder(payload) {
|
637
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_cancelOrderRequest, {});
|
638
|
+
const { fromJSON: fromRes } = serializer(_cancelOrderResponse, {});
|
639
|
+
function __cancelOrder({ host }) {
|
640
|
+
const serializedData = toReq(payload);
|
641
|
+
const metadata = {
|
642
|
+
method: 'POST',
|
643
|
+
url: resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl({
|
644
|
+
protoPath: '/v2/orders/{id}/cancel',
|
645
|
+
data: serializedData,
|
646
|
+
host,
|
647
|
+
}),
|
648
|
+
data: serializedData,
|
649
|
+
transformResponse: fromRes,
|
650
|
+
};
|
651
|
+
return metadata;
|
652
|
+
}
|
653
|
+
__cancelOrder.fromReq = fromReq;
|
654
|
+
return __cancelOrder;
|
655
|
+
}
|
656
|
+
/**
|
657
|
+
* Marks an offline order as paid.
|
658
|
+
* > __Note__: Marking separate payment cycles as paid is not yet supported. The entire order will be marked as paid.
|
659
|
+
*/
|
660
|
+
export function markAsPaid(payload) {
|
661
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_markAsPaidRequest, {});
|
662
|
+
const { fromJSON: fromRes } = serializer(_markAsPaidResponse, {});
|
663
|
+
function __markAsPaid({ host }) {
|
664
|
+
const serializedData = toReq(payload);
|
665
|
+
const metadata = {
|
666
|
+
method: 'POST',
|
667
|
+
url: resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl({
|
668
|
+
protoPath: '/v2/orders/{id}/mark-as-paid',
|
669
|
+
data: serializedData,
|
670
|
+
host,
|
671
|
+
}),
|
672
|
+
data: serializedData,
|
673
|
+
transformResponse: fromRes,
|
674
|
+
};
|
675
|
+
return metadata;
|
676
|
+
}
|
677
|
+
__markAsPaid.fromReq = fromReq;
|
678
|
+
return __markAsPaid;
|
679
|
+
}
|
680
|
+
/**
|
681
|
+
* Pauses an order.
|
682
|
+
*
|
683
|
+
* For orders with recurring payments, it also pauses the payment schedule. Buyers are not charged when an order is paused.
|
684
|
+
* Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`. Can only pause orders with an `ACTIVE` status.
|
685
|
+
*
|
686
|
+
* Use [Resume Order to resume a paused order](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/resume-order/).
|
687
|
+
*/
|
688
|
+
export function pauseOrder(payload) {
|
689
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_pauseOrderRequest, {});
|
690
|
+
const { fromJSON: fromRes } = serializer(_pauseOrderResponse, {});
|
691
|
+
function __pauseOrder({ host }) {
|
692
|
+
const serializedData = toReq(payload);
|
693
|
+
const metadata = {
|
694
|
+
method: 'POST',
|
695
|
+
url: resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl({
|
696
|
+
protoPath: '/v2/orders/{id}/pause',
|
697
|
+
data: serializedData,
|
698
|
+
host,
|
699
|
+
}),
|
700
|
+
data: serializedData,
|
701
|
+
transformResponse: fromRes,
|
702
|
+
};
|
703
|
+
return metadata;
|
704
|
+
}
|
705
|
+
__pauseOrder.fromReq = fromReq;
|
706
|
+
return __pauseOrder;
|
707
|
+
}
|
708
|
+
/**
|
709
|
+
* Resumes a paused order.
|
710
|
+
*
|
711
|
+
* Updates `endDate` by adding the time the plan was paused.
|
712
|
+
* For orders with recurring payments, it also restarts the payment schedule.
|
713
|
+
* Use [Pause Order to pause an order](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/pause-order/).
|
714
|
+
*/
|
715
|
+
export function resumeOrder(payload) {
|
716
|
+
const { toJSON: toReq, fromJSON: fromReq } = serializer(_resumeOrderRequest, {});
|
717
|
+
const { fromJSON: fromRes } = serializer(_resumeOrderResponse, {});
|
718
|
+
function __resumeOrder({ host }) {
|
719
|
+
const serializedData = toReq(payload);
|
720
|
+
const metadata = {
|
721
|
+
method: 'POST',
|
722
|
+
url: resolveComWixpressMembershipV2OrdersOrderManagementServiceUrl({
|
723
|
+
protoPath: '/v2/orders/{id}/resume',
|
724
|
+
data: serializedData,
|
725
|
+
host,
|
726
|
+
}),
|
727
|
+
data: serializedData,
|
728
|
+
transformResponse: fromRes,
|
729
|
+
};
|
730
|
+
return metadata;
|
731
|
+
}
|
732
|
+
__resumeOrder.fromReq = fromReq;
|
733
|
+
return __resumeOrder;
|
734
|
+
}
|
735
|
+
//# sourceMappingURL=pricing-plans-v2-order.http.js.map
|