@wix/auto_sdk_pricing-plans_orders 1.0.58 → 1.0.60

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.
Files changed (121) hide show
  1. package/build/cjs/index.d.ts +343 -1
  2. package/build/cjs/index.js +1867 -15
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/meta.d.ts +982 -1
  5. package/build/cjs/meta.js +1054 -15
  6. package/build/cjs/meta.js.map +1 -1
  7. package/build/{internal/cjs/src/pricing-plans-v2-order-orders.types.d.ts → cjs/pricing-plans-v2-order-orders.universal-Bwx6oqbS.d.ts} +420 -170
  8. package/build/es/index.d.mts +343 -0
  9. package/build/es/index.mjs +1807 -0
  10. package/build/es/index.mjs.map +1 -0
  11. package/build/es/meta.d.mts +982 -0
  12. package/build/es/meta.mjs +1016 -0
  13. package/build/es/meta.mjs.map +1 -0
  14. package/build/{internal/es/src/pricing-plans-v2-order-orders.types.d.ts → es/pricing-plans-v2-order-orders.universal-Bwx6oqbS.d.mts} +420 -170
  15. package/build/internal/cjs/index.d.ts +343 -1
  16. package/build/internal/cjs/index.js +1867 -15
  17. package/build/internal/cjs/index.js.map +1 -1
  18. package/build/internal/cjs/meta.d.ts +982 -1
  19. package/build/internal/cjs/meta.js +1054 -15
  20. package/build/internal/cjs/meta.js.map +1 -1
  21. package/build/{es/src/pricing-plans-v2-order-orders.types.d.ts → internal/cjs/pricing-plans-v2-order-orders.universal-CxIXSY94.d.ts} +424 -157
  22. package/build/internal/es/index.d.mts +343 -0
  23. package/build/internal/es/index.mjs +1807 -0
  24. package/build/internal/es/index.mjs.map +1 -0
  25. package/build/internal/es/meta.d.mts +982 -0
  26. package/build/internal/es/meta.mjs +1016 -0
  27. package/build/internal/es/meta.mjs.map +1 -0
  28. package/build/{cjs/src/pricing-plans-v2-order-orders.types.d.ts → internal/es/pricing-plans-v2-order-orders.universal-CxIXSY94.d.mts} +424 -157
  29. package/package.json +9 -8
  30. package/build/cjs/index.typings.d.ts +0 -1
  31. package/build/cjs/index.typings.js +0 -18
  32. package/build/cjs/index.typings.js.map +0 -1
  33. package/build/cjs/src/pricing-plans-v2-order-orders.context.d.ts +0 -111
  34. package/build/cjs/src/pricing-plans-v2-order-orders.context.js +0 -126
  35. package/build/cjs/src/pricing-plans-v2-order-orders.context.js.map +0 -1
  36. package/build/cjs/src/pricing-plans-v2-order-orders.http.d.ts +0 -149
  37. package/build/cjs/src/pricing-plans-v2-order-orders.http.js +0 -877
  38. package/build/cjs/src/pricing-plans-v2-order-orders.http.js.map +0 -1
  39. package/build/cjs/src/pricing-plans-v2-order-orders.meta.d.ts +0 -43
  40. package/build/cjs/src/pricing-plans-v2-order-orders.meta.js +0 -313
  41. package/build/cjs/src/pricing-plans-v2-order-orders.meta.js.map +0 -1
  42. package/build/cjs/src/pricing-plans-v2-order-orders.public.d.ts +0 -249
  43. package/build/cjs/src/pricing-plans-v2-order-orders.public.js +0 -373
  44. package/build/cjs/src/pricing-plans-v2-order-orders.public.js.map +0 -1
  45. package/build/cjs/src/pricing-plans-v2-order-orders.types.js +0 -145
  46. package/build/cjs/src/pricing-plans-v2-order-orders.types.js.map +0 -1
  47. package/build/cjs/src/pricing-plans-v2-order-orders.universal.d.ts +0 -2369
  48. package/build/cjs/src/pricing-plans-v2-order-orders.universal.js +0 -956
  49. package/build/cjs/src/pricing-plans-v2-order-orders.universal.js.map +0 -1
  50. package/build/es/index.d.ts +0 -1
  51. package/build/es/index.js +0 -2
  52. package/build/es/index.js.map +0 -1
  53. package/build/es/index.typings.d.ts +0 -1
  54. package/build/es/index.typings.js +0 -2
  55. package/build/es/index.typings.js.map +0 -1
  56. package/build/es/meta.d.ts +0 -1
  57. package/build/es/meta.js +0 -2
  58. package/build/es/meta.js.map +0 -1
  59. package/build/es/src/pricing-plans-v2-order-orders.context.d.ts +0 -111
  60. package/build/es/src/pricing-plans-v2-order-orders.context.js +0 -111
  61. package/build/es/src/pricing-plans-v2-order-orders.context.js.map +0 -1
  62. package/build/es/src/pricing-plans-v2-order-orders.http.d.ts +0 -149
  63. package/build/es/src/pricing-plans-v2-order-orders.http.js +0 -859
  64. package/build/es/src/pricing-plans-v2-order-orders.http.js.map +0 -1
  65. package/build/es/src/pricing-plans-v2-order-orders.meta.d.ts +0 -43
  66. package/build/es/src/pricing-plans-v2-order-orders.meta.js +0 -272
  67. package/build/es/src/pricing-plans-v2-order-orders.meta.js.map +0 -1
  68. package/build/es/src/pricing-plans-v2-order-orders.public.d.ts +0 -249
  69. package/build/es/src/pricing-plans-v2-order-orders.public.js +0 -343
  70. package/build/es/src/pricing-plans-v2-order-orders.public.js.map +0 -1
  71. package/build/es/src/pricing-plans-v2-order-orders.types.js +0 -142
  72. package/build/es/src/pricing-plans-v2-order-orders.types.js.map +0 -1
  73. package/build/es/src/pricing-plans-v2-order-orders.universal.d.ts +0 -2369
  74. package/build/es/src/pricing-plans-v2-order-orders.universal.js +0 -915
  75. package/build/es/src/pricing-plans-v2-order-orders.universal.js.map +0 -1
  76. package/build/internal/cjs/index.typings.d.ts +0 -1
  77. package/build/internal/cjs/index.typings.js +0 -18
  78. package/build/internal/cjs/index.typings.js.map +0 -1
  79. package/build/internal/cjs/src/pricing-plans-v2-order-orders.context.d.ts +0 -111
  80. package/build/internal/cjs/src/pricing-plans-v2-order-orders.context.js +0 -126
  81. package/build/internal/cjs/src/pricing-plans-v2-order-orders.context.js.map +0 -1
  82. package/build/internal/cjs/src/pricing-plans-v2-order-orders.http.d.ts +0 -149
  83. package/build/internal/cjs/src/pricing-plans-v2-order-orders.http.js +0 -877
  84. package/build/internal/cjs/src/pricing-plans-v2-order-orders.http.js.map +0 -1
  85. package/build/internal/cjs/src/pricing-plans-v2-order-orders.meta.d.ts +0 -43
  86. package/build/internal/cjs/src/pricing-plans-v2-order-orders.meta.js +0 -313
  87. package/build/internal/cjs/src/pricing-plans-v2-order-orders.meta.js.map +0 -1
  88. package/build/internal/cjs/src/pricing-plans-v2-order-orders.public.d.ts +0 -249
  89. package/build/internal/cjs/src/pricing-plans-v2-order-orders.public.js +0 -373
  90. package/build/internal/cjs/src/pricing-plans-v2-order-orders.public.js.map +0 -1
  91. package/build/internal/cjs/src/pricing-plans-v2-order-orders.types.js +0 -145
  92. package/build/internal/cjs/src/pricing-plans-v2-order-orders.types.js.map +0 -1
  93. package/build/internal/cjs/src/pricing-plans-v2-order-orders.universal.d.ts +0 -2386
  94. package/build/internal/cjs/src/pricing-plans-v2-order-orders.universal.js +0 -956
  95. package/build/internal/cjs/src/pricing-plans-v2-order-orders.universal.js.map +0 -1
  96. package/build/internal/es/index.d.ts +0 -1
  97. package/build/internal/es/index.js +0 -2
  98. package/build/internal/es/index.js.map +0 -1
  99. package/build/internal/es/index.typings.d.ts +0 -1
  100. package/build/internal/es/index.typings.js +0 -2
  101. package/build/internal/es/index.typings.js.map +0 -1
  102. package/build/internal/es/meta.d.ts +0 -1
  103. package/build/internal/es/meta.js +0 -2
  104. package/build/internal/es/meta.js.map +0 -1
  105. package/build/internal/es/src/pricing-plans-v2-order-orders.context.d.ts +0 -111
  106. package/build/internal/es/src/pricing-plans-v2-order-orders.context.js +0 -111
  107. package/build/internal/es/src/pricing-plans-v2-order-orders.context.js.map +0 -1
  108. package/build/internal/es/src/pricing-plans-v2-order-orders.http.d.ts +0 -149
  109. package/build/internal/es/src/pricing-plans-v2-order-orders.http.js +0 -859
  110. package/build/internal/es/src/pricing-plans-v2-order-orders.http.js.map +0 -1
  111. package/build/internal/es/src/pricing-plans-v2-order-orders.meta.d.ts +0 -43
  112. package/build/internal/es/src/pricing-plans-v2-order-orders.meta.js +0 -272
  113. package/build/internal/es/src/pricing-plans-v2-order-orders.meta.js.map +0 -1
  114. package/build/internal/es/src/pricing-plans-v2-order-orders.public.d.ts +0 -249
  115. package/build/internal/es/src/pricing-plans-v2-order-orders.public.js +0 -343
  116. package/build/internal/es/src/pricing-plans-v2-order-orders.public.js.map +0 -1
  117. package/build/internal/es/src/pricing-plans-v2-order-orders.types.js +0 -142
  118. package/build/internal/es/src/pricing-plans-v2-order-orders.types.js.map +0 -1
  119. package/build/internal/es/src/pricing-plans-v2-order-orders.universal.d.ts +0 -2386
  120. package/build/internal/es/src/pricing-plans-v2-order-orders.universal.js +0 -915
  121. package/build/internal/es/src/pricing-plans-v2-order-orders.universal.js.map +0 -1
