@wix/auto_sdk_subscription_subscriptions 1.0.0
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/index.d.ts +1 -0
- package/build/cjs/index.js +18 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +18 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +18 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.context.d.ts +99 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.context.js +141 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.context.js.map +1 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.http.d.ts +134 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.http.js +3048 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.http.js.map +1 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.meta.d.ts +94 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.meta.js +636 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.meta.js.map +1 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.public.d.ts +273 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.public.js +768 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.public.js.map +1 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.types.d.ts +3618 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.types.js +337 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.types.js.map +1 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.universal.d.ts +4355 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.universal.js +1985 -0
- package/build/cjs/src/billing-v1-subscription-subscriptions.universal.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/index.typings.d.ts +1 -0
- package/build/es/index.typings.js +2 -0
- package/build/es/index.typings.js.map +1 -0
- package/build/es/meta.d.ts +1 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -0
- package/build/es/package.json +3 -0
- package/build/es/src/billing-v1-subscription-subscriptions.context.d.ts +99 -0
- package/build/es/src/billing-v1-subscription-subscriptions.context.js +101 -0
- package/build/es/src/billing-v1-subscription-subscriptions.context.js.map +1 -0
- package/build/es/src/billing-v1-subscription-subscriptions.http.d.ts +134 -0
- package/build/es/src/billing-v1-subscription-subscriptions.http.js +3013 -0
- package/build/es/src/billing-v1-subscription-subscriptions.http.js.map +1 -0
- package/build/es/src/billing-v1-subscription-subscriptions.meta.d.ts +94 -0
- package/build/es/src/billing-v1-subscription-subscriptions.meta.js +578 -0
- package/build/es/src/billing-v1-subscription-subscriptions.meta.js.map +1 -0
- package/build/es/src/billing-v1-subscription-subscriptions.public.d.ts +273 -0
- package/build/es/src/billing-v1-subscription-subscriptions.public.js +696 -0
- package/build/es/src/billing-v1-subscription-subscriptions.public.js.map +1 -0
- package/build/es/src/billing-v1-subscription-subscriptions.types.d.ts +3618 -0
- package/build/es/src/billing-v1-subscription-subscriptions.types.js +334 -0
- package/build/es/src/billing-v1-subscription-subscriptions.types.js.map +1 -0
- package/build/es/src/billing-v1-subscription-subscriptions.universal.d.ts +4355 -0
- package/build/es/src/billing-v1-subscription-subscriptions.universal.js +1926 -0
- package/build/es/src/billing-v1-subscription-subscriptions.universal.js.map +1 -0
- package/build/internal/cjs/index.d.ts +1 -0
- package/build/internal/cjs/index.js +18 -0
- package/build/internal/cjs/index.js.map +1 -0
- package/build/internal/cjs/index.typings.d.ts +1 -0
- package/build/internal/cjs/index.typings.js +18 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +1 -0
- package/build/internal/cjs/meta.js +18 -0
- package/build/internal/cjs/meta.js.map +1 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.context.d.ts +101 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.context.js +141 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.context.js.map +1 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.http.d.ts +134 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.http.js +3048 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.http.js.map +1 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.meta.d.ts +94 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.meta.js +636 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.meta.js.map +1 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.public.d.ts +293 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.public.js +768 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.public.js.map +1 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.types.d.ts +3618 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.types.js +337 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.types.js.map +1 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.universal.d.ts +4379 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.universal.js +1985 -0
- package/build/internal/cjs/src/billing-v1-subscription-subscriptions.universal.js.map +1 -0
- package/build/internal/es/index.d.ts +1 -0
- package/build/internal/es/index.js +2 -0
- package/build/internal/es/index.js.map +1 -0
- package/build/internal/es/index.typings.d.ts +1 -0
- package/build/internal/es/index.typings.js +2 -0
- package/build/internal/es/index.typings.js.map +1 -0
- package/build/internal/es/meta.d.ts +1 -0
- package/build/internal/es/meta.js +2 -0
- package/build/internal/es/meta.js.map +1 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.context.d.ts +101 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.context.js +101 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.context.js.map +1 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.http.d.ts +134 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.http.js +3013 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.http.js.map +1 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.meta.d.ts +94 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.meta.js +578 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.meta.js.map +1 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.public.d.ts +293 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.public.js +696 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.public.js.map +1 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.types.d.ts +3618 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.types.js +334 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.types.js.map +1 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.universal.d.ts +4379 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.universal.js +1926 -0
- package/build/internal/es/src/billing-v1-subscription-subscriptions.universal.js.map +1 -0
- package/meta/package.json +3 -0
- package/package.json +52 -0
|
@@ -0,0 +1,1926 @@
|
|
|
1
|
+
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
|
2
|
+
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
|
|
3
|
+
import * as ambassadorWixBillingV1Subscription from './billing-v1-subscription-subscriptions.http.js';
|
|
4
|
+
import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
|
|
5
|
+
import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
|
|
6
|
+
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
|
|
7
|
+
export var SubscriptionStatusEnumSubscriptionStatus;
|
|
8
|
+
(function (SubscriptionStatusEnumSubscriptionStatus) {
|
|
9
|
+
SubscriptionStatusEnumSubscriptionStatus["UNKNOWN"] = "UNKNOWN";
|
|
10
|
+
/** Subscription created in this status, but hasn't been paid for yet. Filtered out from subscriptions querying. */
|
|
11
|
+
SubscriptionStatusEnumSubscriptionStatus["DRAFT"] = "DRAFT";
|
|
12
|
+
/** Subscription that will be active in future. */
|
|
13
|
+
SubscriptionStatusEnumSubscriptionStatus["PENDING"] = "PENDING";
|
|
14
|
+
/** Subscription is active */
|
|
15
|
+
SubscriptionStatusEnumSubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
16
|
+
/** Subscription is paused */
|
|
17
|
+
SubscriptionStatusEnumSubscriptionStatus["PAUSED"] = "PAUSED";
|
|
18
|
+
/** Subscription was ended */
|
|
19
|
+
SubscriptionStatusEnumSubscriptionStatus["ENDED"] = "ENDED";
|
|
20
|
+
/** Subscription was canceled or auto-renew off. Ended before its time. */
|
|
21
|
+
SubscriptionStatusEnumSubscriptionStatus["CANCELED"] = "CANCELED";
|
|
22
|
+
})(SubscriptionStatusEnumSubscriptionStatus || (SubscriptionStatusEnumSubscriptionStatus = {}));
|
|
23
|
+
export var CollectionMethodEnumCollectionMethod;
|
|
24
|
+
(function (CollectionMethodEnumCollectionMethod) {
|
|
25
|
+
CollectionMethodEnumCollectionMethod["UNKNOWN"] = "UNKNOWN";
|
|
26
|
+
/** Subscriber automatically charged */
|
|
27
|
+
CollectionMethodEnumCollectionMethod["AUTO_CHARGE"] = "AUTO_CHARGE";
|
|
28
|
+
/** Payments manually collected and managed by owner */
|
|
29
|
+
CollectionMethodEnumCollectionMethod["OFFLINE"] = "OFFLINE";
|
|
30
|
+
/** Payment will be collected somehow. Billing only issues invoice per cycle. */
|
|
31
|
+
CollectionMethodEnumCollectionMethod["SEND_INVOICE"] = "SEND_INVOICE";
|
|
32
|
+
/** Payment will be collected externally */
|
|
33
|
+
CollectionMethodEnumCollectionMethod["EXTERNAL"] = "EXTERNAL";
|
|
34
|
+
/** Indicates the product has a zero amount, meaning its free with no payment required. */
|
|
35
|
+
CollectionMethodEnumCollectionMethod["FREE"] = "FREE";
|
|
36
|
+
})(CollectionMethodEnumCollectionMethod || (CollectionMethodEnumCollectionMethod = {}));
|
|
37
|
+
export var DurationUnit;
|
|
38
|
+
(function (DurationUnit) {
|
|
39
|
+
DurationUnit["UNKNOWN"] = "UNKNOWN";
|
|
40
|
+
DurationUnit["DAY"] = "DAY";
|
|
41
|
+
DurationUnit["WEEK"] = "WEEK";
|
|
42
|
+
DurationUnit["MONTH"] = "MONTH";
|
|
43
|
+
DurationUnit["YEAR"] = "YEAR";
|
|
44
|
+
})(DurationUnit || (DurationUnit = {}));
|
|
45
|
+
export var AdditionalFeeTrigger;
|
|
46
|
+
(function (AdditionalFeeTrigger) {
|
|
47
|
+
AdditionalFeeTrigger["UNKNOWN"] = "UNKNOWN";
|
|
48
|
+
/** Charge upon subscription first payment */
|
|
49
|
+
AdditionalFeeTrigger["FIRST_PAYMENT"] = "FIRST_PAYMENT";
|
|
50
|
+
})(AdditionalFeeTrigger || (AdditionalFeeTrigger = {}));
|
|
51
|
+
export var TaxableAddressType;
|
|
52
|
+
(function (TaxableAddressType) {
|
|
53
|
+
TaxableAddressType["UNKNOWN"] = "UNKNOWN";
|
|
54
|
+
/** Tax will be calculated using a single address */
|
|
55
|
+
TaxableAddressType["BUSINESS"] = "BUSINESS";
|
|
56
|
+
/** Tax will be calculated using multiple address (from BUSINESS to BILLING) */
|
|
57
|
+
TaxableAddressType["BILLING"] = "BILLING";
|
|
58
|
+
/** Tax will be calculated using multiple address (from BUSINESS to SHIPPING) */
|
|
59
|
+
TaxableAddressType["SHIPPING"] = "SHIPPING";
|
|
60
|
+
})(TaxableAddressType || (TaxableAddressType = {}));
|
|
61
|
+
export var PaymentStatus;
|
|
62
|
+
(function (PaymentStatus) {
|
|
63
|
+
/** Payment status unknown */
|
|
64
|
+
PaymentStatus["UNKNOWN"] = "UNKNOWN";
|
|
65
|
+
/** Payment has not been paid */
|
|
66
|
+
PaymentStatus["UNPAID"] = "UNPAID";
|
|
67
|
+
/** Payment has been paid // TODO: p13n review: we are not sending event when in SEND_INVOICE mode cycle was paid. should we and which event? */
|
|
68
|
+
PaymentStatus["PAID"] = "PAID";
|
|
69
|
+
/** Payment failed */
|
|
70
|
+
PaymentStatus["FAILED"] = "FAILED";
|
|
71
|
+
})(PaymentStatus || (PaymentStatus = {}));
|
|
72
|
+
export var PausePolicy;
|
|
73
|
+
(function (PausePolicy) {
|
|
74
|
+
PausePolicy["NONE"] = "NONE";
|
|
75
|
+
/** Pause the payment and the service. When resuming, the subscription end date is extended by the number of cycles postponed, and if the pause happened in a middle of a cycle, the payment date is postponed by the amount of days that already paid. */
|
|
76
|
+
PausePolicy["SERVICE_AND_PAYMENTS"] = "SERVICE_AND_PAYMENTS";
|
|
77
|
+
/** Pause the service and continue the billing. When resuming, extend the service by the time that was paused */
|
|
78
|
+
PausePolicy["SERVICE_ONLY"] = "SERVICE_ONLY";
|
|
79
|
+
})(PausePolicy || (PausePolicy = {}));
|
|
80
|
+
export var PauseAt;
|
|
81
|
+
(function (PauseAt) {
|
|
82
|
+
/** Cancel scheduled pause */
|
|
83
|
+
PauseAt["NONE"] = "NONE";
|
|
84
|
+
/** Pause the subscription now */
|
|
85
|
+
PauseAt["IMMEDIATELY"] = "IMMEDIATELY";
|
|
86
|
+
/** Pause the subscription at the next billing date */
|
|
87
|
+
PauseAt["NEXT_BILLING_DATE"] = "NEXT_BILLING_DATE";
|
|
88
|
+
/** A specific date must be defined in Schedule.specific_date */
|
|
89
|
+
PauseAt["SPECIFIC_DATE"] = "SPECIFIC_DATE";
|
|
90
|
+
/** The number of cycles must be defined in Schedule.number_of_cycles */
|
|
91
|
+
PauseAt["NUMBER_OF_CYCLES_FROM_TODAY"] = "NUMBER_OF_CYCLES_FROM_TODAY";
|
|
92
|
+
})(PauseAt || (PauseAt = {}));
|
|
93
|
+
export var ResumeAt;
|
|
94
|
+
(function (ResumeAt) {
|
|
95
|
+
/** Cancel scheduled resume */
|
|
96
|
+
ResumeAt["NONE"] = "NONE";
|
|
97
|
+
/** Resume the subscription now */
|
|
98
|
+
ResumeAt["IMMEDIATELY"] = "IMMEDIATELY";
|
|
99
|
+
/** Resume the subscription at the next billing date */
|
|
100
|
+
ResumeAt["NEXT_BILLING_DATE"] = "NEXT_BILLING_DATE";
|
|
101
|
+
/** A specific date must be defined in Schedule.specific_date */
|
|
102
|
+
ResumeAt["SPECIFIC_DATE"] = "SPECIFIC_DATE";
|
|
103
|
+
})(ResumeAt || (ResumeAt = {}));
|
|
104
|
+
export var HistoryActionInitiator;
|
|
105
|
+
(function (HistoryActionInitiator) {
|
|
106
|
+
HistoryActionInitiator["UNDEFINED"] = "UNDEFINED";
|
|
107
|
+
HistoryActionInitiator["BUSINESS"] = "BUSINESS";
|
|
108
|
+
HistoryActionInitiator["CUSTOMER"] = "CUSTOMER";
|
|
109
|
+
HistoryActionInitiator["SYSTEM"] = "SYSTEM";
|
|
110
|
+
HistoryActionInitiator["PAYMENT_FAILURE"] = "PAYMENT_FAILURE";
|
|
111
|
+
})(HistoryActionInitiator || (HistoryActionInitiator = {}));
|
|
112
|
+
export var ItemCategory;
|
|
113
|
+
(function (ItemCategory) {
|
|
114
|
+
ItemCategory["UNKNOWN"] = "UNKNOWN";
|
|
115
|
+
ItemCategory["PHYSICAL"] = "PHYSICAL";
|
|
116
|
+
ItemCategory["DIGITAL"] = "DIGITAL";
|
|
117
|
+
})(ItemCategory || (ItemCategory = {}));
|
|
118
|
+
export var HistoryViewMode;
|
|
119
|
+
(function (HistoryViewMode) {
|
|
120
|
+
HistoryViewMode["UNKNOWN"] = "UNKNOWN";
|
|
121
|
+
/** Comprehensive view including all history events. */
|
|
122
|
+
HistoryViewMode["BACKOFFICE"] = "BACKOFFICE";
|
|
123
|
+
/** User-centric view of the history. */
|
|
124
|
+
HistoryViewMode["USER"] = "USER";
|
|
125
|
+
})(HistoryViewMode || (HistoryViewMode = {}));
|
|
126
|
+
export var UpdateAction;
|
|
127
|
+
(function (UpdateAction) {
|
|
128
|
+
UpdateAction["NONE"] = "NONE";
|
|
129
|
+
/** Update subscription immediately, please note proration for updates changing price are not yet supported */
|
|
130
|
+
UpdateAction["IMMEDIATELY"] = "IMMEDIATELY";
|
|
131
|
+
/** Request updates that will take affect only at the start of the next billing cycle. */
|
|
132
|
+
UpdateAction["NEXT_BILLING_CYCLE"] = "NEXT_BILLING_CYCLE";
|
|
133
|
+
/** Reset all pending updates */
|
|
134
|
+
UpdateAction["RESET_PENDING_UPDATES"] = "RESET_PENDING_UPDATES";
|
|
135
|
+
/** Request updates that will take affect only at a specific date. */
|
|
136
|
+
UpdateAction["SPECIFIC_DATE"] = "SPECIFIC_DATE";
|
|
137
|
+
})(UpdateAction || (UpdateAction = {}));
|
|
138
|
+
export var PaymentSettlementMethod;
|
|
139
|
+
(function (PaymentSettlementMethod) {
|
|
140
|
+
PaymentSettlementMethod["UNKNOWN"] = "UNKNOWN";
|
|
141
|
+
/** System-defined payment settlement. */
|
|
142
|
+
PaymentSettlementMethod["SYSTEM"] = "SYSTEM";
|
|
143
|
+
/** Manually mark the payment as paid. */
|
|
144
|
+
PaymentSettlementMethod["MARK_AS_PAID"] = "MARK_AS_PAID";
|
|
145
|
+
/** Require the customer to pay immediately, by insert a new payment method. */
|
|
146
|
+
PaymentSettlementMethod["CUSTOMER_PAY_NOW"] = "CUSTOMER_PAY_NOW";
|
|
147
|
+
})(PaymentSettlementMethod || (PaymentSettlementMethod = {}));
|
|
148
|
+
export var PaymentMode;
|
|
149
|
+
(function (PaymentMode) {
|
|
150
|
+
PaymentMode["NONE"] = "NONE";
|
|
151
|
+
/** The latest invoice of the subscription will be charged. */
|
|
152
|
+
PaymentMode["CHARGE"] = "CHARGE";
|
|
153
|
+
/** An authorization invoice with zero amount will be created. */
|
|
154
|
+
PaymentMode["AUTHORIZATION"] = "AUTHORIZATION";
|
|
155
|
+
})(PaymentMode || (PaymentMode = {}));
|
|
156
|
+
export var WebhookIdentityType;
|
|
157
|
+
(function (WebhookIdentityType) {
|
|
158
|
+
WebhookIdentityType["UNKNOWN"] = "UNKNOWN";
|
|
159
|
+
WebhookIdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
160
|
+
WebhookIdentityType["MEMBER"] = "MEMBER";
|
|
161
|
+
WebhookIdentityType["WIX_USER"] = "WIX_USER";
|
|
162
|
+
WebhookIdentityType["APP"] = "APP";
|
|
163
|
+
})(WebhookIdentityType || (WebhookIdentityType = {}));
|
|
164
|
+
export var SortOrder;
|
|
165
|
+
(function (SortOrder) {
|
|
166
|
+
SortOrder["ASC"] = "ASC";
|
|
167
|
+
SortOrder["DESC"] = "DESC";
|
|
168
|
+
})(SortOrder || (SortOrder = {}));
|
|
169
|
+
export var SubscriptionStatusGroup;
|
|
170
|
+
(function (SubscriptionStatusGroup) {
|
|
171
|
+
SubscriptionStatusGroup["ALL"] = "ALL";
|
|
172
|
+
/** Union of ACTIVE, PAUSED and PENDING */
|
|
173
|
+
SubscriptionStatusGroup["LIVE"] = "LIVE";
|
|
174
|
+
})(SubscriptionStatusGroup || (SubscriptionStatusGroup = {}));
|
|
175
|
+
export var ActionType;
|
|
176
|
+
(function (ActionType) {
|
|
177
|
+
ActionType["NONE"] = "NONE";
|
|
178
|
+
ActionType["CREATION"] = "CREATION";
|
|
179
|
+
ActionType["CANCEL"] = "CANCEL";
|
|
180
|
+
ActionType["CYCLE_AUTO_RENEW_ON"] = "CYCLE_AUTO_RENEW_ON";
|
|
181
|
+
ActionType["CYCLE_AUTO_RENEW_OFF"] = "CYCLE_AUTO_RENEW_OFF";
|
|
182
|
+
ActionType["PAUSE"] = "PAUSE";
|
|
183
|
+
ActionType["RESUME"] = "RESUME";
|
|
184
|
+
ActionType["MARK_AS_PAID"] = "MARK_AS_PAID";
|
|
185
|
+
ActionType["EXTEND"] = "EXTEND";
|
|
186
|
+
ActionType["UPDATE"] = "UPDATE";
|
|
187
|
+
ActionType["UPDATE_START_DATE"] = "UPDATE_START_DATE";
|
|
188
|
+
ActionType["UPM"] = "UPM";
|
|
189
|
+
ActionType["UPDATE_BILLING_DATE"] = "UPDATE_BILLING_DATE";
|
|
190
|
+
ActionType["UPDATE_COLLECTION_METHOD"] = "UPDATE_COLLECTION_METHOD";
|
|
191
|
+
})(ActionType || (ActionType = {}));
|
|
192
|
+
export var ExtendPolicyType;
|
|
193
|
+
(function (ExtendPolicyType) {
|
|
194
|
+
ExtendPolicyType["PERIOD"] = "PERIOD";
|
|
195
|
+
ExtendPolicyType["BILLING_CYCLE"] = "BILLING_CYCLE";
|
|
196
|
+
})(ExtendPolicyType || (ExtendPolicyType = {}));
|
|
197
|
+
export var OrderMethod;
|
|
198
|
+
(function (OrderMethod) {
|
|
199
|
+
OrderMethod["UNKNOWN"] = "UNKNOWN";
|
|
200
|
+
OrderMethod["MOTO"] = "MOTO";
|
|
201
|
+
OrderMethod["NOT_MOTO"] = "NOT_MOTO";
|
|
202
|
+
})(OrderMethod || (OrderMethod = {}));
|
|
203
|
+
export var ActionInitiator;
|
|
204
|
+
(function (ActionInitiator) {
|
|
205
|
+
ActionInitiator["UNDEFINED"] = "UNDEFINED";
|
|
206
|
+
ActionInitiator["BUSINESS"] = "BUSINESS";
|
|
207
|
+
ActionInitiator["CUSTOMER"] = "CUSTOMER";
|
|
208
|
+
ActionInitiator["SYSTEM"] = "SYSTEM";
|
|
209
|
+
})(ActionInitiator || (ActionInitiator = {}));
|
|
210
|
+
export var RequestedFields;
|
|
211
|
+
(function (RequestedFields) {
|
|
212
|
+
RequestedFields["UNKNOWN_REQUESTED_FIELD"] = "UNKNOWN_REQUESTED_FIELD";
|
|
213
|
+
/** Include unsupported action list, including the reasons for the lack of support */
|
|
214
|
+
RequestedFields["UNSUPPORTED_ACTION"] = "UNSUPPORTED_ACTION";
|
|
215
|
+
})(RequestedFields || (RequestedFields = {}));
|
|
216
|
+
export var InvoiceStatus;
|
|
217
|
+
(function (InvoiceStatus) {
|
|
218
|
+
InvoiceStatus["UNKNOWN"] = "UNKNOWN";
|
|
219
|
+
InvoiceStatus["OPEN"] = "OPEN";
|
|
220
|
+
InvoiceStatus["PAID"] = "PAID";
|
|
221
|
+
InvoiceStatus["FAILED"] = "FAILED";
|
|
222
|
+
InvoiceStatus["ATTEMPT_FAILED"] = "ATTEMPT_FAILED";
|
|
223
|
+
InvoiceStatus["CANCELED"] = "CANCELED";
|
|
224
|
+
})(InvoiceStatus || (InvoiceStatus = {}));
|
|
225
|
+
export var CollectionMethod;
|
|
226
|
+
(function (CollectionMethod) {
|
|
227
|
+
CollectionMethod["UNKNOWN"] = "UNKNOWN";
|
|
228
|
+
CollectionMethod["AUTO_CHARGE"] = "AUTO_CHARGE";
|
|
229
|
+
CollectionMethod["OFFLINE"] = "OFFLINE";
|
|
230
|
+
CollectionMethod["SEND_INVOICE"] = "SEND_INVOICE";
|
|
231
|
+
})(CollectionMethod || (CollectionMethod = {}));
|
|
232
|
+
export var CreationMode;
|
|
233
|
+
(function (CreationMode) {
|
|
234
|
+
CreationMode["UNKNOWN"] = "UNKNOWN";
|
|
235
|
+
CreationMode["SYSTEM"] = "SYSTEM";
|
|
236
|
+
CreationMode["MANUAL"] = "MANUAL";
|
|
237
|
+
})(CreationMode || (CreationMode = {}));
|
|
238
|
+
export var PaymentAttemptStatus;
|
|
239
|
+
(function (PaymentAttemptStatus) {
|
|
240
|
+
PaymentAttemptStatus["UNKNOWN"] = "UNKNOWN";
|
|
241
|
+
PaymentAttemptStatus["SCHEDULED"] = "SCHEDULED";
|
|
242
|
+
PaymentAttemptStatus["IN_PROGRESS"] = "IN_PROGRESS";
|
|
243
|
+
PaymentAttemptStatus["PAID"] = "PAID";
|
|
244
|
+
PaymentAttemptStatus["DECLINED"] = "DECLINED";
|
|
245
|
+
PaymentAttemptStatus["TECHNICAL_FAILURE"] = "TECHNICAL_FAILURE";
|
|
246
|
+
PaymentAttemptStatus["CANCELED"] = "CANCELED";
|
|
247
|
+
PaymentAttemptStatus["PENDING"] = "PENDING";
|
|
248
|
+
})(PaymentAttemptStatus || (PaymentAttemptStatus = {}));
|
|
249
|
+
export var IdentityType;
|
|
250
|
+
(function (IdentityType) {
|
|
251
|
+
/** Identity type undefined */
|
|
252
|
+
IdentityType["UNDEFINED"] = "UNDEFINED";
|
|
253
|
+
/** Subscription is associated with a member ID */
|
|
254
|
+
IdentityType["MEMBER"] = "MEMBER";
|
|
255
|
+
/** Subscriptions is associated with a contact ID */
|
|
256
|
+
IdentityType["CONTACT"] = "CONTACT";
|
|
257
|
+
})(IdentityType || (IdentityType = {}));
|
|
258
|
+
export var SubscriptionType;
|
|
259
|
+
(function (SubscriptionType) {
|
|
260
|
+
SubscriptionType["UNDEFINED"] = "UNDEFINED";
|
|
261
|
+
/** Payments made by the subscriber */
|
|
262
|
+
SubscriptionType["ONLINE"] = "ONLINE";
|
|
263
|
+
/** Payments managed manually by the site owner */
|
|
264
|
+
SubscriptionType["OFFLINE"] = "OFFLINE";
|
|
265
|
+
})(SubscriptionType || (SubscriptionType = {}));
|
|
266
|
+
export var V1SubscriptionStatusEnumSubscriptionStatus;
|
|
267
|
+
(function (V1SubscriptionStatusEnumSubscriptionStatus) {
|
|
268
|
+
/** Subscription status undefined */
|
|
269
|
+
V1SubscriptionStatusEnumSubscriptionStatus["UNDEFINED"] = "UNDEFINED";
|
|
270
|
+
/** Subscription created, but hasn't been paid for yet. This status if filtered out in ListSubscriptions response by default. */
|
|
271
|
+
V1SubscriptionStatusEnumSubscriptionStatus["DRAFT"] = "DRAFT";
|
|
272
|
+
/** Subscription has been paid for, but the start date is in the future */
|
|
273
|
+
V1SubscriptionStatusEnumSubscriptionStatus["PENDING"] = "PENDING";
|
|
274
|
+
/** Subscription is active */
|
|
275
|
+
V1SubscriptionStatusEnumSubscriptionStatus["ACTIVE"] = "ACTIVE";
|
|
276
|
+
/** Subscription has expired */
|
|
277
|
+
V1SubscriptionStatusEnumSubscriptionStatus["EXPIRED"] = "EXPIRED";
|
|
278
|
+
/** Subscription has been canceled */
|
|
279
|
+
V1SubscriptionStatusEnumSubscriptionStatus["CANCELED"] = "CANCELED";
|
|
280
|
+
/** Subscription has been set to be canceled at a future date */
|
|
281
|
+
V1SubscriptionStatusEnumSubscriptionStatus["PENDING_CANCELLATION"] = "PENDING_CANCELLATION";
|
|
282
|
+
/** Subscription is suspended */
|
|
283
|
+
V1SubscriptionStatusEnumSubscriptionStatus["SUSPENDED"] = "SUSPENDED";
|
|
284
|
+
})(V1SubscriptionStatusEnumSubscriptionStatus || (V1SubscriptionStatusEnumSubscriptionStatus = {}));
|
|
285
|
+
export var PaymentStatusEnumPaymentStatus;
|
|
286
|
+
(function (PaymentStatusEnumPaymentStatus) {
|
|
287
|
+
/** Payment status undefined */
|
|
288
|
+
PaymentStatusEnumPaymentStatus["UNDEFINED"] = "UNDEFINED";
|
|
289
|
+
/** Payment has been paid */
|
|
290
|
+
PaymentStatusEnumPaymentStatus["PAID"] = "PAID";
|
|
291
|
+
/** Payment has been refunded */
|
|
292
|
+
PaymentStatusEnumPaymentStatus["REFUNDED"] = "REFUNDED";
|
|
293
|
+
/** Recurring payment has failed */
|
|
294
|
+
PaymentStatusEnumPaymentStatus["FAILED"] = "FAILED";
|
|
295
|
+
/** Payment has not been paid */
|
|
296
|
+
PaymentStatusEnumPaymentStatus["UNPAID"] = "UNPAID";
|
|
297
|
+
/** Billing has been initialized, but actual charge is yet to be made. Can happen for free trial and PayPal */
|
|
298
|
+
PaymentStatusEnumPaymentStatus["PENDING"] = "PENDING";
|
|
299
|
+
})(PaymentStatusEnumPaymentStatus || (PaymentStatusEnumPaymentStatus = {}));
|
|
300
|
+
/** Frequency unit of recurring payment */
|
|
301
|
+
export var SubscriptionFrequency;
|
|
302
|
+
(function (SubscriptionFrequency) {
|
|
303
|
+
SubscriptionFrequency["UNDEFINED"] = "UNDEFINED";
|
|
304
|
+
SubscriptionFrequency["DAY"] = "DAY";
|
|
305
|
+
SubscriptionFrequency["WEEK"] = "WEEK";
|
|
306
|
+
SubscriptionFrequency["MONTH"] = "MONTH";
|
|
307
|
+
SubscriptionFrequency["YEAR"] = "YEAR";
|
|
308
|
+
})(SubscriptionFrequency || (SubscriptionFrequency = {}));
|
|
309
|
+
export var CancellationInitiator;
|
|
310
|
+
(function (CancellationInitiator) {
|
|
311
|
+
/** Cancellation initiator undefined */
|
|
312
|
+
CancellationInitiator["UNDEFINED"] = "UNDEFINED";
|
|
313
|
+
/** Subscription was canceled by site owner (default if canceled by user or service identity) */
|
|
314
|
+
CancellationInitiator["OWNER"] = "OWNER";
|
|
315
|
+
/** Subscription was canceled by member (default if canceled by member identity) */
|
|
316
|
+
CancellationInitiator["MEMBER"] = "MEMBER";
|
|
317
|
+
/** Subscription was canceled because of payment failure */
|
|
318
|
+
CancellationInitiator["PAYMENT_FAILURE"] = "PAYMENT_FAILURE";
|
|
319
|
+
/** Subscription was canceled because of payment setup failure */
|
|
320
|
+
CancellationInitiator["SETUP_FAILURE"] = "SETUP_FAILURE";
|
|
321
|
+
})(CancellationInitiator || (CancellationInitiator = {}));
|
|
322
|
+
export var Status;
|
|
323
|
+
(function (Status) {
|
|
324
|
+
Status["UNDEFINED"] = "UNDEFINED";
|
|
325
|
+
Status["ACTIVE"] = "ACTIVE";
|
|
326
|
+
Status["ENDED"] = "ENDED";
|
|
327
|
+
})(Status || (Status = {}));
|
|
328
|
+
export var PaymentTestMode;
|
|
329
|
+
(function (PaymentTestMode) {
|
|
330
|
+
PaymentTestMode["REGULAR"] = "REGULAR";
|
|
331
|
+
PaymentTestMode["FAIL_TECHNICAL"] = "FAIL_TECHNICAL";
|
|
332
|
+
PaymentTestMode["FAIL_DECLINE"] = "FAIL_DECLINE";
|
|
333
|
+
PaymentTestMode["FAIL_RETRYABLE_DECLINE"] = "FAIL_RETRYABLE_DECLINE";
|
|
334
|
+
})(PaymentTestMode || (PaymentTestMode = {}));
|
|
335
|
+
export var RevivePolicy;
|
|
336
|
+
(function (RevivePolicy) {
|
|
337
|
+
RevivePolicy["SIMPLE"] = "SIMPLE";
|
|
338
|
+
RevivePolicy["RESUME"] = "RESUME";
|
|
339
|
+
})(RevivePolicy || (RevivePolicy = {}));
|
|
340
|
+
/** @public
|
|
341
|
+
* @documentationMaturity preview
|
|
342
|
+
* @requiredField subscriptionId
|
|
343
|
+
* @permissionId subscriptions.view
|
|
344
|
+
* @permissionScope Manage Events
|
|
345
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
346
|
+
* @applicableIdentity APP
|
|
347
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionHistoryService.ListSubscriptionHistory
|
|
348
|
+
*/
|
|
349
|
+
export async function listSubscriptionHistory(subscriptionId, options) {
|
|
350
|
+
// @ts-ignore
|
|
351
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
352
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
353
|
+
subscriptionId: subscriptionId,
|
|
354
|
+
mode: options?.mode,
|
|
355
|
+
cursor: options?.cursor,
|
|
356
|
+
});
|
|
357
|
+
const reqOpts = ambassadorWixBillingV1Subscription.listSubscriptionHistory(payload);
|
|
358
|
+
sideEffects?.onSiteCall?.();
|
|
359
|
+
try {
|
|
360
|
+
const result = await httpClient.request(reqOpts);
|
|
361
|
+
sideEffects?.onSuccess?.(result);
|
|
362
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
363
|
+
{
|
|
364
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
365
|
+
paths: [
|
|
366
|
+
{
|
|
367
|
+
path: 'historyEntries.event.created.subscription.billingSettings.billingAddress.address',
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
path: 'historyEntries.event.created.subscription.shippingAddress.address',
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
path: 'historyEntries.event.updated.current.billingSettings.billingAddress.address',
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
path: 'historyEntries.event.updated.current.shippingAddress.address',
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
path: 'historyEntries.event.updated.previous.billingSettings.billingAddress.address',
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
path: 'historyEntries.event.updated.previous.shippingAddress.address',
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
path: 'historyEntries.event.activated.subscription.billingSettings.billingAddress.address',
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
path: 'historyEntries.event.activated.subscription.shippingAddress.address',
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
path: 'historyEntries.event.ended.subscription.billingSettings.billingAddress.address',
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
path: 'historyEntries.event.ended.subscription.shippingAddress.address',
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
path: 'historyEntries.event.canceled.subscription.billingSettings.billingAddress.address',
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
path: 'historyEntries.event.canceled.subscription.shippingAddress.address',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
path: 'historyEntries.event.paused.subscription.billingSettings.billingAddress.address',
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
path: 'historyEntries.event.paused.subscription.shippingAddress.address',
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
path: 'historyEntries.event.resumed.subscription.billingSettings.billingAddress.address',
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
path: 'historyEntries.event.resumed.subscription.shippingAddress.address',
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
path: 'historyEntries.event.pauseRequested.subscription.billingSettings.billingAddress.address',
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
path: 'historyEntries.event.pauseRequested.subscription.shippingAddress.address',
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
path: 'historyEntries.event.resumeRequested.subscription.billingSettings.billingAddress.address',
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
path: 'historyEntries.event.resumeRequested.subscription.shippingAddress.address',
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
path: 'historyEntries.event.scheduledPauseCanceled.subscription.billingSettings.billingAddress.address',
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
path: 'historyEntries.event.scheduledPauseCanceled.subscription.shippingAddress.address',
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
path: 'historyEntries.event.scheduledResumeCanceled.subscription.billingSettings.billingAddress.address',
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
path: 'historyEntries.event.scheduledResumeCanceled.subscription.shippingAddress.address',
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
path: 'historyEntries.event.billingCycleStarted.subscription.billingSettings.billingAddress.address',
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
path: 'historyEntries.event.billingCycleStarted.subscription.shippingAddress.address',
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
path: 'historyEntries.event.autoRenewalTurnedOn.subscription.billingSettings.billingAddress.address',
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
path: 'historyEntries.event.autoRenewalTurnedOn.subscription.shippingAddress.address',
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
path: 'historyEntries.event.autoRenewalTurnedOff.subscription.billingSettings.billingAddress.address',
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
path: 'historyEntries.event.autoRenewalTurnedOff.subscription.shippingAddress.address',
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
path: 'historyEntries.event.cycleReadyToPay.subscription.billingSettings.billingAddress.address',
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
path: 'historyEntries.event.cycleReadyToPay.subscription.shippingAddress.address',
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
path: 'historyEntries.event.extended.subscription.billingSettings.billingAddress.address',
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
path: 'historyEntries.event.extended.subscription.shippingAddress.address',
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
path: 'historyEntries.event.initialPurchaseCompleted.subscription.billingSettings.billingAddress.address',
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
path: 'historyEntries.event.initialPurchaseCompleted.subscription.shippingAddress.address',
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
path: 'historyEntries.event.latestInvoiceMarkedAsPaid.subscription.billingSettings.billingAddress.address',
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
path: 'historyEntries.event.latestInvoiceMarkedAsPaid.subscription.shippingAddress.address',
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
path: 'historyEntries.event.revived.subscription.billingSettings.billingAddress.address',
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
path: 'historyEntries.event.revived.subscription.shippingAddress.address',
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
path: 'historyEntries.event.billingDateUpdated.subscription.billingSettings.billingAddress.address',
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
path: 'historyEntries.event.billingDateUpdated.subscription.shippingAddress.address',
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
path: 'historyEntries.event.futureUpdatesRequested.subscription.billingSettings.billingAddress.address',
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
path: 'historyEntries.event.futureUpdatesRequested.subscription.shippingAddress.address',
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
path: 'historyEntries.event.updatesApplied.subscription.billingSettings.billingAddress.address',
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
path: 'historyEntries.event.updatesApplied.subscription.shippingAddress.address',
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
path: 'historyEntries.event.resetPendingUpdates.subscription.billingSettings.billingAddress.address',
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
path: 'historyEntries.event.resetPendingUpdates.subscription.shippingAddress.address',
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
path: 'historyEntries.event.gracePeriodStarted.subscription.billingSettings.billingAddress.address',
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
path: 'historyEntries.event.gracePeriodStarted.subscription.shippingAddress.address',
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
path: 'historyEntries.event.gracePeriodEnded.subscription.billingSettings.billingAddress.address',
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
path: 'historyEntries.event.gracePeriodEnded.subscription.shippingAddress.address',
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
path: 'historyEntries.event.paymentMethodUpdated.subscription.billingSettings.billingAddress.address',
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
path: 'historyEntries.event.paymentMethodUpdated.subscription.shippingAddress.address',
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
path: 'historyEntries.event.collectionMethodUpdated.subscription.billingSettings.billingAddress.address',
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
path: 'historyEntries.event.collectionMethodUpdated.subscription.shippingAddress.address',
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
path: 'historyEntries.event.freeTrailStarted.subscription.billingSettings.billingAddress.address',
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
path: 'historyEntries.event.freeTrailStarted.subscription.shippingAddress.address',
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
path: 'historyEntries.event.freeTrailEnded.subscription.billingSettings.billingAddress.address',
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
path: 'historyEntries.event.freeTrailEnded.subscription.shippingAddress.address',
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
path: 'historyEntries.event.invoiceMarkedAsPaid.subscription.billingSettings.billingAddress.address',
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
path: 'historyEntries.event.invoiceMarkedAsPaid.subscription.shippingAddress.address',
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
path: 'historyEntries.event.initiatePaymentMethodSetup.subscription.billingSettings.billingAddress.address',
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
path: 'historyEntries.event.initiatePaymentMethodSetup.subscription.shippingAddress.address',
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
path: 'historyEntries.event.subscriptionBoAction.subscription.billingSettings.billingAddress.address',
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
path: 'historyEntries.event.subscriptionBoAction.subscription.shippingAddress.address',
|
|
563
|
+
},
|
|
564
|
+
],
|
|
565
|
+
},
|
|
566
|
+
]));
|
|
567
|
+
}
|
|
568
|
+
catch (err) {
|
|
569
|
+
const transformedError = sdkTransformError(err, {
|
|
570
|
+
spreadPathsToArguments: {},
|
|
571
|
+
explicitPathsToArguments: {
|
|
572
|
+
subscriptionId: '$[0]',
|
|
573
|
+
mode: '$[1].mode',
|
|
574
|
+
cursor: '$[1].cursor',
|
|
575
|
+
},
|
|
576
|
+
singleArgumentUnchanged: false,
|
|
577
|
+
}, ['subscriptionId', 'options']);
|
|
578
|
+
sideEffects?.onError?.(err);
|
|
579
|
+
throw transformedError;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Identity must be a site member and customer subscription belongs to
|
|
584
|
+
* @public
|
|
585
|
+
* @documentationMaturity preview
|
|
586
|
+
* @requiredField _id
|
|
587
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.GetSubscription
|
|
588
|
+
*/
|
|
589
|
+
export async function customerGetSubscription(_id) {
|
|
590
|
+
// @ts-ignore
|
|
591
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
592
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
593
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerGetSubscription(payload);
|
|
594
|
+
sideEffects?.onSiteCall?.();
|
|
595
|
+
try {
|
|
596
|
+
const result = await httpClient.request(reqOpts);
|
|
597
|
+
sideEffects?.onSuccess?.(result);
|
|
598
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
599
|
+
{
|
|
600
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
601
|
+
paths: [
|
|
602
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
603
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
604
|
+
],
|
|
605
|
+
},
|
|
606
|
+
]));
|
|
607
|
+
}
|
|
608
|
+
catch (err) {
|
|
609
|
+
const transformedError = sdkTransformError(err, {
|
|
610
|
+
spreadPathsToArguments: {},
|
|
611
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
612
|
+
singleArgumentUnchanged: false,
|
|
613
|
+
}, ['_id']);
|
|
614
|
+
sideEffects?.onError?.(err);
|
|
615
|
+
throw transformedError;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Identity must be a site member and customer subscription belongs to
|
|
620
|
+
* @public
|
|
621
|
+
* @documentationMaturity preview
|
|
622
|
+
* @requiredField _id
|
|
623
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.CancelSubscription
|
|
624
|
+
*/
|
|
625
|
+
export async function customerCancelSubscription(_id, options) {
|
|
626
|
+
// @ts-ignore
|
|
627
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
628
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
629
|
+
id: _id,
|
|
630
|
+
reason: options?.reason,
|
|
631
|
+
});
|
|
632
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerCancelSubscription(payload);
|
|
633
|
+
sideEffects?.onSiteCall?.();
|
|
634
|
+
try {
|
|
635
|
+
const result = await httpClient.request(reqOpts);
|
|
636
|
+
sideEffects?.onSuccess?.(result);
|
|
637
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
638
|
+
{
|
|
639
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
640
|
+
paths: [
|
|
641
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
642
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
643
|
+
],
|
|
644
|
+
},
|
|
645
|
+
]));
|
|
646
|
+
}
|
|
647
|
+
catch (err) {
|
|
648
|
+
const transformedError = sdkTransformError(err, {
|
|
649
|
+
spreadPathsToArguments: {},
|
|
650
|
+
explicitPathsToArguments: { id: '$[0]', reason: '$[1].reason' },
|
|
651
|
+
singleArgumentUnchanged: false,
|
|
652
|
+
}, ['_id', 'options']);
|
|
653
|
+
sideEffects?.onError?.(err);
|
|
654
|
+
throw transformedError;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Identity must be a site member and customer subscription belongs to
|
|
659
|
+
* @public
|
|
660
|
+
* @documentationMaturity preview
|
|
661
|
+
* @requiredField _id
|
|
662
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.TurnOnSubscriptionAutoRenewal
|
|
663
|
+
*/
|
|
664
|
+
export async function customerTurnOnSubscriptionAutoRenewal(_id, options) {
|
|
665
|
+
// @ts-ignore
|
|
666
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
667
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
668
|
+
id: _id,
|
|
669
|
+
reason: options?.reason,
|
|
670
|
+
});
|
|
671
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerTurnOnSubscriptionAutoRenewal(payload);
|
|
672
|
+
sideEffects?.onSiteCall?.();
|
|
673
|
+
try {
|
|
674
|
+
const result = await httpClient.request(reqOpts);
|
|
675
|
+
sideEffects?.onSuccess?.(result);
|
|
676
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
677
|
+
{
|
|
678
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
679
|
+
paths: [
|
|
680
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
681
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
682
|
+
],
|
|
683
|
+
},
|
|
684
|
+
]));
|
|
685
|
+
}
|
|
686
|
+
catch (err) {
|
|
687
|
+
const transformedError = sdkTransformError(err, {
|
|
688
|
+
spreadPathsToArguments: {},
|
|
689
|
+
explicitPathsToArguments: { id: '$[0]', reason: '$[1].reason' },
|
|
690
|
+
singleArgumentUnchanged: false,
|
|
691
|
+
}, ['_id', 'options']);
|
|
692
|
+
sideEffects?.onError?.(err);
|
|
693
|
+
throw transformedError;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Identity must be a site member and customer subscription belongs to
|
|
698
|
+
* @public
|
|
699
|
+
* @documentationMaturity preview
|
|
700
|
+
* @requiredField _id
|
|
701
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.TurnOffSubscriptionAutoRenewal
|
|
702
|
+
*/
|
|
703
|
+
export async function customerTurnOffSubscriptionAutoRenewal(_id, options) {
|
|
704
|
+
// @ts-ignore
|
|
705
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
706
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
707
|
+
id: _id,
|
|
708
|
+
reason: options?.reason,
|
|
709
|
+
});
|
|
710
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerTurnOffSubscriptionAutoRenewal(payload);
|
|
711
|
+
sideEffects?.onSiteCall?.();
|
|
712
|
+
try {
|
|
713
|
+
const result = await httpClient.request(reqOpts);
|
|
714
|
+
sideEffects?.onSuccess?.(result);
|
|
715
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
716
|
+
{
|
|
717
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
718
|
+
paths: [
|
|
719
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
720
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
721
|
+
],
|
|
722
|
+
},
|
|
723
|
+
]));
|
|
724
|
+
}
|
|
725
|
+
catch (err) {
|
|
726
|
+
const transformedError = sdkTransformError(err, {
|
|
727
|
+
spreadPathsToArguments: {},
|
|
728
|
+
explicitPathsToArguments: { id: '$[0]', reason: '$[1].reason' },
|
|
729
|
+
singleArgumentUnchanged: false,
|
|
730
|
+
}, ['_id', 'options']);
|
|
731
|
+
sideEffects?.onError?.(err);
|
|
732
|
+
throw transformedError;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
/** @param _id - The ID of the subscription to be extended
|
|
736
|
+
* @public
|
|
737
|
+
* @documentationMaturity preview
|
|
738
|
+
* @requiredField _id
|
|
739
|
+
* @requiredField options.billingCyclesToAdd
|
|
740
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.ExtendSubscription
|
|
741
|
+
*/
|
|
742
|
+
export async function customerExtendSubscription(_id, options) {
|
|
743
|
+
// @ts-ignore
|
|
744
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
745
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
746
|
+
id: _id,
|
|
747
|
+
reason: options?.reason,
|
|
748
|
+
billingCyclesToAdd: options?.billingCyclesToAdd,
|
|
749
|
+
});
|
|
750
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerExtendSubscription(payload);
|
|
751
|
+
sideEffects?.onSiteCall?.();
|
|
752
|
+
try {
|
|
753
|
+
const result = await httpClient.request(reqOpts);
|
|
754
|
+
sideEffects?.onSuccess?.(result);
|
|
755
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
756
|
+
{
|
|
757
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
758
|
+
paths: [
|
|
759
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
760
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
761
|
+
],
|
|
762
|
+
},
|
|
763
|
+
]));
|
|
764
|
+
}
|
|
765
|
+
catch (err) {
|
|
766
|
+
const transformedError = sdkTransformError(err, {
|
|
767
|
+
spreadPathsToArguments: {},
|
|
768
|
+
explicitPathsToArguments: {
|
|
769
|
+
id: '$[0]',
|
|
770
|
+
reason: '$[1].reason',
|
|
771
|
+
billingCyclesToAdd: '$[1].billingCyclesToAdd',
|
|
772
|
+
},
|
|
773
|
+
singleArgumentUnchanged: false,
|
|
774
|
+
}, ['_id', 'options']);
|
|
775
|
+
sideEffects?.onError?.(err);
|
|
776
|
+
throw transformedError;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* identity must be a site member
|
|
781
|
+
* @public
|
|
782
|
+
* @documentationMaturity preview
|
|
783
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.QuerySubscriptions
|
|
784
|
+
*/
|
|
785
|
+
export async function customerQuerySubscriptions(options) {
|
|
786
|
+
// @ts-ignore
|
|
787
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
788
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
789
|
+
query: options?.query,
|
|
790
|
+
});
|
|
791
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerQuerySubscriptions(payload);
|
|
792
|
+
sideEffects?.onSiteCall?.();
|
|
793
|
+
try {
|
|
794
|
+
const result = await httpClient.request(reqOpts);
|
|
795
|
+
sideEffects?.onSuccess?.(result);
|
|
796
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
797
|
+
{
|
|
798
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
799
|
+
paths: [
|
|
800
|
+
{ path: 'subscriptions.billingSettings.billingAddress.address' },
|
|
801
|
+
{ path: 'subscriptions.shippingAddress.address' },
|
|
802
|
+
],
|
|
803
|
+
},
|
|
804
|
+
]));
|
|
805
|
+
}
|
|
806
|
+
catch (err) {
|
|
807
|
+
const transformedError = sdkTransformError(err, {
|
|
808
|
+
spreadPathsToArguments: {},
|
|
809
|
+
explicitPathsToArguments: { query: '$[0].query' },
|
|
810
|
+
singleArgumentUnchanged: false,
|
|
811
|
+
}, ['options']);
|
|
812
|
+
sideEffects?.onError?.(err);
|
|
813
|
+
throw transformedError;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Update subscription's payment method.
|
|
818
|
+
* Supported only for recurring subscriptions or one time subscriptions during free trial.
|
|
819
|
+
* @param _id - Subscription ID
|
|
820
|
+
* @public
|
|
821
|
+
* @documentationMaturity preview
|
|
822
|
+
* @requiredField _id
|
|
823
|
+
* @requiredField paymentMethodId
|
|
824
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.UpdateSubscriptionPaymentMethod
|
|
825
|
+
*/
|
|
826
|
+
export async function customerUpdateSubscriptionPaymentMethod(_id, paymentMethodId) {
|
|
827
|
+
// @ts-ignore
|
|
828
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
829
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
830
|
+
id: _id,
|
|
831
|
+
paymentMethodId: paymentMethodId,
|
|
832
|
+
});
|
|
833
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerUpdateSubscriptionPaymentMethod(payload);
|
|
834
|
+
sideEffects?.onSiteCall?.();
|
|
835
|
+
try {
|
|
836
|
+
const result = await httpClient.request(reqOpts);
|
|
837
|
+
sideEffects?.onSuccess?.(result);
|
|
838
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
839
|
+
{
|
|
840
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
841
|
+
paths: [
|
|
842
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
843
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
844
|
+
],
|
|
845
|
+
},
|
|
846
|
+
]));
|
|
847
|
+
}
|
|
848
|
+
catch (err) {
|
|
849
|
+
const transformedError = sdkTransformError(err, {
|
|
850
|
+
spreadPathsToArguments: {},
|
|
851
|
+
explicitPathsToArguments: { id: '$[0]', paymentMethodId: '$[1]' },
|
|
852
|
+
singleArgumentUnchanged: false,
|
|
853
|
+
}, ['_id', 'paymentMethodId']);
|
|
854
|
+
sideEffects?.onError?.(err);
|
|
855
|
+
throw transformedError;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
/** @public
|
|
859
|
+
* @documentationMaturity preview
|
|
860
|
+
* @requiredField _id
|
|
861
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.AllowedActions
|
|
862
|
+
*/
|
|
863
|
+
export async function customerAllowedActions(_id) {
|
|
864
|
+
// @ts-ignore
|
|
865
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
866
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
867
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerAllowedActions(payload);
|
|
868
|
+
sideEffects?.onSiteCall?.();
|
|
869
|
+
try {
|
|
870
|
+
const result = await httpClient.request(reqOpts);
|
|
871
|
+
sideEffects?.onSuccess?.(result);
|
|
872
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
873
|
+
}
|
|
874
|
+
catch (err) {
|
|
875
|
+
const transformedError = sdkTransformError(err, {
|
|
876
|
+
spreadPathsToArguments: {},
|
|
877
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
878
|
+
singleArgumentUnchanged: false,
|
|
879
|
+
}, ['_id']);
|
|
880
|
+
sideEffects?.onError?.(err);
|
|
881
|
+
throw transformedError;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* List future subscriptions charges.
|
|
886
|
+
* @param _id - Subscription id upcoming charge to be previewed for
|
|
887
|
+
* @public
|
|
888
|
+
* @documentationMaturity preview
|
|
889
|
+
* @requiredField _id
|
|
890
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.ListUpcomingCharges
|
|
891
|
+
*/
|
|
892
|
+
export async function customerListUpcomingCharges(_id) {
|
|
893
|
+
// @ts-ignore
|
|
894
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
895
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
896
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerListUpcomingCharges(payload);
|
|
897
|
+
sideEffects?.onSiteCall?.();
|
|
898
|
+
try {
|
|
899
|
+
const result = await httpClient.request(reqOpts);
|
|
900
|
+
sideEffects?.onSuccess?.(result);
|
|
901
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
902
|
+
}
|
|
903
|
+
catch (err) {
|
|
904
|
+
const transformedError = sdkTransformError(err, {
|
|
905
|
+
spreadPathsToArguments: {},
|
|
906
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
907
|
+
singleArgumentUnchanged: false,
|
|
908
|
+
}, ['_id']);
|
|
909
|
+
sideEffects?.onError?.(err);
|
|
910
|
+
throw transformedError;
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Creates auto-charge order that can be paid by customer
|
|
915
|
+
* @public
|
|
916
|
+
* @documentationMaturity preview
|
|
917
|
+
* @requiredField _id
|
|
918
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.CustomerSubscriptionsService.InitiatePaymentMethodSetup
|
|
919
|
+
*/
|
|
920
|
+
export async function customerInitiatePaymentMethodSetup(_id, options) {
|
|
921
|
+
// @ts-ignore
|
|
922
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
923
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
924
|
+
id: _id,
|
|
925
|
+
paymentMode: options?.paymentMode,
|
|
926
|
+
paymentSettings: options?.paymentSettings,
|
|
927
|
+
});
|
|
928
|
+
const reqOpts = ambassadorWixBillingV1Subscription.customerInitiatePaymentMethodSetup(payload);
|
|
929
|
+
sideEffects?.onSiteCall?.();
|
|
930
|
+
try {
|
|
931
|
+
const result = await httpClient.request(reqOpts);
|
|
932
|
+
sideEffects?.onSuccess?.(result);
|
|
933
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
934
|
+
}
|
|
935
|
+
catch (err) {
|
|
936
|
+
const transformedError = sdkTransformError(err, {
|
|
937
|
+
spreadPathsToArguments: {},
|
|
938
|
+
explicitPathsToArguments: {
|
|
939
|
+
id: '$[0]',
|
|
940
|
+
paymentMode: '$[1].paymentMode',
|
|
941
|
+
paymentSettings: '$[1].paymentSettings',
|
|
942
|
+
},
|
|
943
|
+
singleArgumentUnchanged: false,
|
|
944
|
+
}, ['_id', 'options']);
|
|
945
|
+
sideEffects?.onError?.(err);
|
|
946
|
+
throw transformedError;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Returns a single subscription by its id
|
|
951
|
+
* @public
|
|
952
|
+
* @documentationMaturity preview
|
|
953
|
+
* @requiredField _id
|
|
954
|
+
* @permissionId subscriptions.view
|
|
955
|
+
* @permissionScope Manage Events
|
|
956
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
957
|
+
* @applicableIdentity APP
|
|
958
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.GetSubscription
|
|
959
|
+
*/
|
|
960
|
+
export async function getSubscription(_id) {
|
|
961
|
+
// @ts-ignore
|
|
962
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
963
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ id: _id });
|
|
964
|
+
const reqOpts = ambassadorWixBillingV1Subscription.getSubscription(payload);
|
|
965
|
+
sideEffects?.onSiteCall?.();
|
|
966
|
+
try {
|
|
967
|
+
const result = await httpClient.request(reqOpts);
|
|
968
|
+
sideEffects?.onSuccess?.(result);
|
|
969
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
970
|
+
{
|
|
971
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
972
|
+
paths: [
|
|
973
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
974
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
975
|
+
],
|
|
976
|
+
},
|
|
977
|
+
]));
|
|
978
|
+
}
|
|
979
|
+
catch (err) {
|
|
980
|
+
const transformedError = sdkTransformError(err, {
|
|
981
|
+
spreadPathsToArguments: {},
|
|
982
|
+
explicitPathsToArguments: { id: '$[0]' },
|
|
983
|
+
singleArgumentUnchanged: false,
|
|
984
|
+
}, ['_id']);
|
|
985
|
+
sideEffects?.onError?.(err);
|
|
986
|
+
throw transformedError;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Update subscription's payment method.
|
|
991
|
+
* Supported only for recurring subscriptions or one time subscriptions during free trial.
|
|
992
|
+
* @param _id - Subscription ID
|
|
993
|
+
* @public
|
|
994
|
+
* @documentationMaturity preview
|
|
995
|
+
* @requiredField _id
|
|
996
|
+
* @requiredField paymentMethodId
|
|
997
|
+
* @permissionId subscriptions.manage
|
|
998
|
+
* @permissionScope Manage Orders
|
|
999
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1000
|
+
* @applicableIdentity APP
|
|
1001
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.UpdateSubscriptionPaymentMethod
|
|
1002
|
+
*/
|
|
1003
|
+
export async function updateSubscriptionPaymentMethod(_id, paymentMethodId) {
|
|
1004
|
+
// @ts-ignore
|
|
1005
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1006
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1007
|
+
id: _id,
|
|
1008
|
+
paymentMethodId: paymentMethodId,
|
|
1009
|
+
});
|
|
1010
|
+
const reqOpts = ambassadorWixBillingV1Subscription.updateSubscriptionPaymentMethod(payload);
|
|
1011
|
+
sideEffects?.onSiteCall?.();
|
|
1012
|
+
try {
|
|
1013
|
+
const result = await httpClient.request(reqOpts);
|
|
1014
|
+
sideEffects?.onSuccess?.(result);
|
|
1015
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1016
|
+
{
|
|
1017
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1018
|
+
paths: [
|
|
1019
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1020
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1021
|
+
],
|
|
1022
|
+
},
|
|
1023
|
+
]));
|
|
1024
|
+
}
|
|
1025
|
+
catch (err) {
|
|
1026
|
+
const transformedError = sdkTransformError(err, {
|
|
1027
|
+
spreadPathsToArguments: {},
|
|
1028
|
+
explicitPathsToArguments: { id: '$[0]', paymentMethodId: '$[1]' },
|
|
1029
|
+
singleArgumentUnchanged: false,
|
|
1030
|
+
}, ['_id', 'paymentMethodId']);
|
|
1031
|
+
sideEffects?.onError?.(err);
|
|
1032
|
+
throw transformedError;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Updates the next billing date for a subscription.
|
|
1037
|
+
*
|
|
1038
|
+
*
|
|
1039
|
+
* Updating the billing date may add a proration charge or credit to the next
|
|
1040
|
+
* invoice. The customer must pay more in case you extend the current billing
|
|
1041
|
+
* cycle. They pay less in case you shorten the current billing cycle. You can
|
|
1042
|
+
* choose whether BASS automatically calculates the proration amount based on
|
|
1043
|
+
* the number of days added to or removed from the current billing cycle.
|
|
1044
|
+
* Alternatively, you can pass a proration amount based on your own custom
|
|
1045
|
+
* calculation. The custom proration amount can't exceed the total of the
|
|
1046
|
+
* current billing cycle.
|
|
1047
|
+
* @param _id - ID of the subscription to update the billing date for.
|
|
1048
|
+
* @param billingDate - New billing date in `YYYY-MM-DDThh:mm:ss:sssZ` format.
|
|
1049
|
+
* @public
|
|
1050
|
+
* @documentationMaturity preview
|
|
1051
|
+
* @requiredField _id
|
|
1052
|
+
* @requiredField billingDate
|
|
1053
|
+
* @permissionId subscriptions.manage
|
|
1054
|
+
* @permissionScope Manage Orders
|
|
1055
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1056
|
+
* @applicableIdentity APP
|
|
1057
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.UpdateSubscriptionBillingDate
|
|
1058
|
+
*/
|
|
1059
|
+
export async function updateSubscriptionBillingDate(_id, billingDate, options) {
|
|
1060
|
+
// @ts-ignore
|
|
1061
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
1062
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1063
|
+
id: _id,
|
|
1064
|
+
billingDate: billingDate,
|
|
1065
|
+
proration: options?.proration,
|
|
1066
|
+
});
|
|
1067
|
+
const reqOpts = ambassadorWixBillingV1Subscription.updateSubscriptionBillingDate(payload);
|
|
1068
|
+
sideEffects?.onSiteCall?.();
|
|
1069
|
+
try {
|
|
1070
|
+
const result = await httpClient.request(reqOpts);
|
|
1071
|
+
sideEffects?.onSuccess?.(result);
|
|
1072
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1073
|
+
{
|
|
1074
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1075
|
+
paths: [
|
|
1076
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1077
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1078
|
+
],
|
|
1079
|
+
},
|
|
1080
|
+
]));
|
|
1081
|
+
}
|
|
1082
|
+
catch (err) {
|
|
1083
|
+
const transformedError = sdkTransformError(err, {
|
|
1084
|
+
spreadPathsToArguments: {},
|
|
1085
|
+
explicitPathsToArguments: {
|
|
1086
|
+
id: '$[0]',
|
|
1087
|
+
billingDate: '$[1]',
|
|
1088
|
+
proration: '$[2].proration',
|
|
1089
|
+
},
|
|
1090
|
+
singleArgumentUnchanged: false,
|
|
1091
|
+
}, ['_id', 'billingDate', 'options']);
|
|
1092
|
+
sideEffects?.onError?.(err);
|
|
1093
|
+
throw transformedError;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Cancels subscription immediately. Can be canceled by member if subscription policy allows it
|
|
1098
|
+
* Only PENDING, ACTIVE or PAUSED subscriptions can be canceled
|
|
1099
|
+
* @public
|
|
1100
|
+
* @documentationMaturity preview
|
|
1101
|
+
* @requiredField _id
|
|
1102
|
+
* @requiredField actionContext
|
|
1103
|
+
* @permissionId subscriptions.manage
|
|
1104
|
+
* @permissionScope Manage Orders
|
|
1105
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1106
|
+
* @applicableIdentity APP
|
|
1107
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.CancelSubscription
|
|
1108
|
+
*/
|
|
1109
|
+
export async function cancelSubscription(_id, actionContext) {
|
|
1110
|
+
// @ts-ignore
|
|
1111
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1112
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1113
|
+
id: _id,
|
|
1114
|
+
actionContext: actionContext,
|
|
1115
|
+
});
|
|
1116
|
+
const reqOpts = ambassadorWixBillingV1Subscription.cancelSubscription(payload);
|
|
1117
|
+
sideEffects?.onSiteCall?.();
|
|
1118
|
+
try {
|
|
1119
|
+
const result = await httpClient.request(reqOpts);
|
|
1120
|
+
sideEffects?.onSuccess?.(result);
|
|
1121
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1122
|
+
{
|
|
1123
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1124
|
+
paths: [
|
|
1125
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1126
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1127
|
+
],
|
|
1128
|
+
},
|
|
1129
|
+
]));
|
|
1130
|
+
}
|
|
1131
|
+
catch (err) {
|
|
1132
|
+
const transformedError = sdkTransformError(err, {
|
|
1133
|
+
spreadPathsToArguments: {},
|
|
1134
|
+
explicitPathsToArguments: { id: '$[0]', actionContext: '$[1]' },
|
|
1135
|
+
singleArgumentUnchanged: false,
|
|
1136
|
+
}, ['_id', 'actionContext']);
|
|
1137
|
+
sideEffects?.onError?.(err);
|
|
1138
|
+
throw transformedError;
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Pauses subscription now or in future. Possible to pause also payments schedule.
|
|
1143
|
+
* @public
|
|
1144
|
+
* @documentationMaturity preview
|
|
1145
|
+
* @requiredField _id
|
|
1146
|
+
* @requiredField options.actionContext
|
|
1147
|
+
* @permissionId subscriptions.manage
|
|
1148
|
+
* @permissionScope Manage Orders
|
|
1149
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1150
|
+
* @applicableIdentity APP
|
|
1151
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.PauseSubscription
|
|
1152
|
+
*/
|
|
1153
|
+
export async function pauseSubscription(_id, options) {
|
|
1154
|
+
// @ts-ignore
|
|
1155
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1156
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1157
|
+
id: _id,
|
|
1158
|
+
pausePolicy: options?.pausePolicy,
|
|
1159
|
+
pauseAt: options?.pauseAt,
|
|
1160
|
+
pauseAtSchedule: options?.pauseAtSchedule,
|
|
1161
|
+
autoResumeAtSchedule: options?.autoResumeAtSchedule,
|
|
1162
|
+
actionContext: options?.actionContext,
|
|
1163
|
+
});
|
|
1164
|
+
const reqOpts = ambassadorWixBillingV1Subscription.pauseSubscription(payload);
|
|
1165
|
+
sideEffects?.onSiteCall?.();
|
|
1166
|
+
try {
|
|
1167
|
+
const result = await httpClient.request(reqOpts);
|
|
1168
|
+
sideEffects?.onSuccess?.(result);
|
|
1169
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1170
|
+
{
|
|
1171
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1172
|
+
paths: [
|
|
1173
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1174
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1175
|
+
],
|
|
1176
|
+
},
|
|
1177
|
+
]));
|
|
1178
|
+
}
|
|
1179
|
+
catch (err) {
|
|
1180
|
+
const transformedError = sdkTransformError(err, {
|
|
1181
|
+
spreadPathsToArguments: {},
|
|
1182
|
+
explicitPathsToArguments: {
|
|
1183
|
+
id: '$[0]',
|
|
1184
|
+
pausePolicy: '$[1].pausePolicy',
|
|
1185
|
+
pauseAt: '$[1].pauseAt',
|
|
1186
|
+
pauseAtSchedule: '$[1].pauseAtSchedule',
|
|
1187
|
+
autoResumeAtSchedule: '$[1].autoResumeAtSchedule',
|
|
1188
|
+
actionContext: '$[1].actionContext',
|
|
1189
|
+
},
|
|
1190
|
+
singleArgumentUnchanged: false,
|
|
1191
|
+
}, ['_id', 'options']);
|
|
1192
|
+
sideEffects?.onError?.(err);
|
|
1193
|
+
throw transformedError;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Resumes paused subscription now or in future.
|
|
1198
|
+
* @public
|
|
1199
|
+
* @documentationMaturity preview
|
|
1200
|
+
* @requiredField _id
|
|
1201
|
+
* @requiredField options.actionContext
|
|
1202
|
+
* @permissionId subscriptions.manage
|
|
1203
|
+
* @permissionScope Manage Orders
|
|
1204
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1205
|
+
* @applicableIdentity APP
|
|
1206
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.ResumeSubscription
|
|
1207
|
+
*/
|
|
1208
|
+
export async function resumeSubscription(_id, options) {
|
|
1209
|
+
// @ts-ignore
|
|
1210
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1211
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1212
|
+
id: _id,
|
|
1213
|
+
resumeAt: options?.resumeAt,
|
|
1214
|
+
resumeAtSchedule: options?.resumeAtSchedule,
|
|
1215
|
+
actionContext: options?.actionContext,
|
|
1216
|
+
});
|
|
1217
|
+
const reqOpts = ambassadorWixBillingV1Subscription.resumeSubscription(payload);
|
|
1218
|
+
sideEffects?.onSiteCall?.();
|
|
1219
|
+
try {
|
|
1220
|
+
const result = await httpClient.request(reqOpts);
|
|
1221
|
+
sideEffects?.onSuccess?.(result);
|
|
1222
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1223
|
+
{
|
|
1224
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1225
|
+
paths: [
|
|
1226
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1227
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1228
|
+
],
|
|
1229
|
+
},
|
|
1230
|
+
]));
|
|
1231
|
+
}
|
|
1232
|
+
catch (err) {
|
|
1233
|
+
const transformedError = sdkTransformError(err, {
|
|
1234
|
+
spreadPathsToArguments: {},
|
|
1235
|
+
explicitPathsToArguments: {
|
|
1236
|
+
id: '$[0]',
|
|
1237
|
+
resumeAt: '$[1].resumeAt',
|
|
1238
|
+
resumeAtSchedule: '$[1].resumeAtSchedule',
|
|
1239
|
+
actionContext: '$[1].actionContext',
|
|
1240
|
+
},
|
|
1241
|
+
singleArgumentUnchanged: false,
|
|
1242
|
+
}, ['_id', 'options']);
|
|
1243
|
+
sideEffects?.onError?.(err);
|
|
1244
|
+
throw transformedError;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Lists subscriptions based on specified filters.
|
|
1249
|
+
* By default non-draft subscriptions returned.
|
|
1250
|
+
* @public
|
|
1251
|
+
* @documentationMaturity preview
|
|
1252
|
+
* @requiredField query
|
|
1253
|
+
* @permissionId subscriptions.view
|
|
1254
|
+
* @permissionScope Manage Events
|
|
1255
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
1256
|
+
* @applicableIdentity APP
|
|
1257
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.QuerySubscriptions
|
|
1258
|
+
*/
|
|
1259
|
+
export async function querySubscriptions(query) {
|
|
1260
|
+
// @ts-ignore
|
|
1261
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1262
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({ query: query });
|
|
1263
|
+
const reqOpts = ambassadorWixBillingV1Subscription.querySubscriptions(payload);
|
|
1264
|
+
sideEffects?.onSiteCall?.();
|
|
1265
|
+
try {
|
|
1266
|
+
const result = await httpClient.request(reqOpts);
|
|
1267
|
+
sideEffects?.onSuccess?.(result);
|
|
1268
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1269
|
+
{
|
|
1270
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1271
|
+
paths: [
|
|
1272
|
+
{ path: 'subscriptions.billingSettings.billingAddress.address' },
|
|
1273
|
+
{ path: 'subscriptions.shippingAddress.address' },
|
|
1274
|
+
],
|
|
1275
|
+
},
|
|
1276
|
+
]));
|
|
1277
|
+
}
|
|
1278
|
+
catch (err) {
|
|
1279
|
+
const transformedError = sdkTransformError(err, {
|
|
1280
|
+
spreadPathsToArguments: {},
|
|
1281
|
+
explicitPathsToArguments: { query: '$[0]' },
|
|
1282
|
+
singleArgumentUnchanged: false,
|
|
1283
|
+
}, ['query']);
|
|
1284
|
+
sideEffects?.onError?.(err);
|
|
1285
|
+
throw transformedError;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
/** @public
|
|
1289
|
+
* @documentationMaturity preview
|
|
1290
|
+
* @permissionId subscriptions.view
|
|
1291
|
+
* @permissionScope Manage Events
|
|
1292
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
1293
|
+
* @applicableIdentity APP
|
|
1294
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.SearchSubscriptions
|
|
1295
|
+
*/
|
|
1296
|
+
export async function searchSubscriptions(options) {
|
|
1297
|
+
// @ts-ignore
|
|
1298
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1299
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1300
|
+
filter: options?.filter,
|
|
1301
|
+
paging: options?.paging,
|
|
1302
|
+
cursor: options?.cursor,
|
|
1303
|
+
sorting: options?.sorting,
|
|
1304
|
+
});
|
|
1305
|
+
const reqOpts = ambassadorWixBillingV1Subscription.searchSubscriptions(payload);
|
|
1306
|
+
sideEffects?.onSiteCall?.();
|
|
1307
|
+
try {
|
|
1308
|
+
const result = await httpClient.request(reqOpts);
|
|
1309
|
+
sideEffects?.onSuccess?.(result);
|
|
1310
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1311
|
+
{
|
|
1312
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1313
|
+
paths: [
|
|
1314
|
+
{ path: 'subscriptions.billingSettings.billingAddress.address' },
|
|
1315
|
+
{ path: 'subscriptions.shippingAddress.address' },
|
|
1316
|
+
],
|
|
1317
|
+
},
|
|
1318
|
+
]));
|
|
1319
|
+
}
|
|
1320
|
+
catch (err) {
|
|
1321
|
+
const transformedError = sdkTransformError(err, {
|
|
1322
|
+
spreadPathsToArguments: {},
|
|
1323
|
+
explicitPathsToArguments: {
|
|
1324
|
+
filter: '$[0].filter',
|
|
1325
|
+
paging: '$[0].paging',
|
|
1326
|
+
cursor: '$[0].cursor',
|
|
1327
|
+
sorting: '$[0].sorting',
|
|
1328
|
+
},
|
|
1329
|
+
singleArgumentUnchanged: false,
|
|
1330
|
+
}, ['options']);
|
|
1331
|
+
sideEffects?.onError?.(err);
|
|
1332
|
+
throw transformedError;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Counts subscriptions given the provided filters. Returns the total number
|
|
1337
|
+
* of subscriptions matching the filters and a count per status.
|
|
1338
|
+
*
|
|
1339
|
+
*
|
|
1340
|
+
* You can either pass a list of statuses or a `statusGroup`, which is a
|
|
1341
|
+
* pre-defined combination of statuses.
|
|
1342
|
+
*
|
|
1343
|
+
* If you don't provide any filters, all subscription statuses with the
|
|
1344
|
+
* exception of `"DRAFT"` are counted.
|
|
1345
|
+
*
|
|
1346
|
+
* You may also specify a `customerId` as filter. Then, only subscriptions for
|
|
1347
|
+
* this customer are counted. When providing a `customerId`, you must also
|
|
1348
|
+
* specify a `paymentMethodId`.
|
|
1349
|
+
* @public
|
|
1350
|
+
* @documentationMaturity preview
|
|
1351
|
+
* @permissionId subscriptions.view
|
|
1352
|
+
* @permissionScope Manage Events
|
|
1353
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
1354
|
+
* @applicableIdentity APP
|
|
1355
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.CountSubscriptions
|
|
1356
|
+
*/
|
|
1357
|
+
export async function countSubscriptions(options) {
|
|
1358
|
+
// @ts-ignore
|
|
1359
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1360
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1361
|
+
filter: options?.filter,
|
|
1362
|
+
});
|
|
1363
|
+
const reqOpts = ambassadorWixBillingV1Subscription.countSubscriptions(payload);
|
|
1364
|
+
sideEffects?.onSiteCall?.();
|
|
1365
|
+
try {
|
|
1366
|
+
const result = await httpClient.request(reqOpts);
|
|
1367
|
+
sideEffects?.onSuccess?.(result);
|
|
1368
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1369
|
+
}
|
|
1370
|
+
catch (err) {
|
|
1371
|
+
const transformedError = sdkTransformError(err, {
|
|
1372
|
+
spreadPathsToArguments: {},
|
|
1373
|
+
explicitPathsToArguments: { filter: '$[0].filter' },
|
|
1374
|
+
singleArgumentUnchanged: false,
|
|
1375
|
+
}, ['options']);
|
|
1376
|
+
sideEffects?.onError?.(err);
|
|
1377
|
+
throw transformedError;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Turn on auto-renew subscription in case auto-renew was turned off. The operation changes back cycle_auto_renew
|
|
1382
|
+
* to true, which will ensure subscription billing will continue. Also cancellation info holding information about
|
|
1383
|
+
* auto renew off will be cleared.
|
|
1384
|
+
* @public
|
|
1385
|
+
* @documentationMaturity preview
|
|
1386
|
+
* @requiredField _id
|
|
1387
|
+
* @requiredField actionContext
|
|
1388
|
+
* @permissionId subscriptions.manage
|
|
1389
|
+
* @permissionScope Manage Orders
|
|
1390
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1391
|
+
* @applicableIdentity APP
|
|
1392
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.TurnOnSubscriptionAutoRenewal
|
|
1393
|
+
*/
|
|
1394
|
+
export async function turnOnSubscriptionAutoRenewal(_id, actionContext) {
|
|
1395
|
+
// @ts-ignore
|
|
1396
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1397
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1398
|
+
id: _id,
|
|
1399
|
+
actionContext: actionContext,
|
|
1400
|
+
});
|
|
1401
|
+
const reqOpts = ambassadorWixBillingV1Subscription.turnOnSubscriptionAutoRenewal(payload);
|
|
1402
|
+
sideEffects?.onSiteCall?.();
|
|
1403
|
+
try {
|
|
1404
|
+
const result = await httpClient.request(reqOpts);
|
|
1405
|
+
sideEffects?.onSuccess?.(result);
|
|
1406
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1407
|
+
{
|
|
1408
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1409
|
+
paths: [
|
|
1410
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1411
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1412
|
+
],
|
|
1413
|
+
},
|
|
1414
|
+
]));
|
|
1415
|
+
}
|
|
1416
|
+
catch (err) {
|
|
1417
|
+
const transformedError = sdkTransformError(err, {
|
|
1418
|
+
spreadPathsToArguments: {},
|
|
1419
|
+
explicitPathsToArguments: { id: '$[0]', actionContext: '$[1]' },
|
|
1420
|
+
singleArgumentUnchanged: false,
|
|
1421
|
+
}, ['_id', 'actionContext']);
|
|
1422
|
+
sideEffects?.onError?.(err);
|
|
1423
|
+
throw transformedError;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Turn off auto-renew of subscription. At next billing date subscription will be canceled.
|
|
1428
|
+
* Billing settings flag cycle_auto_renew is set to false and information about this operation stored
|
|
1429
|
+
* in cancellation info for future usage in cancellation.
|
|
1430
|
+
* @public
|
|
1431
|
+
* @documentationMaturity preview
|
|
1432
|
+
* @requiredField _id
|
|
1433
|
+
* @requiredField actionContext
|
|
1434
|
+
* @permissionId subscriptions.manage
|
|
1435
|
+
* @permissionScope Manage Orders
|
|
1436
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1437
|
+
* @applicableIdentity APP
|
|
1438
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.TurnOffSubscriptionAutoRenewal
|
|
1439
|
+
*/
|
|
1440
|
+
export async function turnOffSubscriptionAutoRenewal(_id, actionContext) {
|
|
1441
|
+
// @ts-ignore
|
|
1442
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1443
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1444
|
+
id: _id,
|
|
1445
|
+
actionContext: actionContext,
|
|
1446
|
+
});
|
|
1447
|
+
const reqOpts = ambassadorWixBillingV1Subscription.turnOffSubscriptionAutoRenewal(payload);
|
|
1448
|
+
sideEffects?.onSiteCall?.();
|
|
1449
|
+
try {
|
|
1450
|
+
const result = await httpClient.request(reqOpts);
|
|
1451
|
+
sideEffects?.onSuccess?.(result);
|
|
1452
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1453
|
+
{
|
|
1454
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1455
|
+
paths: [
|
|
1456
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1457
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1458
|
+
],
|
|
1459
|
+
},
|
|
1460
|
+
]));
|
|
1461
|
+
}
|
|
1462
|
+
catch (err) {
|
|
1463
|
+
const transformedError = sdkTransformError(err, {
|
|
1464
|
+
spreadPathsToArguments: {},
|
|
1465
|
+
explicitPathsToArguments: { id: '$[0]', actionContext: '$[1]' },
|
|
1466
|
+
singleArgumentUnchanged: false,
|
|
1467
|
+
}, ['_id', 'actionContext']);
|
|
1468
|
+
sideEffects?.onError?.(err);
|
|
1469
|
+
throw transformedError;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Marks the last invoice as paid used for the following scenarios:
|
|
1474
|
+
* * Offline subscriptions.
|
|
1475
|
+
* * Online subscriptions during grace period. The operation will convert invoice to offline, remove grace period
|
|
1476
|
+
* and will send BillingCycleStarted event after invoice closing.
|
|
1477
|
+
* * Online one time payment subscription with total price of zero during purchase flow.
|
|
1478
|
+
* Activated event will be sent after invoice closing and subscription will be activated.
|
|
1479
|
+
* @param subscriptionId - The ID of the offline subscription to mark as paid its latest invoice
|
|
1480
|
+
* @public
|
|
1481
|
+
* @documentationMaturity preview
|
|
1482
|
+
* @requiredField subscriptionId
|
|
1483
|
+
* @permissionId subscriptions.manage
|
|
1484
|
+
* @permissionScope Manage Orders
|
|
1485
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1486
|
+
* @applicableIdentity APP
|
|
1487
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.MarkLatestInvoiceAsPaid
|
|
1488
|
+
* @deprecated
|
|
1489
|
+
* @replacedBy com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.MarkInvoiceAsPaid
|
|
1490
|
+
* @targetRemovalDate 2025-09-30
|
|
1491
|
+
*/
|
|
1492
|
+
export async function markLatestInvoiceAsPaid(subscriptionId) {
|
|
1493
|
+
// @ts-ignore
|
|
1494
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1495
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1496
|
+
subscriptionId: subscriptionId,
|
|
1497
|
+
});
|
|
1498
|
+
const reqOpts = ambassadorWixBillingV1Subscription.markLatestInvoiceAsPaid(payload);
|
|
1499
|
+
sideEffects?.onSiteCall?.();
|
|
1500
|
+
try {
|
|
1501
|
+
const result = await httpClient.request(reqOpts);
|
|
1502
|
+
sideEffects?.onSuccess?.(result);
|
|
1503
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1504
|
+
{
|
|
1505
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1506
|
+
paths: [
|
|
1507
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1508
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1509
|
+
],
|
|
1510
|
+
},
|
|
1511
|
+
]));
|
|
1512
|
+
}
|
|
1513
|
+
catch (err) {
|
|
1514
|
+
const transformedError = sdkTransformError(err, {
|
|
1515
|
+
spreadPathsToArguments: {},
|
|
1516
|
+
explicitPathsToArguments: { subscriptionId: '$[0]' },
|
|
1517
|
+
singleArgumentUnchanged: false,
|
|
1518
|
+
}, ['subscriptionId']);
|
|
1519
|
+
sideEffects?.onError?.(err);
|
|
1520
|
+
throw transformedError;
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Marks the invoice associated with the subscription in the specified cycle as paid.
|
|
1525
|
+
* If `paid_cycle` is left empty, the most recent invoice will be marked as paid.
|
|
1526
|
+
* If the invoice contains items other than subscription items, an error will be thrown.
|
|
1527
|
+
*
|
|
1528
|
+
* Marks the invoice as paid for the following scenarios:
|
|
1529
|
+
* 1. Offline subscriptions.
|
|
1530
|
+
* 2. Online subscriptions during the grace period.
|
|
1531
|
+
* This operation will convert the invoice to offline, remove the grace period,
|
|
1532
|
+
* and send a BillingCycleStarted event after the invoice is closed.
|
|
1533
|
+
* 3. Online one-time payment subscriptions with a total price of zero during the purchase flow.
|
|
1534
|
+
* An Activated event will be sent after the invoice is closed, and the subscription will be activated.
|
|
1535
|
+
* 4. For external subscriptions, where the payment occurs outside of BASS, an invoice is created and marked as paid
|
|
1536
|
+
* @param subscriptionId - The ID of the subscription to mark as paid its invoice.
|
|
1537
|
+
* @internal
|
|
1538
|
+
* @documentationMaturity preview
|
|
1539
|
+
* @requiredField subscriptionId
|
|
1540
|
+
* @permissionId subscriptions.manage
|
|
1541
|
+
* @permissionScope Manage Orders
|
|
1542
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1543
|
+
* @applicableIdentity APP
|
|
1544
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.MarkInvoiceAsPaid
|
|
1545
|
+
*/
|
|
1546
|
+
export async function markInvoiceAsPaid(subscriptionId, options) {
|
|
1547
|
+
// @ts-ignore
|
|
1548
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1549
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1550
|
+
subscriptionId: subscriptionId,
|
|
1551
|
+
paidCycle: options?.paidCycle,
|
|
1552
|
+
});
|
|
1553
|
+
const reqOpts = ambassadorWixBillingV1Subscription.markInvoiceAsPaid(payload);
|
|
1554
|
+
sideEffects?.onSiteCall?.();
|
|
1555
|
+
try {
|
|
1556
|
+
const result = await httpClient.request(reqOpts);
|
|
1557
|
+
sideEffects?.onSuccess?.(result);
|
|
1558
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1559
|
+
{
|
|
1560
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1561
|
+
paths: [
|
|
1562
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1563
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1564
|
+
],
|
|
1565
|
+
},
|
|
1566
|
+
]));
|
|
1567
|
+
}
|
|
1568
|
+
catch (err) {
|
|
1569
|
+
const transformedError = sdkTransformError(err, {
|
|
1570
|
+
spreadPathsToArguments: {},
|
|
1571
|
+
explicitPathsToArguments: {
|
|
1572
|
+
subscriptionId: '$[0]',
|
|
1573
|
+
paidCycle: '$[1].paidCycle',
|
|
1574
|
+
},
|
|
1575
|
+
singleArgumentUnchanged: false,
|
|
1576
|
+
}, ['subscriptionId', 'options']);
|
|
1577
|
+
sideEffects?.onError?.(err);
|
|
1578
|
+
throw transformedError;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
/**
|
|
1582
|
+
* Returns number of subscriptions in each state.
|
|
1583
|
+
* @public
|
|
1584
|
+
* @documentationMaturity preview
|
|
1585
|
+
* @permissionId subscriptions.view
|
|
1586
|
+
* @permissionScope Manage Events
|
|
1587
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
1588
|
+
* @applicableIdentity APP
|
|
1589
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.GetSubscriptionsStats
|
|
1590
|
+
*/
|
|
1591
|
+
export async function getSubscriptionsStats() {
|
|
1592
|
+
// @ts-ignore
|
|
1593
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
1594
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({});
|
|
1595
|
+
const reqOpts = ambassadorWixBillingV1Subscription.getSubscriptionsStats(payload);
|
|
1596
|
+
sideEffects?.onSiteCall?.();
|
|
1597
|
+
try {
|
|
1598
|
+
const result = await httpClient.request(reqOpts);
|
|
1599
|
+
sideEffects?.onSuccess?.(result);
|
|
1600
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1601
|
+
}
|
|
1602
|
+
catch (err) {
|
|
1603
|
+
const transformedError = sdkTransformError(err, {
|
|
1604
|
+
spreadPathsToArguments: {},
|
|
1605
|
+
explicitPathsToArguments: {},
|
|
1606
|
+
singleArgumentUnchanged: false,
|
|
1607
|
+
}, []);
|
|
1608
|
+
sideEffects?.onError?.(err);
|
|
1609
|
+
throw transformedError;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Extends subscription by moving end date with or without billing cycles addition.
|
|
1614
|
+
* @param _id - The ID of the subscription to be extended
|
|
1615
|
+
* @public
|
|
1616
|
+
* @documentationMaturity preview
|
|
1617
|
+
* @requiredField _id
|
|
1618
|
+
* @requiredField actionContext
|
|
1619
|
+
* @permissionId subscriptions.manage
|
|
1620
|
+
* @permissionScope Manage Orders
|
|
1621
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1622
|
+
* @applicableIdentity APP
|
|
1623
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.ExtendSubscription
|
|
1624
|
+
*/
|
|
1625
|
+
export async function extendSubscription(_id, actionContext, options) {
|
|
1626
|
+
// @ts-ignore
|
|
1627
|
+
const { httpClient, sideEffects } = arguments[3];
|
|
1628
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1629
|
+
id: _id,
|
|
1630
|
+
actionContext: actionContext,
|
|
1631
|
+
extensionPeriod: options?.extensionPeriod,
|
|
1632
|
+
extensionBillingCycles: options?.extensionBillingCycles,
|
|
1633
|
+
});
|
|
1634
|
+
const reqOpts = ambassadorWixBillingV1Subscription.extendSubscription(payload);
|
|
1635
|
+
sideEffects?.onSiteCall?.();
|
|
1636
|
+
try {
|
|
1637
|
+
const result = await httpClient.request(reqOpts);
|
|
1638
|
+
sideEffects?.onSuccess?.(result);
|
|
1639
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1640
|
+
{
|
|
1641
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1642
|
+
paths: [
|
|
1643
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1644
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1645
|
+
],
|
|
1646
|
+
},
|
|
1647
|
+
]));
|
|
1648
|
+
}
|
|
1649
|
+
catch (err) {
|
|
1650
|
+
const transformedError = sdkTransformError(err, {
|
|
1651
|
+
spreadPathsToArguments: {},
|
|
1652
|
+
explicitPathsToArguments: {
|
|
1653
|
+
id: '$[0]',
|
|
1654
|
+
actionContext: '$[1]',
|
|
1655
|
+
extensionPeriod: '$[2].extensionPeriod',
|
|
1656
|
+
extensionBillingCycles: '$[2].extensionBillingCycles',
|
|
1657
|
+
},
|
|
1658
|
+
singleArgumentUnchanged: false,
|
|
1659
|
+
}, ['_id', 'actionContext', 'options']);
|
|
1660
|
+
sideEffects?.onError?.(err);
|
|
1661
|
+
throw transformedError;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
/** @public
|
|
1665
|
+
* @documentationMaturity preview
|
|
1666
|
+
* @requiredField _id
|
|
1667
|
+
* @permissionId subscriptions.manage
|
|
1668
|
+
* @permissionScope Manage Orders
|
|
1669
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1670
|
+
* @applicableIdentity APP
|
|
1671
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.AllowedActions
|
|
1672
|
+
*/
|
|
1673
|
+
export async function allowedActions(_id, options) {
|
|
1674
|
+
// @ts-ignore
|
|
1675
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1676
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1677
|
+
id: _id,
|
|
1678
|
+
fields: options?.fields,
|
|
1679
|
+
});
|
|
1680
|
+
const reqOpts = ambassadorWixBillingV1Subscription.allowedActions(payload);
|
|
1681
|
+
sideEffects?.onSiteCall?.();
|
|
1682
|
+
try {
|
|
1683
|
+
const result = await httpClient.request(reqOpts);
|
|
1684
|
+
sideEffects?.onSuccess?.(result);
|
|
1685
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1686
|
+
}
|
|
1687
|
+
catch (err) {
|
|
1688
|
+
const transformedError = sdkTransformError(err, {
|
|
1689
|
+
spreadPathsToArguments: {},
|
|
1690
|
+
explicitPathsToArguments: { id: '$[0]', fields: '$[1].fields' },
|
|
1691
|
+
singleArgumentUnchanged: false,
|
|
1692
|
+
}, ['_id', 'options']);
|
|
1693
|
+
sideEffects?.onError?.(err);
|
|
1694
|
+
throw transformedError;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
/**
|
|
1698
|
+
* List future subscriptions charges
|
|
1699
|
+
* @param subscriptionId - Subscription id charges to be previewed for
|
|
1700
|
+
* @public
|
|
1701
|
+
* @documentationMaturity preview
|
|
1702
|
+
* @requiredField subscriptionId
|
|
1703
|
+
* @permissionId subscriptions.view
|
|
1704
|
+
* @permissionScope Manage Events
|
|
1705
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
1706
|
+
* @applicableIdentity APP
|
|
1707
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.ListUpcomingCharges
|
|
1708
|
+
*/
|
|
1709
|
+
export async function listUpcomingCharges(subscriptionId, options) {
|
|
1710
|
+
// @ts-ignore
|
|
1711
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1712
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1713
|
+
subscriptionId: subscriptionId,
|
|
1714
|
+
customDuration: options?.customDuration,
|
|
1715
|
+
nextBillingDate: options?.nextBillingDate,
|
|
1716
|
+
});
|
|
1717
|
+
const reqOpts = ambassadorWixBillingV1Subscription.listUpcomingCharges(payload);
|
|
1718
|
+
sideEffects?.onSiteCall?.();
|
|
1719
|
+
try {
|
|
1720
|
+
const result = await httpClient.request(reqOpts);
|
|
1721
|
+
sideEffects?.onSuccess?.(result);
|
|
1722
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1723
|
+
}
|
|
1724
|
+
catch (err) {
|
|
1725
|
+
const transformedError = sdkTransformError(err, {
|
|
1726
|
+
spreadPathsToArguments: {},
|
|
1727
|
+
explicitPathsToArguments: {
|
|
1728
|
+
subscriptionId: '$[0]',
|
|
1729
|
+
customDuration: '$[1].customDuration',
|
|
1730
|
+
nextBillingDate: '$[1].nextBillingDate',
|
|
1731
|
+
},
|
|
1732
|
+
singleArgumentUnchanged: false,
|
|
1733
|
+
}, ['subscriptionId', 'options']);
|
|
1734
|
+
sideEffects?.onError?.(err);
|
|
1735
|
+
throw transformedError;
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Retrieves the preview of subscription charges.
|
|
1740
|
+
* Returns all the charges applicable to a subscription based on the provided subscription information.
|
|
1741
|
+
* @public
|
|
1742
|
+
* @documentationMaturity preview
|
|
1743
|
+
* @requiredField options
|
|
1744
|
+
* @requiredField options.subscriptionInfo
|
|
1745
|
+
* @requiredField options.subscriptionInfo.billingSettings
|
|
1746
|
+
* @requiredField options.subscriptionInfo.items
|
|
1747
|
+
* @requiredField options.subscriptionInfo.items.pricingModel
|
|
1748
|
+
* @permissionId subscriptions.view
|
|
1749
|
+
* @permissionScope Manage Events
|
|
1750
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
1751
|
+
* @applicableIdentity APP
|
|
1752
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.PreviewSubscriptionCharges
|
|
1753
|
+
* @deprecated
|
|
1754
|
+
* @replacedBy com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.PreviewSubscriptionsCharges
|
|
1755
|
+
* @targetRemovalDate 2025-06-30
|
|
1756
|
+
*/
|
|
1757
|
+
export async function previewSubscriptionCharges(options) {
|
|
1758
|
+
// @ts-ignore
|
|
1759
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1760
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1761
|
+
subscriptionInfo: options?.subscriptionInfo,
|
|
1762
|
+
}), [
|
|
1763
|
+
{
|
|
1764
|
+
transformFn: transformSDKAddressToRESTAddress,
|
|
1765
|
+
paths: [
|
|
1766
|
+
{ path: 'subscriptionInfo.billingSettings.billingAddress.address' },
|
|
1767
|
+
],
|
|
1768
|
+
},
|
|
1769
|
+
]);
|
|
1770
|
+
const reqOpts = ambassadorWixBillingV1Subscription.previewSubscriptionCharges(payload);
|
|
1771
|
+
sideEffects?.onSiteCall?.();
|
|
1772
|
+
try {
|
|
1773
|
+
const result = await httpClient.request(reqOpts);
|
|
1774
|
+
sideEffects?.onSuccess?.(result);
|
|
1775
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1776
|
+
}
|
|
1777
|
+
catch (err) {
|
|
1778
|
+
const transformedError = sdkTransformError(err, {
|
|
1779
|
+
spreadPathsToArguments: {},
|
|
1780
|
+
explicitPathsToArguments: { subscriptionInfo: '$[0].subscriptionInfo' },
|
|
1781
|
+
singleArgumentUnchanged: false,
|
|
1782
|
+
}, ['options']);
|
|
1783
|
+
sideEffects?.onError?.(err);
|
|
1784
|
+
throw transformedError;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Retrieves the preview of subscription charges for a bulk of subscriptions.
|
|
1789
|
+
* Returns all the charges applicable to all subscriptions, based on the provided subscriptions information.
|
|
1790
|
+
* @public
|
|
1791
|
+
* @documentationMaturity preview
|
|
1792
|
+
* @requiredField options.subscriptionsBillingDetails.billingSettings
|
|
1793
|
+
* @requiredField options.subscriptionsBillingDetails.billingSettings.shippingCharges.tax
|
|
1794
|
+
* @requiredField options.subscriptionsBillingDetails.externalId
|
|
1795
|
+
* @requiredField options.subscriptionsBillingDetails.items
|
|
1796
|
+
* @requiredField options.subscriptionsBillingDetails.items.pricingModel
|
|
1797
|
+
* @requiredField options.subscriptionsBillingDetails.items.tax
|
|
1798
|
+
* @permissionId subscriptions.view
|
|
1799
|
+
* @permissionScope Manage Events
|
|
1800
|
+
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
1801
|
+
* @applicableIdentity APP
|
|
1802
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.PreviewSubscriptionsCharges
|
|
1803
|
+
*/
|
|
1804
|
+
export async function previewSubscriptionsCharges(options) {
|
|
1805
|
+
// @ts-ignore
|
|
1806
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
1807
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
1808
|
+
subscriptionsBillingDetails: options?.subscriptionsBillingDetails,
|
|
1809
|
+
numberOfNextRecurringCharges: options?.numberOfNextRecurringCharges,
|
|
1810
|
+
}), [
|
|
1811
|
+
{
|
|
1812
|
+
transformFn: transformSDKAddressToRESTAddress,
|
|
1813
|
+
paths: [
|
|
1814
|
+
{
|
|
1815
|
+
path: 'subscriptionsBillingDetails.billingSettings.billingAddress.address',
|
|
1816
|
+
},
|
|
1817
|
+
{ path: 'subscriptionsBillingDetails.shippingAddress.address' },
|
|
1818
|
+
],
|
|
1819
|
+
},
|
|
1820
|
+
]);
|
|
1821
|
+
const reqOpts = ambassadorWixBillingV1Subscription.previewSubscriptionsCharges(payload);
|
|
1822
|
+
sideEffects?.onSiteCall?.();
|
|
1823
|
+
try {
|
|
1824
|
+
const result = await httpClient.request(reqOpts);
|
|
1825
|
+
sideEffects?.onSuccess?.(result);
|
|
1826
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1827
|
+
}
|
|
1828
|
+
catch (err) {
|
|
1829
|
+
const transformedError = sdkTransformError(err, {
|
|
1830
|
+
spreadPathsToArguments: {},
|
|
1831
|
+
explicitPathsToArguments: {
|
|
1832
|
+
subscriptionsBillingDetails: '$[0].subscriptionsBillingDetails',
|
|
1833
|
+
numberOfNextRecurringCharges: '$[0].numberOfNextRecurringCharges',
|
|
1834
|
+
},
|
|
1835
|
+
singleArgumentUnchanged: false,
|
|
1836
|
+
}, ['options']);
|
|
1837
|
+
sideEffects?.onError?.(err);
|
|
1838
|
+
throw transformedError;
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* Creates authorization invoice with Moto settings in order to create
|
|
1843
|
+
* @public
|
|
1844
|
+
* @documentationMaturity preview
|
|
1845
|
+
* @requiredField _id
|
|
1846
|
+
* @permissionId subscriptions.manage
|
|
1847
|
+
* @permissionScope Manage Orders
|
|
1848
|
+
* @permissionScopeId SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
|
|
1849
|
+
* @applicableIdentity APP
|
|
1850
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsService.InitiatePaymentMethodSetup
|
|
1851
|
+
*/
|
|
1852
|
+
export async function initiatePaymentMethodSetup(_id, options) {
|
|
1853
|
+
// @ts-ignore
|
|
1854
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1855
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1856
|
+
id: _id,
|
|
1857
|
+
paymentMode: options?.paymentMode,
|
|
1858
|
+
paymentSettings: options?.paymentSettings,
|
|
1859
|
+
});
|
|
1860
|
+
const reqOpts = ambassadorWixBillingV1Subscription.initiatePaymentMethodSetup(payload);
|
|
1861
|
+
sideEffects?.onSiteCall?.();
|
|
1862
|
+
try {
|
|
1863
|
+
const result = await httpClient.request(reqOpts);
|
|
1864
|
+
sideEffects?.onSuccess?.(result);
|
|
1865
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
1866
|
+
}
|
|
1867
|
+
catch (err) {
|
|
1868
|
+
const transformedError = sdkTransformError(err, {
|
|
1869
|
+
spreadPathsToArguments: {},
|
|
1870
|
+
explicitPathsToArguments: {
|
|
1871
|
+
id: '$[0]',
|
|
1872
|
+
paymentMode: '$[1].paymentMode',
|
|
1873
|
+
paymentSettings: '$[1].paymentSettings',
|
|
1874
|
+
},
|
|
1875
|
+
singleArgumentUnchanged: false,
|
|
1876
|
+
}, ['_id', 'options']);
|
|
1877
|
+
sideEffects?.onError?.(err);
|
|
1878
|
+
throw transformedError;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* This used only for automation and permitted tenants (QA & testing)
|
|
1883
|
+
* @public
|
|
1884
|
+
* @documentationMaturity preview
|
|
1885
|
+
* @requiredField options.tenantId
|
|
1886
|
+
* @requiredField subscriptionId
|
|
1887
|
+
* @fqn com.wixpress.billing.subscriptions.api.v1.SubscriptionsBackOfficeService.PayCycle
|
|
1888
|
+
*/
|
|
1889
|
+
export async function payCycle(subscriptionId, options) {
|
|
1890
|
+
// @ts-ignore
|
|
1891
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
1892
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
1893
|
+
subscriptionId: subscriptionId,
|
|
1894
|
+
paymentTestMode: options?.paymentTestMode,
|
|
1895
|
+
tenantId: options?.tenantId,
|
|
1896
|
+
});
|
|
1897
|
+
const reqOpts = ambassadorWixBillingV1Subscription.payCycle(payload);
|
|
1898
|
+
sideEffects?.onSiteCall?.();
|
|
1899
|
+
try {
|
|
1900
|
+
const result = await httpClient.request(reqOpts);
|
|
1901
|
+
sideEffects?.onSuccess?.(result);
|
|
1902
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
1903
|
+
{
|
|
1904
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
1905
|
+
paths: [
|
|
1906
|
+
{ path: 'subscription.billingSettings.billingAddress.address' },
|
|
1907
|
+
{ path: 'subscription.shippingAddress.address' },
|
|
1908
|
+
],
|
|
1909
|
+
},
|
|
1910
|
+
]));
|
|
1911
|
+
}
|
|
1912
|
+
catch (err) {
|
|
1913
|
+
const transformedError = sdkTransformError(err, {
|
|
1914
|
+
spreadPathsToArguments: {},
|
|
1915
|
+
explicitPathsToArguments: {
|
|
1916
|
+
subscriptionId: '$[0]',
|
|
1917
|
+
paymentTestMode: '$[1].paymentTestMode',
|
|
1918
|
+
tenantId: '$[1].tenantId',
|
|
1919
|
+
},
|
|
1920
|
+
singleArgumentUnchanged: false,
|
|
1921
|
+
}, ['subscriptionId', 'options']);
|
|
1922
|
+
sideEffects?.onError?.(err);
|
|
1923
|
+
throw transformedError;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
//# sourceMappingURL=billing-v1-subscription-subscriptions.universal.js.map
|