@wix/pricing-plans 1.0.54 → 1.0.56

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 (97) hide show
  1. package/build/cjs/context.d.ts +2 -2
  2. package/build/cjs/context.js +2 -2
  3. package/build/cjs/context.js.map +1 -1
  4. package/build/cjs/index.d.ts +2 -2
  5. package/build/cjs/index.js +2 -2
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/meta.d.ts +2 -2
  8. package/build/cjs/meta.js +2 -2
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/context.d.ts +2 -2
  11. package/build/es/context.js +2 -2
  12. package/build/es/context.js.map +1 -1
  13. package/build/es/index.d.ts +2 -2
  14. package/build/es/index.js +2 -2
  15. package/build/es/index.js.map +1 -1
  16. package/build/es/meta.d.ts +2 -2
  17. package/build/es/meta.js +2 -2
  18. package/build/es/meta.js.map +1 -1
  19. package/package.json +12 -9
  20. package/build/cjs/index.typings.d.ts +0 -2
  21. package/build/cjs/index.typings.js +0 -29
  22. package/build/cjs/index.typings.js.map +0 -1
  23. package/build/cjs/src/pricing-plans-v2-order.context.d.ts +0 -15
  24. package/build/cjs/src/pricing-plans-v2-order.context.js +0 -148
  25. package/build/cjs/src/pricing-plans-v2-order.context.js.map +0 -1
  26. package/build/cjs/src/pricing-plans-v2-order.http.d.ts +0 -165
  27. package/build/cjs/src/pricing-plans-v2-order.http.js +0 -818
  28. package/build/cjs/src/pricing-plans-v2-order.http.js.map +0 -1
  29. package/build/cjs/src/pricing-plans-v2-order.meta.d.ts +0 -41
  30. package/build/cjs/src/pricing-plans-v2-order.meta.js +0 -275
  31. package/build/cjs/src/pricing-plans-v2-order.meta.js.map +0 -1
  32. package/build/cjs/src/pricing-plans-v2-order.public.d.ts +0 -104
  33. package/build/cjs/src/pricing-plans-v2-order.public.js +0 -110
  34. package/build/cjs/src/pricing-plans-v2-order.public.js.map +0 -1
  35. package/build/cjs/src/pricing-plans-v2-order.types.d.ts +0 -1801
  36. package/build/cjs/src/pricing-plans-v2-order.types.js +0 -135
  37. package/build/cjs/src/pricing-plans-v2-order.types.js.map +0 -1
  38. package/build/cjs/src/pricing-plans-v2-order.universal.d.ts +0 -2225
  39. package/build/cjs/src/pricing-plans-v2-order.universal.js +0 -1151
  40. package/build/cjs/src/pricing-plans-v2-order.universal.js.map +0 -1
  41. package/build/cjs/src/pricing-plans-v2-plan.context.d.ts +0 -14
  42. package/build/cjs/src/pricing-plans-v2-plan.context.js +0 -137
  43. package/build/cjs/src/pricing-plans-v2-plan.context.js.map +0 -1
  44. package/build/cjs/src/pricing-plans-v2-plan.http.d.ts +0 -134
  45. package/build/cjs/src/pricing-plans-v2-plan.http.js +0 -544
  46. package/build/cjs/src/pricing-plans-v2-plan.http.js.map +0 -1
  47. package/build/cjs/src/pricing-plans-v2-plan.meta.d.ts +0 -34
  48. package/build/cjs/src/pricing-plans-v2-plan.meta.js +0 -256
  49. package/build/cjs/src/pricing-plans-v2-plan.meta.js.map +0 -1
  50. package/build/cjs/src/pricing-plans-v2-plan.public.d.ts +0 -86
  51. package/build/cjs/src/pricing-plans-v2-plan.public.js +0 -89
  52. package/build/cjs/src/pricing-plans-v2-plan.public.js.map +0 -1
  53. package/build/cjs/src/pricing-plans-v2-plan.types.d.ts +0 -732
  54. package/build/cjs/src/pricing-plans-v2-plan.types.js +0 -41
  55. package/build/cjs/src/pricing-plans-v2-plan.types.js.map +0 -1
  56. package/build/cjs/src/pricing-plans-v2-plan.universal.d.ts +0 -1176
  57. package/build/cjs/src/pricing-plans-v2-plan.universal.js +0 -913
  58. package/build/cjs/src/pricing-plans-v2-plan.universal.js.map +0 -1
  59. package/build/es/index.typings.d.ts +0 -2
  60. package/build/es/index.typings.js +0 -3
  61. package/build/es/index.typings.js.map +0 -1
  62. package/build/es/src/pricing-plans-v2-order.context.d.ts +0 -15
  63. package/build/es/src/pricing-plans-v2-order.context.js +0 -132
  64. package/build/es/src/pricing-plans-v2-order.context.js.map +0 -1
  65. package/build/es/src/pricing-plans-v2-order.http.d.ts +0 -165
  66. package/build/es/src/pricing-plans-v2-order.http.js +0 -802
  67. package/build/es/src/pricing-plans-v2-order.http.js.map +0 -1
  68. package/build/es/src/pricing-plans-v2-order.meta.d.ts +0 -41
  69. package/build/es/src/pricing-plans-v2-order.meta.js +0 -236
  70. package/build/es/src/pricing-plans-v2-order.meta.js.map +0 -1
  71. package/build/es/src/pricing-plans-v2-order.public.d.ts +0 -104
  72. package/build/es/src/pricing-plans-v2-order.public.js +0 -70
  73. package/build/es/src/pricing-plans-v2-order.public.js.map +0 -1
  74. package/build/es/src/pricing-plans-v2-order.types.d.ts +0 -1801
  75. package/build/es/src/pricing-plans-v2-order.types.js +0 -132
  76. package/build/es/src/pricing-plans-v2-order.types.js.map +0 -1
  77. package/build/es/src/pricing-plans-v2-order.universal.d.ts +0 -2225
  78. package/build/es/src/pricing-plans-v2-order.universal.js +0 -1112
  79. package/build/es/src/pricing-plans-v2-order.universal.js.map +0 -1
  80. package/build/es/src/pricing-plans-v2-plan.context.d.ts +0 -14
  81. package/build/es/src/pricing-plans-v2-plan.context.js +0 -122
  82. package/build/es/src/pricing-plans-v2-plan.context.js.map +0 -1
  83. package/build/es/src/pricing-plans-v2-plan.http.d.ts +0 -134
  84. package/build/es/src/pricing-plans-v2-plan.http.js +0 -529
  85. package/build/es/src/pricing-plans-v2-plan.http.js.map +0 -1
  86. package/build/es/src/pricing-plans-v2-plan.meta.d.ts +0 -34
  87. package/build/es/src/pricing-plans-v2-plan.meta.js +0 -218
  88. package/build/es/src/pricing-plans-v2-plan.meta.js.map +0 -1
  89. package/build/es/src/pricing-plans-v2-plan.public.d.ts +0 -86
  90. package/build/es/src/pricing-plans-v2-plan.public.js +0 -65
  91. package/build/es/src/pricing-plans-v2-plan.public.js.map +0 -1
  92. package/build/es/src/pricing-plans-v2-plan.types.d.ts +0 -732
  93. package/build/es/src/pricing-plans-v2-plan.types.js +0 -38
  94. package/build/es/src/pricing-plans-v2-plan.types.js.map +0 -1
  95. package/build/es/src/pricing-plans-v2-plan.universal.d.ts +0 -1176
  96. package/build/es/src/pricing-plans-v2-plan.universal.js +0 -875
  97. package/build/es/src/pricing-plans-v2-plan.universal.js.map +0 -1
