@wix/auto_sdk_app-management_custom-charges 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.
Files changed (61) hide show
  1. package/build/cjs/index.d.ts +2 -0
  2. package/build/cjs/index.js +19 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +59 -0
  5. package/build/cjs/index.typings.js +18 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  8. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +9 -0
  9. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  10. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  11. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +88 -0
  12. package/build/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  13. package/build/cjs/src/service-plugins-types.d.ts +275 -0
  14. package/build/cjs/src/service-plugins-types.js +30 -0
  15. package/build/cjs/src/service-plugins-types.js.map +1 -0
  16. package/build/es/index.d.ts +2 -0
  17. package/build/es/index.js +3 -0
  18. package/build/es/index.js.map +1 -0
  19. package/build/es/index.typings.d.ts +59 -0
  20. package/build/es/index.typings.js +2 -0
  21. package/build/es/index.typings.js.map +1 -0
  22. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  23. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js +6 -0
  24. package/build/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  25. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  26. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js +85 -0
  27. package/build/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  28. package/build/es/src/service-plugins-types.d.ts +275 -0
  29. package/build/es/src/service-plugins-types.js +27 -0
  30. package/build/es/src/service-plugins-types.js.map +1 -0
  31. package/build/internal/cjs/index.d.ts +2 -0
  32. package/build/internal/cjs/index.js +19 -0
  33. package/build/internal/cjs/index.js.map +1 -0
  34. package/build/internal/cjs/index.typings.d.ts +59 -0
  35. package/build/internal/cjs/index.typings.js +18 -0
  36. package/build/internal/cjs/index.typings.js.map +1 -0
  37. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  38. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js +9 -0
  39. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  40. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  41. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js +88 -0
  42. package/build/internal/cjs/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  43. package/build/internal/cjs/src/service-plugins-types.d.ts +275 -0
  44. package/build/internal/cjs/src/service-plugins-types.js +30 -0
  45. package/build/internal/cjs/src/service-plugins-types.js.map +1 -0
  46. package/build/internal/es/index.d.ts +2 -0
  47. package/build/internal/es/index.js +3 -0
  48. package/build/internal/es/index.js.map +1 -0
  49. package/build/internal/es/index.typings.d.ts +59 -0
  50. package/build/internal/es/index.typings.js +2 -0
  51. package/build/internal/es/index.typings.js.map +1 -0
  52. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.d.ts +5 -0
  53. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js +6 -0
  54. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.context.js.map +1 -0
  55. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.d.ts +79 -0
  56. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js +85 -0
  57. package/build/internal/es/src/interfaces-premium-v1-custom-charges-provider.public.js.map +1 -0
  58. package/build/internal/es/src/service-plugins-types.d.ts +275 -0
  59. package/build/internal/es/src/service-plugins-types.js +27 -0
  60. package/build/internal/es/src/service-plugins-types.js.map +1 -0
  61. package/package.json +52 -0
