@wix/auto_sdk_app-management_custom-charges 1.0.26 → 1.0.27
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 +2 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +2 -2
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/{interfaces-premium-v1-custom-charges-provider.public-Clu3MMgM.d.ts → interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.d.ts} +1 -1
- package/build/es/index.d.mts +2 -2
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +2 -2
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/{interfaces-premium-v1-custom-charges-provider.public-Clu3MMgM.d.mts → interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.d.mts} +1 -1
- package/build/internal/cjs/index.d.ts +2 -2
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +2 -2
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/{interfaces-premium-v1-custom-charges-provider.public-Clu3MMgM.d.ts → interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.d.ts} +1 -1
- package/build/internal/es/index.d.mts +2 -2
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +2 -2
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/{interfaces-premium-v1-custom-charges-provider.public-Clu3MMgM.d.mts → interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.d.mts} +1 -1
- package/package.json +2 -2
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
2
|
-
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, r as ChargeLimitUpdatedResponse, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, h as ChargesRejectedResponse, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, o as InvoiceCreatedResponse, n as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, c as ListUsagesRequest, d as ListUsagesRequestIntent, e as ListUsagesResponse, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest, l as UsagesRejectedResponse } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
1
|
+
import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.js';
|
|
2
|
+
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, r as ChargeLimitUpdatedResponse, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, h as ChargesRejectedResponse, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, o as InvoiceCreatedResponse, n as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, c as ListUsagesRequest, d as ListUsagesRequestIntent, e as ListUsagesResponse, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest, l as UsagesRejectedResponse } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.js';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-premium-v1-custom-charges-provider.public.ts","../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-premium-v1-custom-charges-provider.context.js';\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n GetChargeLimitRequest,\n GetChargeLimitResponse,\n ListChargesRequest,\n ListChargesResponse,\n ListUsagesRequest,\n ListUsagesResponse,\n ChargesRejectedRequest,\n ChargesRejectedResponse,\n UsagesRejectedRequest,\n UsagesRejectedResponse,\n InvoiceCreatedRequest,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedRequest,\n ChargeLimitUpdatedResponse,\n} from './service-plugins-types.js';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface GetChargeLimitEnvelope {\n request: GetChargeLimitRequest;\n metadata: Context;\n}\n\nexport interface ListChargesEnvelope {\n request: ListChargesRequest;\n metadata: Context;\n}\n\nexport interface ListUsagesEnvelope {\n request: ListUsagesRequest;\n metadata: Context;\n}\n\nexport interface ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\n metadata: Context;\n}\n\nexport interface UsagesRejectedEventEnvelope {\n request: UsagesRejectedRequest;\n metadata: Context;\n}\n\nexport interface InvoiceCreatedEventEnvelope {\n request: InvoiceCreatedRequest;\n metadata: Context;\n}\n\nexport interface ChargeLimitUpdatedEventEnvelope {\n request: ChargeLimitUpdatedRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n getChargeLimit(\n payload: GetChargeLimitEnvelope\n ): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n\n /**\n *\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\n\n /**\n *\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages. */\n listUsages(\n payload: ListUsagesEnvelope\n ): ListUsagesResponse | Promise<ListUsagesResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */\n chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n ): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted. */\n usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n ): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app. */\n invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n ): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n\n /**\n *\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it. */\n chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n ): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n}>('PREMIUM_CUSTOM_CHARGES', [\n {\n name: 'getChargeLimit',\n primaryHttpMappingPath: '/v1/charge-limit',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listCharges',\n primaryHttpMappingPath: '/v1/charges',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listUsages',\n primaryHttpMappingPath: '/v1/usages',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargesRejectedEvent',\n primaryHttpMappingPath: '/v1/charges-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'usagesRejectedEvent',\n primaryHttpMappingPath: '/v1/usages-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'invoiceCreatedEvent',\n primaryHttpMappingPath: '/v1/invoice-created',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeLimitUpdatedEvent',\n primaryHttpMappingPath: '/v1/limit-updated',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-premium-v1-custom-charges-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n"],"mappings":"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","names":["provideHandlers","Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType","provideHandlers"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/service-plugins-types.ts","../../src/interfaces-premium-v1-custom-charges-provider.public.ts","../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"sourcesContent":["export * from './src/service-plugins-types.js';\nexport * from './src/interfaces-premium-v1-custom-charges-provider.context.js';\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 20\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n GetChargeLimitRequest,\n GetChargeLimitResponse,\n ListChargesRequest,\n ListChargesResponse,\n ListUsagesRequest,\n ListUsagesResponse,\n ChargesRejectedRequest,\n ChargesRejectedResponse,\n UsagesRejectedRequest,\n UsagesRejectedResponse,\n InvoiceCreatedRequest,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedRequest,\n ChargeLimitUpdatedResponse,\n} from './service-plugins-types.js';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface GetChargeLimitEnvelope {\n request: GetChargeLimitRequest;\n metadata: Context;\n}\n\nexport interface ListChargesEnvelope {\n request: ListChargesRequest;\n metadata: Context;\n}\n\nexport interface ListUsagesEnvelope {\n request: ListUsagesRequest;\n metadata: Context;\n}\n\nexport interface ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\n metadata: Context;\n}\n\nexport interface UsagesRejectedEventEnvelope {\n request: UsagesRejectedRequest;\n metadata: Context;\n}\n\nexport interface InvoiceCreatedEventEnvelope {\n request: InvoiceCreatedRequest;\n metadata: Context;\n}\n\nexport interface ChargeLimitUpdatedEventEnvelope {\n request: ChargeLimitUpdatedRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n getChargeLimit(\n payload: GetChargeLimitEnvelope\n ): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n\n /**\n *\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\n\n /**\n *\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages. */\n listUsages(\n payload: ListUsagesEnvelope\n ): ListUsagesResponse | Promise<ListUsagesResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */\n chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n ): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted. */\n usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n ): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app. */\n invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n ): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n\n /**\n *\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it. */\n chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n ): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n}>('PREMIUM_CUSTOM_CHARGES', [\n {\n name: 'getChargeLimit',\n primaryHttpMappingPath: '/v1/charge-limit',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listCharges',\n primaryHttpMappingPath: '/v1/charges',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listUsages',\n primaryHttpMappingPath: '/v1/usages',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargesRejectedEvent',\n primaryHttpMappingPath: '/v1/charges-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'usagesRejectedEvent',\n primaryHttpMappingPath: '/v1/usages-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'invoiceCreatedEvent',\n primaryHttpMappingPath: '/v1/invoice-created',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeLimitUpdatedEvent',\n primaryHttpMappingPath: '/v1/limit-updated',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-premium-v1-custom-charges-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKC,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAsEL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAwEL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AA8EL,IAAK,uBAAL,kBAAKC,0BAAL;AAEL,EAAAA,sBAAA,aAAU;AAEV,EAAAA,sBAAA,2BAAwB;AAJd,SAAAA;AAAA,GAAA;AA8JL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;;;ACxbZ,uBAAwC;AAkBxC,uBAAqD;AACrD,6BAA+B;AAC/B,oCAGO;AAqCA,IAAM,sBAAkB,0CAsG5B,0BAA0B;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,sBAAkB,uCAAe,SAAS;AAAA,UAC9C;AAAA,YACE,aAAa;AAAA,YACb,OAAO;AAAA,cACL,EAAE,MAAM,sBAAsB;AAAA,cAC9B,EAAE,MAAM,oBAAoB;AAAA,YAC9B;AAAA,UACF;AAAA,QACF,CAAC;AAED,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,sBAAkB,uCAAe,SAAS;AAAA,UAC9C;AAAA,YACE,aAAa;AAAA,YACb,OAAO;AAAA,cACL,EAAE,MAAM,sBAAsB;AAAA,cAC9B,EAAE,MAAM,oBAAoB;AAAA,YAC9B;AAAA,UACF;AAAA,QACF,CAAC;AAED,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,mBAAO,qEAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,mBAAO,uEAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;ACxSD,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;","names":["provideHandlers","Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType","provideHandlers"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as GetChargeLimitEnvelope, a as GetChargeLimitResponse, y as ListChargesEnvelope, b as ListChargesResponse, z as ListUsagesEnvelope, e as ListUsagesResponse, B as ChargesRejectedEventEnvelope, h as ChargesRejectedResponse, D as UsagesRejectedEventEnvelope, l as UsagesRejectedResponse, E as InvoiceCreatedEventEnvelope, o as InvoiceCreatedResponse, F as ChargeLimitUpdatedEventEnvelope, r as ChargeLimitUpdatedResponse } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
2
|
-
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, n as InvoiceLineItem, L as ListChargesRequest, c as ListUsagesRequest, d as ListUsagesRequestIntent, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
1
|
+
import { x as GetChargeLimitEnvelope, a as GetChargeLimitResponse, y as ListChargesEnvelope, b as ListChargesResponse, z as ListUsagesEnvelope, e as ListUsagesResponse, B as ChargesRejectedEventEnvelope, h as ChargesRejectedResponse, D as UsagesRejectedEventEnvelope, l as UsagesRejectedResponse, E as InvoiceCreatedEventEnvelope, o as InvoiceCreatedResponse, F as ChargeLimitUpdatedEventEnvelope, r as ChargeLimitUpdatedResponse } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.js';
|
|
2
|
+
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, n as InvoiceLineItem, L as ListChargesRequest, c as ListUsagesRequest, d as ListUsagesRequestIntent, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.js';
|
|
3
3
|
import '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import {\n GetChargeLimitResponse,\n ListChargesResponse,\n ListUsagesResponse,\n ChargesRejectedResponse,\n UsagesRejectedResponse,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedResponse,\n} from './src/service-plugins-types.js';\nimport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ListUsagesEnvelope,\n ChargesRejectedEventEnvelope,\n UsagesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n} from './src/interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport * from './src/service-plugins-types';\nexport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ListUsagesEnvelope,\n ChargesRejectedEventEnvelope,\n UsagesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n};\n\n/**\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport declare function getChargeLimit(\n payload: GetChargeLimitEnvelope\n): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n/**\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport declare function listCharges(\n payload: ListChargesEnvelope\n): ListChargesResponse | Promise<ListChargesResponse>;\n/**\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages.\n */\nexport declare function listUsages(\n payload: ListUsagesEnvelope\n): ListUsagesResponse | Promise<ListUsagesResponse>;\n/**\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted.\n */\nexport declare function chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n/**\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted.\n */\nexport declare function usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n/**\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app.\n */\nexport declare function invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n/**\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it.\n */\nexport declare function chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAsEL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAwEL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AA8EL,IAAK,uBAAL,kBAAKC,0BAAL;AAEL,EAAAA,sBAAA,aAAU;AAEV,EAAAA,sBAAA,2BAAwB;AAJd,SAAAA;AAAA,GAAA;AA8JL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/service-plugins-types.ts"],"sourcesContent":["import {\n GetChargeLimitResponse,\n ListChargesResponse,\n ListUsagesResponse,\n ChargesRejectedResponse,\n UsagesRejectedResponse,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedResponse,\n} from './src/service-plugins-types.js';\nimport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ListUsagesEnvelope,\n ChargesRejectedEventEnvelope,\n UsagesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n} from './src/interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport * from './src/service-plugins-types';\nexport {\n GetChargeLimitEnvelope,\n ListChargesEnvelope,\n ListUsagesEnvelope,\n ChargesRejectedEventEnvelope,\n UsagesRejectedEventEnvelope,\n InvoiceCreatedEventEnvelope,\n ChargeLimitUpdatedEventEnvelope,\n};\n\n/**\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport declare function getChargeLimit(\n payload: GetChargeLimitEnvelope\n): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n/**\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels).\n */\nexport declare function listCharges(\n payload: ListChargesEnvelope\n): ListChargesResponse | Promise<ListChargesResponse>;\n/**\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages.\n */\nexport declare function listUsages(\n payload: ListUsagesEnvelope\n): ListUsagesResponse | Promise<ListUsagesResponse>;\n/**\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted.\n */\nexport declare function chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n/**\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted.\n */\nexport declare function usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n/**\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app.\n */\nexport declare function invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n/**\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it.\n */\nexport declare function chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n","export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 20\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAsEL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAwEL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AA8EL,IAAK,uBAAL,kBAAKC,0BAAL;AAEL,EAAAA,sBAAA,aAAU;AAEV,EAAAA,sBAAA,2BAAwB;AAJd,SAAAA;AAAA,GAAA;AA8JL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType"]}
|
package/build/es/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
2
|
-
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, r as ChargeLimitUpdatedResponse, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, h as ChargesRejectedResponse, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, o as InvoiceCreatedResponse, n as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, c as ListUsagesRequest, d as ListUsagesRequestIntent, e as ListUsagesResponse, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest, l as UsagesRejectedResponse } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
1
|
+
import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.mjs';
|
|
2
|
+
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, r as ChargeLimitUpdatedResponse, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, h as ChargesRejectedResponse, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, o as InvoiceCreatedResponse, n as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, c as ListUsagesRequest, d as ListUsagesRequestIntent, e as ListUsagesResponse, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest, l as UsagesRejectedResponse } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.mjs';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
package/build/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-premium-v1-custom-charges-provider.public.ts","../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"sourcesContent":["export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n GetChargeLimitRequest,\n GetChargeLimitResponse,\n ListChargesRequest,\n ListChargesResponse,\n ListUsagesRequest,\n ListUsagesResponse,\n ChargesRejectedRequest,\n ChargesRejectedResponse,\n UsagesRejectedRequest,\n UsagesRejectedResponse,\n InvoiceCreatedRequest,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedRequest,\n ChargeLimitUpdatedResponse,\n} from './service-plugins-types.js';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface GetChargeLimitEnvelope {\n request: GetChargeLimitRequest;\n metadata: Context;\n}\n\nexport interface ListChargesEnvelope {\n request: ListChargesRequest;\n metadata: Context;\n}\n\nexport interface ListUsagesEnvelope {\n request: ListUsagesRequest;\n metadata: Context;\n}\n\nexport interface ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\n metadata: Context;\n}\n\nexport interface UsagesRejectedEventEnvelope {\n request: UsagesRejectedRequest;\n metadata: Context;\n}\n\nexport interface InvoiceCreatedEventEnvelope {\n request: InvoiceCreatedRequest;\n metadata: Context;\n}\n\nexport interface ChargeLimitUpdatedEventEnvelope {\n request: ChargeLimitUpdatedRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n getChargeLimit(\n payload: GetChargeLimitEnvelope\n ): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n\n /**\n *\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\n\n /**\n *\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages. */\n listUsages(\n payload: ListUsagesEnvelope\n ): ListUsagesResponse | Promise<ListUsagesResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */\n chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n ): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted. */\n usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n ): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app. */\n invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n ): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n\n /**\n *\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it. */\n chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n ): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n}>('PREMIUM_CUSTOM_CHARGES', [\n {\n name: 'getChargeLimit',\n primaryHttpMappingPath: '/v1/charge-limit',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listCharges',\n primaryHttpMappingPath: '/v1/charges',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listUsages',\n primaryHttpMappingPath: '/v1/usages',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargesRejectedEvent',\n primaryHttpMappingPath: '/v1/charges-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'usagesRejectedEvent',\n primaryHttpMappingPath: '/v1/usages-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'invoiceCreatedEvent',\n primaryHttpMappingPath: '/v1/invoice-created',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeLimitUpdatedEvent',\n primaryHttpMappingPath: '/v1/limit-updated',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-premium-v1-custom-charges-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n"],"mappings":"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","names":["Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType","provideHandlers"]}
|
|
1
|
+
{"version":3,"sources":["../../src/service-plugins-types.ts","../../src/interfaces-premium-v1-custom-charges-provider.public.ts","../../src/interfaces-premium-v1-custom-charges-provider.context.ts"],"sourcesContent":["export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 20\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n","import { ServicePluginDefinition } from '@wix/sdk-types';\nimport {\n Context,\n GetChargeLimitRequest,\n GetChargeLimitResponse,\n ListChargesRequest,\n ListChargesResponse,\n ListUsagesRequest,\n ListUsagesResponse,\n ChargesRejectedRequest,\n ChargesRejectedResponse,\n UsagesRejectedRequest,\n UsagesRejectedResponse,\n InvoiceCreatedRequest,\n InvoiceCreatedResponse,\n ChargeLimitUpdatedRequest,\n ChargeLimitUpdatedResponse,\n} from './service-plugins-types.js';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\n\nexport interface GetChargeLimitEnvelope {\n request: GetChargeLimitRequest;\n metadata: Context;\n}\n\nexport interface ListChargesEnvelope {\n request: ListChargesRequest;\n metadata: Context;\n}\n\nexport interface ListUsagesEnvelope {\n request: ListUsagesRequest;\n metadata: Context;\n}\n\nexport interface ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\n metadata: Context;\n}\n\nexport interface UsagesRejectedEventEnvelope {\n request: UsagesRejectedRequest;\n metadata: Context;\n}\n\nexport interface InvoiceCreatedEventEnvelope {\n request: InvoiceCreatedRequest;\n metadata: Context;\n}\n\nexport interface ChargeLimitUpdatedEventEnvelope {\n request: ChargeLimitUpdatedRequest;\n metadata: Context;\n}\n\nexport const provideHandlers = ServicePluginDefinition<{\n /**\n *\n * Wix calls this method to retrieve the initial charge limit for a paid instance\n * of your app. This happens every time a customer is upgrading to a paid version of\n * your app.\n *\n * You can't update the charge limit after you've set an initial\n * value. Customers can increase the limit in their site's dashboard, currently they\n * aren't allowed to decrease it.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n getChargeLimit(\n payload: GetChargeLimitEnvelope\n ): GetChargeLimitResponse | Promise<GetChargeLimitResponse>;\n\n /**\n *\n * Wix calls this method to retrieve a list of charges for a paid instance\n * of your app. This happens when Wix creates an invoice or in case the customer\n * wants to preview how much your app would charge them at the moment.\n *\n * You must return the charges in the currency that's specified in the request,\n * you aren't allowed to return more than 5 charges, and their sum must be lower\n * than the charge limit.\n *\n * You may not bill customers for any usage that didn’t occur during the period\n * Wix specifies when retrieving the charges. If Wix discovers that your app has\n * charged customers for usage outside of an invoice's specified period, we may\n * take action such as blocking your app from charging the customer, removing\n * your app from the Wix App Market, revoking your access to the Wix developer\n * program, or pursuing legal action to recover damages caused by overcharging.\n * We understand that mistakes can happen and encourage you to contact\n * [the Wix App Market team](https://devforum.wix.com/kb/en/contact) immediately if you\n * become aware of any overcharging issues so that we can work together to\n * resolve the situation.\n *\n * > **Note:**\n * > This feature isn't yet available to all users. Your app can have only 1 usage-based plan and no other plans. To add a usage-based plan to your app, [submit a request to add a usage-based plan](https://www.wix.com/support-chatbot?nodeId=25a57397-ccf7-4376-8b74-48d51edf7159&referral=devRels). */\n listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\n\n /**\n *\n * Wix calls this method to retrieve counter usage quantities for a paid instance\n * of your app. This happens when Wix needs to understand how much of each counter\n * a customer has used during a specific period.\n *\n * You must return the usage quantities in integer units for the requested\n * counter IDs. The usage should only reflect consumption that occurred during\n * the period Wix specifies when retrieving the usages. */\n listUsages(\n payload: ListUsagesEnvelope\n ): ListUsagesResponse | Promise<ListUsagesResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the charges you've returned in the\n * List Charges method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * call List Charges in regular intervals until the sum of all charges is lower than the\n * charge limit. Wix doesn't create an invoice in case the charges aren't accepted. */\n chargesRejectedEvent(\n payload: ChargesRejectedEventEnvelope\n ): ChargesRejectedResponse | Promise<ChargesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix doesn't accept the usage-based charges calculated from\n * the usages you've returned in the List Usages method.\n *\n *\n * You aren't allowed to charge a site owner more than the charge limit. Wix\n * calculates charges from your usage data and validates them against the limit.\n * Wix doesn't create an invoice in case the usage-based charges aren't accepted. */\n usagesRejectedEvent(\n payload: UsagesRejectedEventEnvelope\n ): UsagesRejectedResponse | Promise<UsagesRejectedResponse>;\n\n /**\n *\n * Triggered in case Wix creates an invoice that includes charges for an instance\n * of your app. */\n invoiceCreatedEvent(\n payload: InvoiceCreatedEventEnvelope\n ): InvoiceCreatedResponse | Promise<InvoiceCreatedResponse>;\n\n /**\n *\n * Triggered in case the charge limit for an instance of your app is updated.\n *\n *\n * You can't update the charge limit after you've set an initial\n * value. Site owners can increase the limit in their site's dashboard,\n * currently they aren't allowed to decrease it. */\n chargeLimitUpdatedEvent(\n payload: ChargeLimitUpdatedEventEnvelope\n ): ChargeLimitUpdatedResponse | Promise<ChargeLimitUpdatedResponse>;\n}>('PREMIUM_CUSTOM_CHARGES', [\n {\n name: 'getChargeLimit',\n primaryHttpMappingPath: '/v1/charge-limit',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listCharges',\n primaryHttpMappingPath: '/v1/charges',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'listUsages',\n primaryHttpMappingPath: '/v1/usages',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'request.periodStart' },\n { path: 'request.periodEnd' },\n ],\n },\n ]);\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargesRejectedEvent',\n primaryHttpMappingPath: '/v1/charges-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'usagesRejectedEvent',\n primaryHttpMappingPath: '/v1/usages-rejected',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'invoiceCreatedEvent',\n primaryHttpMappingPath: '/v1/invoice-created',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n\n {\n name: 'chargeLimitUpdatedEvent',\n primaryHttpMappingPath: '/v1/limit-updated',\n transformations: {\n toREST: (payload: any) => {\n const toRestResponse = payload;\n\n return renameKeysFromSDKRequestToRESTRequest(toRestResponse);\n },\n fromREST: (payload: any) => {\n const fromRestRequest = payload;\n\n return renameKeysFromRESTResponseToSDKResponse(fromRestRequest);\n },\n },\n },\n]);\n","import './interfaces-premium-v1-custom-charges-provider.public.js';\nimport { createServicePluginModule } from '@wix/sdk-runtime/service-plugin-modules';\nimport { BuildServicePluginDefinition } from '@wix/sdk-types';\nimport { provideHandlers as publicProvideHandlers } from './interfaces-premium-v1-custom-charges-provider.public.js';\n\nexport { publicProvideHandlers };\n\nexport const provideHandlers: BuildServicePluginDefinition<\n typeof publicProvideHandlers\n> &\n typeof publicProvideHandlers = createServicePluginModule(\n publicProvideHandlers\n);\n"],"mappings":"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","names":["Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType","provideHandlers"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as GetChargeLimitEnvelope, a as GetChargeLimitResponse, y as ListChargesEnvelope, b as ListChargesResponse, z as ListUsagesEnvelope, e as ListUsagesResponse, B as ChargesRejectedEventEnvelope, h as ChargesRejectedResponse, D as UsagesRejectedEventEnvelope, l as UsagesRejectedResponse, E as InvoiceCreatedEventEnvelope, o as InvoiceCreatedResponse, F as ChargeLimitUpdatedEventEnvelope, r as ChargeLimitUpdatedResponse } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
2
|
-
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, n as InvoiceLineItem, L as ListChargesRequest, c as ListUsagesRequest, d as ListUsagesRequestIntent, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
1
|
+
import { x as GetChargeLimitEnvelope, a as GetChargeLimitResponse, y as ListChargesEnvelope, b as ListChargesResponse, z as ListUsagesEnvelope, e as ListUsagesResponse, B as ChargesRejectedEventEnvelope, h as ChargesRejectedResponse, D as UsagesRejectedEventEnvelope, l as UsagesRejectedResponse, E as InvoiceCreatedEventEnvelope, o as InvoiceCreatedResponse, F as ChargeLimitUpdatedEventEnvelope, r as ChargeLimitUpdatedResponse } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.mjs';
|
|
2
|
+
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, n as InvoiceLineItem, L as ListChargesRequest, c as ListUsagesRequest, d as ListUsagesRequestIntent, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.mjs';
|
|
3
3
|
import '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/service-plugins-types.ts"],"sourcesContent":["export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 5\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AA8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAsEL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAwEL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AA8EL,IAAK,uBAAL,kBAAKC,0BAAL;AAEL,EAAAA,sBAAA,aAAU;AAEV,EAAAA,sBAAA,2BAAwB;AAJd,SAAAA;AAAA,GAAA;AA8JL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType"]}
|
|
1
|
+
{"version":3,"sources":["../../src/service-plugins-types.ts"],"sourcesContent":["export interface GetChargeLimitRequest {\n /**\n * ID of the subscription for which Wix retrieves the charge limit. Equals\n * `null` in case Wix hasn't created the subscription when retrieving an\n * initial charge limit. To track usage and billing for apps, we recommend to\n * use `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string | null;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charge limit. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface GetChargeLimitResponse {\n /**\n * Retrieved charge limit for the app instance. You can't update the\n * charge limit after you've set an initial value. Site owners can increase the\n * limit in their site's dashboard, currently they aren't allowed to decrease it.\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n}\n\nexport interface ListChargesRequest {\n /**\n * ID of the subscription for which Wix retrieves your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of your charges to return. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Begin of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's charges for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved charges. */\n intent?: Intent;\n}\n\nexport enum Intent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListChargesResponse {\n /**\n * Retrieved charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n charges?: ChargeLineItem[];\n}\n\nexport interface ChargeLineItem {\n /**\n * ID of the charge. Make sure to save the charge ID on your servers for future\n * reference. Identical to `lineItem.chargeId` in the Invoice Created Event.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n _id?: string | null;\n /** Charge description. */\n description?: string;\n /**\n * Charge amount in the currency that's specified in the request. Use a whole number\n * or separate major and minor units with a dot. For example, `10` or `1.99`. If\n * you return an amount with more minor units than supported according to\n * [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes),\n * Wix truncates the additional minor units.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n */\n amount?: string;\n}\n\nexport interface ListUsagesRequest {\n /**\n * ID of the subscription for which Wix retrieves feature usages.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * List of counter IDs to get usage quantities for.\n * @maxSize 5\n * @minLength 1\n * @maxLength 100\n */\n counterIds?: string[];\n /**\n * Begin of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodStart?: Date | null;\n /**\n * End of the period Wix retrieves the app instance's feature usages for in\n * `YYYY-MM-DDThh:mm:ss.sssZ` format.\n */\n periodEnd?: Date | null;\n /** Information about what Wix intends to do with the retrieved usages. */\n intent?: ListUsagesRequestIntent;\n}\n\nexport enum ListUsagesRequestIntent {\n /** Inform the customer about how much your app would charge them at the moment. Wix doesn't create an invoice. */\n DISPLAY_ONLY = 'DISPLAY_ONLY',\n /** Create an invoice for the customer. */\n CREATE_INVOICE = 'CREATE_INVOICE',\n}\n\nexport interface ListUsagesResponse {\n /**\n * Retrieved feature usages.\n * @maxSize 5\n */\n usages?: Usage[];\n}\n\nexport interface Usage {\n /**\n * ID of the counter for which usage is reported.\n * @minLength 1\n * @maxLength 100\n */\n counterId?: string;\n /** Usage quantity for this feature in integer units. */\n quantity?: number;\n /**\n * Description of the usage.\n * @maxLength 256\n */\n description?: string;\n}\n\nexport interface ChargesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your custom charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * IDs of the rejected charges.\n *\n * Max: 5 charges\n * @maxSize 5\n */\n chargeIds?: string[] | null;\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: ChargesRejectedReason[];\n}\n\nexport enum ChargesRejectedReason {\n /** There is no information about why Wix has rejected the charges. */\n UNKNOWN = 'UNKNOWN',\n /** The sum of the charges is higher than the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n /** You can't provide more than 5 charges per invoice. */\n TOO_MANY_CHARGES = 'TOO_MANY_CHARGES',\n /** 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. */\n INVALID_FORMAT = 'INVALID_FORMAT',\n}\n\nexport interface ChargesRejectedResponse {}\n\nexport interface UsagesRejectedRequest {\n /**\n * ID of the subscription for which Wix hasn't accepted your usage-based charges.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the calculated charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Usage line items that include the counter ID, quantity, unit price, and\n * calculated amount.\n * Max: 5 counter IDs\n * @maxSize 5\n */\n usageLineItems?: UsageLineItem[];\n /**\n * Maximum amount that your app may charge the customer per billing cycle.\n *\n * Min: `0.50`\n * @format DECIMAL_VALUE\n * @decimalValue options { gt:0.00, maxScale:2 }\n */\n chargeLimit?: string | null;\n /**\n * Information about why Wix has rejected your app's usage-based charges.\n *\n * Max: 20 reasons\n * @maxSize 20\n */\n reasons?: UsagesRejectedReason[];\n}\n\n/** Details about the usage line items. */\nexport interface UsageLineItem {\n /**\n * ID of the counter for which usage is reported.\n * @maxLength 100\n * @minLength 1\n */\n counterId?: string;\n /** Usage quantity for this counter in integer units. */\n quantity?: number;\n /**\n * Price per unit that is linked to the counterId on the related product of the subscription.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n unitPrice?: string;\n /**\n * Calculated charge amount (quantity x unit price) in the currency that's specified in the request.\n * @format DECIMAL_VALUE\n * @decimalValue options { gte:0.00, maxScale:2 }\n */\n amount?: string;\n}\n\nexport enum UsagesRejectedReason {\n /** There is no information about why Wix has rejected the usage-based charges. */\n UNKNOWN = 'UNKNOWN',\n /** The calculated charges from usage data exceed the limit that you may charge the customer per billing cycle. */\n CHARGE_LIMIT_EXCEEDED = 'CHARGE_LIMIT_EXCEEDED',\n}\n\nexport interface UsagesRejectedResponse {}\n\nexport interface InvoiceCreatedRequest {\n /**\n * ID of the subscription for which Wix has created an invoice that includes\n * your custom charges. To track usage and billing for apps, we recommend to use\n * `instanceId` instead of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /** ID of the created invoice. */\n invoiceId?: string;\n /**\n * Line items included in the invoice.\n * @maxSize 20\n */\n lineItems?: InvoiceLineItem[];\n}\n\nexport interface InvoiceLineItem {\n /**\n * ID of the charge as returned in List Charges.\n *\n * Max: 64 characters\n * @maxLength 64\n */\n chargeId?: string | null;\n /**\n * Charge amount.\n * @format DECIMAL_VALUE\n */\n amount?: string;\n /**\n * ID of the line item in the invoice that Wix sends to the customer.\n * @format GUID\n */\n _id?: string;\n}\n\nexport interface InvoiceCreatedResponse {}\n\nexport interface ChargeLimitUpdatedRequest {\n /**\n * ID of the subscription for which the charge limit has been updated.\n * To track usage and billing for apps, we recommend to use `instanceId` instead\n * of the `subscriptionId`.\n * @format GUID\n */\n subscriptionId?: string;\n /**\n * Supported values: `AUD`, `BRL`, `CAD`, `EUR`, `GBP`, `ILS`, `INR`, `JPY`, `MXN`, `PLN`, `RUB`, `TRY`, `USD`.\n *\n * 3-letter currency code in\n * [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes)\n * format of the charges. Wix may add supported currencies in the future.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Updated charge limit.\n * @format DECIMAL_VALUE\n */\n chargeLimit?: string | null;\n}\n\nexport interface ChargeLimitUpdatedResponse {}\n\nexport interface CustomChargesConfig {\n /**\n * Base part of your integration's deployment URI for the Custom Charges SPI.\n * For example `\"https://provider.example.com\"`, if Wix should call your\n * integration at `https://provider.example.com/v1/charge-limit` for the\n * Get Charge Limit method.\n */\n baseUri?: SpiBaseUri;\n /** Flag that indicates if charges by usages are enabled */\n listUsagesEnabled?: boolean;\n}\n\nexport interface SpiBaseUri {\n /**\n * Base URI where the methods are called. Wix appends the path to the `baseUri`.\n * 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/`.\n * @minLength 6\n * @maxLength 2048\n */\n baseUri?: string;\n /** Alternate, custom URIs to replace the default URIs for specific service plugin methods. */\n alternativeUris?: AlternativeUri[];\n}\n\nexport interface AlternativeUri {\n /**\n * Name of the method to create a custom URI for.\n *\n * For `methodName`, use the name of the method in PascalCase.\n * For example, for Get Shipping Rates use `GetShippingRates`.\n * @minLength 3\n * @maxLength 128\n */\n methodName?: string;\n /**\n * 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.\n * Must be a secured endpoint beginning with `https://`. For example, `https://www.my-shipping-provider.com/my-shipping-rates`.\n * @minLength 6\n * @maxLength 2048\n */\n absoluteUri?: string;\n}\n\n/**\n * this message is not directly used by any service,\n * it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform.\n * e.g. SPIs, event-handlers, etc..\n * NOTE: this context object MUST be provided as the last argument in each Velo method signature.\n *\n * Example:\n * ```typescript\n * export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) {\n * ...\n * }\n * ```\n */\nexport interface Context {\n /** 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. */\n requestId?: string | null;\n /**\n * [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.\n * @format CURRENCY\n */\n currency?: string | null;\n /** An object that describes the identity that triggered this request. */\n identity?: IdentificationData;\n /** 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\"`. */\n languages?: string[];\n /**\n * The service provider app's instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n}\n\nexport enum IdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: IdentityType;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n"],"mappings":";AA8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAsEL,IAAK,0BAAL,kBAAKC,6BAAL;AAEL,EAAAA,yBAAA,kBAAe;AAEf,EAAAA,yBAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAwEL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AA8EL,IAAK,uBAAL,kBAAKC,0BAAL;AAEL,EAAAA,sBAAA,aAAU;AAEV,EAAAA,sBAAA,2BAAwB;AAJd,SAAAA;AAAA,GAAA;AA8JL,IAAK,eAAL,kBAAKC,kBAAL;AACL,EAAAA,cAAA,aAAU;AACV,EAAAA,cAAA,uBAAoB;AACpB,EAAAA,cAAA,YAAS;AACT,EAAAA,cAAA,cAAW;AACX,EAAAA,cAAA,SAAM;AALI,SAAAA;AAAA,GAAA;","names":["Intent","ListUsagesRequestIntent","ChargesRejectedReason","UsagesRejectedReason","IdentityType"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
2
|
-
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, r as ChargeLimitUpdatedResponse, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, h as ChargesRejectedResponse, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, o as InvoiceCreatedResponse, n as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, c as ListUsagesRequest, d as ListUsagesRequestIntent, e as ListUsagesResponse, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest, l as UsagesRejectedResponse } from './interfaces-premium-v1-custom-charges-provider.public-
|
|
1
|
+
import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.js';
|
|
2
|
+
export { A as AlternativeUri, q as ChargeLimitUpdatedRequest, r as ChargeLimitUpdatedResponse, C as ChargeLineItem, g as ChargesRejectedReason, f as ChargesRejectedRequest, h as ChargesRejectedResponse, t as Context, s as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, v as IdentificationData, w as IdentificationDataIdOneOf, u as IdentityType, I as Intent, m as InvoiceCreatedRequest, o as InvoiceCreatedResponse, n as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, c as ListUsagesRequest, d as ListUsagesRequestIntent, e as ListUsagesResponse, S as SpiBaseUri, U as Usage, j as UsageLineItem, k as UsagesRejectedReason, i as UsagesRejectedRequest, l as UsagesRejectedResponse } from './interfaces-premium-v1-custom-charges-provider.public-B4rBSUSp.js';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
5
|
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|