@wix/auto_sdk_app-management_custom-charges 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{cjs/src/service-plugins-types.d.ts → index.d.mts} +105 -21
- package/build/{internal/cjs/src/service-plugins-types.d.ts → index.d.ts} +105 -21
- package/build/index.js +150 -0
- package/build/index.js.map +1 -0
- package/build/index.mjs +122 -0
- package/build/index.mjs.map +1 -0
- package/build/{es/src/service-plugins-types.d.ts → internal/index.d.mts} +105 -21
- package/build/internal/{es/src/service-plugins-types.d.ts → index.d.ts} +105 -21
- package/build/internal/index.js +150 -0
- package/build/internal/index.js.map +1 -0
- package/build/internal/index.mjs +122 -0
- package/build/internal/index.mjs.map +1 -0
- package/package.json +12 -11
- package/build/cjs/index.d.ts +0 -2
- package/build/cjs/index.js +0 -19
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/index.typings.d.ts +0 -59
- package/build/cjs/index.typings.js +0 -18
- package/build/cjs/index.typings.js.map +0 -1
- package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
- package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -9
- package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
- package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
- package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -88
- package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
- package/build/cjs/src/service-plugins-types.js +0 -30
- package/build/cjs/src/service-plugins-types.js.map +0 -1
- package/build/es/index.d.ts +0 -2
- package/build/es/index.js +0 -3
- package/build/es/index.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -59
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
- package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -6
- package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
- package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
- package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -85
- package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
- package/build/es/src/service-plugins-types.js +0 -27
- package/build/es/src/service-plugins-types.js.map +0 -1
- package/build/internal/cjs/index.d.ts +0 -2
- package/build/internal/cjs/index.js +0 -19
- package/build/internal/cjs/index.js.map +0 -1
- package/build/internal/cjs/index.typings.d.ts +0 -59
- package/build/internal/cjs/index.typings.js +0 -18
- package/build/internal/cjs/index.typings.js.map +0 -1
- package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
- package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -9
- package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
- package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
- package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -88
- package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
- package/build/internal/cjs/src/service-plugins-types.js +0 -30
- package/build/internal/cjs/src/service-plugins-types.js.map +0 -1
- package/build/internal/es/index.d.ts +0 -2
- package/build/internal/es/index.js +0 -3
- package/build/internal/es/index.js.map +0 -1
- package/build/internal/es/index.typings.d.ts +0 -59
- package/build/internal/es/index.typings.js +0 -2
- package/build/internal/es/index.typings.js.map +0 -1
- package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +0 -5
- package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js +0 -6
- package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +0 -1
- package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +0 -79
- package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js +0 -85
- package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +0 -1
- package/build/internal/es/src/service-plugins-types.js +0 -27
- package/build/internal/es/src/service-plugins-types.js.map +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ServicePluginDefinition, BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
2
|
+
|
|
3
|
+
interface GetChargeLimitRequest {
|
|
2
4
|
/**
|
|
3
5
|
* ID of the subscription for which Wix retrieves the charge limit. Equals
|
|
4
6
|
* `null` in case Wix hasn't created the subscription when retrieving an
|
|
@@ -17,7 +19,7 @@ export interface GetChargeLimitRequest {
|
|
|
17
19
|
*/
|
|
18
20
|
currency?: string;
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
interface GetChargeLimitResponse {
|
|
21
23
|
/**
|
|
22
24
|
* Retrieved charge limit for the app instance. You can't update the
|
|
23
25
|
* charge limit after you've set an initial value. Site owners can increase the
|
|
@@ -27,7 +29,7 @@ export interface GetChargeLimitResponse {
|
|
|
27
29
|
*/
|
|
28
30
|
chargeLimit?: string | null;
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
interface ListChargesRequest {
|
|
31
33
|
/**
|
|
32
34
|
* ID of the subscription for which Wix retrieves your custom charges.
|
|
33
35
|
* To track usage and billing for apps, we recommend to use `instanceId` instead
|
|
@@ -57,13 +59,13 @@ export interface ListChargesRequest {
|
|
|
57
59
|
/** Information about what Wix intends to do with the retrieved charges. */
|
|
58
60
|
intent?: Intent;
|
|
59
61
|
}
|
|
60
|
-
|
|
62
|
+
declare enum Intent {
|
|
61
63
|
/** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
|
|
62
64
|
DISPLAY_ONLY = "DISPLAY_ONLY",
|
|
63
65
|
/** Create an invoice for the customer. */
|
|
64
66
|
CREATE_INVOICE = "CREATE_INVOICE"
|
|
65
67
|
}
|
|
66
|
-
|
|
68
|
+
interface ListChargesResponse {
|
|
67
69
|
/**
|
|
68
70
|
* Retrieved charges.
|
|
69
71
|
*
|
|
@@ -72,7 +74,7 @@ export interface ListChargesResponse {
|
|
|
72
74
|
*/
|
|
73
75
|
charges?: ChargeLineItem[];
|
|
74
76
|
}
|
|
75
|
-
|
|
77
|
+
interface ChargeLineItem {
|
|
76
78
|
/**
|
|
77
79
|
* ID of the charge. Make sure to save the charge ID on your servers for future
|
|
78
80
|
* reference. Identical to `lineItem.chargeId` in the Invoice Created Event.
|
|
@@ -95,7 +97,7 @@ export interface ChargeLineItem {
|
|
|
95
97
|
*/
|
|
96
98
|
amount?: string;
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
interface ChargesRejectedRequest {
|
|
99
101
|
/**
|
|
100
102
|
* ID of the subscription for which Wix hasn't accepted your custom charges.
|
|
101
103
|
* To track usage and billing for apps, we recommend to use `instanceId` instead
|
|
@@ -135,7 +137,7 @@ export interface ChargesRejectedRequest {
|
|
|
135
137
|
*/
|
|
136
138
|
reasons?: ChargesRejectedReason[];
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
declare enum ChargesRejectedReason {
|
|
139
141
|
/** There is no information about why Wix has rejected the charges. */
|
|
140
142
|
UNKNOWN = "UNKNOWN",
|
|
141
143
|
/** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
|
|
@@ -145,9 +147,9 @@ export declare enum ChargesRejectedReason {
|
|
|
145
147
|
/** You must submit charges as whole numbers or use a dot to separate major and minor units. For example, `10` or `1.50`. Currently, Wix doesn't validate whether the submitted number of decimals for the minor unit is supported for the given currency. */
|
|
146
148
|
INVALID_FORMAT = "INVALID_FORMAT"
|
|
147
149
|
}
|
|
148
|
-
|
|
150
|
+
interface ChargesRejectedResponse {
|
|
149
151
|
}
|
|
150
|
-
|
|
152
|
+
interface InvoiceCreatedRequest {
|
|
151
153
|
/**
|
|
152
154
|
* ID of the subscription for which Wix has created an invoice that includes
|
|
153
155
|
* your custom charges. To track usage and billing for apps, we recommend to use
|
|
@@ -172,7 +174,7 @@ export interface InvoiceCreatedRequest {
|
|
|
172
174
|
*/
|
|
173
175
|
lineItems?: InvoiceLineItem[];
|
|
174
176
|
}
|
|
175
|
-
|
|
177
|
+
interface InvoiceLineItem {
|
|
176
178
|
/**
|
|
177
179
|
* ID of the charge as returned in List Charges.
|
|
178
180
|
*
|
|
@@ -191,9 +193,9 @@ export interface InvoiceLineItem {
|
|
|
191
193
|
*/
|
|
192
194
|
_id?: string;
|
|
193
195
|
}
|
|
194
|
-
|
|
196
|
+
interface InvoiceCreatedResponse {
|
|
195
197
|
}
|
|
196
|
-
|
|
198
|
+
interface ChargeLimitUpdatedRequest {
|
|
197
199
|
/**
|
|
198
200
|
* ID of the subscription for which the charge limit has been updated.
|
|
199
201
|
* To track usage and billing for apps, we recommend to use `instanceId` instead
|
|
@@ -216,9 +218,9 @@ export interface ChargeLimitUpdatedRequest {
|
|
|
216
218
|
*/
|
|
217
219
|
chargeLimit?: string | null;
|
|
218
220
|
}
|
|
219
|
-
|
|
221
|
+
interface ChargeLimitUpdatedResponse {
|
|
220
222
|
}
|
|
221
|
-
|
|
223
|
+
interface CustomChargesConfig {
|
|
222
224
|
/**
|
|
223
225
|
* Base part of your integration's deployment URI for the Custom Charges SPI.
|
|
224
226
|
* For example `"https://provider.example.com"`, if Wix should call your
|
|
@@ -227,7 +229,7 @@ export interface CustomChargesConfig {
|
|
|
227
229
|
*/
|
|
228
230
|
baseUri?: SpiBaseUri;
|
|
229
231
|
}
|
|
230
|
-
|
|
232
|
+
interface SpiBaseUri {
|
|
231
233
|
/**
|
|
232
234
|
* Base URI where the methods are called. Wix appends the path to the `baseUri`.
|
|
233
235
|
* For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.
|
|
@@ -238,7 +240,7 @@ export interface SpiBaseUri {
|
|
|
238
240
|
/** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
|
|
239
241
|
alternativeUris?: AlternativeUri[];
|
|
240
242
|
}
|
|
241
|
-
|
|
243
|
+
interface AlternativeUri {
|
|
242
244
|
/**
|
|
243
245
|
* Name of the method to create a custom URI for.
|
|
244
246
|
*
|
|
@@ -269,7 +271,7 @@ export interface AlternativeUri {
|
|
|
269
271
|
* }
|
|
270
272
|
* ```
|
|
271
273
|
*/
|
|
272
|
-
|
|
274
|
+
interface Context {
|
|
273
275
|
/** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */
|
|
274
276
|
requestId?: string | null;
|
|
275
277
|
/**
|
|
@@ -287,14 +289,14 @@ export interface Context {
|
|
|
287
289
|
*/
|
|
288
290
|
instanceId?: string | null;
|
|
289
291
|
}
|
|
290
|
-
|
|
292
|
+
declare enum IdentityType {
|
|
291
293
|
UNKNOWN = "UNKNOWN",
|
|
292
294
|
ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
|
|
293
295
|
MEMBER = "MEMBER",
|
|
294
296
|
WIX_USER = "WIX_USER",
|
|
295
297
|
APP = "APP"
|
|
296
298
|
}
|
|
297
|
-
|
|
299
|
+
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
298
300
|
/**
|
|
299
301
|
* ID of a site visitor that has not logged in to the site.
|
|
300
302
|
* @format GUID
|
|
@@ -319,7 +321,7 @@ export interface IdentificationData extends IdentificationDataIdOneOf {
|
|
|
319
321
|
identityType?: IdentityType;
|
|
320
322
|
}
|
|
321
323
|
/** @oneof */
|
|
322
|
-
|
|
324
|
+
interface IdentificationDataIdOneOf {
|
|
323
325
|
/**
|
|
324
326
|
* ID of a site visitor that has not logged in to the site.
|
|
325
327
|
* @format GUID
|
|
@@ -341,3 +343,85 @@ export interface IdentificationDataIdOneOf {
|
|
|
341
343
|
*/
|
|
342
344
|
appId?: string;
|
|
343
345
|
}
|
|
346
|
+
|
|
347
|
+
interface GetChargeLimitEnvelope {
|
|
348
|
+
request: GetChargeLimitRequest;
|
|
349
|
+
metadata: Context;
|
|
350
|
+
}
|
|
351
|
+
interface ListChargesEnvelope {
|
|
352
|
+
request: ListChargesRequest;
|
|
353
|
+
metadata: Context;
|
|
354
|
+
}
|
|
355
|
+
interface ChargesRejectedEventEnvelope {
|
|
356
|
+
request: ChargesRejectedRequest;
|
|
357
|
+
metadata: Context;
|
|
358
|
+
}
|
|
359
|
+
interface InvoiceCreatedEventEnvelope {
|
|
360
|
+
request: InvoiceCreatedRequest;
|
|
361
|
+
metadata: Context;
|
|
362
|
+
}
|
|
363
|
+
interface ChargeLimitUpdatedEventEnvelope {
|
|
364
|
+
request: ChargeLimitUpdatedRequest;
|
|
365
|
+
metadata: Context;
|
|
366
|
+
}
|
|
367
|
+
declare const provideHandlers$1: ServicePluginDefinition<{
|
|
368
|
+
/**
|
|
369
|
+
*
|
|
370
|
+
* Wix calls this method to retrieve the initial charge limit for a paid instance
|
|
371
|
+
* of your app. This happens every time a customer is upgrading to a paid version of
|
|
372
|
+
* your app.
|
|
373
|
+
*
|
|
374
|
+
* You can't update the charge limit after you've set an initial
|
|
375
|
+
* value. Customers can increase the limit in their site's dashboard, currently they
|
|
376
|
+
* aren't allowed to decrease it. */
|
|
377
|
+
getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
|
|
378
|
+
/**
|
|
379
|
+
*
|
|
380
|
+
* Wix calls this method to retrieve a list of charges for a paid instance
|
|
381
|
+
* of your app. This happens when Wix creates an invoice or in case the customer
|
|
382
|
+
* wants to preview how much your app would charge them at the moment.
|
|
383
|
+
*
|
|
384
|
+
* You must return the charges in the currency that's specified in the request,
|
|
385
|
+
* you aren't allowed to return more than 5 charges, and their sum must be lower
|
|
386
|
+
* than the charge limit.
|
|
387
|
+
*
|
|
388
|
+
* You may not bill customers for any usage that didn’t occur during the period
|
|
389
|
+
* Wix specifies when retrieving the charges. If Wix discovers that your app has
|
|
390
|
+
* charged customers for usage outside of an invoice's specified period, we may
|
|
391
|
+
* take action such as blocking your app from charging the customer, removing
|
|
392
|
+
* your app from the Wix App Market, revoking your access to the Wix developer
|
|
393
|
+
* program, or pursuing legal action to recover damages caused by overcharging.
|
|
394
|
+
* We understand that mistakes can happen and encourage you to contact
|
|
395
|
+
* [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
|
|
396
|
+
* become aware of any overcharging issues so that we can work together to
|
|
397
|
+
* resolve the situation. */
|
|
398
|
+
listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
|
|
399
|
+
/**
|
|
400
|
+
*
|
|
401
|
+
* Triggered in case Wix doesn't accept the charges you've returned in the
|
|
402
|
+
* List Charges method.
|
|
403
|
+
*
|
|
404
|
+
*
|
|
405
|
+
* You aren't allowed to charge a site owner more than the charge limit. Wix
|
|
406
|
+
* call List Charges in regular intervals until the sum of all charges is lower than the
|
|
407
|
+
* charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
|
|
408
|
+
chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
|
|
409
|
+
/**
|
|
410
|
+
*
|
|
411
|
+
* Triggered in case Wix creates an invoice that includes charges for an instance
|
|
412
|
+
* of your app. */
|
|
413
|
+
invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
|
|
414
|
+
/**
|
|
415
|
+
*
|
|
416
|
+
* Triggered in case the charge limit for an instance of your app is updated.
|
|
417
|
+
*
|
|
418
|
+
*
|
|
419
|
+
* You can't update the charge limit after you've set an initial
|
|
420
|
+
* value. Site owners can increase the limit in their site's dashboard,
|
|
421
|
+
* currently they aren't allowed to decrease it. */
|
|
422
|
+
chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
|
|
423
|
+
}>;
|
|
424
|
+
|
|
425
|
+
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1>;
|
|
426
|
+
|
|
427
|
+
export { type AlternativeUri, type ChargeLimitUpdatedRequest, type ChargeLimitUpdatedResponse, type ChargeLineItem, ChargesRejectedReason, type ChargesRejectedRequest, type ChargesRejectedResponse, type Context, type CustomChargesConfig, type GetChargeLimitRequest, type GetChargeLimitResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, Intent, type InvoiceCreatedRequest, type InvoiceCreatedResponse, type InvoiceLineItem, type ListChargesRequest, type ListChargesResponse, type SpiBaseUri, provideHandlers, provideHandlers$1 as publicProvideHandlers };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ServicePluginDefinition, BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
2
|
+
|
|
3
|
+
interface GetChargeLimitRequest {
|
|
2
4
|
/**
|
|
3
5
|
* ID of the subscription for which Wix retrieves the charge limit. Equals
|
|
4
6
|
* `null` in case Wix hasn't created the subscription when retrieving an
|
|
@@ -17,7 +19,7 @@ export interface GetChargeLimitRequest {
|
|
|
17
19
|
*/
|
|
18
20
|
currency?: string;
|
|
19
21
|
}
|
|
20
|
-
|
|
22
|
+
interface GetChargeLimitResponse {
|
|
21
23
|
/**
|
|
22
24
|
* Retrieved charge limit for the app instance. You can't update the
|
|
23
25
|
* charge limit after you've set an initial value. Site owners can increase the
|
|
@@ -27,7 +29,7 @@ export interface GetChargeLimitResponse {
|
|
|
27
29
|
*/
|
|
28
30
|
chargeLimit?: string | null;
|
|
29
31
|
}
|
|
30
|
-
|
|
32
|
+
interface ListChargesRequest {
|
|
31
33
|
/**
|
|
32
34
|
* ID of the subscription for which Wix retrieves your custom charges.
|
|
33
35
|
* To track usage and billing for apps, we recommend to use `instanceId` instead
|
|
@@ -57,13 +59,13 @@ export interface ListChargesRequest {
|
|
|
57
59
|
/** Information about what Wix intends to do with the retrieved charges. */
|
|
58
60
|
intent?: Intent;
|
|
59
61
|
}
|
|
60
|
-
|
|
62
|
+
declare enum Intent {
|
|
61
63
|
/** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
|
|
62
64
|
DISPLAY_ONLY = "DISPLAY_ONLY",
|
|
63
65
|
/** Create an invoice for the customer. */
|
|
64
66
|
CREATE_INVOICE = "CREATE_INVOICE"
|
|
65
67
|
}
|
|
66
|
-
|
|
68
|
+
interface ListChargesResponse {
|
|
67
69
|
/**
|
|
68
70
|
* Retrieved charges.
|
|
69
71
|
*
|
|
@@ -72,7 +74,7 @@ export interface ListChargesResponse {
|
|
|
72
74
|
*/
|
|
73
75
|
charges?: ChargeLineItem[];
|
|
74
76
|
}
|
|
75
|
-
|
|
77
|
+
interface ChargeLineItem {
|
|
76
78
|
/**
|
|
77
79
|
* ID of the charge. Make sure to save the charge ID on your servers for future
|
|
78
80
|
* reference. Identical to `lineItem.chargeId` in the Invoice Created Event.
|
|
@@ -95,7 +97,7 @@ export interface ChargeLineItem {
|
|
|
95
97
|
*/
|
|
96
98
|
amount?: string;
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
interface ChargesRejectedRequest {
|
|
99
101
|
/**
|
|
100
102
|
* ID of the subscription for which Wix hasn't accepted your custom charges.
|
|
101
103
|
* To track usage and billing for apps, we recommend to use `instanceId` instead
|
|
@@ -135,7 +137,7 @@ export interface ChargesRejectedRequest {
|
|
|
135
137
|
*/
|
|
136
138
|
reasons?: ChargesRejectedReason[];
|
|
137
139
|
}
|
|
138
|
-
|
|
140
|
+
declare enum ChargesRejectedReason {
|
|
139
141
|
/** There is no information about why Wix has rejected the charges. */
|
|
140
142
|
UNKNOWN = "UNKNOWN",
|
|
141
143
|
/** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
|
|
@@ -145,9 +147,9 @@ export declare enum ChargesRejectedReason {
|
|
|
145
147
|
/** You must submit charges as whole numbers or use a dot to separate major and minor units. For example, `10` or `1.50`. Currently, Wix doesn't validate whether the submitted number of decimals for the minor unit is supported for the given currency. */
|
|
146
148
|
INVALID_FORMAT = "INVALID_FORMAT"
|
|
147
149
|
}
|
|
148
|
-
|
|
150
|
+
interface ChargesRejectedResponse {
|
|
149
151
|
}
|
|
150
|
-
|
|
152
|
+
interface InvoiceCreatedRequest {
|
|
151
153
|
/**
|
|
152
154
|
* ID of the subscription for which Wix has created an invoice that includes
|
|
153
155
|
* your custom charges. To track usage and billing for apps, we recommend to use
|
|
@@ -172,7 +174,7 @@ export interface InvoiceCreatedRequest {
|
|
|
172
174
|
*/
|
|
173
175
|
lineItems?: InvoiceLineItem[];
|
|
174
176
|
}
|
|
175
|
-
|
|
177
|
+
interface InvoiceLineItem {
|
|
176
178
|
/**
|
|
177
179
|
* ID of the charge as returned in List Charges.
|
|
178
180
|
*
|
|
@@ -191,9 +193,9 @@ export interface InvoiceLineItem {
|
|
|
191
193
|
*/
|
|
192
194
|
_id?: string;
|
|
193
195
|
}
|
|
194
|
-
|
|
196
|
+
interface InvoiceCreatedResponse {
|
|
195
197
|
}
|
|
196
|
-
|
|
198
|
+
interface ChargeLimitUpdatedRequest {
|
|
197
199
|
/**
|
|
198
200
|
* ID of the subscription for which the charge limit has been updated.
|
|
199
201
|
* To track usage and billing for apps, we recommend to use `instanceId` instead
|
|
@@ -216,9 +218,9 @@ export interface ChargeLimitUpdatedRequest {
|
|
|
216
218
|
*/
|
|
217
219
|
chargeLimit?: string | null;
|
|
218
220
|
}
|
|
219
|
-
|
|
221
|
+
interface ChargeLimitUpdatedResponse {
|
|
220
222
|
}
|
|
221
|
-
|
|
223
|
+
interface CustomChargesConfig {
|
|
222
224
|
/**
|
|
223
225
|
* Base part of your integration's deployment URI for the Custom Charges SPI.
|
|
224
226
|
* For example `"https://provider.example.com"`, if Wix should call your
|
|
@@ -227,7 +229,7 @@ export interface CustomChargesConfig {
|
|
|
227
229
|
*/
|
|
228
230
|
baseUri?: SpiBaseUri;
|
|
229
231
|
}
|
|
230
|
-
|
|
232
|
+
interface SpiBaseUri {
|
|
231
233
|
/**
|
|
232
234
|
* Base URI where the methods are called. Wix appends the path to the `baseUri`.
|
|
233
235
|
* For example, to call the Get Shipping Rates method at `https://my-shipping-provider.com/v1/getRates`, the base URI you provide here is `https://my-shipping-provider.com/`.
|
|
@@ -238,7 +240,7 @@ export interface SpiBaseUri {
|
|
|
238
240
|
/** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
|
|
239
241
|
alternativeUris?: AlternativeUri[];
|
|
240
242
|
}
|
|
241
|
-
|
|
243
|
+
interface AlternativeUri {
|
|
242
244
|
/**
|
|
243
245
|
* Name of the method to create a custom URI for.
|
|
244
246
|
*
|
|
@@ -269,7 +271,7 @@ export interface AlternativeUri {
|
|
|
269
271
|
* }
|
|
270
272
|
* ```
|
|
271
273
|
*/
|
|
272
|
-
|
|
274
|
+
interface Context {
|
|
273
275
|
/** A unique identifier of the request. You may print this ID to your logs to help with future debugging and easier correlation with Wix's logs. */
|
|
274
276
|
requestId?: string | null;
|
|
275
277
|
/**
|
|
@@ -287,14 +289,14 @@ export interface Context {
|
|
|
287
289
|
*/
|
|
288
290
|
instanceId?: string | null;
|
|
289
291
|
}
|
|
290
|
-
|
|
292
|
+
declare enum IdentityType {
|
|
291
293
|
UNKNOWN = "UNKNOWN",
|
|
292
294
|
ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
|
|
293
295
|
MEMBER = "MEMBER",
|
|
294
296
|
WIX_USER = "WIX_USER",
|
|
295
297
|
APP = "APP"
|
|
296
298
|
}
|
|
297
|
-
|
|
299
|
+
interface IdentificationData extends IdentificationDataIdOneOf {
|
|
298
300
|
/**
|
|
299
301
|
* ID of a site visitor that has not logged in to the site.
|
|
300
302
|
* @format GUID
|
|
@@ -319,7 +321,7 @@ export interface IdentificationData extends IdentificationDataIdOneOf {
|
|
|
319
321
|
identityType?: IdentityType;
|
|
320
322
|
}
|
|
321
323
|
/** @oneof */
|
|
322
|
-
|
|
324
|
+
interface IdentificationDataIdOneOf {
|
|
323
325
|
/**
|
|
324
326
|
* ID of a site visitor that has not logged in to the site.
|
|
325
327
|
* @format GUID
|
|
@@ -341,3 +343,85 @@ export interface IdentificationDataIdOneOf {
|
|
|
341
343
|
*/
|
|
342
344
|
appId?: string;
|
|
343
345
|
}
|
|
346
|
+
|
|
347
|
+
interface GetChargeLimitEnvelope {
|
|
348
|
+
request: GetChargeLimitRequest;
|
|
349
|
+
metadata: Context;
|
|
350
|
+
}
|
|
351
|
+
interface ListChargesEnvelope {
|
|
352
|
+
request: ListChargesRequest;
|
|
353
|
+
metadata: Context;
|
|
354
|
+
}
|
|
355
|
+
interface ChargesRejectedEventEnvelope {
|
|
356
|
+
request: ChargesRejectedRequest;
|
|
357
|
+
metadata: Context;
|
|
358
|
+
}
|
|
359
|
+
interface InvoiceCreatedEventEnvelope {
|
|
360
|
+
request: InvoiceCreatedRequest;
|
|
361
|
+
metadata: Context;
|
|
362
|
+
}
|
|
363
|
+
interface ChargeLimitUpdatedEventEnvelope {
|
|
364
|
+
request: ChargeLimitUpdatedRequest;
|
|
365
|
+
metadata: Context;
|
|
366
|
+
}
|
|
367
|
+
declare const provideHandlers$1: ServicePluginDefinition<{
|
|
368
|
+
/**
|
|
369
|
+
*
|
|
370
|
+
* Wix calls this method to retrieve the initial charge limit for a paid instance
|
|
371
|
+
* of your app. This happens every time a customer is upgrading to a paid version of
|
|
372
|
+
* your app.
|
|
373
|
+
*
|
|
374
|
+
* You can't update the charge limit after you've set an initial
|
|
375
|
+
* value. Customers can increase the limit in their site's dashboard, currently they
|
|
376
|
+
* aren't allowed to decrease it. */
|
|
377
|
+
getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
|
|
378
|
+
/**
|
|
379
|
+
*
|
|
380
|
+
* Wix calls this method to retrieve a list of charges for a paid instance
|
|
381
|
+
* of your app. This happens when Wix creates an invoice or in case the customer
|
|
382
|
+
* wants to preview how much your app would charge them at the moment.
|
|
383
|
+
*
|
|
384
|
+
* You must return the charges in the currency that's specified in the request,
|
|
385
|
+
* you aren't allowed to return more than 5 charges, and their sum must be lower
|
|
386
|
+
* than the charge limit.
|
|
387
|
+
*
|
|
388
|
+
* You may not bill customers for any usage that didn’t occur during the period
|
|
389
|
+
* Wix specifies when retrieving the charges. If Wix discovers that your app has
|
|
390
|
+
* charged customers for usage outside of an invoice's specified period, we may
|
|
391
|
+
* take action such as blocking your app from charging the customer, removing
|
|
392
|
+
* your app from the Wix App Market, revoking your access to the Wix developer
|
|
393
|
+
* program, or pursuing legal action to recover damages caused by overcharging.
|
|
394
|
+
* We understand that mistakes can happen and encourage you to contact
|
|
395
|
+
* [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
|
|
396
|
+
* become aware of any overcharging issues so that we can work together to
|
|
397
|
+
* resolve the situation. */
|
|
398
|
+
listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
|
|
399
|
+
/**
|
|
400
|
+
*
|
|
401
|
+
* Triggered in case Wix doesn't accept the charges you've returned in the
|
|
402
|
+
* List Charges method.
|
|
403
|
+
*
|
|
404
|
+
*
|
|
405
|
+
* You aren't allowed to charge a site owner more than the charge limit. Wix
|
|
406
|
+
* call List Charges in regular intervals until the sum of all charges is lower than the
|
|
407
|
+
* charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
|
|
408
|
+
chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
|
|
409
|
+
/**
|
|
410
|
+
*
|
|
411
|
+
* Triggered in case Wix creates an invoice that includes charges for an instance
|
|
412
|
+
* of your app. */
|
|
413
|
+
invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
|
|
414
|
+
/**
|
|
415
|
+
*
|
|
416
|
+
* Triggered in case the charge limit for an instance of your app is updated.
|
|
417
|
+
*
|
|
418
|
+
*
|
|
419
|
+
* You can't update the charge limit after you've set an initial
|
|
420
|
+
* value. Site owners can increase the limit in their site's dashboard,
|
|
421
|
+
* currently they aren't allowed to decrease it. */
|
|
422
|
+
chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
|
|
423
|
+
}>;
|
|
424
|
+
|
|
425
|
+
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1>;
|
|
426
|
+
|
|
427
|
+
export { type AlternativeUri, type ChargeLimitUpdatedRequest, type ChargeLimitUpdatedResponse, type ChargeLineItem, ChargesRejectedReason, type ChargesRejectedRequest, type ChargesRejectedResponse, type Context, type CustomChargesConfig, type GetChargeLimitRequest, type GetChargeLimitResponse, type IdentificationData, type IdentificationDataIdOneOf, IdentityType, Intent, type InvoiceCreatedRequest, type InvoiceCreatedResponse, type InvoiceLineItem, type ListChargesRequest, type ListChargesResponse, type SpiBaseUri, provideHandlers, provideHandlers$1 as publicProvideHandlers };
|
package/build/index.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ChargesRejectedReason: () => ChargesRejectedReason,
|
|
24
|
+
IdentityType: () => IdentityType,
|
|
25
|
+
Intent: () => Intent,
|
|
26
|
+
provideHandlers: () => provideHandlers2,
|
|
27
|
+
publicProvideHandlers: () => provideHandlers
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(index_exports);
|
|
30
|
+
|
|
31
|
+
// src/service-plugins-types.ts
|
|
32
|
+
var Intent = /* @__PURE__ */ ((Intent2) => {
|
|
33
|
+
Intent2["DISPLAY_ONLY"] = "DISPLAY_ONLY";
|
|
34
|
+
Intent2["CREATE_INVOICE"] = "CREATE_INVOICE";
|
|
35
|
+
return Intent2;
|
|
36
|
+
})(Intent || {});
|
|
37
|
+
var ChargesRejectedReason = /* @__PURE__ */ ((ChargesRejectedReason2) => {
|
|
38
|
+
ChargesRejectedReason2["UNKNOWN"] = "UNKNOWN";
|
|
39
|
+
ChargesRejectedReason2["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
|
|
40
|
+
ChargesRejectedReason2["TOO_MANY_CHARGES"] = "TOO_MANY_CHARGES";
|
|
41
|
+
ChargesRejectedReason2["INVALID_FORMAT"] = "INVALID_FORMAT";
|
|
42
|
+
return ChargesRejectedReason2;
|
|
43
|
+
})(ChargesRejectedReason || {});
|
|
44
|
+
var IdentityType = /* @__PURE__ */ ((IdentityType2) => {
|
|
45
|
+
IdentityType2["UNKNOWN"] = "UNKNOWN";
|
|
46
|
+
IdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
|
|
47
|
+
IdentityType2["MEMBER"] = "MEMBER";
|
|
48
|
+
IdentityType2["WIX_USER"] = "WIX_USER";
|
|
49
|
+
IdentityType2["APP"] = "APP";
|
|
50
|
+
return IdentityType2;
|
|
51
|
+
})(IdentityType || {});
|
|
52
|
+
|
|
53
|
+
// src/interfaces-premium-v1-custom-charges-provider.public.ts
|
|
54
|
+
var import_sdk_types = require("@wix/sdk-types");
|
|
55
|
+
var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
|
|
56
|
+
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
57
|
+
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
58
|
+
var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("PREMIUM_CUSTOM_CHARGES", [
|
|
59
|
+
{
|
|
60
|
+
name: "getChargeLimit",
|
|
61
|
+
primaryHttpMappingPath: "/v1/charge-limit",
|
|
62
|
+
transformations: {
|
|
63
|
+
toREST: (payload) => {
|
|
64
|
+
const toRestResponse = payload;
|
|
65
|
+
return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
|
|
66
|
+
},
|
|
67
|
+
fromREST: (payload) => {
|
|
68
|
+
const fromRestRequest = payload;
|
|
69
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "listCharges",
|
|
75
|
+
primaryHttpMappingPath: "/v1/charges",
|
|
76
|
+
transformations: {
|
|
77
|
+
toREST: (payload) => {
|
|
78
|
+
const toRestResponse = payload;
|
|
79
|
+
return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
|
|
80
|
+
},
|
|
81
|
+
fromREST: (payload) => {
|
|
82
|
+
const fromRestRequest = (0, import_transform_paths.transformPaths)(payload, [
|
|
83
|
+
{
|
|
84
|
+
transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
|
|
85
|
+
paths: [
|
|
86
|
+
{ path: "request.periodStart" },
|
|
87
|
+
{ path: "request.periodEnd" }
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
]);
|
|
91
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "chargesRejectedEvent",
|
|
97
|
+
primaryHttpMappingPath: "/v1/charges-rejected",
|
|
98
|
+
transformations: {
|
|
99
|
+
toREST: (payload) => {
|
|
100
|
+
const toRestResponse = payload;
|
|
101
|
+
return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
|
|
102
|
+
},
|
|
103
|
+
fromREST: (payload) => {
|
|
104
|
+
const fromRestRequest = payload;
|
|
105
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "invoiceCreatedEvent",
|
|
111
|
+
primaryHttpMappingPath: "/v1/invoice-created",
|
|
112
|
+
transformations: {
|
|
113
|
+
toREST: (payload) => {
|
|
114
|
+
const toRestResponse = payload;
|
|
115
|
+
return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
|
|
116
|
+
},
|
|
117
|
+
fromREST: (payload) => {
|
|
118
|
+
const fromRestRequest = payload;
|
|
119
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "chargeLimitUpdatedEvent",
|
|
125
|
+
primaryHttpMappingPath: "/v1/limit-updated",
|
|
126
|
+
transformations: {
|
|
127
|
+
toREST: (payload) => {
|
|
128
|
+
const toRestResponse = payload;
|
|
129
|
+
return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
|
|
130
|
+
},
|
|
131
|
+
fromREST: (payload) => {
|
|
132
|
+
const fromRestRequest = payload;
|
|
133
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
]);
|
|
138
|
+
|
|
139
|
+
// src/interfaces-premium-v1-custom-charges-provider.context.ts
|
|
140
|
+
var import_service_plugin_modules = require("@wix/sdk-runtime/service-plugin-modules");
|
|
141
|
+
var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(provideHandlers);
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {
|
|
144
|
+
ChargesRejectedReason,
|
|
145
|
+
IdentityType,
|
|
146
|
+
Intent,
|
|
147
|
+
provideHandlers,
|
|
148
|
+
publicProvideHandlers
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=index.js.map
|