@@ -0,0 +1,18 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/service-plugins-types"), exports);
18
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../../index.typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAeA,8DAA4C"}
@@ -0,0 +1,5 @@
1
+ import './interfaces-premium-v1-custom-charges-provider.public.js';
2
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
3
+ import { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';
4
+ export { publicProvideHandlers };
5
+ export declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provideHandlers = exports.publicProvideHandlers = void 0;
4
+ require("./interfaces-premium-v1-custom-charges-provider.public.js");
5
+ const service_plugin_modules_1 = require("@wix/sdk-runtime/service-plugin-modules");
6
+ const interfaces_premium_v1_custom_charges_provider_public_js_1 = require("./interfaces-premium-v1-custom-charges-provider.public.js");
7
+ Object.defineProperty(exports, "publicProvideHandlers", { enumerable: true, get: function () { return interfaces_premium_v1_custom_charges_provider_public_js_1.provideHandlers; } });
8
+ exports.provideHandlers = (0, service_plugin_modules_1.createServicePluginModule)(interfaces_premium_v1_custom_charges_provider_public_js_1.provideHandlers);
9
+ //# sourceMappingURL=interfaces-premium-v1-custom-charges-provider.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-premium-v1-custom-charges-provider.context.js","sourceRoot":"","sources":["../../../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"names":[],"mappings":";;;AAAA,qEAAmE;AACnE,oFAAoF;AACpF,uIAAqH;AAE5G,sGAFmB,yEAAqB,OAEnB;AAEjB,QAAA,eAAe,GAExB,IAAA,kDAAyB,EAAC,yEAAqB,CAAC,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { ServicePluginDefinition } from '@wix/sdk-types';
2
+ import { Context, GetChargeLimitRequest, GetChargeLimitResponse, ListChargesRequest, ListChargesResponse, ChargesRejectedRequest, ChargesRejectedResponse, InvoiceCreatedRequest, InvoiceCreatedResponse, ChargeLimitUpdatedRequest, ChargeLimitUpdatedResponse } from './service-plugins-types.js';
3
+ export interface GetChargeLimitEnvelope {
4
+ request: GetChargeLimitRequest;
5
+ metadata: Context;
6
+ }
7
+ export interface ListChargesEnvelope {
8
+ request: ListChargesRequest;
9
+ metadata: Context;
10
+ }
11
+ export interface ChargesRejectedEventEnvelope {
12
+ request: ChargesRejectedRequest;
13
+ metadata: Context;
14
+ }
15
+ export interface InvoiceCreatedEventEnvelope {
16
+ request: InvoiceCreatedRequest;
17
+ metadata: Context;
18
+ }
19
+ export interface ChargeLimitUpdatedEventEnvelope {
20
+ request: ChargeLimitUpdatedRequest;
21
+ metadata: Context;
22
+ }
23
+ export declare const provideHandlers: ServicePluginDefinition<{
24
+ /**
25
+ *
26
+ * Wix calls this method to retrieve the initial charge limit for a paid instance
27
+ * of your app. This happens every time a customer is upgrading to a paid version of
28
+ * your app.
29
+ *
30
+ * You can't update the charge limit after you've set an initial
31
+ * value. Customers can increase the limit in their site's dashboard, currently they
32
+ * aren't allowed to decrease it. */
33
+ getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
34
+ /**
35
+ *
36
+ * Wix calls this method to retrieve a list of charges for a paid instance
37
+ * of your app. This happens when Wix creates an invoice or in case the customer
38
+ * wants to preview how much your app would charge them at the moment.
39
+ *
40
+ * You must return the charges in the currency that's specified in the request,
41
+ * you aren't allowed to return more than 5 charges, and their sum must be lower
42
+ * than the charge limit.
43
+ *
44
+ * You may not bill customers for any usage that didn’t occur during the period
45
+ * Wix specifies when retrieving the charges. If Wix discovers that your app has
46
+ * charged customers for usage outside of an invoice's specified period, we may
47
+ * take action such as blocking your app from charging the customer, removing
48
+ * your app from the Wix App Market, revoking your access to the Wix developer
49
+ * program, or pursuing legal action to recover damages caused by overcharging.
50
+ * We understand that mistakes can happen and encourage you to contact
51
+ * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
52
+ * become aware of any overcharging issues so that we can work together to
53
+ * resolve the situation. */
54
+ listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
55
+ /**
56
+ *
57
+ * Triggered in case Wix doesn't accept the charges you've returned in the
58
+ * List Charges method.
59
+ *
60
+ *
61
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
62
+ * call List Charges in regular intervals until the sum of all charges is lower than the
63
+ * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */
64
+ chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
65
+ /**
66
+ *
67
+ * Triggered in case Wix creates an invoice that includes charges for an instance
68
+ * of your app. */
69
+ invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
70
+ /**
71
+ *
72
+ * Triggered in case the charge limit for an instance of your app is updated.
73
+ *
74
+ *
75
+ * You can't update the charge limit after you've set an initial
76
+ * value. Site owners can increase the limit in their site's dashboard,
77
+ * currently they aren't allowed to decrease it. */
78
+ chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
79
+ }>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provideHandlers = void 0;
4
+ const sdk_types_1 = require("@wix/sdk-types");
5
+ const timestamp_1 = require("@wix/sdk-runtime/transformations/timestamp");
6
+ const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
7
+ const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
8
+ exports.provideHandlers = (0, sdk_types_1.ServicePluginDefinition)('PREMIUM_CUSTOM_CHARGES', [
9
+ {
10
+ name: 'getChargeLimit',
11
+ primaryHttpMappingPath: '/v1/charge-limit',
12
+ transformations: {
13
+ toREST: (payload) => {
14
+ const toRestResponse = payload;
15
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
16
+ },
17
+ fromREST: (payload) => {
18
+ const fromRestRequest = payload;
19
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
20
+ },
21
+ },
22
+ },
23
+ {
24
+ name: 'listCharges',
25
+ primaryHttpMappingPath: '/v1/charges',
26
+ transformations: {
27
+ toREST: (payload) => {
28
+ const toRestResponse = payload;
29
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
30
+ },
31
+ fromREST: (payload) => {
32
+ const fromRestRequest = (0, transform_paths_1.transformPaths)(payload, [
33
+ {
34
+ transformFn: timestamp_1.transformRESTTimestampToSDKTimestamp,
35
+ paths: [
36
+ { path: 'request.periodStart' },
37
+ { path: 'request.periodEnd' },
38
+ ],
39
+ },
40
+ ]);
41
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
42
+ },
43
+ },
44
+ },
45
+ {
46
+ name: 'chargesRejectedEvent',
47
+ primaryHttpMappingPath: '/v1/charges-rejected',
48
+ transformations: {
49
+ toREST: (payload) => {
50
+ const toRestResponse = payload;
51
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
52
+ },
53
+ fromREST: (payload) => {
54
+ const fromRestRequest = payload;
55
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
56
+ },
57
+ },
58
+ },
59
+ {
60
+ name: 'invoiceCreatedEvent',
61
+ primaryHttpMappingPath: '/v1/invoice-created',
62
+ transformations: {
63
+ toREST: (payload) => {
64
+ const toRestResponse = payload;
65
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
66
+ },
67
+ fromREST: (payload) => {
68
+ const fromRestRequest = payload;
69
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
70
+ },
71
+ },
72
+ },
73
+ {
74
+ name: 'chargeLimitUpdatedEvent',
75
+ primaryHttpMappingPath: '/v1/limit-updated',
76
+ transformations: {
77
+ toREST: (payload) => {
78
+ const toRestResponse = payload;
79
+ return (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)(toRestResponse);
80
+ },
81
+ fromREST: (payload) => {
82
+ const fromRestRequest = payload;
83
+ return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(fromRestRequest);
84
+ },
85
+ },
86
+ },
87
+ ]);
88
+ //# sourceMappingURL=interfaces-premium-v1-custom-charges-provider.public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-premium-v1-custom-charges-provider.public.js","sourceRoot":"","sources":["../../../../src/interfaces-premium-v1-custom-charges-provider.public.ts"],"names":[],"mappings":";;;AAAA,8CAAyD;AAczD,0EAAkG;AAClG,sFAAkF;AAClF,oFAGiD;AA2BpC,QAAA,eAAe,GAAG,IAAA,mCAAuB,EAsEnD,wBAAwB,EAAE;IAC3B;QACE,IAAI,EAAE,gBAAgB;QACtB,sBAAsB,EAAE,kBAAkB;QAC1C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,aAAa;QACnB,sBAAsB,EAAE,aAAa;QACrC,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,IAAA,gCAAc,EAAC,OAAO,EAAE;oBAC9C;wBACE,WAAW,EAAE,gDAAoC;wBACjD,KAAK,EAAE;4BACL,EAAE,IAAI,EAAE,qBAAqB,EAAE;4BAC/B,EAAE,IAAI,EAAE,mBAAmB,EAAE;yBAC9B;qBACF;iBACF,CAAC,CAAC;gBAEH,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,sBAAsB;QAC5B,sBAAsB,EAAE,sBAAsB;QAC9C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,qBAAqB;QAC3B,sBAAsB,EAAE,qBAAqB;QAC7C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;IAED;QACE,IAAI,EAAE,yBAAyB;QAC/B,sBAAsB,EAAE,mBAAmB;QAC3C,eAAe,EAAE;YACf,MAAM,EAAE,CAAC,OAAY,EAAE,EAAE;gBACvB,MAAM,cAAc,GAAG,OAAO,CAAC;gBAE/B,OAAO,IAAA,8DAAqC,EAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YACD,QAAQ,EAAE,CAAC,OAAY,EAAE,EAAE;gBACzB,MAAM,eAAe,GAAG,OAAO,CAAC;gBAEhC,OAAO,IAAA,gEAAuC,EAAC,eAAe,CAAC,CAAC;YAClE,CAAC;SACF;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,275 @@
1
+ export interface GetChargeLimitRequest {
2
+ /**
3
+ * ID of the subscription for which Wix retrieves the charge limit. Equals
4
+ * `null` in case Wix hasn't created the subscription when retrieving an
5
+ * initial charge limit. To track usage and billing for apps, we recommend to
6
+ * use `instanceId` instead of the `subscriptionId`.
7
+ */
8
+ subscriptionId?: string | null;
9
+ /**
10
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
11
+ *
12
+ * 3-letter currency code in
13
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
14
+ * format of the charge limit. Wix may add supported currencies in the future.
15
+ */
16
+ currency?: string;
17
+ }
18
+ export interface GetChargeLimitResponse {
19
+ /**
20
+ * Retrieved charge limit for the app instance. You can't update the
21
+ * charge limit after you've set an initial value. Site owners can increase the
22
+ * limit in their site's dashboard, currently they aren't allowed to decrease it.
23
+ */
24
+ chargeLimit?: string | null;
25
+ }
26
+ export interface ListChargesRequest {
27
+ /**
28
+ * ID of the subscription for which Wix retrieves your custom charges.
29
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
30
+ * of the `subscriptionId`.
31
+ */
32
+ subscriptionId?: string;
33
+ /**
34
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
35
+ *
36
+ * 3-letter currency code in
37
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
38
+ * format of your charges to return. Wix may add supported currencies in the future.
39
+ */
40
+ currency?: string;
41
+ /**
42
+ * Begin of the period Wix retrieves the app instance's charges for in
43
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
44
+ */
45
+ periodStart?: Date | null;
46
+ /**
47
+ * End of the period Wix retrieves the app instance's charges for in
48
+ * `YYYY-MM-DDThh:mm:ss.sssZ` format.
49
+ */
50
+ periodEnd?: Date | null;
51
+ /** Information about what Wix intends to do with the retrieved charges. */
52
+ intent?: Intent;
53
+ }
54
+ export declare enum Intent {
55
+ /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
56
+ DISPLAY_ONLY = "DISPLAY_ONLY",
57
+ /** Create an invoice for the customer. */
58
+ CREATE_INVOICE = "CREATE_INVOICE"
59
+ }
60
+ export interface ListChargesResponse {
61
+ /**
62
+ * Retrieved charges.
63
+ *
64
+ * Max: 5 charges
65
+ */
66
+ charges?: ChargeLineItem[];
67
+ }
68
+ export interface ChargeLineItem {
69
+ /**
70
+ * ID of the charge. Make sure to save the charge ID on your servers for future
71
+ * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.
72
+ *
73
+ * Max: 64 characters
74
+ */
75
+ _id?: string | null;
76
+ /** Charge description. */
77
+ description?: string;
78
+ /**
79
+ * Charge amount in the currency that's specified in the request. Use a whole number
80
+ * or separate major and minor units with a dot. For example, `10` or `1.99`. If
81
+ * you return an amount with more minor units than supported according to
82
+ * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),
83
+ * Wix truncates the additional minor units.
84
+ *
85
+ * Min: `0.50`
86
+ */
87
+ amount?: string;
88
+ }
89
+ export interface ChargesRejectedRequest {
90
+ /**
91
+ * ID of the subscription for which Wix hasn't accepted your custom charges.
92
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
93
+ * of the `subscriptionId`.
94
+ */
95
+ subscriptionId?: string;
96
+ /**
97
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
98
+ *
99
+ * 3-letter currency code in
100
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
101
+ * format of the charges. Wix may add supported currencies in the future.
102
+ */
103
+ currency?: string;
104
+ /**
105
+ * IDs of the rejected charges.
106
+ *
107
+ * Max: 5 charges
108
+ */
109
+ chargeIds?: string[] | null;
110
+ /**
111
+ * Maximum amount that your app may charge the customer per billing cycle.
112
+ *
113
+ * Min: `0.50`
114
+ */
115
+ chargeLimit?: string | null;
116
+ /**
117
+ * Information about why Wix has rejected your app's charges.
118
+ *
119
+ * Max: 20 reasons
120
+ */
121
+ reasons?: ChargesRejectedReason[];
122
+ }
123
+ export declare enum ChargesRejectedReason {
124
+ /** There is no information about why Wix has rejected the charges. */
125
+ UNKNOWN = "UNKNOWN",
126
+ /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
127
+ CHARGE_LIMIT_EXCEEDED = "CHARGE_LIMIT_EXCEEDED",
128
+ /** You can't provide more than 5 charges per invoice. */
129
+ TOO_MANY_CHARGES = "TOO_MANY_CHARGES",
130
+ /** 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. */
131
+ INVALID_FORMAT = "INVALID_FORMAT"
132
+ }
133
+ export interface ChargesRejectedResponse {
134
+ }
135
+ export interface InvoiceCreatedRequest {
136
+ /**
137
+ * ID of the subscription for which Wix has created an invoice that includes
138
+ * your custom charges. To track usage and billing for apps, we recommend to use
139
+ * `instanceId` instead of the `subscriptionId`.
140
+ */
141
+ subscriptionId?: string;
142
+ /**
143
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
144
+ *
145
+ * 3-letter currency code in
146
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
147
+ * format of the charges. Wix may add supported currencies in the future.
148
+ */
149
+ currency?: string;
150
+ /** ID of the created invoice. */
151
+ invoiceId?: string;
152
+ /** Line items included in the invoice. */
153
+ lineItems?: InvoiceLineItem[];
154
+ }
155
+ export interface InvoiceLineItem {
156
+ /**
157
+ * ID of the charge as returned in List Charges.
158
+ *
159
+ * Max: 64 characters
160
+ */
161
+ chargeId?: string | null;
162
+ /** Charge amount. */
163
+ amount?: string;
164
+ /** ID of the line item in the invoice that Wix sends to the customer. */
165
+ _id?: string;
166
+ }
167
+ export interface InvoiceCreatedResponse {
168
+ }
169
+ export interface ChargeLimitUpdatedRequest {
170
+ /**
171
+ * ID of the subscription for which the charge limit has been updated.
172
+ * To track usage and billing for apps, we recommend to use `instanceId` instead
173
+ * of the `subscriptionId`.
174
+ */
175
+ subscriptionId?: string;
176
+ /**
177
+ * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.
178
+ *
179
+ * 3-letter currency code in
180
+ * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)
181
+ * format of the charges. Wix may add supported currencies in the future.
182
+ */
183
+ currency?: string;
184
+ /** Updated charge limit. */
185
+ chargeLimit?: string | null;
186
+ }
187
+ export interface ChargeLimitUpdatedResponse {
188
+ }
189
+ export interface CustomChargesConfig {
190
+ /**
191
+ * Base part of your integration's deployment URI for the Custom Charges SPI.
192
+ * For example `"https://provider.example.com"`, if Wix should call your
193
+ * integration at `https://provider.example.com/v1/charge-limit` for the
194
+ * Get Charge Limit method.
195
+ */
196
+ baseUri?: SpiBaseUri;
197
+ }
198
+ export interface SpiBaseUri {
199
+ /**
200
+ * Base URI where the methods are called. Wix appends the path to the `baseUri`.
201
+ * 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/`.
202
+ */
203
+ baseUri?: string;
204
+ /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */
205
+ alternativeUris?: AlternativeUri[];
206
+ }
207
+ export interface AlternativeUri {
208
+ /**
209
+ * Name of the method to create a custom URI for.
210
+ *
211
+ * For `methodName`, use the name of the method in PascalCase.
212
+ * For example, for Get Shipping Rates use `GetShippingRates`.
213
+ */
214
+ methodName?: string;
215
+ /**
216
+ * Custom URI that Wix uses to call your server for this method. The path-suffix documented in the method will not be appended to this URI.
217
+ * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.
218
+ */
219
+ absoluteUri?: string;
220
+ }
221
+ /**
222
+ * this message is not directly used by any service,
223
+ * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.
224
+ * e.g. SPIs, event-handlers, etc..
225
+ * NOTE: this context object MUST be provided as the last argument in each Velo method signature.
226
+ *
227
+ * Example:
228
+ * ```typescript
229
+ * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {
230
+ * ...
231
+ * }
232
+ * ```
233
+ */
234
+ export interface Context {
235
+ /** 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. */
236
+ requestId?: string | null;
237
+ /** [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code. */
238
+ currency?: string | null;
239
+ /** An object that describes the identity that triggered this request. */
240
+ identity?: IdentificationData;
241
+ /** A string representing a language and region in the format of `"xx-XX"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash "-", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `"en-US"`. */
242
+ languages?: string[];
243
+ /** The service provider app's instance ID. */
244
+ instanceId?: string | null;
245
+ }
246
+ export declare enum IdentityType {
247
+ UNKNOWN = "UNKNOWN",
248
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
249
+ MEMBER = "MEMBER",
250
+ WIX_USER = "WIX_USER",
251
+ APP = "APP"
252
+ }
253
+ export interface IdentificationData extends IdentificationDataIdOneOf {
254
+ /** ID of a site visitor that has not logged in to the site. */
255
+ anonymousVisitorId?: string;
256
+ /** ID of a site visitor that has logged in to the site. */
257
+ memberId?: string;
258
+ /** ID of a Wix user (site owner, contributor, etc.). */
259
+ wixUserId?: string;
260
+ /** ID of an app. */
261
+ appId?: string;
262
+ /** @readonly */
263
+ identityType?: IdentityType;
264
+ }
265
+ /** @oneof */
266
+ export interface IdentificationDataIdOneOf {
267
+ /** ID of a site visitor that has not logged in to the site. */
268
+ anonymousVisitorId?: string;
269
+ /** ID of a site visitor that has logged in to the site. */
270
+ memberId?: string;
271
+ /** ID of a Wix user (site owner, contributor, etc.). */
272
+ wixUserId?: string;
273
+ /** ID of an app. */
274
+ appId?: string;
275
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IdentityType = exports.ChargesRejectedReason = exports.Intent = void 0;
4
+ var Intent;
5
+ (function (Intent) {
6
+ /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */
7
+ Intent["DISPLAY_ONLY"] = "DISPLAY_ONLY";
8
+ /** Create an invoice for the customer. */
9
+ Intent["CREATE_INVOICE"] = "CREATE_INVOICE";
10
+ })(Intent || (exports.Intent = Intent = {}));
11
+ var ChargesRejectedReason;
12
+ (function (ChargesRejectedReason) {
13
+ /** There is no information about why Wix has rejected the charges. */
14
+ ChargesRejectedReason["UNKNOWN"] = "UNKNOWN";
15
+ /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */
16
+ ChargesRejectedReason["CHARGE_LIMIT_EXCEEDED"] = "CHARGE_LIMIT_EXCEEDED";
17
+ /** You can't provide more than 5 charges per invoice. */
18
+ ChargesRejectedReason["TOO_MANY_CHARGES"] = "TOO_MANY_CHARGES";
19
+ /** 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. */
20
+ ChargesRejectedReason["INVALID_FORMAT"] = "INVALID_FORMAT";
21
+ })(ChargesRejectedReason || (exports.ChargesRejectedReason = ChargesRejectedReason = {}));
22
+ var IdentityType;
23
+ (function (IdentityType) {
24
+ IdentityType["UNKNOWN"] = "UNKNOWN";
25
+ IdentityType["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
26
+ IdentityType["MEMBER"] = "MEMBER";
27
+ IdentityType["WIX_USER"] = "WIX_USER";
28
+ IdentityType["APP"] = "APP";
29
+ })(IdentityType || (exports.IdentityType = IdentityType = {}));
30
+ //# sourceMappingURL=service-plugins-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-plugins-types.js","sourceRoot":"","sources":["../../../../src/service-plugins-types.ts"],"names":[],"mappings":";;;AAwDA,IAAY,MAKX;AALD,WAAY,MAAM;IAChB,kHAAkH;IAClH,uCAA6B,CAAA;IAC7B,0CAA0C;IAC1C,2CAAiC,CAAA;AACnC,CAAC,EALW,MAAM,sBAAN,MAAM,QAKjB;AAoED,IAAY,qBASX;AATD,WAAY,qBAAqB;IAC/B,sEAAsE;IACtE,4CAAmB,CAAA;IACnB,0GAA0G;IAC1G,wEAA+C,CAAA;IAC/C,yDAAyD;IACzD,8DAAqC,CAAA;IACrC,6PAA6P;IAC7P,0DAAiC,CAAA;AACnC,CAAC,EATW,qBAAqB,qCAArB,qBAAqB,QAShC;AA0HD,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,uDAAuC,CAAA;IACvC,iCAAiB,CAAA;IACjB,qCAAqB,CAAA;IACrB,2BAAW,CAAA;AACb,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB"}
@@ -0,0 +1,2 @@
1
+ export * from './src/service-plugins-types';
2
+ export * from './src/interfaces-premium-v1-custom-charges-provider.context';
@@ -0,0 +1,3 @@
1
+ export * from './src/service-plugins-types';
2
+ export * from './src/interfaces-premium-v1-custom-charges-provider.context';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6DAA6D,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { GetChargeLimitResponse, ListChargesResponse, ChargesRejectedResponse, InvoiceCreatedResponse, ChargeLimitUpdatedResponse } from './src/service-plugins-types.js';
2
+ import { GetChargeLimitEnvelope, ListChargesEnvelope, ChargesRejectedEventEnvelope, InvoiceCreatedEventEnvelope, ChargeLimitUpdatedEventEnvelope } from './src/interfaces-premium-v1-custom-charges-provider.public.js';
3
+ export * from './src/service-plugins-types';
4
+ export { GetChargeLimitEnvelope, ListChargesEnvelope, ChargesRejectedEventEnvelope, InvoiceCreatedEventEnvelope, ChargeLimitUpdatedEventEnvelope, };
5
+ /**
6
+ * Wix calls this method to retrieve the initial charge limit for a paid instance
7
+ * of your app. This happens every time a customer is upgrading to a paid version of
8
+ * your app.
9
+ *
10
+ * You can't update the charge limit after you've set an initial
11
+ * value. Customers can increase the limit in their site's dashboard, currently they
12
+ * aren't allowed to decrease it.
13
+ */
14
+ export declare function getChargeLimit(payload: GetChargeLimitEnvelope): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;
15
+ /**
16
+ * Wix calls this method to retrieve a list of charges for a paid instance
17
+ * of your app. This happens when Wix creates an invoice or in case the customer
18
+ * wants to preview how much your app would charge them at the moment.
19
+ *
20
+ * You must return the charges in the currency that's specified in the request,
21
+ * you aren't allowed to return more than 5 charges, and their sum must be lower
22
+ * than the charge limit.
23
+ *
24
+ * You may not bill customers for any usage that didn’t occur during the period
25
+ * Wix specifies when retrieving the charges. If Wix discovers that your app has
26
+ * charged customers for usage outside of an invoice's specified period, we may
27
+ * take action such as blocking your app from charging the customer, removing
28
+ * your app from the Wix App Market, revoking your access to the Wix developer
29
+ * program, or pursuing legal action to recover damages caused by overcharging.
30
+ * We understand that mistakes can happen and encourage you to contact
31
+ * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you
32
+ * become aware of any overcharging issues so that we can work together to
33
+ * resolve the situation.
34
+ */
35
+ export declare function listCharges(payload: ListChargesEnvelope): ListChargesResponse | Promise<ListChargesResponse>;
36
+ /**
37
+ * Triggered in case Wix doesn't accept the charges you've returned in the
38
+ * List Charges method.
39
+ *
40
+ *
41
+ * You aren't allowed to charge a site owner more than the charge limit. Wix
42
+ * call List Charges in regular intervals until the sum of all charges is lower than the
43
+ * charge limit. Wix doesn't create an invoice in case the charges aren't accepted.
44
+ */
45
+ export declare function chargesRejectedEvent(payload: ChargesRejectedEventEnvelope): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;
46
+ /**
47
+ * Triggered in case Wix creates an invoice that includes charges for an instance
48
+ * of your app.
49
+ */
50
+ export declare function invoiceCreatedEvent(payload: InvoiceCreatedEventEnvelope): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;
51
+ /**
52
+ * Triggered in case the charge limit for an instance of your app is updated.
53
+ *
54
+ *
55
+ * You can't update the charge limit after you've set an initial
56
+ * value. Site owners can increase the limit in their site's dashboard,
57
+ * currently they aren't allowed to decrease it.
58
+ */
59
+ export declare function chargeLimitUpdatedEvent(payload: ChargeLimitUpdatedEventEnvelope): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;
@@ -0,0 +1,2 @@
1
+ export * from './src/service-plugins-types';
2
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../../index.typings.ts"],"names":[],"mappings":"AAeA,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import './interfaces-premium-v1-custom-charges-provider.public.js';
2
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
3
+ import { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';
4
+ export { publicProvideHandlers };
5
+ export declare const provideHandlers: ReturnType<typeof createServicePluginModule<typeof publicProvideHandlers>>;
@@ -0,0 +1,6 @@
1
+ import './interfaces-premium-v1-custom-charges-provider.public.js';
2
+ import { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';
3
+ import { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';
4
+ export { publicProvideHandlers };
5
+ export const provideHandlers = createServicePluginModule(publicProvideHandlers);
6
+ //# sourceMappingURL=interfaces-premium-v1-custom-charges-provider.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces-premium-v1-custom-charges-provider.context.js","sourceRoot":"","sources":["../../../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"names":[],"mappings":"AAAA,OAAO,2DAA2D,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,2DAA2D,CAAC;AAErH,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC,MAAM,CAAC,MAAM,eAAe,GAExB,yBAAyB,CAAC,qBAAqB,CAAC,CAAC"}