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