@@ -1,1151 +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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.resumeOrder = exports.pauseOrder = exports.markAsPaid = exports.cancelOrder = exports.postponeEndDate = exports.managementListOrders = exports.managementGetOrder = exports.getPricePreview = exports.getOfflineOrderPreview = exports.createOfflineOrder = exports.requestCancellation = exports.memberListOrders = exports.memberGetOrder = exports.onOrderResumed = exports.onOrderPaused = exports.onOrderMarkedAsPaid = exports.onOrderEndDatePostponed = exports.onOrderEnded = exports.onOrderAutoRenewCanceled = exports.onOrderCycleStarted = exports.onOrderStarted = exports.onOrderPurchased = exports.onOrderStartDateChanged = exports.onOrderUpdated = exports.onOrderCreated = exports.onOrderCanceled = exports.ReasonNotSuspendable = exports.SortOrder = exports.Set = exports.Status = exports.PaymentStatus = exports.CancellationEffectiveAt = exports.CancellationCause = exports.OrderStatus = exports.OrderMethod = exports.OrderType = exports.PeriodUnit = void 0;
36
- const velo_1 = require("@wix/metro-runtime/velo");
37
- const transform_error_1 = require("@wix/sdk-runtime/transform-error");
38
- const sdk_types_1 = require("@wix/sdk-types");
39
- const ambassadorWixPricingPlansV2Order = __importStar(require("./pricing-plans-v2-order.http"));
40
- // @ts-ignore
41
- const _toVeloEntity = '$';
42
- const _fromVeloEntity = '$';
43
- var PeriodUnit;
44
- (function (PeriodUnit) {
45
- PeriodUnit["UNDEFINED"] = "UNDEFINED";
46
- PeriodUnit["DAY"] = "DAY";
47
- PeriodUnit["WEEK"] = "WEEK";
48
- PeriodUnit["MONTH"] = "MONTH";
49
- PeriodUnit["YEAR"] = "YEAR";
50
- })(PeriodUnit || (exports.PeriodUnit = PeriodUnit = {}));
51
- var OrderType;
52
- (function (OrderType) {
53
- OrderType["UNDEFINED"] = "UNDEFINED";
54
- /** Payments made by the buyer */
55
- OrderType["ONLINE"] = "ONLINE";
56
- /** Payments managed manually by the site owner */
57
- OrderType["OFFLINE"] = "OFFLINE";
58
- /** Payments managed externally */
59
- OrderType["EXTERNAL"] = "EXTERNAL";
60
- })(OrderType || (exports.OrderType = OrderType = {}));
61
- var OrderMethod;
62
- (function (OrderMethod) {
63
- OrderMethod["UNKNOWN"] = "UNKNOWN";
64
- /** Mail Order / Telephone Order transaction */
65
- OrderMethod["MOTO"] = "MOTO";
66
- /** Point of Sale transaction */
67
- OrderMethod["POS"] = "POS";
68
- })(OrderMethod || (exports.OrderMethod = OrderMethod = {}));
69
- var OrderStatus;
70
- (function (OrderStatus) {
71
- /** Order status undefined */
72
- OrderStatus["UNDEFINED"] = "UNDEFINED";
73
- /** Order created, but hasn't been paid for yet. Filtered out in ListOrders response by default. */
74
- OrderStatus["DRAFT"] = "DRAFT";
75
- /** Order has been paid for, but the start date is in the future */
76
- OrderStatus["PENDING"] = "PENDING";
77
- /** Order is active */
78
- OrderStatus["ACTIVE"] = "ACTIVE";
79
- /** Order is paused until site owner resumes it */
80
- OrderStatus["PAUSED"] = "PAUSED";
81
- /** Order has ended */
82
- OrderStatus["ENDED"] = "ENDED";
83
- /** Order has been canceled */
84
- OrderStatus["CANCELED"] = "CANCELED";
85
- })(OrderStatus || (exports.OrderStatus = OrderStatus = {}));
86
- var CancellationCause;
87
- (function (CancellationCause) {
88
- /** Cancellation initiator undefined */
89
- CancellationCause["UNDEFINED"] = "UNDEFINED";
90
- /** Order was canceled by site owner (default if canceled by user or service identity) */
91
- CancellationCause["OWNER_ACTION"] = "OWNER_ACTION";
92
- /** Order was canceled by member (default if canceled by member identity) */
93
- CancellationCause["MEMBER_ACTION"] = "MEMBER_ACTION";
94
- /** Order was canceled because of payment failure */
95
- CancellationCause["PAYMENT_FAILURE"] = "PAYMENT_FAILURE";
96
- /** Order was canceled because of payment setup failure */
97
- CancellationCause["PAYMENT_SETUP_FAILURE"] = "PAYMENT_SETUP_FAILURE";
98
- /** Order was cancelled because of an unknown reason. It's not possible to know with certain payment providers (e.g. paypal) */
99
- CancellationCause["UNKNOWN"] = "UNKNOWN";
100
- })(CancellationCause || (exports.CancellationCause = CancellationCause = {}));
101
- var CancellationEffectiveAt;
102
- (function (CancellationEffectiveAt) {
103
- /** Cancellation time undefined */
104
- CancellationEffectiveAt["UNDEFINED"] = "UNDEFINED";
105
- /** Will cancel the order now, i.e. update validUntil to the current date */
106
- CancellationEffectiveAt["IMMEDIATELY"] = "IMMEDIATELY";
107
- /** Will cancel the order at the date when next payment should have been made */
108
- CancellationEffectiveAt["NEXT_PAYMENT_DATE"] = "NEXT_PAYMENT_DATE";
109
- })(CancellationEffectiveAt || (exports.CancellationEffectiveAt = CancellationEffectiveAt = {}));
110
- var PaymentStatus;
111
- (function (PaymentStatus) {
112
- /** Payment status undefined */
113
- PaymentStatus["UNDEFINED"] = "UNDEFINED";
114
- /** Payment has been paid */
115
- PaymentStatus["PAID"] = "PAID";
116
- /** Payment has been refunded */
117
- PaymentStatus["REFUNDED"] = "REFUNDED";
118
- /** Recurring payment has failed */
119
- PaymentStatus["FAILED"] = "FAILED";
120
- /** Payment has not been paid */
121
- PaymentStatus["UNPAID"] = "UNPAID";
122
- /** Billing has been initialized, but actual charge is yet to be made. Can happen for free trial and PayPal */
123
- PaymentStatus["PENDING"] = "PENDING";
124
- /** Used in cases where the plan is free */
125
- PaymentStatus["NOT_APPLICABLE"] = "NOT_APPLICABLE";
126
- })(PaymentStatus || (exports.PaymentStatus = PaymentStatus = {}));
127
- var Status;
128
- (function (Status) {
129
- Status["UNDEFINED"] = "UNDEFINED";
130
- /** Order suspension is active */
131
- Status["ACTIVE"] = "ACTIVE";
132
- /** Order suspension has ended */
133
- Status["ENDED"] = "ENDED";
134
- })(Status || (exports.Status = Status = {}));
135
- var Set;
136
- (function (Set) {
137
- /** Same behavior as BASIC */
138
- Set["UNKNOWN_SET"] = "UNKNOWN_SET";
139
- /**
140
- * Returns fields of the entity that are available in the database.
141
- * By default a field is available in the database unless explicitly specified in the documentation
142
- */
143
- Set["BASIC"] = "BASIC";
144
- /**
145
- * Returns all fields in the entity.
146
- * This might make additional calls to gather the full entity
147
- */
148
- Set["FULL"] = "FULL";
149
- })(Set || (exports.Set = Set = {}));
150
- var SortOrder;
151
- (function (SortOrder) {
152
- SortOrder["ASC"] = "ASC";
153
- SortOrder["DESC"] = "DESC";
154
- })(SortOrder || (exports.SortOrder = SortOrder = {}));
155
- var ReasonNotSuspendable;
156
- (function (ReasonNotSuspendable) {
157
- /** Reason unknown */
158
- ReasonNotSuspendable["UNDEFINED"] = "UNDEFINED";
159
- /** Saved in the database but is awaiting payment. Non-active orders cannot be suspended */
160
- ReasonNotSuspendable["PENDING"] = "PENDING";
161
- /** Trial orders cannot be suspended */
162
- ReasonNotSuspendable["TRIAL"] = "TRIAL";
163
- /** Canceled orders cannot be suspended */
164
- ReasonNotSuspendable["CANCELED"] = "CANCELED";
165
- /** Ended orders cannot be suspended */
166
- ReasonNotSuspendable["ENDED"] = "ENDED";
167
- /** Paid for orders with future start dates cannot be suspended */
168
- ReasonNotSuspendable["NOT_STARTED"] = "NOT_STARTED";
169
- /** Order is already suspended */
170
- ReasonNotSuspendable["ALREADY_SUSPENDED"] = "ALREADY_SUSPENDED";
171
- /** Orders based on recurring payments using older Stripe versions cannot be suspended */
172
- ReasonNotSuspendable["OLD_STRIPE"] = "OLD_STRIPE";
173
- })(ReasonNotSuspendable || (exports.ReasonNotSuspendable = ReasonNotSuspendable = {}));
174
- const _cancelOrderRequest = {};
175
- const _cancelOrderResponse = {};
176
- const _createOfflineOrderRequest = {};
177
- const _createOfflineOrderResponse = {};
178
- const _getOfflineOrderPreviewRequest = {};
179
- const _getOfflineOrderPreviewResponse = {};
180
- const _getOrderRequest = {};
181
- const _getOrderResponse = {};
182
- const _getPricePreviewRequest = {};
183
- const _getPricePreviewResponse = {};
184
- const _listOrdersRequest = {};
185
- const _listOrdersResponse = {};
186
- const _markAsPaidRequest = {};
187
- const _markAsPaidResponse = {};
188
- const _memberGetOrderRequest = {};
189
- const _memberGetOrderResponse = {};
190
- const _memberListOrdersRequest = {};
191
- const _memberListOrdersResponse = {};
192
- const _pauseOrderRequest = {};
193
- const _pauseOrderResponse = {};
194
- const _postponeEndDateRequest = {};
195
- const _postponeEndDateResponse = {};
196
- const _requestCancellationRequest = {};
197
- const _requestCancellationResponse = {};
198
- const _resumeOrderRequest = {};
199
- const _resumeOrderResponse = {};
200
- exports.onOrderCanceled = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_canceled')();
201
- exports.onOrderCreated = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_created')();
202
- exports.onOrderUpdated = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_updated')();
203
- exports.onOrderStartDateChanged = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_start_date_changed')();
204
- exports.onOrderPurchased = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_purchased')();
205
- exports.onOrderStarted = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_started')();
206
- exports.onOrderCycleStarted = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_cycle_started')();
207
- exports.onOrderAutoRenewCanceled = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_auto_renew_canceled')();
208
- exports.onOrderEnded = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_ended')();
209
- exports.onOrderEndDatePostponed = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_end_date_postponed')();
210
- exports.onOrderMarkedAsPaid = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_marked_as_paid')();
211
- exports.onOrderPaused = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_paused')();
212
- exports.onOrderResumed = (0, sdk_types_1.EventDefinition)('wix.pricing_plans.v2.order_resumed')();
213
- /**
214
- * Gets an order by ID for the currently logged-in member.
215
- *
216
- * The `memberGetOrder()` function returns a Promise that resolves to information about a specified order for the currently logged-in member.
217
- * @param _id - Order ID.
218
- * @public
219
- * @requiredField _id
220
- * @param options - Options for getting a logged-in member's order.
221
- * @applicableIdentity MEMBER
222
- * @returns Requested order.
223
- */
224
- function memberGetOrder(_id, options) {
225
- var _a, _b, _c;
226
- return __awaiter(this, arguments, void 0, function* () {
227
- const requestTransformation = { id: '$[0]', fieldSet: '$[1].fieldSet' };
228
- const responseTransformation = '$.order';
229
- // @ts-ignore
230
- const { httpClient, sideEffects } = arguments[2];
231
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
232
- rootSchema: _memberGetOrderRequest,
233
- depSchemas: {},
234
- fqdnTransformation: {
235
- paths: [],
236
- transformation: _fromVeloEntity,
237
- },
238
- customTransformation: requestTransformation,
239
- });
240
- const { fromJSON } = (0, velo_1.serializer)({
241
- rootSchema: _memberGetOrderResponse,
242
- depSchemas: {},
243
- fqdnTransformation: {
244
- paths: [...['order']],
245
- transformation: _toVeloEntity,
246
- },
247
- customTransformation: responseTransformation,
248
- });
249
- const payload = toAmbassadorRequest([_id, options]);
250
- const reqOpts = ambassadorWixPricingPlansV2Order.memberGetOrder(payload);
251
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
252
- try {
253
- const result = yield httpClient.request(reqOpts);
254
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
255
- return fromJSON(result.data);
256
- }
257
- catch (err) {
258
- const transformedError = (0, transform_error_1.transformError)(err, {
259
- spreadPathsToArguments: {},
260
- explicitPathsToArguments: { id: '$[0]', fieldSet: '$[1].fieldSet' },
261
- singleArgumentUnchanged: false,
262
- }, ['_id', 'options']);
263
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
264
- throw transformedError;
265
- }
266
- });
267
- }
268
- exports.memberGetOrder = memberGetOrder;
269
- /**
270
- * Lists orders for the currently logged-in member.
271
- *
272
- * The `memberListOrders()` function returns a Promise that resolves to a list of up to 100 pricing plan orders.
273
- * @public
274
- * @documentationMaturity preview
275
- * @param options - Filtering, sorting, and pagination options.
276
- * @applicableIdentity MEMBER
277
- */
278
- function memberListOrders(options) {
279
- var _a, _b, _c;
280
- return __awaiter(this, arguments, void 0, function* () {
281
- const requestTransformation = {
282
- planIds: '$[0].planIds',
283
- autoRenewCanceled: '$[0].autoRenewCanceled',
284
- orderStatuses: '$[0].orderStatuses',
285
- paymentStatuses: '$[0].paymentStatuses',
286
- limit: '$[0].limit',
287
- offset: '$[0].offset',
288
- sorting: '$[0].sorting',
289
- fieldSet: '$[0].fieldSet',
290
- };
291
- const responseTransformation = '$';
292
- // @ts-ignore
293
- const { httpClient, sideEffects } = arguments[1];
294
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
295
- rootSchema: _memberListOrdersRequest,
296
- depSchemas: {},
297
- fqdnTransformation: {
298
- paths: [],
299
- transformation: _fromVeloEntity,
300
- },
301
- customTransformation: requestTransformation,
302
- });
303
- const { fromJSON } = (0, velo_1.serializer)({
304
- rootSchema: _memberListOrdersResponse,
305
- depSchemas: {},
306
- fqdnTransformation: {
307
- paths: [...['Array#orders']],
308
- transformation: _toVeloEntity,
309
- },
310
- customTransformation: responseTransformation,
311
- });
312
- const payload = toAmbassadorRequest([options]);
313
- const reqOpts = ambassadorWixPricingPlansV2Order.memberListOrders(payload);
314
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
315
- try {
316
- const result = yield httpClient.request(reqOpts);
317
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
318
- return fromJSON(result.data);
319
- }
320
- catch (err) {
321
- const transformedError = (0, transform_error_1.transformError)(err, {
322
- spreadPathsToArguments: {},
323
- explicitPathsToArguments: {
324
- planIds: '$[0].planIds',
325
- autoRenewCanceled: '$[0].autoRenewCanceled',
326
- orderStatuses: '$[0].orderStatuses',
327
- paymentStatuses: '$[0].paymentStatuses',
328
- limit: '$[0].limit',
329
- offset: '$[0].offset',
330
- sorting: '$[0].sorting',
331
- fieldSet: '$[0].fieldSet',
332
- },
333
- singleArgumentUnchanged: false,
334
- }, ['options']);
335
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
336
- throw transformedError;
337
- }
338
- });
339
- }
340
- exports.memberListOrders = memberListOrders;
341
- /**
342
- * Starts the process of canceling an order.
343
- *
344
- *
345
- * The `requestCancellation()` function returns a Promise that resolves when the order cancellation is successfully requested.
346
- *
347
- * For orders with recurring payments, a cancellation can be set to occur either immediately or at the next payment date. For orders with one-time payments, a cancellation occurs immediately after the request is processed.
348
- *
349
- * Requesting an order cancellation starts the cancellation process. 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.
350
- *
351
- * #### Canceling during the free trial period.
352
- *
353
- * 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.
354
- *
355
- * @param _id - Order ID.
356
- * @param effectiveAt - Whether to cancel the order immediately or at the next payment date.
357
- * One-time payment orders can only be canceled immediately.
358
- *
359
- * Supported values:
360
- * - `"IMMEDIATELY"`: Indicates that the order should be canceled immediately.
361
- * - `"NEXT_PAYMENT_DATE"`: Indicates that the order be canceled at the next payment date.
362
- * @public
363
- * @documentationMaturity preview
364
- * @requiredField _id
365
- * @requiredField effectiveAt
366
- * @param options - Options for requesting a cancellation.
367
- * @applicableIdentity MEMBER
368
- * @returns Fulfilled - When the cancellation process is started.
369
- */
370
- function requestCancellation(_id, effectiveAt) {
371
- var _a, _b, _c;
372
- return __awaiter(this, arguments, void 0, function* () {
373
- const requestTransformation = { id: '$[0]', effectiveAt: '$[1]' };
374
- const responseTransformation = '$';
375
- // @ts-ignore
376
- const { httpClient, sideEffects } = arguments[2];
377
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
378
- rootSchema: _requestCancellationRequest,
379
- depSchemas: {},
380
- fqdnTransformation: {
381
- paths: [],
382
- transformation: _fromVeloEntity,
383
- },
384
- customTransformation: requestTransformation,
385
- });
386
- const { fromJSON } = (0, velo_1.serializer)({
387
- rootSchema: _requestCancellationResponse,
388
- depSchemas: {},
389
- fqdnTransformation: {
390
- paths: [],
391
- transformation: _toVeloEntity,
392
- },
393
- customTransformation: responseTransformation,
394
- });
395
- const payload = toAmbassadorRequest([_id, effectiveAt]);
396
- const reqOpts = ambassadorWixPricingPlansV2Order.requestCancellation(payload);
397
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
398
- try {
399
- const result = yield httpClient.request(reqOpts);
400
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
401
- }
402
- catch (err) {
403
- const transformedError = (0, transform_error_1.transformError)(err, {
404
- spreadPathsToArguments: {},
405
- explicitPathsToArguments: { id: '$[0]', effectiveAt: '$[1]' },
406
- singleArgumentUnchanged: false,
407
- }, ['_id', 'effectiveAt']);
408
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
409
- throw transformedError;
410
- }
411
- });
412
- }
413
- exports.requestCancellation = requestCancellation;
414
- /**
415
- * Creates an order for a buyer who purchased the plan with an offline transaction.
416
- *
417
- * The `createOfflineOrder()` function returns a Promise that resolves to an `order` object when the order has been created.
418
- *
419
- * Payment of an offline order is handled in 1 of 2 ways.
420
- * - When creating the order, select `true` in the `paid` request parameter.
421
- * - After creation, with the [`markAsPaid()`](#markaspaid) function.
422
- *
423
- * When creating a non-free offline order:
424
- * - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
425
- * The order's last payment status is set to `"UNPAID"` or `"PAID"`.
426
- *
427
- * When creating a free offline order:
428
- * - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
429
- * - The order's last payment status is set to `"NOT_APPLICABLE"`.
430
- * @param memberId - ID of the member ordering the plan.
431
- * @public
432
- * @documentationMaturity preview
433
- * @requiredField memberId
434
- * @requiredField planId
435
- * @param options - Options for creating an offline order.
436
- * @param planId - ID of the plan being ordered. See [Plans for more information about plan IDs](plans)
437
- * @permissionScope Manage Orders
438
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
439
- * @applicableIdentity APP
440
- * @returns Fulfilled - The order of the plan.
441
- */
442
- function createOfflineOrder(planId, memberId, options) {
443
- var _a, _b, _c;
444
- return __awaiter(this, arguments, void 0, function* () {
445
- const requestTransformation = {
446
- planId: '$[0]',
447
- memberId: '$[1]',
448
- startDate: '$[2].startDate',
449
- paid: '$[2].paid',
450
- couponCode: '$[2].couponCode',
451
- submissionId: '$[2].submissionId',
452
- };
453
- const responseTransformation = '$';
454
- // @ts-ignore
455
- const { httpClient, sideEffects } = arguments[3];
456
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
457
- rootSchema: _createOfflineOrderRequest,
458
- depSchemas: {},
459
- fqdnTransformation: {
460
- paths: [],
461
- transformation: _fromVeloEntity,
462
- },
463
- customTransformation: requestTransformation,
464
- });
465
- const { fromJSON } = (0, velo_1.serializer)({
466
- rootSchema: _createOfflineOrderResponse,
467
- depSchemas: {},
468
- fqdnTransformation: {
469
- paths: [...['order']],
470
- transformation: _toVeloEntity,
471
- },
472
- customTransformation: responseTransformation,
473
- });
474
- const payload = toAmbassadorRequest([planId, memberId, options]);
475
- const reqOpts = ambassadorWixPricingPlansV2Order.createOfflineOrder(payload);
476
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
477
- try {
478
- const result = yield httpClient.request(reqOpts);
479
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
480
- return fromJSON(result.data);
481
- }
482
- catch (err) {
483
- const transformedError = (0, transform_error_1.transformError)(err, {
484
- spreadPathsToArguments: {},
485
- explicitPathsToArguments: {
486
- planId: '$[0]',
487
- memberId: '$[1]',
488
- startDate: '$[2].startDate',
489
- paid: '$[2].paid',
490
- couponCode: '$[2].couponCode',
491
- submissionId: '$[2].submissionId',
492
- },
493
- singleArgumentUnchanged: false,
494
- }, ['planId', 'memberId', 'options']);
495
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
496
- throw transformedError;
497
- }
498
- });
499
- }
500
- exports.createOfflineOrder = createOfflineOrder;
501
- /**
502
- * Provides a preview of an offline order as if it was purchased.
503
- *
504
- * The `getOfflineOrderPreview()` function returns a Promise that resolves to a temporary preview of the offline order.
505
- *
506
- * The preview uses the same logic as purchasing a plan, but the preview is not saved. Because an order is not actually created, the preview's `_id` and `subscriptionId` properties are displayed as a string of multiple zero characters (`000000-0000`).
507
- *
508
- * If [taxes are configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection) for the site, taxes are applied to the preview. If not, `tax` previews as `null`.
509
- *
510
- * You can preview the order to check purchase limitations, but the limitations are not enforced for the preview. If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview. But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then `purchaseLimitExceeded` will return as `true`. Thus function is not available to the buyer. You specify the member ID for the buyer whose order should be previewed. To get a general price preview for a plan that's not buyer-specific, use the [`getPricePreview()`](#getpricepreview) function.
511
- * @param memberId - Member ID of the buyer the previewed order is for.
512
- * @public
513
- * @documentationMaturity preview
514
- * @requiredField memberId
515
- * @requiredField planId
516
- * @param options - Options for previewing the offline order.
517
- * @param planId - ID of the plan of the previewed order.
518
- * @permissionScope Manage Orders
519
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
520
- * @applicableIdentity APP
521
- * @returns Fulfilled - A preview of the order.
522
- */
523
- function getOfflineOrderPreview(planId, memberId, options) {
524
- var _a, _b, _c;
525
- return __awaiter(this, arguments, void 0, function* () {
526
- const requestTransformation = {
527
- planId: '$[0]',
528
- memberId: '$[1]',
529
- startDate: '$[2].startDate',
530
- couponCode: '$[2].couponCode',
531
- };
532
- const responseTransformation = '$';
533
- // @ts-ignore
534
- const { httpClient, sideEffects } = arguments[3];
535
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
536
- rootSchema: _getOfflineOrderPreviewRequest,
537
- depSchemas: {},
538
- fqdnTransformation: {
539
- paths: [],
540
- transformation: _fromVeloEntity,
541
- },
542
- customTransformation: requestTransformation,
543
- });
544
- const { fromJSON } = (0, velo_1.serializer)({
545
- rootSchema: _getOfflineOrderPreviewResponse,
546
- depSchemas: {},
547
- fqdnTransformation: {
548
- paths: [...['order']],
549
- transformation: _toVeloEntity,
550
- },
551
- customTransformation: responseTransformation,
552
- });
553
- const payload = toAmbassadorRequest([planId, memberId, options]);
554
- const reqOpts = ambassadorWixPricingPlansV2Order.getOfflineOrderPreview(payload);
555
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
556
- try {
557
- const result = yield httpClient.request(reqOpts);
558
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
559
- return fromJSON(result.data);
560
- }
561
- catch (err) {
562
- const transformedError = (0, transform_error_1.transformError)(err, {
563
- spreadPathsToArguments: {},
564
- explicitPathsToArguments: {
565
- planId: '$[0]',
566
- memberId: '$[1]',
567
- startDate: '$[2].startDate',
568
- couponCode: '$[2].couponCode',
569
- },
570
- singleArgumentUnchanged: false,
571
- }, ['planId', 'memberId', 'options']);
572
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
573
- throw transformedError;
574
- }
575
- });
576
- }
577
- exports.getOfflineOrderPreview = getOfflineOrderPreview;
578
- /**
579
- * Retrieves a preview of an order's pricing as if it was purchased.
580
- *
581
- * The `getPricePreview()` function returns a Promise that resolves to a temporary preview of the order's price.
582
- *
583
- * The price preview uses the same logic for calculating prices as used when purchasing a plan, but the preview is not saved. If [taxes are configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection) for the site, taxes are applied to the preview. If not, the `tax` previews as `null`.
584
- *
585
- * Buyers do not have to be logged in to preview the price, as such, the details returned by this function are not buyer-specific. To generate a preview of a purchase for a specific-buyer, use the [`getOfflineOrderPreview()`](#getofflineorderpreview).
586
- * @param planId - ID of plan to preview.
587
- * @public
588
- * @documentationMaturity preview
589
- * @requiredField planId
590
- * @param options - Options for getting a price preview.
591
- * @permissionScope Read Pricing Plans
592
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-PLANS
593
- * @permissionScope Manage Orders
594
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
595
- * @permissionScope Manage Bookings Services and Settings
596
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
597
- * @permissionScope Read Orders
598
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
599
- * @permissionScope Manage Pricing Plans
600
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-PLANS
601
- * @applicableIdentity APP
602
- * @applicableIdentity MEMBER
603
- * @applicableIdentity VISITOR
604
- * @returns Fulfilled - A preview of the pricing for the order.
605
- */
606
- function getPricePreview(planId, options) {
607
- var _a, _b, _c;
608
- return __awaiter(this, arguments, void 0, function* () {
609
- const requestTransformation = {
610
- planId: '$[0]',
611
- couponCode: '$[1].couponCode',
612
- };
613
- const responseTransformation = '$';
614
- // @ts-ignore
615
- const { httpClient, sideEffects } = arguments[2];
616
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
617
- rootSchema: _getPricePreviewRequest,
618
- depSchemas: {},
619
- fqdnTransformation: {
620
- paths: [],
621
- transformation: _fromVeloEntity,
622
- },
623
- customTransformation: requestTransformation,
624
- });
625
- const { fromJSON } = (0, velo_1.serializer)({
626
- rootSchema: _getPricePreviewResponse,
627
- depSchemas: {},
628
- fqdnTransformation: {
629
- paths: [],
630
- transformation: _toVeloEntity,
631
- },
632
- customTransformation: responseTransformation,
633
- });
634
- const payload = toAmbassadorRequest([planId, options]);
635
- const reqOpts = ambassadorWixPricingPlansV2Order.getPricePreview(payload);
636
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
637
- try {
638
- const result = yield httpClient.request(reqOpts);
639
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
640
- return fromJSON(result.data);
641
- }
642
- catch (err) {
643
- const transformedError = (0, transform_error_1.transformError)(err, {
644
- spreadPathsToArguments: {},
645
- explicitPathsToArguments: {
646
- planId: '$[0]',
647
- couponCode: '$[1].couponCode',
648
- },
649
- singleArgumentUnchanged: false,
650
- }, ['planId', 'options']);
651
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
652
- throw transformedError;
653
- }
654
- });
655
- }
656
- exports.getPricePreview = getPricePreview;
657
- /**
658
- * Retrieves an order by ID.
659
- *
660
- * The `managementGetOrder()` function returns a Promise that resolves to information about the specified order.
661
- * @param _id - Order ID.
662
- * @public
663
- * @documentationMaturity preview
664
- * @requiredField _id
665
- * @param options - Options to use when getting an order.
666
- * @permissionScope Manage Orders
667
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
668
- * @permissionScope Manage Bookings Services and Settings
669
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
670
- * @permissionScope Read Orders
671
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
672
- * @applicableIdentity APP
673
- */
674
- function managementGetOrder(_id, options) {
675
- var _a, _b, _c;
676
- return __awaiter(this, arguments, void 0, function* () {
677
- const requestTransformation = { id: '$[0]', fieldSet: '$[1].fieldSet' };
678
- const responseTransformation = '$';
679
- // @ts-ignore
680
- const { httpClient, sideEffects } = arguments[2];
681
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
682
- rootSchema: _getOrderRequest,
683
- depSchemas: {},
684
- fqdnTransformation: {
685
- paths: [],
686
- transformation: _fromVeloEntity,
687
- },
688
- customTransformation: requestTransformation,
689
- });
690
- const { fromJSON } = (0, velo_1.serializer)({
691
- rootSchema: _getOrderResponse,
692
- depSchemas: {},
693
- fqdnTransformation: {
694
- paths: [...['order']],
695
- transformation: _toVeloEntity,
696
- },
697
- customTransformation: responseTransformation,
698
- });
699
- const payload = toAmbassadorRequest([_id, options]);
700
- const reqOpts = ambassadorWixPricingPlansV2Order.managementGetOrder(payload);
701
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
702
- try {
703
- const result = yield httpClient.request(reqOpts);
704
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
705
- return fromJSON(result.data);
706
- }
707
- catch (err) {
708
- const transformedError = (0, transform_error_1.transformError)(err, {
709
- spreadPathsToArguments: {},
710
- explicitPathsToArguments: { id: '$[0]', fieldSet: '$[1].fieldSet' },
711
- singleArgumentUnchanged: false,
712
- }, ['_id', 'options']);
713
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
714
- throw transformedError;
715
- }
716
- });
717
- }
718
- exports.managementGetOrder = managementGetOrder;
719
- /**
720
- * Lists pricing plan orders.
721
- *
722
- * The `managementListOrders()` function returns a Promise that resolves to a list of up to 50 pricing plan orders. You can specify options for filtering, sorting, and paginating the results.
723
- *
724
- * This function returns the orders on the site. To list orders for the currently logged-in member, use [`memberListOrders()`](#memberlistorders).
725
- * @public
726
- * @documentationMaturity preview
727
- * @param options - Filtering, sorting, and pagination options.
728
- * @permissionScope Manage Orders
729
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
730
- * @permissionScope Manage Bookings Services and Settings
731
- * @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
732
- * @permissionScope Read Orders
733
- * @permissionScopeId SCOPE.DC-PAIDPLANS.READ-ORDERS
734
- * @applicableIdentity APP
735
- */
736
- function managementListOrders(options) {
737
- var _a, _b, _c;
738
- return __awaiter(this, arguments, void 0, function* () {
739
- const requestTransformation = {
740
- buyerIds: '$[0].buyerIds',
741
- planIds: '$[0].planIds',
742
- autoRenewCanceled: '$[0].autoRenewCanceled',
743
- orderStatuses: '$[0].orderStatuses',
744
- paymentStatuses: '$[0].paymentStatuses',
745
- limit: '$[0].limit',
746
- offset: '$[0].offset',
747
- sorting: '$[0].sorting',
748
- fieldSet: '$[0].fieldSet',
749
- };
750
- const responseTransformation = '$';
751
- // @ts-ignore
752
- const { httpClient, sideEffects } = arguments[1];
753
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
754
- rootSchema: _listOrdersRequest,
755
- depSchemas: {},
756
- fqdnTransformation: {
757
- paths: [],
758
- transformation: _fromVeloEntity,
759
- },
760
- customTransformation: requestTransformation,
761
- });
762
- const { fromJSON } = (0, velo_1.serializer)({
763
- rootSchema: _listOrdersResponse,
764
- depSchemas: {},
765
- fqdnTransformation: {
766
- paths: [...['Array#orders']],
767
- transformation: _toVeloEntity,
768
- },
769
- customTransformation: responseTransformation,
770
- });
771
- const payload = toAmbassadorRequest([options]);
772
- const reqOpts = ambassadorWixPricingPlansV2Order.managementListOrders(payload);
773
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
774
- try {
775
- const result = yield httpClient.request(reqOpts);
776
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
777
- return fromJSON(result.data);
778
- }
779
- catch (err) {
780
- const transformedError = (0, transform_error_1.transformError)(err, {
781
- spreadPathsToArguments: {},
782
- explicitPathsToArguments: {
783
- buyerIds: '$[0].buyerIds',
784
- planIds: '$[0].planIds',
785
- autoRenewCanceled: '$[0].autoRenewCanceled',
786
- orderStatuses: '$[0].orderStatuses',
787
- paymentStatuses: '$[0].paymentStatuses',
788
- limit: '$[0].limit',
789
- offset: '$[0].offset',
790
- sorting: '$[0].sorting',
791
- fieldSet: '$[0].fieldSet',
792
- },
793
- singleArgumentUnchanged: false,
794
- }, ['options']);
795
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
796
- throw transformedError;
797
- }
798
- });
799
- }
800
- exports.managementListOrders = managementListOrders;
801
- /**
802
- * Extends the duration of a pricing plan order by postponing the order's `endDate`.
803
- *
804
- * The `postponeEndDate()` function returns a Promise that resolves when the order's end date is successfully changed.
805
- *
806
- * The new end date and time must be later than the order's current `endDate`.
807
- *
808
- * Postponing the end date of an order does not impact payments. For example, if the pricing plan is for a membership to an online lecture series, and you want to extend the duration of the series because the lecturer could not attend some sessions, you can postpone the end date of the orders for all relevant participants. The participants will not be billed additionally.
809
- *
810
- * Postponing an order causes the following changes:
811
- * - The `endDate` for the order is adjusted to the new end date.
812
- * @param _id - Order ID.
813
- * @param endDate - New end date and time.
814
- *
815
- * Must be later than the current end date and time.
816
- * @public
817
- * @documentationMaturity preview
818
- * @requiredField _id
819
- * @requiredField endDate
820
- * @param options - Options for postponing the end date of an order.
821
- * @permissionScope Manage Orders
822
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
823
- * @applicableIdentity APP
824
- * @returns Fulfilled - When the order's end date has been postponed or made earlier.
825
- *
826
- *
827
- */
828
- function postponeEndDate(_id, endDate) {
829
- var _a, _b, _c;
830
- return __awaiter(this, arguments, void 0, function* () {
831
- const requestTransformation = { id: '$[0]', endDate: '$[1]' };
832
- const responseTransformation = '$';
833
- // @ts-ignore
834
- const { httpClient, sideEffects } = arguments[2];
835
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
836
- rootSchema: _postponeEndDateRequest,
837
- depSchemas: {},
838
- fqdnTransformation: {
839
- paths: [],
840
- transformation: _fromVeloEntity,
841
- },
842
- customTransformation: requestTransformation,
843
- });
844
- const { fromJSON } = (0, velo_1.serializer)({
845
- rootSchema: _postponeEndDateResponse,
846
- depSchemas: {},
847
- fqdnTransformation: {
848
- paths: [],
849
- transformation: _toVeloEntity,
850
- },
851
- customTransformation: responseTransformation,
852
- });
853
- const payload = toAmbassadorRequest([_id, endDate]);
854
- const reqOpts = ambassadorWixPricingPlansV2Order.postponeEndDate(payload);
855
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
856
- try {
857
- const result = yield httpClient.request(reqOpts);
858
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
859
- }
860
- catch (err) {
861
- const transformedError = (0, transform_error_1.transformError)(err, {
862
- spreadPathsToArguments: {},
863
- explicitPathsToArguments: { id: '$[0]', endDate: '$[1]' },
864
- singleArgumentUnchanged: false,
865
- }, ['_id', 'endDate']);
866
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
867
- throw transformedError;
868
- }
869
- });
870
- }
871
- exports.postponeEndDate = postponeEndDate;
872
- /**
873
- * Cancels an existing order.
874
- *
875
- * The `cancelOrder()` function returns a Promise that resolves when the order is successfully canceled.
876
- *
877
- * For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
878
- * For orders with one-time payments, a cancellation occurs `IMMEDIATELY`.
879
- *
880
- * Canceling an order changes the order status to `CANCELED`.
881
- *
882
- * #### Canceling during the free trial period.
883
- *
884
- * When a site owner cancels an ordered plan during the free trial period, they choose to apply the cancellation `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
885
- *
886
- * Canceling `IMMEDIATELY` will end the subscription for the buyer
887
- * immediately, even during the free trial period and the buyer won't be billed.
888
- *
889
- * Canceling at the `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period. Then, the subscription ends and the buyer is not billed.
890
- * @param _id - Order ID.
891
- * @param effectiveAt - When the order is canceled.
892
- *
893
- * One time orders can only be canceled immediately. Supported values:
894
- * - `"IMMEDIATELY"`: The order is canceled immediately.
895
- * - `"NEXT_PAYMENT_DATE"`: The order is canceled at the next payment date.
896
- * @public
897
- * @documentationMaturity preview
898
- * @requiredField _id
899
- * @requiredField effectiveAt
900
- * @param options - Options for canceling orders.
901
- * @permissionScope Manage Orders
902
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
903
- * @applicableIdentity APP
904
- * @returns Fulfilled - When the order is canceled.
905
- */
906
- function cancelOrder(_id, effectiveAt) {
907
- var _a, _b, _c;
908
- return __awaiter(this, arguments, void 0, function* () {
909
- const requestTransformation = { id: '$[0]', effectiveAt: '$[1]' };
910
- const responseTransformation = '$';
911
- // @ts-ignore
912
- const { httpClient, sideEffects } = arguments[2];
913
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
914
- rootSchema: _cancelOrderRequest,
915
- depSchemas: {},
916
- fqdnTransformation: {
917
- paths: [],
918
- transformation: _fromVeloEntity,
919
- },
920
- customTransformation: requestTransformation,
921
- });
922
- const { fromJSON } = (0, velo_1.serializer)({
923
- rootSchema: _cancelOrderResponse,
924
- depSchemas: {},
925
- fqdnTransformation: {
926
- paths: [],
927
- transformation: _toVeloEntity,
928
- },
929
- customTransformation: responseTransformation,
930
- });
931
- const payload = toAmbassadorRequest([_id, effectiveAt]);
932
- const reqOpts = ambassadorWixPricingPlansV2Order.cancelOrder(payload);
933
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
934
- try {
935
- const result = yield httpClient.request(reqOpts);
936
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
937
- }
938
- catch (err) {
939
- const transformedError = (0, transform_error_1.transformError)(err, {
940
- spreadPathsToArguments: {},
941
- explicitPathsToArguments: { id: '$[0]', effectiveAt: '$[1]' },
942
- singleArgumentUnchanged: false,
943
- }, ['_id', 'effectiveAt']);
944
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
945
- throw transformedError;
946
- }
947
- });
948
- }
949
- exports.cancelOrder = cancelOrder;
950
- /**
951
- * Marks an offline order as paid.
952
- *
953
- * The `markAsPaid()` function returns a Promise that resolves when the offline order is successfully marked as paid.
954
- *
955
- * The entire order is marked as paid, even if the order's payments are recurring.
956
- *
957
- * >**Note:** Marking separate payment cycles as paid is not yet supported. Subsequent offline payments do trigger events and emails, but are not registered as additional offline payments.
958
- *
959
- * Marking an offline order as paid causes the following changes:
960
- * - The order's `lastPaymentStatus` changes to `"PAID"`.
961
- * - The order's status changes to either `"PENDING"` or `"ACTIVE"`, depending on the order's `startDate`.
962
- *
963
- * An error occurs if you attempt to:
964
- * - Mark an already-paid, offline order as paid. You cannot make an offline order as paid twice.
965
- * - Mark an online order as paid. The `markAsPaid()` function is supported for offline orders only.
966
- * @param _id - Order ID.
967
- * @public
968
- * @documentationMaturity preview
969
- * @requiredField _id
970
- * @permissionScope Manage Orders
971
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
972
- * @applicableIdentity APP
973
- * @returns Fulfilled - When the order is marked as paid.
974
- */
975
- function markAsPaid(_id) {
976
- var _a, _b, _c;
977
- return __awaiter(this, arguments, void 0, function* () {
978
- const requestTransformation = { id: '$[0]' };
979
- const responseTransformation = '$';
980
- // @ts-ignore
981
- const { httpClient, sideEffects } = arguments[1];
982
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
983
- rootSchema: _markAsPaidRequest,
984
- depSchemas: {},
985
- fqdnTransformation: {
986
- paths: [],
987
- transformation: _fromVeloEntity,
988
- },
989
- customTransformation: requestTransformation,
990
- });
991
- const { fromJSON } = (0, velo_1.serializer)({
992
- rootSchema: _markAsPaidResponse,
993
- depSchemas: {},
994
- fqdnTransformation: {
995
- paths: [],
996
- transformation: _toVeloEntity,
997
- },
998
- customTransformation: responseTransformation,
999
- });
1000
- const payload = toAmbassadorRequest([_id]);
1001
- const reqOpts = ambassadorWixPricingPlansV2Order.markAsPaid(payload);
1002
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1003
- try {
1004
- const result = yield httpClient.request(reqOpts);
1005
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1006
- }
1007
- catch (err) {
1008
- const transformedError = (0, transform_error_1.transformError)(err, {
1009
- spreadPathsToArguments: {},
1010
- explicitPathsToArguments: { id: '$[0]' },
1011
- singleArgumentUnchanged: false,
1012
- }, ['_id']);
1013
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1014
- throw transformedError;
1015
- }
1016
- });
1017
- }
1018
- exports.markAsPaid = markAsPaid;
1019
- /**
1020
- * Pauses a pricing plan order.
1021
- *
1022
- * The `pauseOrder()` function returns a Promise that resolves when the order is successfully paused.
1023
- *
1024
- * For orders with recurring payments, `pauseOrder()` also pauses the payment schedule. Buyers are not charged when an order is paused. Use `pauseOrder()`, for example, if the buyer is away and would like to put their pricing plan membership on hold until they return. Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`. You can only pause orders with an `"ACTIVE`" status.
1025
- *
1026
- * Pausing an order causes the following changes:
1027
- * - The order status changes to `"PAUSED"`.
1028
- * - The `pausePeriods` array is updated.
1029
- *
1030
- * The `endDate` and the `earliestEndDate` for the order are adjusted to include the pause period when the order is resumed.
1031
- *
1032
- * Paused orders can be continued with the [`resumeOrder()`](#resumeorder) function.
1033
- * @param _id - Order ID.
1034
- * @public
1035
- * @documentationMaturity preview
1036
- * @requiredField _id
1037
- * @permissionScope Manage Orders
1038
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
1039
- * @applicableIdentity APP
1040
- * @returns Fulfilled - When the order is paused.
1041
- */
1042
- function pauseOrder(_id) {
1043
- var _a, _b, _c;
1044
- return __awaiter(this, arguments, void 0, function* () {
1045
- const requestTransformation = { id: '$[0]' };
1046
- const responseTransformation = '$';
1047
- // @ts-ignore
1048
- const { httpClient, sideEffects } = arguments[1];
1049
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
1050
- rootSchema: _pauseOrderRequest,
1051
- depSchemas: {},
1052
- fqdnTransformation: {
1053
- paths: [],
1054
- transformation: _fromVeloEntity,
1055
- },
1056
- customTransformation: requestTransformation,
1057
- });
1058
- const { fromJSON } = (0, velo_1.serializer)({
1059
- rootSchema: _pauseOrderResponse,
1060
- depSchemas: {},
1061
- fqdnTransformation: {
1062
- paths: [],
1063
- transformation: _toVeloEntity,
1064
- },
1065
- customTransformation: responseTransformation,
1066
- });
1067
- const payload = toAmbassadorRequest([_id]);
1068
- const reqOpts = ambassadorWixPricingPlansV2Order.pauseOrder(payload);
1069
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1070
- try {
1071
- const result = yield httpClient.request(reqOpts);
1072
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1073
- }
1074
- catch (err) {
1075
- const transformedError = (0, transform_error_1.transformError)(err, {
1076
- spreadPathsToArguments: {},
1077
- explicitPathsToArguments: { id: '$[0]' },
1078
- singleArgumentUnchanged: false,
1079
- }, ['_id']);
1080
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1081
- throw transformedError;
1082
- }
1083
- });
1084
- }
1085
- exports.pauseOrder = pauseOrder;
1086
- /**
1087
- * Resumes a paused pricing plan order.
1088
- *
1089
- * The `resumeOrder()` function returns a Promise that resolves when a paused order is successfully resumed.
1090
- *
1091
- * For orders with recurring payments, `resumeOrder()` also restarts the payment schedule.
1092
- *
1093
- * Resuming an order causes the following changes:
1094
- * - The order status changes to `"ACTIVE"`.
1095
- * - The `pausePeriods` array is updated.
1096
- * - The `endDate` for the order is adjusted to include the pause period.
1097
- * - The `earliestEndDate` is adjusted to include the pause period. (This property is reserved for future use).
1098
- * @param _id - Order ID.
1099
- * @public
1100
- * @documentationMaturity preview
1101
- * @requiredField _id
1102
- * @permissionScope Manage Orders
1103
- * @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
1104
- * @applicableIdentity APP
1105
- * @returns Fulfilled - When the order is resumed.
1106
- */
1107
- function resumeOrder(_id) {
1108
- var _a, _b, _c;
1109
- return __awaiter(this, arguments, void 0, function* () {
1110
- const requestTransformation = { id: '$[0]' };
1111
- const responseTransformation = '$';
1112
- // @ts-ignore
1113
- const { httpClient, sideEffects } = arguments[1];
1114
- const { toAmbassadorRequest } = (0, velo_1.serializer)({
1115
- rootSchema: _resumeOrderRequest,
1116
- depSchemas: {},
1117
- fqdnTransformation: {
1118
- paths: [],
1119
- transformation: _fromVeloEntity,
1120
- },
1121
- customTransformation: requestTransformation,
1122
- });
1123
- const { fromJSON } = (0, velo_1.serializer)({
1124
- rootSchema: _resumeOrderResponse,
1125
- depSchemas: {},
1126
- fqdnTransformation: {
1127
- paths: [],
1128
- transformation: _toVeloEntity,
1129
- },
1130
- customTransformation: responseTransformation,
1131
- });
1132
- const payload = toAmbassadorRequest([_id]);
1133
- const reqOpts = ambassadorWixPricingPlansV2Order.resumeOrder(payload);
1134
- (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
1135
- try {
1136
- const result = yield httpClient.request(reqOpts);
1137
- (_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
1138
- }
1139
- catch (err) {
1140
- const transformedError = (0, transform_error_1.transformError)(err, {
1141
- spreadPathsToArguments: {},
1142
- explicitPathsToArguments: { id: '$[0]' },
1143
- singleArgumentUnchanged: false,
1144
- }, ['_id']);
1145
- (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
1146
- throw transformedError;
1147
- }
1148
- });
1149
- }
1150
- exports.resumeOrder = resumeOrder;
1151
- //# sourceMappingURL=pricing-plans-v2-order.universal.js.map