@wix/pricing-plans 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/src/pricing-plans-v2-order.http.d.ts +140 -49
- package/build/cjs/src/pricing-plans-v2-order.http.js +140 -49
- package/build/cjs/src/pricing-plans-v2-order.http.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-order.universal.d.ts +282 -102
- package/build/cjs/src/pricing-plans-v2-order.universal.js +154 -48
- package/build/cjs/src/pricing-plans-v2-order.universal.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-plan.http.d.ts +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.http.js +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.http.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-plan.universal.d.ts +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.universal.js +2 -8
- package/build/cjs/src/pricing-plans-v2-plan.universal.js.map +1 -1
- package/build/es/src/pricing-plans-v2-order.http.d.ts +140 -49
- package/build/es/src/pricing-plans-v2-order.http.js +140 -49
- package/build/es/src/pricing-plans-v2-order.http.js.map +1 -1
- package/build/es/src/pricing-plans-v2-order.universal.d.ts +282 -102
- package/build/es/src/pricing-plans-v2-order.universal.js +154 -48
- package/build/es/src/pricing-plans-v2-order.universal.js.map +1 -1
- package/build/es/src/pricing-plans-v2-plan.http.d.ts +2 -8
- package/build/es/src/pricing-plans-v2-plan.http.js +2 -8
- package/build/es/src/pricing-plans-v2-plan.http.js.map +1 -1
- package/build/es/src/pricing-plans-v2-plan.universal.d.ts +2 -8
- package/build/es/src/pricing-plans-v2-plan.universal.js +2 -8
- package/build/es/src/pricing-plans-v2-plan.universal.js.map +1 -1
- package/package.json +4 -4
@@ -1,105 +1,196 @@
|
|
1
1
|
import { RequestOptionsFactory } from '@wix/sdk-types';
|
2
2
|
import { CancelOrderRequest, CancelOrderResponse, CreateOfflineOrderRequest, CreateOfflineOrderResponse, GetOfflineOrderPreviewRequest, GetOfflineOrderPreviewResponse, GetOrderRequest, GetOrderResponse, GetPricePreviewRequest, GetPricePreviewResponse, ListOrdersRequest, ListOrdersResponse, MarkAsPaidRequest, MarkAsPaidResponse, MemberGetOrderRequest, MemberGetOrderResponse, MemberListOrdersRequest, MemberListOrdersResponse, RequestCancellationRequest, RequestCancellationResponse, PauseOrderRequest, PauseOrderResponse, PostponeEndDateRequest, PostponeEndDateResponse, ResumeOrderRequest, ResumeOrderResponse } from './pricing-plans-v2-order.types';
|
3
|
-
/**
|
3
|
+
/**
|
4
|
+
* Gets an order by ID for the currently logged-in member.
|
5
|
+
*
|
6
|
+
* The `getCurrentMemberOrder()` function returns a Promise that resolves to information about a specified order for the currently logged-in member.
|
7
|
+
*/
|
4
8
|
export declare function memberGetOrder(payload: MemberGetOrderRequest): RequestOptionsFactory<MemberGetOrderResponse>;
|
5
|
-
/**
|
9
|
+
/**
|
10
|
+
* Lists orders for the currently logged-in member.
|
11
|
+
*
|
12
|
+
* The `memberListOrders()` function returns a Promise that resolves to a list of up to 100 pricing plan orders.
|
13
|
+
*/
|
6
14
|
export declare function memberListOrders(payload: MemberListOrdersRequest): RequestOptionsFactory<MemberListOrdersResponse>;
|
7
15
|
/**
|
8
|
-
*
|
9
|
-
*
|
16
|
+
* Starts the process of canceling an order.
|
17
|
+
*
|
18
|
+
*
|
19
|
+
* The `requestCancellation()` function returns a Promise that resolves when the order cancellation is successfully requested.
|
20
|
+
*
|
21
|
+
* 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.
|
22
|
+
*
|
23
|
+
* Requesting an order cancellation starts the cancellation process. The event is triggered immediately and the function's promise is fulfilled. However, 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.
|
24
|
+
*
|
25
|
+
* The [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handler runs when a cancellation is requested. The [`onOrderCanceled()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercanceled) event handler runs when the cancellation is completed.
|
10
26
|
*/
|
11
27
|
export declare function requestCancellation(payload: RequestCancellationRequest): RequestOptionsFactory<RequestCancellationResponse>;
|
12
28
|
/**
|
13
29
|
* Creates an order for a buyer who purchased the plan with an offline transaction.
|
14
30
|
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
31
|
+
* The `createOfflineOrder()` function returns a Promise that resolves to an `order` object when the order has been created.
|
32
|
+
*
|
33
|
+
* Payment of an offline order is handled in 1 of 2 ways.
|
34
|
+
* - When creating the order, select `true` in the `paid` request parameter.
|
35
|
+
* - After creation, with the [`markAsPaid()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/markaspaid) function.
|
36
|
+
*
|
37
|
+
* When creating a non-free offline order:
|
38
|
+
* - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
|
39
|
+
* The order's last payment status is set to `"UNPAID"` or `"PAID"`.
|
40
|
+
*
|
41
|
+
* When creating a free offline order:
|
42
|
+
* - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
|
43
|
+
* - The order's last payment status is set to `"NOT_APPLICABLE"`.
|
18
44
|
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
45
|
+
* The [`onOrderCreated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercreated) event handler runs when an offline order is created.
|
46
|
+
*
|
47
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can create offline orders.
|
22
48
|
*/
|
23
49
|
export declare function createOfflineOrder(payload: CreateOfflineOrderRequest): RequestOptionsFactory<CreateOfflineOrderResponse>;
|
24
50
|
/**
|
25
|
-
*
|
51
|
+
* Provides a preview of an offline order as if it was purchased.
|
52
|
+
*
|
53
|
+
* The `getOfflineOrderPreview()` function returns a Promise that resolves to a temporary preview of the offline order.
|
54
|
+
*
|
55
|
+
* 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`).
|
56
|
+
*
|
57
|
+
* 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`.
|
26
58
|
*
|
27
|
-
*
|
28
|
-
* created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters
|
29
|
-
* (`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
|
30
|
-
* <br>
|
31
|
-
* If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview.
|
32
|
-
* But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then
|
33
|
-
* `purchaseLimitExceeded` will return as `true`.
|
59
|
+
* 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()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/getpricepreview) function.
|
34
60
|
*
|
35
|
-
*
|
61
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can get offline order previews.
|
36
62
|
*/
|
37
63
|
export declare function getOfflineOrderPreview(payload: GetOfflineOrderPreviewRequest): RequestOptionsFactory<GetOfflineOrderPreviewResponse>;
|
38
64
|
/**
|
39
|
-
* Retrieves a
|
65
|
+
* Retrieves a preview of an order's pricing as if it was purchased.
|
40
66
|
*
|
41
|
-
* The
|
42
|
-
* the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection). The price is returned
|
43
|
-
* in the [pricing model](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models) format used for orders.
|
67
|
+
* The `getPricePreview()` function returns a Promise that resolves to a temporary preview of the order's price.
|
44
68
|
*
|
45
|
-
*
|
46
|
-
*
|
69
|
+
* 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`.
|
70
|
+
*
|
71
|
+
* 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()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/getofflineorderpreview).
|
47
72
|
*/
|
48
73
|
export declare function getPricePreview(payload: GetPricePreviewRequest): RequestOptionsFactory<GetPricePreviewResponse>;
|
49
|
-
/**
|
74
|
+
/**
|
75
|
+
* Retrieves an order by ID.
|
76
|
+
*
|
77
|
+
* The `managementGetOrder()` function returns a Promise that resolves to information about the specified order.
|
78
|
+
*
|
79
|
+
* >**Note:** Only users with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can get orders.
|
80
|
+
*/
|
50
81
|
export declare function managementGetOrder(payload: GetOrderRequest): RequestOptionsFactory<GetOrderResponse>;
|
51
82
|
/**
|
52
|
-
*
|
83
|
+
* Lists pricing plan orders.
|
84
|
+
*
|
85
|
+
* 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.
|
53
86
|
*
|
54
|
-
*
|
55
|
-
*
|
87
|
+
* This function returns the orders on the site. To list orders for the currently logged-in member, use [`listMemberOrders()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/memberlistorders).
|
88
|
+
*
|
89
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can list orders.
|
56
90
|
*/
|
57
91
|
export declare function managementListOrders(payload: ListOrdersRequest): RequestOptionsFactory<ListOrdersResponse>;
|
58
92
|
/**
|
59
93
|
* Extends the duration of a pricing plan order by postponing the order's `endDate`.
|
60
94
|
*
|
61
|
-
*
|
62
|
-
*
|
95
|
+
* The `postponeEndDate()` function returns a Promise that resolves when the order's end date is successfully changed.
|
96
|
+
*
|
97
|
+
* The new end date and time must be later than the order's current `endDate`.
|
98
|
+
*
|
99
|
+
* 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.
|
100
|
+
*
|
101
|
+
* Postponing an order causes the following changes:
|
102
|
+
* - The `endDate` for the order is adjusted to the new end date.
|
103
|
+
* The `onOrderEndDatePostponed()` and `onOrderUpdated()` event handlers run when an order's end date is postponed or made earlier.
|
104
|
+
*
|
105
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can postpone the end date of an order.
|
106
|
+
*
|
63
107
|
*/
|
64
108
|
export declare function postponeEndDate(payload: PostponeEndDateRequest): RequestOptionsFactory<PostponeEndDateResponse>;
|
65
109
|
/**
|
66
110
|
* Cancels an existing order.
|
67
111
|
*
|
112
|
+
* The `cancelOrder()` function returns a Promise that resolves when the order is successfully canceled.
|
113
|
+
*
|
68
114
|
* For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
|
69
|
-
* For orders with one-time payments, a cancellation
|
115
|
+
* For orders with one-time payments, a cancellation occurs `IMMEDIATELY`.
|
116
|
+
*
|
117
|
+
* Canceling an order changes the order status to `"CANCELED"`.
|
118
|
+
* The [`onOrderCanceled()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercanceled) event handler runs when an order is canceled.
|
70
119
|
*
|
71
120
|
* #### Canceling during the free trial period.
|
72
121
|
*
|
73
|
-
* When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end
|
74
|
-
*
|
75
|
-
*
|
122
|
+
* 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.
|
123
|
+
*
|
124
|
+
* 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`.
|
125
|
+
*
|
126
|
+
* Canceling `IMMEDIATELY` will end the subscription for the buyer
|
127
|
+
* immediately, even during the free trial period and the buyer won't be billed.
|
128
|
+
* 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.
|
129
|
+
*
|
130
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only users with the "Manage Pricing Plans" and "Manage Subscription" permissions can cancel orders.
|
131
|
+
*
|
132
|
+
*
|
133
|
+
*
|
76
134
|
*
|
77
|
-
* When a site owner cancels an ordered plan during the free trial period, they choose to apply the cancellation
|
78
|
-
* `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`. Canceling `IMMEDIATELY` will end the subscription for the buyer
|
79
|
-
* immediately, even during the free trial period and the buyer won't be billed. Canceling at the
|
80
|
-
* `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period.
|
81
|
-
* Then, the subscription ends and the buyer is not billed.
|
82
135
|
*/
|
83
136
|
export declare function cancelOrder(payload: CancelOrderRequest): RequestOptionsFactory<CancelOrderResponse>;
|
84
137
|
/**
|
85
138
|
* Marks an offline order as paid.
|
86
|
-
*
|
139
|
+
*
|
140
|
+
* The `markAsPaid()` function returns a Promise that resolves when the offline order is successfully marked as paid.
|
141
|
+
*
|
142
|
+
* The entire order is marked as paid, even if the order's payments are recurring.
|
143
|
+
*
|
144
|
+
* >**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.
|
145
|
+
*
|
146
|
+
* Marking an offline order as paid causes the following changes:
|
147
|
+
* - The order's `lastPaymentStatus` changes to `"PAID"`.
|
148
|
+
* - The order's status changes to either `"PENDING"` or `"ACTIVE"`, depending on the order's `startDate`.
|
149
|
+
*
|
150
|
+
* An error occurs if you attempt to:
|
151
|
+
* - Mark an already-paid, offline order as paid. You cannot make an offline order as paid twice.
|
152
|
+
* - Mark an online order as paid. The `markAsPaid()` function is supported for offline orders only.
|
153
|
+
*
|
154
|
+
* The [`onOrderMarkedAsPaid()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordermarkedaspaid) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an offline order is marked as paid.
|
155
|
+
*
|
156
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can mark offline orders as paid.
|
87
157
|
*/
|
88
158
|
export declare function markAsPaid(payload: MarkAsPaidRequest): RequestOptionsFactory<MarkAsPaidResponse>;
|
89
159
|
/**
|
90
|
-
* Pauses
|
160
|
+
* Pauses a pricing plan order.
|
161
|
+
*
|
162
|
+
* The `pauseOrder()` function returns a Promise that resolves when the order is successfully paused.
|
163
|
+
*
|
164
|
+
* 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.
|
165
|
+
*
|
166
|
+
* Pausing an order causes the following changes:
|
167
|
+
* - The order status changes to `"PAUSED"`.
|
168
|
+
* - The `pausePeriods` array is updated.
|
91
169
|
*
|
92
|
-
*
|
93
|
-
* Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`. Can only pause orders with an `ACTIVE` status.
|
170
|
+
* The `endDate` and the `earliestEndDate` for the order are adjusted to include the pause period when the order is resumed.
|
94
171
|
*
|
95
|
-
*
|
172
|
+
* The [`onOrderPaused()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderpaused) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an order is paused.
|
173
|
+
*
|
174
|
+
* Paused orders can be continued with the [`resumeOrder()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder) function.
|
175
|
+
*
|
176
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can pause orders.
|
96
177
|
*/
|
97
178
|
export declare function pauseOrder(payload: PauseOrderRequest): RequestOptionsFactory<PauseOrderResponse>;
|
98
179
|
/**
|
99
|
-
* Resumes a paused order.
|
180
|
+
* Resumes a paused pricing plan order.
|
181
|
+
*
|
182
|
+
* The `resumeOrder()` function returns a Promise that resolves when a paused order is successfully resumed.
|
183
|
+
*
|
184
|
+
* For orders with recurring payments, `resumeOrder()` also restarts the payment schedule.
|
185
|
+
*
|
186
|
+
* Resuming an order causes the following changes:
|
187
|
+
* - The order status changes to `"ACTIVE"`.
|
188
|
+
* - The `pausePeriods` array is updated.
|
189
|
+
* - The `endDate` for the order is adjusted to include the pause period.
|
190
|
+
* - The `earliestEndDate` is adjusted to include the pause period. (This property is reserved for future use.)
|
191
|
+
*
|
192
|
+
* The [`onOrderResumed()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderresumed) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an order is resumed.
|
100
193
|
*
|
101
|
-
*
|
102
|
-
* For orders with recurring payments, it also restarts the payment schedule.
|
103
|
-
* Use [Pause Order to pause an order](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/pause-order/).
|
194
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can resume orders.
|
104
195
|
*/
|
105
196
|
export declare function resumeOrder(payload: ResumeOrderRequest): RequestOptionsFactory<ResumeOrderResponse>;
|
@@ -349,7 +349,11 @@ function resolveComWixpressMembershipV2OrdersMemberMemberOrdersServiceUrl(opts)
|
|
349
349
|
};
|
350
350
|
return (0, metro_runtime_2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
351
351
|
}
|
352
|
-
/**
|
352
|
+
/**
|
353
|
+
* Gets an order by ID for the currently logged-in member.
|
354
|
+
*
|
355
|
+
* The `getCurrentMemberOrder()` function returns a Promise that resolves to information about a specified order for the currently logged-in member.
|
356
|
+
*/
|
353
357
|
function memberGetOrder(payload) {
|
354
358
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_memberGetOrderRequest, {});
|
355
359
|
const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_memberGetOrderResponse, {
|
@@ -377,7 +381,11 @@ function memberGetOrder(payload) {
|
|
377
381
|
return __memberGetOrder;
|
378
382
|
}
|
379
383
|
exports.memberGetOrder = memberGetOrder;
|
380
|
-
/**
|
384
|
+
/**
|
385
|
+
* Lists orders for the currently logged-in member.
|
386
|
+
*
|
387
|
+
* The `memberListOrders()` function returns a Promise that resolves to a list of up to 100 pricing plan orders.
|
388
|
+
*/
|
381
389
|
function memberListOrders(payload) {
|
382
390
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_memberListOrdersRequest, {});
|
383
391
|
const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_memberListOrdersResponse, {
|
@@ -406,8 +414,16 @@ function memberListOrders(payload) {
|
|
406
414
|
}
|
407
415
|
exports.memberListOrders = memberListOrders;
|
408
416
|
/**
|
409
|
-
*
|
410
|
-
*
|
417
|
+
* Starts the process of canceling an order.
|
418
|
+
*
|
419
|
+
*
|
420
|
+
* The `requestCancellation()` function returns a Promise that resolves when the order cancellation is successfully requested.
|
421
|
+
*
|
422
|
+
* 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.
|
423
|
+
*
|
424
|
+
* Requesting an order cancellation starts the cancellation process. The event is triggered immediately and the function's promise is fulfilled. However, 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.
|
425
|
+
*
|
426
|
+
* The [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handler runs when a cancellation is requested. The [`onOrderCanceled()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercanceled) event handler runs when the cancellation is completed.
|
411
427
|
*/
|
412
428
|
function requestCancellation(payload) {
|
413
429
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_requestCancellationRequest, {});
|
@@ -433,13 +449,23 @@ exports.requestCancellation = requestCancellation;
|
|
433
449
|
/**
|
434
450
|
* Creates an order for a buyer who purchased the plan with an offline transaction.
|
435
451
|
*
|
436
|
-
*
|
437
|
-
*
|
438
|
-
*
|
452
|
+
* The `createOfflineOrder()` function returns a Promise that resolves to an `order` object when the order has been created.
|
453
|
+
*
|
454
|
+
* Payment of an offline order is handled in 1 of 2 ways.
|
455
|
+
* - When creating the order, select `true` in the `paid` request parameter.
|
456
|
+
* - After creation, with the [`markAsPaid()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/markaspaid) function.
|
457
|
+
*
|
458
|
+
* When creating a non-free offline order:
|
459
|
+
* - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
|
460
|
+
* The order's last payment status is set to `"UNPAID"` or `"PAID"`.
|
461
|
+
*
|
462
|
+
* When creating a free offline order:
|
463
|
+
* - The order's status is set to `"PENDING"` if the start date is in the future. Otherwise, the status is set to `"ACTIVE"`.
|
464
|
+
* - The order's last payment status is set to `"NOT_APPLICABLE"`.
|
439
465
|
*
|
440
|
-
*
|
441
|
-
*
|
442
|
-
*
|
466
|
+
* The [`onOrderCreated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercreated) event handler runs when an offline order is created.
|
467
|
+
*
|
468
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can create offline orders.
|
443
469
|
*/
|
444
470
|
function createOfflineOrder(payload) {
|
445
471
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_createOfflineOrderRequest, {});
|
@@ -469,17 +495,17 @@ function createOfflineOrder(payload) {
|
|
469
495
|
}
|
470
496
|
exports.createOfflineOrder = createOfflineOrder;
|
471
497
|
/**
|
472
|
-
*
|
498
|
+
* Provides a preview of an offline order as if it was purchased.
|
499
|
+
*
|
500
|
+
* The `getOfflineOrderPreview()` function returns a Promise that resolves to a temporary preview of the offline order.
|
501
|
+
*
|
502
|
+
* 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`).
|
503
|
+
*
|
504
|
+
* 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`.
|
473
505
|
*
|
474
|
-
*
|
475
|
-
* created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters
|
476
|
-
* (`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
|
477
|
-
* <br>
|
478
|
-
* If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview.
|
479
|
-
* But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then
|
480
|
-
* `purchaseLimitExceeded` will return as `true`.
|
506
|
+
* 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()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/getpricepreview) function.
|
481
507
|
*
|
482
|
-
*
|
508
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can get offline order previews.
|
483
509
|
*/
|
484
510
|
function getOfflineOrderPreview(payload) {
|
485
511
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_getOfflineOrderPreviewRequest, {});
|
@@ -509,14 +535,13 @@ function getOfflineOrderPreview(payload) {
|
|
509
535
|
}
|
510
536
|
exports.getOfflineOrderPreview = getOfflineOrderPreview;
|
511
537
|
/**
|
512
|
-
* Retrieves a
|
538
|
+
* Retrieves a preview of an order's pricing as if it was purchased.
|
513
539
|
*
|
514
|
-
* The
|
515
|
-
* the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection). The price is returned
|
516
|
-
* in the [pricing model](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models) format used for orders.
|
540
|
+
* The `getPricePreview()` function returns a Promise that resolves to a temporary preview of the order's price.
|
517
541
|
*
|
518
|
-
*
|
519
|
-
*
|
542
|
+
* 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`.
|
543
|
+
*
|
544
|
+
* 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()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/getofflineorderpreview).
|
520
545
|
*/
|
521
546
|
function getPricePreview(payload) {
|
522
547
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_getPricePreviewRequest, {});
|
@@ -539,7 +564,13 @@ function getPricePreview(payload) {
|
|
539
564
|
return __getPricePreview;
|
540
565
|
}
|
541
566
|
exports.getPricePreview = getPricePreview;
|
542
|
-
/**
|
567
|
+
/**
|
568
|
+
* Retrieves an order by ID.
|
569
|
+
*
|
570
|
+
* The `managementGetOrder()` function returns a Promise that resolves to information about the specified order.
|
571
|
+
*
|
572
|
+
* >**Note:** Only users with the "Manage Pricing Plans" and "Manage Subscriptions" permissions can get orders.
|
573
|
+
*/
|
543
574
|
function managementGetOrder(payload) {
|
544
575
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_getOrderRequest, {});
|
545
576
|
const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_getOrderResponse, {
|
@@ -568,10 +599,13 @@ function managementGetOrder(payload) {
|
|
568
599
|
}
|
569
600
|
exports.managementGetOrder = managementGetOrder;
|
570
601
|
/**
|
571
|
-
*
|
602
|
+
* Lists pricing plan orders.
|
603
|
+
*
|
604
|
+
* 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.
|
572
605
|
*
|
573
|
-
*
|
574
|
-
*
|
606
|
+
* This function returns the orders on the site. To list orders for the currently logged-in member, use [`listMemberOrders()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/memberlistorders).
|
607
|
+
*
|
608
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can list orders.
|
575
609
|
*/
|
576
610
|
function managementListOrders(payload) {
|
577
611
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_listOrdersRequest, {});
|
@@ -603,8 +637,18 @@ exports.managementListOrders = managementListOrders;
|
|
603
637
|
/**
|
604
638
|
* Extends the duration of a pricing plan order by postponing the order's `endDate`.
|
605
639
|
*
|
606
|
-
*
|
607
|
-
*
|
640
|
+
* The `postponeEndDate()` function returns a Promise that resolves when the order's end date is successfully changed.
|
641
|
+
*
|
642
|
+
* The new end date and time must be later than the order's current `endDate`.
|
643
|
+
*
|
644
|
+
* 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.
|
645
|
+
*
|
646
|
+
* Postponing an order causes the following changes:
|
647
|
+
* - The `endDate` for the order is adjusted to the new end date.
|
648
|
+
* The `onOrderEndDatePostponed()` and `onOrderUpdated()` event handlers run when an order's end date is postponed or made earlier.
|
649
|
+
*
|
650
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can postpone the end date of an order.
|
651
|
+
*
|
608
652
|
*/
|
609
653
|
function postponeEndDate(payload) {
|
610
654
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_postponeEndDateRequest, {});
|
@@ -630,20 +674,29 @@ exports.postponeEndDate = postponeEndDate;
|
|
630
674
|
/**
|
631
675
|
* Cancels an existing order.
|
632
676
|
*
|
677
|
+
* The `cancelOrder()` function returns a Promise that resolves when the order is successfully canceled.
|
678
|
+
*
|
633
679
|
* For orders with recurring payments, a cancellation can be set to occur either `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`.
|
634
|
-
* For orders with one-time payments, a cancellation
|
680
|
+
* For orders with one-time payments, a cancellation occurs `IMMEDIATELY`.
|
681
|
+
*
|
682
|
+
* Canceling an order changes the order status to `"CANCELED"`.
|
683
|
+
* The [`onOrderCanceled()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordercanceled) event handler runs when an order is canceled.
|
635
684
|
*
|
636
685
|
* #### Canceling during the free trial period.
|
637
686
|
*
|
638
|
-
* When a buyer cancels their order during the free trial period, the buyer's subscription expires at the end
|
639
|
-
*
|
640
|
-
*
|
687
|
+
* 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.
|
688
|
+
*
|
689
|
+
* 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`.
|
690
|
+
*
|
691
|
+
* Canceling `IMMEDIATELY` will end the subscription for the buyer
|
692
|
+
* immediately, even during the free trial period and the buyer won't be billed.
|
693
|
+
* 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.
|
694
|
+
*
|
695
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only users with the "Manage Pricing Plans" and "Manage Subscription" permissions can cancel orders.
|
696
|
+
*
|
697
|
+
*
|
698
|
+
*
|
641
699
|
*
|
642
|
-
* When a site owner cancels an ordered plan during the free trial period, they choose to apply the cancellation
|
643
|
-
* `IMMEDIATELY` or at the `NEXT_PAYMENT_DATE`. Canceling `IMMEDIATELY` will end the subscription for the buyer
|
644
|
-
* immediately, even during the free trial period and the buyer won't be billed. Canceling at the
|
645
|
-
* `NEXT_PAYMENT_DATE` allows the buyer to continue using the benefits of the subscription until the end of the free trial period.
|
646
|
-
* Then, the subscription ends and the buyer is not billed.
|
647
700
|
*/
|
648
701
|
function cancelOrder(payload) {
|
649
702
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_cancelOrderRequest, {});
|
@@ -668,7 +721,24 @@ function cancelOrder(payload) {
|
|
668
721
|
exports.cancelOrder = cancelOrder;
|
669
722
|
/**
|
670
723
|
* Marks an offline order as paid.
|
671
|
-
*
|
724
|
+
*
|
725
|
+
* The `markAsPaid()` function returns a Promise that resolves when the offline order is successfully marked as paid.
|
726
|
+
*
|
727
|
+
* The entire order is marked as paid, even if the order's payments are recurring.
|
728
|
+
*
|
729
|
+
* >**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.
|
730
|
+
*
|
731
|
+
* Marking an offline order as paid causes the following changes:
|
732
|
+
* - The order's `lastPaymentStatus` changes to `"PAID"`.
|
733
|
+
* - The order's status changes to either `"PENDING"` or `"ACTIVE"`, depending on the order's `startDate`.
|
734
|
+
*
|
735
|
+
* An error occurs if you attempt to:
|
736
|
+
* - Mark an already-paid, offline order as paid. You cannot make an offline order as paid twice.
|
737
|
+
* - Mark an online order as paid. The `markAsPaid()` function is supported for offline orders only.
|
738
|
+
*
|
739
|
+
* The [`onOrderMarkedAsPaid()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onordermarkedaspaid) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an offline order is marked as paid.
|
740
|
+
*
|
741
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can mark offline orders as paid.
|
672
742
|
*/
|
673
743
|
function markAsPaid(payload) {
|
674
744
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_markAsPaidRequest, {});
|
@@ -692,12 +762,23 @@ function markAsPaid(payload) {
|
|
692
762
|
}
|
693
763
|
exports.markAsPaid = markAsPaid;
|
694
764
|
/**
|
695
|
-
* Pauses
|
765
|
+
* Pauses a pricing plan order.
|
766
|
+
*
|
767
|
+
* The `pauseOrder()` function returns a Promise that resolves when the order is successfully paused.
|
768
|
+
*
|
769
|
+
* 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.
|
770
|
+
*
|
771
|
+
* Pausing an order causes the following changes:
|
772
|
+
* - The order status changes to `"PAUSED"`.
|
773
|
+
* - The `pausePeriods` array is updated.
|
696
774
|
*
|
697
|
-
*
|
698
|
-
* Pausing an order affects the end date of the order by adding the time the order is paused to the `endDate`. Can only pause orders with an `ACTIVE` status.
|
775
|
+
* The `endDate` and the `earliestEndDate` for the order are adjusted to include the pause period when the order is resumed.
|
699
776
|
*
|
700
|
-
*
|
777
|
+
* The [`onOrderPaused()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderpaused) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an order is paused.
|
778
|
+
*
|
779
|
+
* Paused orders can be continued with the [`resumeOrder()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/orders/resumeorder) function.
|
780
|
+
*
|
781
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can pause orders.
|
701
782
|
*/
|
702
783
|
function pauseOrder(payload) {
|
703
784
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_pauseOrderRequest, {});
|
@@ -721,11 +802,21 @@ function pauseOrder(payload) {
|
|
721
802
|
}
|
722
803
|
exports.pauseOrder = pauseOrder;
|
723
804
|
/**
|
724
|
-
* Resumes a paused order.
|
805
|
+
* Resumes a paused pricing plan order.
|
806
|
+
*
|
807
|
+
* The `resumeOrder()` function returns a Promise that resolves when a paused order is successfully resumed.
|
808
|
+
*
|
809
|
+
* For orders with recurring payments, `resumeOrder()` also restarts the payment schedule.
|
810
|
+
*
|
811
|
+
* Resuming an order causes the following changes:
|
812
|
+
* - The order status changes to `"ACTIVE"`.
|
813
|
+
* - The `pausePeriods` array is updated.
|
814
|
+
* - The `endDate` for the order is adjusted to include the pause period.
|
815
|
+
* - The `earliestEndDate` is adjusted to include the pause period. (This property is reserved for future use.)
|
816
|
+
*
|
817
|
+
* The [`onOrderResumed()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderresumed) and [`onOrderUpdated()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/events/onorderupdated) event handlers run when an order is resumed.
|
725
818
|
*
|
726
|
-
*
|
727
|
-
* For orders with recurring payments, it also restarts the payment schedule.
|
728
|
-
* Use [Pause Order to pause an order](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/orders/pause-order/).
|
819
|
+
* >**Note:** This function is restricted and only runs if you elevate permissions using the [`wix-auth.elevate()`](https://www.wix.com/velo/reference/wix-auth/elevate) function. If `wix-auth.elevate()` is not used, only those with the “Manage Pricing Plans” and “Manage Subscriptions” permissions can resume orders.
|
729
820
|
*/
|
730
821
|
function resumeOrder(payload) {
|
731
822
|
const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_resumeOrderRequest, {});
|