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