@@ -1,915 +0,0 @@
1
- import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
2
- import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
3
- import * as ambassadorWixPricingPlansV2Order from './pricing-plans-v2-order-orders.http.js';
4
- export var PeriodUnit;
5
- (function (PeriodUnit) {
6
- /** Not defined. */
7
- PeriodUnit["UNDEFINED"] = "UNDEFINED";
8
- /** Time unit is a day. */
9
- PeriodUnit["DAY"] = "DAY";
10
- /** Time unit is a week. */
11
- PeriodUnit["WEEK"] = "WEEK";
12
- /** Time unit is a month. */
13
- PeriodUnit["MONTH"] = "MONTH";
14
- /** Time unit is a year. */
15
- PeriodUnit["YEAR"] = "YEAR";
16
- })(PeriodUnit || (PeriodUnit = {}));
17
- export var OrderType;
18
- (function (OrderType) {
19
- /** Undefined order type. */
20
- OrderType["UNDEFINED"] = "UNDEFINED";
21
- /** The buyer purchased the plan using the site. */
22
- OrderType["ONLINE"] = "ONLINE";
23
- /** The buyer made a manual, offline purchase without using the site. */
24
- OrderType["OFFLINE"] = "OFFLINE";
25
- /** The buyer made a purchase through an external payment provider. */
26
- OrderType["EXTERNAL"] = "EXTERNAL";
27
- })(OrderType || (OrderType = {}));
28
- export var OrderMethod;
29
- (function (OrderMethod) {
30
- /** Unknown order method. */
31
- OrderMethod["UNKNOWN"] = "UNKNOWN";
32
- /** Mail Order / Telephone Order transaction. */
33
- OrderMethod["MOTO"] = "MOTO";
34
- /** Point of Sale transaction. */
35
- OrderMethod["POS"] = "POS";
36
- })(OrderMethod || (OrderMethod = {}));
37
- export var OrderStatus;
38
- (function (OrderStatus) {
39
- /** Undefined order status. */
40
- OrderStatus["UNDEFINED"] = "UNDEFINED";
41
- /** Order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use to the buyer. */
42
- OrderStatus["DRAFT"] = "DRAFT";
43
- /** Order has been purchased and its start date is set in the future. */
44
- OrderStatus["PENDING"] = "PENDING";
45
- /** Order has been processed. The plan is available for use. */
46
- OrderStatus["ACTIVE"] = "ACTIVE";
47
- /** Order, and use of the plan, is paused. The order, and use of the plan, can be resumed. */
48
- OrderStatus["PAUSED"] = "PAUSED";
49
- /** Order has completed its duration and is no longer available for use. */
50
- OrderStatus["ENDED"] = "ENDED";
51
- /** Order has been canceled. */
52
- OrderStatus["CANCELED"] = "CANCELED";
53
- })(OrderStatus || (OrderStatus = {}));
54
- export var CancellationCause;
55
- (function (CancellationCause) {
56
- /** Undefined cancellation cause. */
57
- CancellationCause["UNDEFINED"] = "UNDEFINED";
58
- /** Wix user canceled the order. */
59
- CancellationCause["OWNER_ACTION"] = "OWNER_ACTION";
60
- /** Buyer initiated the cancellation. */
61
- CancellationCause["MEMBER_ACTION"] = "MEMBER_ACTION";
62
- /** Payment transaction failed. */
63
- CancellationCause["PAYMENT_FAILURE"] = "PAYMENT_FAILURE";
64
- /** Buyer's payment details weren't set up correctly. */
65
- CancellationCause["PAYMENT_SETUP_FAILURE"] = "PAYMENT_SETUP_FAILURE";
66
- /** Reason for the cancellation is unknown. */
67
- CancellationCause["UNKNOWN"] = "UNKNOWN";
68
- })(CancellationCause || (CancellationCause = {}));
69
- export var CancellationEffectiveAt;
70
- (function (CancellationEffectiveAt) {
71
- /** Undefined cancellation time. */
72
- CancellationEffectiveAt["UNDEFINED"] = "UNDEFINED";
73
- /** Cancellation occurs immediately and the buyer can no longer use the plan. */
74
- CancellationEffectiveAt["IMMEDIATELY"] = "IMMEDIATELY";
75
- /** Cancellation occurs at the next payment date and time. Buyer can continue to use the plan until that date and time. */
76
- CancellationEffectiveAt["NEXT_PAYMENT_DATE"] = "NEXT_PAYMENT_DATE";
77
- })(CancellationEffectiveAt || (CancellationEffectiveAt = {}));
78
- export var PaymentStatus;
79
- (function (PaymentStatus) {
80
- /** Undefined payment status. */
81
- PaymentStatus["UNDEFINED"] = "UNDEFINED";
82
- /** Payment has been paid. */
83
- PaymentStatus["PAID"] = "PAID";
84
- /** Payment has been refunded. */
85
- PaymentStatus["REFUNDED"] = "REFUNDED";
86
- /** Payment transaction didn't complete. */
87
- PaymentStatus["FAILED"] = "FAILED";
88
- /** Payment has not been paid. */
89
- PaymentStatus["UNPAID"] = "UNPAID";
90
- /** Billing has been initialized, but actual charge is yet to be made. This can happen for free trials and payments made with PayPal. */
91
- PaymentStatus["PENDING"] = "PENDING";
92
- /** No payment was necessary. For example, for free plans or free trials. */
93
- PaymentStatus["NOT_APPLICABLE"] = "NOT_APPLICABLE";
94
- })(PaymentStatus || (PaymentStatus = {}));
95
- export var Status;
96
- (function (Status) {
97
- /** Undefined status. */
98
- Status["UNDEFINED"] = "UNDEFINED";
99
- /** Status while the order is paused. */
100
- Status["ACTIVE"] = "ACTIVE";
101
- /** Status when the order is resumed. */
102
- Status["ENDED"] = "ENDED";
103
- })(Status || (Status = {}));
104
- export var Set;
105
- (function (Set) {
106
- /** Same behavior as `BASIC`.` */
107
- Set["UNKNOWN_SET"] = "UNKNOWN_SET";
108
- /** Doesn't return any order form submission data. */
109
- Set["BASIC"] = "BASIC";
110
- /** Returns all order form submission data. */
111
- Set["FULL"] = "FULL";
112
- })(Set || (Set = {}));
113
- export var SortOrder;
114
- (function (SortOrder) {
115
- SortOrder["ASC"] = "ASC";
116
- SortOrder["DESC"] = "DESC";
117
- })(SortOrder || (SortOrder = {}));
118
- export var ReasonNotSuspendable;
119
- (function (ReasonNotSuspendable) {
120
- /** Undefined reason. */
121
- ReasonNotSuspendable["UNDEFINED"] = "UNDEFINED";
122
- /** Saved in the database but is awaiting payment. Non-active orders can't be suspended. */
123
- ReasonNotSuspendable["PENDING"] = "PENDING";
124
- /** Trial orders can't be suspended. */
125
- ReasonNotSuspendable["TRIAL"] = "TRIAL";
126
- /** Canceled orders can't be suspended. */
127
- ReasonNotSuspendable["CANCELED"] = "CANCELED";
128
- /** Ended orders can't be suspended. */
129
- ReasonNotSuspendable["ENDED"] = "ENDED";
130
- /** Paid for orders with future start dates can't be suspended. */
131
- ReasonNotSuspendable["NOT_STARTED"] = "NOT_STARTED";
132
- /** Order is already suspended. */
133
- ReasonNotSuspendable["ALREADY_SUSPENDED"] = "ALREADY_SUSPENDED";
134
- /** Orders based on recurring payments using older stripe versions can't be suspended. */
135
- ReasonNotSuspendable["OLD_STRIPE"] = "OLD_STRIPE";
136
- })(ReasonNotSuspendable || (ReasonNotSuspendable = {}));
137
- export var WebhookIdentityType;
138
- (function (WebhookIdentityType) {
139
- WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
140
- WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
141
- WebhookIdentityType["MEMBER"] = "MEMBER";
142
- WebhookIdentityType["WIX_USER"] = "WIX_USER";
143
- WebhookIdentityType["APP"] = "APP";
144
- })(WebhookIdentityType || (WebhookIdentityType = {}));
145
- /**
146
- * Retrieves an order by ID.
147
- * @param _id - Order ID.
148
- * @public
149
- * @requiredField _id
150
- * @param options - Options to use when getting an order.
151
- * @permissionId PRICING_PLANS.READ_ORDERS
152
- * @permissionScope Manage Orders
153
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
154
- * @permissionScope Read Orders
155
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
156
- * @permissionScope Manage plans and orders of Pricing Plans
157
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
158
- * @permissionScope Manage Events
159
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
160
- * @applicableIdentity APP
161
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.GetOrder
162
- */
163
- export async function managementGetOrder(_id, options) {
164
- // @ts-ignore
165
- const { httpClient, sideEffects } = arguments[2];
166
- const payload = renameKeysFromSDKRequestToRESTRequest({
167
- id: _id,
168
- fieldSet: options?.fieldSet,
169
- });
170
- const reqOpts = ambassadorWixPricingPlansV2Order.managementGetOrder(payload);
171
- sideEffects?.onSiteCall?.();
172
- try {
173
- const result = await httpClient.request(reqOpts);
174
- sideEffects?.onSuccess?.(result);
175
- return renameKeysFromRESTResponseToSDKResponse(result.data);
176
- }
177
- catch (err) {
178
- const transformedError = sdkTransformError(err, {
179
- spreadPathsToArguments: {},
180
- explicitPathsToArguments: { id: '$[0]', fieldSet: '$[1].fieldSet' },
181
- singleArgumentUnchanged: false,
182
- }, ['_id', 'options']);
183
- sideEffects?.onError?.(err);
184
- throw transformedError;
185
- }
186
- }
187
- /**
188
- * Retrieves a list of up to 50 pricing plan orders and details, given the specified sorting and filtering.
189
- *
190
- * By default, this endpoint will retrieve all orders and return them sorted by `createdDate` in `DESC`, descending order.
191
- * `sort.fieldName` supports `endDate` and `createdDate` fields and defaults to `ASC`, ascending order.
192
- * @public
193
- * @param options - Filtering, sorting, and pagination options.
194
- * @permissionId PRICING_PLANS.READ_ORDERS
195
- * @permissionScope Manage Orders
196
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
197
- * @permissionScope Read Orders
198
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
199
- * @permissionScope Manage plans and orders of Pricing Plans
200
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
201
- * @permissionScope Manage Events
202
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
203
- * @applicableIdentity APP
204
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.ListOrders
205
- */
206
- export async function managementListOrders(options) {
207
- // @ts-ignore
208
- const { httpClient, sideEffects } = arguments[1];
209
- const payload = renameKeysFromSDKRequestToRESTRequest({
210
- buyerIds: options?.buyerIds,
211
- planIds: options?.planIds,
212
- autoRenewCanceled: options?.autoRenewCanceled,
213
- orderStatuses: options?.orderStatuses,
214
- paymentStatuses: options?.paymentStatuses,
215
- limit: options?.limit,
216
- offset: options?.offset,
217
- sorting: options?.sorting,
218
- fieldSet: options?.fieldSet,
219
- });
220
- const reqOpts = ambassadorWixPricingPlansV2Order.managementListOrders(payload);
221
- sideEffects?.onSiteCall?.();
222
- try {
223
- const result = await httpClient.request(reqOpts);
224
- sideEffects?.onSuccess?.(result);
225
- return renameKeysFromRESTResponseToSDKResponse(result.data);
226
- }
227
- catch (err) {
228
- const transformedError = sdkTransformError(err, {
229
- spreadPathsToArguments: {},
230
- explicitPathsToArguments: {
231
- buyerIds: '$[0].buyerIds',
232
- planIds: '$[0].planIds',
233
- autoRenewCanceled: '$[0].autoRenewCanceled',
234
- orderStatuses: '$[0].orderStatuses',
235
- paymentStatuses: '$[0].paymentStatuses',
236
- limit: '$[0].limit',
237
- offset: '$[0].offset',
238
- sorting: '$[0].sorting',
239
- fieldSet: '$[0].fieldSet',
240
- },
241
- singleArgumentUnchanged: false,
242
- }, ['options']);
243
- sideEffects?.onError?.(err);
244
- throw transformedError;
245
- }
246
- }
247
- /**
248
- * Extends the duration of a pricing plan order by postponing the order's `endDate`. Postponing the end date of an order does not impact payments.
249
- *
250
- * New `endDate` must be later than the order's current `endDate`. Can't postpone orders that are unlimited.
251
- * Can't postpone an order with `status`: `PAUSED`.
252
- * @param _id - Order ID.
253
- * @param endDate - New end date and time.
254
- *
255
- * Must be later than the current end date and time.
256
- * @public
257
- * @requiredField _id
258
- * @requiredField endDate
259
- * @param options - Options for postponing the end date of an order.
260
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
261
- * @permissionScope Manage Orders
262
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
263
- * @permissionScope Manage plans and orders of Pricing Plans
264
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
265
- * @applicableIdentity APP
266
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.PostponeEndDate
267
- */
268
- export async function postponeEndDate(_id, endDate) {
269
- // @ts-ignore
270
- const { httpClient, sideEffects } = arguments[2];
271
- const payload = renameKeysFromSDKRequestToRESTRequest({
272
- id: _id,
273
- endDate: endDate,
274
- });
275
- const reqOpts = ambassadorWixPricingPlansV2Order.postponeEndDate(payload);
276
- sideEffects?.onSiteCall?.();
277
- try {
278
- const result = await httpClient.request(reqOpts);
279
- sideEffects?.onSuccess?.(result);
280
- }
281
- catch (err) {
282
- const transformedError = sdkTransformError(err, {
283
- spreadPathsToArguments: {},
284
- explicitPathsToArguments: { id: '$[0]', endDate: '$[1]' },
285
- singleArgumentUnchanged: false,
286
- }, ['_id', 'endDate']);
287
- sideEffects?.onError?.(err);
288
- throw transformedError;
289
- }
290
- }
291
- /**
292
- * Cancels an existing order.
293
- *
294
- * For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
295
- * For orders with one-time payments, a cancellation can only be set for `IMMEDIATELY`.
296
- *
297
- * #### Canceling during the free trial period.
298
- *
299
- * When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end
300
- * of the free trial period and they will not be billed. The buyer may continue using the benefits until the end
301
- * of the free trial period.
302
- *
303
- * When a Wix user cancels an ordered plan during the free trial period, they choose whether to apply the cancellation
304
- * `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`. Canceling `IMMEDIATELY` will end the subscription for the buyer
305
- * immediately, even during the free trial period and the buyer won't be billed. Canceling at the
306
- * `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period.
307
- * Then, the subscription ends and the buyer is not billed.
308
- * @param _id - Order ID.
309
- * @param effectiveAt - __Required.__ When the order will be canceled. One-time orders can only be canceled `IMMEDIATELY`.
310
- * @public
311
- * @requiredField _id
312
- * @requiredField effectiveAt
313
- * @param options - Options for canceling orders.
314
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
315
- * @permissionScope Manage Orders
316
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
317
- * @permissionScope Manage plans and orders of Pricing Plans
318
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
319
- * @applicableIdentity APP
320
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.CancelOrder
321
- */
322
- export async function cancelOrder(_id, effectiveAt) {
323
- // @ts-ignore
324
- const { httpClient, sideEffects } = arguments[2];
325
- const payload = renameKeysFromSDKRequestToRESTRequest({
326
- id: _id,
327
- effectiveAt: effectiveAt,
328
- });
329
- const reqOpts = ambassadorWixPricingPlansV2Order.cancelOrder(payload);
330
- sideEffects?.onSiteCall?.();
331
- try {
332
- const result = await httpClient.request(reqOpts);
333
- sideEffects?.onSuccess?.(result);
334
- }
335
- catch (err) {
336
- const transformedError = sdkTransformError(err, {
337
- spreadPathsToArguments: {},
338
- explicitPathsToArguments: { id: '$[0]', effectiveAt: '$[1]' },
339
- singleArgumentUnchanged: false,
340
- }, ['_id', 'effectiveAt']);
341
- sideEffects?.onError?.(err);
342
- throw transformedError;
343
- }
344
- }
345
- /**
346
- * Marks an offline order as paid.
347
- * > __Note__: Marking separate payment cycles as paid is not yet supported. The entire order will be marked as paid. Subsequent offline payments do trigger events and emails, but are not registered as additional offline payments.
348
- *
349
- * Marking an offline order as paid causes the following changes:
350
- * - The order's `lastPaymentStatus` changes to `"PAID"`.
351
- * - The order's status changes to either `"PENDING"` or `"ACTIVE"`, depending on the order's `startDate`.
352
- *
353
- * An error occurs if you attempt to:
354
- * - Mark an already-paid, offline order as paid. You cannot mark an offline order as paid twice.
355
- * - Mark an online order as paid. The Mark as Paid method is supported for offline orders only.
356
- * @param _id - Order ID.
357
- * @public
358
- * @requiredField _id
359
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
360
- * @permissionScope Manage Orders
361
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
362
- * @permissionScope Manage plans and orders of Pricing Plans
363
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
364
- * @applicableIdentity APP
365
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.MarkAsPaid
366
- */
367
- export async function markAsPaid(_id) {
368
- // @ts-ignore
369
- const { httpClient, sideEffects } = arguments[1];
370
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
371
- const reqOpts = ambassadorWixPricingPlansV2Order.markAsPaid(payload);
372
- sideEffects?.onSiteCall?.();
373
- try {
374
- const result = await httpClient.request(reqOpts);
375
- sideEffects?.onSuccess?.(result);
376
- }
377
- catch (err) {
378
- const transformedError = sdkTransformError(err, {
379
- spreadPathsToArguments: {},
380
- explicitPathsToArguments: { id: '$[0]' },
381
- singleArgumentUnchanged: false,
382
- }, ['_id']);
383
- sideEffects?.onError?.(err);
384
- throw transformedError;
385
- }
386
- }
387
- /**
388
- * Pauses an order. Calling this method changes the order status to `"PAUSED"` and updates the `pausePeriods` array.
389
- *
390
- * Only orders with `status`: `ACTIVE` can be paused.
391
- * For orders with recurring payments, it also pauses the payment schedule. Buyers are not charged when an order is paused.
392
- * Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`.
393
- * The `endDate` and the `earliestEndDate` for the order are adjusted to include the pause period when the order is resumed.
394
- *
395
- * To resume a paused order, call Resume Order.
396
- * @param _id - Order ID.
397
- * @public
398
- * @requiredField _id
399
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
400
- * @permissionScope Manage Orders
401
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
402
- * @permissionScope Manage plans and orders of Pricing Plans
403
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
404
- * @applicableIdentity APP
405
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.PauseOrder
406
- */
407
- export async function pauseOrder(_id) {
408
- // @ts-ignore
409
- const { httpClient, sideEffects } = arguments[1];
410
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
411
- const reqOpts = ambassadorWixPricingPlansV2Order.pauseOrder(payload);
412
- sideEffects?.onSiteCall?.();
413
- try {
414
- const result = await httpClient.request(reqOpts);
415
- sideEffects?.onSuccess?.(result);
416
- }
417
- catch (err) {
418
- const transformedError = sdkTransformError(err, {
419
- spreadPathsToArguments: {},
420
- explicitPathsToArguments: { id: '$[0]' },
421
- singleArgumentUnchanged: false,
422
- }, ['_id']);
423
- sideEffects?.onError?.(err);
424
- throw transformedError;
425
- }
426
- }
427
- /**
428
- * Resumes a paused order. For orders with recurring payments, it also restarts the payment schedule.
429
- *
430
- * Resuming an order causes the following changes:
431
- * - The order status changes to `"ACTIVE"`.
432
- * - The `pausePeriods` array is updated.
433
- * - The `endDate` for the order is adjusted to include the pause period.
434
- * - For orders with recurring payments, the payment schedule is restarted.
435
- * - The `earliestEndDate` is adjusted to include the pause period. (This property is reserved for future use).
436
- *
437
- * To pause an order, call Pause Order.
438
- * @param _id - Order ID.
439
- * @public
440
- * @requiredField _id
441
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
442
- * @permissionScope Manage Orders
443
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
444
- * @permissionScope Manage plans and orders of Pricing Plans
445
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
446
- * @applicableIdentity APP
447
- * @fqn com.wixpress.membership.v2.orders.OrderManagementService.ResumeOrder
448
- */
449
- export async function resumeOrder(_id) {
450
- // @ts-ignore
451
- const { httpClient, sideEffects } = arguments[1];
452
- const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
453
- const reqOpts = ambassadorWixPricingPlansV2Order.resumeOrder(payload);
454
- sideEffects?.onSiteCall?.();
455
- try {
456
- const result = await httpClient.request(reqOpts);
457
- sideEffects?.onSuccess?.(result);
458
- }
459
- catch (err) {
460
- const transformedError = sdkTransformError(err, {
461
- spreadPathsToArguments: {},
462
- explicitPathsToArguments: { id: '$[0]' },
463
- singleArgumentUnchanged: false,
464
- }, ['_id']);
465
- sideEffects?.onError?.(err);
466
- throw transformedError;
467
- }
468
- }
469
- /**
470
- * Retrieves an order for the currently logged-in member by ID.
471
- * @param _id - Order ID.
472
- * @public
473
- * @requiredField _id
474
- * @param options - Options for getting a logged-in member's order.
475
- * @permissionId PRICING_PLANS.READ_OWN_ORDERS
476
- * @permissionScope Manage Orders
477
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
478
- * @permissionScope Read Orders
479
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
480
- * @permissionScope Manage plans and orders of Pricing Plans
481
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
482
- * @applicableIdentity APP
483
- * @applicableIdentity MEMBER
484
- * @returns Requested order.
485
- * @fqn com.wixpress.membership.v2.orders.member.MemberOrdersService.GetOrder
486
- */
487
- export async function memberGetOrder(_id, options) {
488
- // @ts-ignore
489
- const { httpClient, sideEffects } = arguments[2];
490
- const payload = renameKeysFromSDKRequestToRESTRequest({
491
- id: _id,
492
- fieldSet: options?.fieldSet,
493
- });
494
- const reqOpts = ambassadorWixPricingPlansV2Order.memberGetOrder(payload);
495
- sideEffects?.onSiteCall?.();
496
- try {
497
- const result = await httpClient.request(reqOpts);
498
- sideEffects?.onSuccess?.(result);
499
- return renameKeysFromRESTResponseToSDKResponse(result.data)?.order;
500
- }
501
- catch (err) {
502
- const transformedError = sdkTransformError(err, {
503
- spreadPathsToArguments: {},
504
- explicitPathsToArguments: { id: '$[0]', fieldSet: '$[1].fieldSet' },
505
- singleArgumentUnchanged: false,
506
- }, ['_id', 'options']);
507
- sideEffects?.onError?.(err);
508
- throw transformedError;
509
- }
510
- }
511
- /**
512
- * Retrieves a list of up to 100 pricing plan orders for currently logged-in member.
513
- * @public
514
- * @param options - Filtering, sorting, and pagination options.
515
- * @permissionId PRICING_PLANS.READ_OWN_ORDERS
516
- * @permissionScope Manage Orders
517
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
518
- * @permissionScope Read Orders
519
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
520
- * @permissionScope Manage plans and orders of Pricing Plans
521
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
522
- * @applicableIdentity APP
523
- * @applicableIdentity MEMBER
524
- * @fqn com.wixpress.membership.v2.orders.member.MemberOrdersService.ListOrders
525
- */
526
- export async function memberListOrders(options) {
527
- // @ts-ignore
528
- const { httpClient, sideEffects } = arguments[1];
529
- const payload = renameKeysFromSDKRequestToRESTRequest({
530
- planIds: options?.planIds,
531
- autoRenewCanceled: options?.autoRenewCanceled,
532
- orderStatuses: options?.orderStatuses,
533
- paymentStatuses: options?.paymentStatuses,
534
- limit: options?.limit,
535
- offset: options?.offset,
536
- sorting: options?.sorting,
537
- fieldSet: options?.fieldSet,
538
- });
539
- const reqOpts = ambassadorWixPricingPlansV2Order.memberListOrders(payload);
540
- sideEffects?.onSiteCall?.();
541
- try {
542
- const result = await httpClient.request(reqOpts);
543
- sideEffects?.onSuccess?.(result);
544
- return renameKeysFromRESTResponseToSDKResponse(result.data);
545
- }
546
- catch (err) {
547
- const transformedError = sdkTransformError(err, {
548
- spreadPathsToArguments: {},
549
- explicitPathsToArguments: {
550
- planIds: '$[0].planIds',
551
- autoRenewCanceled: '$[0].autoRenewCanceled',
552
- orderStatuses: '$[0].orderStatuses',
553
- paymentStatuses: '$[0].paymentStatuses',
554
- limit: '$[0].limit',
555
- offset: '$[0].offset',
556
- sorting: '$[0].sorting',
557
- fieldSet: '$[0].fieldSet',
558
- },
559
- singleArgumentUnchanged: false,
560
- }, ['options']);
561
- sideEffects?.onError?.(err);
562
- throw transformedError;
563
- }
564
- }
565
- /**
566
- * Cancels an order. Recurring orders can be canceled either immediately or at the next payment date. One time orders can only be canceled immediately.
567
- *
568
- * There may be some operations that continue to be processed before the status of the order is changed to `"CANCELED"`. For example, payments might need to be refunded before the order is fully canceled.
569
- *
570
- * Canceling during the free trial period: When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end of the free trial period and they won't be billed. The buyer may continue using the benefits until the end of the free trial period.
571
- *
572
- * >**Note:**
573
- * >This method requires [visitor or member authentication](https://dev.wix.com/docs/rest/articles/getting-started/access-types-and-permissions).
574
- * @param _id - Order ID.
575
- * @param effectiveAt - Required. Whether to cancel the order effective immediately or at the next payment date. One-time orders can only be canceled immediately.
576
- * @public
577
- * @requiredField _id
578
- * @requiredField effectiveAt
579
- * @param options - Options for requesting a cancellation.
580
- * @permissionId PRICING_PLANS.MANAGE_OWN_ORDERS
581
- * @permissionScope Manage Orders
582
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
583
- * @permissionScope Manage plans and orders of Pricing Plans
584
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
585
- * @applicableIdentity APP
586
- * @applicableIdentity MEMBER
587
- * @fqn com.wixpress.membership.v2.orders.member.MemberOrdersService.RequestCancellation
588
- */
589
- export async function requestCancellation(_id, effectiveAt) {
590
- // @ts-ignore
591
- const { httpClient, sideEffects } = arguments[2];
592
- const payload = renameKeysFromSDKRequestToRESTRequest({
593
- id: _id,
594
- effectiveAt: effectiveAt,
595
- });
596
- const reqOpts = ambassadorWixPricingPlansV2Order.requestCancellation(payload);
597
- sideEffects?.onSiteCall?.();
598
- try {
599
- const result = await httpClient.request(reqOpts);
600
- sideEffects?.onSuccess?.(result);
601
- }
602
- catch (err) {
603
- const transformedError = sdkTransformError(err, {
604
- spreadPathsToArguments: {},
605
- explicitPathsToArguments: { id: '$[0]', effectiveAt: '$[1]' },
606
- singleArgumentUnchanged: false,
607
- }, ['_id', 'effectiveAt']);
608
- sideEffects?.onError?.(err);
609
- throw transformedError;
610
- }
611
- }
612
- /**
613
- * Creates an online order for a site member.
614
- *
615
- * If this method is called by a site member ([SDK](https://dev.wix.com/docs/sdk/articles/get-started/about-identities#site-member) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/about-identities#site-member)), the plan is automatically ordered on behalf of that site member. Otherwise, you must specify `onBehalf.memberId` in your call.
616
- *
617
- * When an online order is created, but payment hasn't been processed, its status is set to `DRAFT`. After the payment has been processed, if the start date is in the future the order's status is set to `PENDING`. Otherwise, it's set to `ACTIVE`.
618
- * @param planId - Plan ID.
619
- * @public
620
- * @requiredField options.onBehalf.memberId
621
- * @requiredField planId
622
- * @fqn com.wixpress.membership.v2.orders.CheckoutService.CreateOnlineOrder
623
- */
624
- export async function createOnlineOrder(planId, options) {
625
- // @ts-ignore
626
- const { httpClient, sideEffects } = arguments[2];
627
- const payload = renameKeysFromSDKRequestToRESTRequest({
628
- planId: planId,
629
- startDate: options?.startDate,
630
- couponCode: options?.couponCode,
631
- onBehalf: options?.onBehalf,
632
- submissionId: options?.submissionId,
633
- });
634
- const reqOpts = ambassadorWixPricingPlansV2Order.createOnlineOrder(payload);
635
- sideEffects?.onSiteCall?.();
636
- try {
637
- const result = await httpClient.request(reqOpts);
638
- sideEffects?.onSuccess?.(result);
639
- return renameKeysFromRESTResponseToSDKResponse(result.data);
640
- }
641
- catch (err) {
642
- const transformedError = sdkTransformError(err, {
643
- spreadPathsToArguments: {},
644
- explicitPathsToArguments: {
645
- planId: '$[0]',
646
- startDate: '$[1].startDate',
647
- couponCode: '$[1].couponCode',
648
- onBehalf: '$[1].onBehalf',
649
- submissionId: '$[1].submissionId',
650
- },
651
- singleArgumentUnchanged: false,
652
- }, ['planId', 'options']);
653
- sideEffects?.onError?.(err);
654
- throw transformedError;
655
- }
656
- }
657
- /**
658
- * Creates an order for a buyer who purchased the plan with an offline transaction.
659
- *
660
- * An offline order is handled off of the Wix site and is marked as `type`: `offline`. If a pricing plan
661
- * has a limit on the amount of purchases per buyer, that limit is ignored for offline orders.
662
- * Tax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
663
- *
664
- * When creating a free offline order:
665
- * The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
666
- * The order's last payment status is set to `"NOT_APPLICABLE"`. "
667
- *
668
- * When creating a non-free offline order:
669
- * The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
670
- * The order's last payment status is set to `"UNPAID"` or `"PAID"` based on the data passed in the `paid` boolean in the request.
671
- *
672
- * Payment for an offline order can be set in 1 of 2 ways:
673
- * + During order creation, set `paid`: `true`.
674
- * + After creation, call Mark As Paid.
675
- * @param planId - ID of the plan being ordered, from the Plans API.
676
- * @param memberId - ID of the member ordering the plan, from the Members API.
677
- * @public
678
- * @requiredField memberId
679
- * @requiredField planId
680
- * @param options - Options for creating an offline order.
681
- * @permissionId PRICING_PLANS.REGISTER_OFFLINE_ORDERS
682
- * @permissionScope Manage Orders
683
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
684
- * @permissionScope Manage plans and orders of Pricing Plans
685
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
686
- * @applicableIdentity APP
687
- * @fqn com.wixpress.membership.v2.orders.CheckoutService.CreateOfflineOrder
688
- */
689
- export async function createOfflineOrder(planId, memberId, options) {
690
- // @ts-ignore
691
- const { httpClient, sideEffects } = arguments[3];
692
- const payload = renameKeysFromSDKRequestToRESTRequest({
693
- planId: planId,
694
- memberId: memberId,
695
- startDate: options?.startDate,
696
- paid: options?.paid,
697
- couponCode: options?.couponCode,
698
- submissionId: options?.submissionId,
699
- });
700
- const reqOpts = ambassadorWixPricingPlansV2Order.createOfflineOrder(payload);
701
- sideEffects?.onSiteCall?.();
702
- try {
703
- const result = await httpClient.request(reqOpts);
704
- sideEffects?.onSuccess?.(result);
705
- return renameKeysFromRESTResponseToSDKResponse(result.data);
706
- }
707
- catch (err) {
708
- const transformedError = sdkTransformError(err, {
709
- spreadPathsToArguments: {},
710
- explicitPathsToArguments: {
711
- planId: '$[0]',
712
- memberId: '$[1]',
713
- startDate: '$[2].startDate',
714
- paid: '$[2].paid',
715
- couponCode: '$[2].couponCode',
716
- submissionId: '$[2].submissionId',
717
- },
718
- singleArgumentUnchanged: false,
719
- }, ['planId', 'memberId', 'options']);
720
- sideEffects?.onError?.(err);
721
- throw transformedError;
722
- }
723
- }
724
- /**
725
- * Returns an `order` object that represents a potential online order for a site member.
726
- *
727
- * You can use this method to show a site member a preview of an online order before [creating](https://dev.wix.com/docs/rest/business-solutions/pricing-plans/pricing-plans/orders/create-online-order) it.
728
- *
729
- * This method must be called using the site member identity ([SDK](https://dev.wix.com/docs/sdk/articles/get-started/about-identities#site-member) | [REST](https://dev.wix.com/docs/rest/articles/getting-started/about-identities#site-member)). Therefore, [Wix apps](https://dev.wix.com/docs/build-apps) can't currently call this method using REST.
730
- * @param planId - Plan ID.
731
- * @public
732
- * @requiredField planId
733
- * @permissionId PRICING_PLANS.PURCHASE_PLANS
734
- * @permissionScope Manage Stores
735
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
736
- * @permissionScope Manage Bookings Services and Settings
737
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
738
- * @permissionScope Manage Events
739
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
740
- * @permissionScope Manage Challenges
741
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
742
- * @permissionScope Manage Portfolio
743
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
744
- * @permissionScope Manage Blog
745
- * @permissionScopeId SCOPE.BLOG.MANAGE-BLOG
746
- * @permissionScope Access Verticals by Automations
747
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
748
- * @permissionScope Manage Restaurants - all permissions
749
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
750
- * @permissionScope Set Up Automations
751
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
752
- * @applicableIdentity APP
753
- * @applicableIdentity MEMBER
754
- * @fqn com.wixpress.membership.v2.orders.CheckoutService.GetOnlineOrderPreview
755
- */
756
- export async function getOnlineOrderPreview(planId, options) {
757
- // @ts-ignore
758
- const { httpClient, sideEffects } = arguments[2];
759
- const payload = renameKeysFromSDKRequestToRESTRequest({
760
- planId: planId,
761
- startDate: options?.startDate,
762
- couponCode: options?.couponCode,
763
- });
764
- const reqOpts = ambassadorWixPricingPlansV2Order.getOnlineOrderPreview(payload);
765
- sideEffects?.onSiteCall?.();
766
- try {
767
- const result = await httpClient.request(reqOpts);
768
- sideEffects?.onSuccess?.(result);
769
- return renameKeysFromRESTResponseToSDKResponse(result.data);
770
- }
771
- catch (err) {
772
- const transformedError = sdkTransformError(err, {
773
- spreadPathsToArguments: {},
774
- explicitPathsToArguments: {
775
- planId: '$[0]',
776
- startDate: '$[1].startDate',
777
- couponCode: '$[1].couponCode',
778
- },
779
- singleArgumentUnchanged: false,
780
- }, ['planId', 'options']);
781
- sideEffects?.onError?.(err);
782
- throw transformedError;
783
- }
784
- }
785
- /**
786
- * Performs a dry run of a purchase and provides an order preview.
787
- *
788
- * The preview uses the same logic as purchasing a plan, but the preview is not saved. Because an order is not actually
789
- * created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters
790
- * (`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
791
- * <br>
792
- * If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview.
793
- * But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then
794
- * `purchaseLimitExceeded` will return as `true`.
795
- *
796
- * To get a general price preview for a plan that's not buyer-specific, call Get Price Preview.
797
- * @param memberId - Member ID of the buyer the previewed order is for, from the Members API.
798
- * @public
799
- * @requiredField memberId
800
- * @requiredField planId
801
- * @param options - Options for previewing the offline order.
802
- * @param planId - ID of the plan of the previewed order.
803
- * @permissionId PRICING_PLANS.MANAGE_ORDERS
804
- * @permissionScope Manage Orders
805
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
806
- * @permissionScope Manage plans and orders of Pricing Plans
807
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
808
- * @applicableIdentity APP
809
- * @fqn com.wixpress.membership.v2.orders.CheckoutService.GetOfflineOrderPreview
810
- */
811
- export async function getOfflineOrderPreview(planId, memberId, options) {
812
- // @ts-ignore
813
- const { httpClient, sideEffects } = arguments[3];
814
- const payload = renameKeysFromSDKRequestToRESTRequest({
815
- planId: planId,
816
- memberId: memberId,
817
- startDate: options?.startDate,
818
- couponCode: options?.couponCode,
819
- });
820
- const reqOpts = ambassadorWixPricingPlansV2Order.getOfflineOrderPreview(payload);
821
- sideEffects?.onSiteCall?.();
822
- try {
823
- const result = await httpClient.request(reqOpts);
824
- sideEffects?.onSuccess?.(result);
825
- return renameKeysFromRESTResponseToSDKResponse(result.data);
826
- }
827
- catch (err) {
828
- const transformedError = sdkTransformError(err, {
829
- spreadPathsToArguments: {},
830
- explicitPathsToArguments: {
831
- planId: '$[0]',
832
- memberId: '$[1]',
833
- startDate: '$[2].startDate',
834
- couponCode: '$[2].couponCode',
835
- },
836
- singleArgumentUnchanged: false,
837
- }, ['planId', 'memberId', 'options']);
838
- sideEffects?.onError?.(err);
839
- throw transformedError;
840
- }
841
- }
842
- /**
843
- * Retrieves a plan's pricing.
844
- *
845
- * The price preview uses the same logic as purchasing a plan, but the preview is not saved. Tax is only applied if
846
- * the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection). The price is returned
847
- * in the pricing model format used for orders. Learn more about pricing models ([REST](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models)|[SDK](https://dev.wix.com/docs/sdk/backend-modules/pricing-plans/introduction#pricing-models)).
848
- *
849
- * Buyers do not have to be logged in to preview the price, and as such, the details returned are not buyer-specific. To
850
- * generate a preview of a purchase for a specific buyer, call Get Offline Order Preview.
851
- * @param planId - ID of plan to preview.
852
- * @public
853
- * @requiredField planId
854
- * @param options - Options for getting a price preview.
855
- * @permissionId PRICING_PLANS.READ_PUBLIC_PLANS
856
- * @permissionScope Read Pricing Plans
857
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-PLANS
858
- * @permissionScope Manage Stores
859
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
860
- * @permissionScope Manage Orders
861
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
862
- * @permissionScope Manage Bookings Services and Settings
863
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
864
- * @permissionScope Read Orders
865
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
866
- * @permissionScope Manage plans and orders of Pricing Plans
867
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS-AND-ORDERS
868
- * @permissionScope Manage Events
869
- * @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
870
- * @permissionScope Manage Challenges
871
- * @permissionScopeId SCOPE.CHALLENGES.MANAGE
872
- * @permissionScope Manage Portfolio
873
- * @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
874
- * @permissionScope Manage Blog
875
- * @permissionScopeId SCOPE.BLOG.MANAGE-BLOG
876
- * @permissionScope Access Verticals by Automations
877
- * @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
878
- * @permissionScope Manage Pricing Plans
879
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
880
- * @permissionScope Manage Restaurants - all permissions
881
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
882
- * @permissionScope Set Up Automations
883
- * @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
884
- * @applicableIdentity APP
885
- * @applicableIdentity VISITOR
886
- * @fqn com.wixpress.membership.v2.orders.CheckoutService.GetPricePreview
887
- */
888
- export async function getPricePreview(planId, options) {
889
- // @ts-ignore
890
- const { httpClient, sideEffects } = arguments[2];
891
- const payload = renameKeysFromSDKRequestToRESTRequest({
892
- planId: planId,
893
- couponCode: options?.couponCode,
894
- });
895
- const reqOpts = ambassadorWixPricingPlansV2Order.getPricePreview(payload);
896
- sideEffects?.onSiteCall?.();
897
- try {
898
- const result = await httpClient.request(reqOpts);
899
- sideEffects?.onSuccess?.(result);
900
- return renameKeysFromRESTResponseToSDKResponse(result.data);
901
- }
902
- catch (err) {
903
- const transformedError = sdkTransformError(err, {
904
- spreadPathsToArguments: {},
905
- explicitPathsToArguments: {
906
- planId: '$[0]',
907
- couponCode: '$[1].couponCode',
908
- },
909
- singleArgumentUnchanged: false,
910
- }, ['planId', 'options']);
911
- sideEffects?.onError?.(err);
912
- throw transformedError;
913
- }
914
- }
915
- //# sourceMappingURL=pricing-plans-v2-order-orders.universal.js.map