@wix/auto_sdk_pricing-plans_orders 1.0.57 → 1.0.59

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