@wix/auto_sdk_app-management_custom-charges 1.0.16 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +1 -1
- package/build/cjs/index.js +3 -1
- package/build/cjs/index.js.map +1 -1
- package/build/es/index.d.mts +1 -1
- package/build/es/index.mjs +3 -1
- package/build/es/index.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +1 -1
- package/build/internal/cjs/index.js +3 -1
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/es/index.d.mts +1 -1
- package/build/internal/es/index.mjs +3 -1
- package/build/internal/es/index.mjs.map +1 -1
- package/package.json +3 -3
package/build/cjs/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-p
|
|
|
2
2
|
export { A as AlternativeUri, i as ChargeLimitUpdatedRequest, j as ChargeLimitUpdatedResponse, C as ChargeLineItem, d as ChargesRejectedReason, c as ChargesRejectedRequest, e as ChargesRejectedResponse, l as Context, k as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, n as IdentificationData, o as IdentificationDataIdOneOf, m as IdentityType, I as Intent, f as InvoiceCreatedRequest, h as InvoiceCreatedResponse, g as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, S as SpiBaseUri } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.js';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
|
-
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1
|
|
5
|
+
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
|
6
6
|
|
|
7
7
|
export { provideHandlers, provideHandlers$1 as publicProvideHandlers };
|
package/build/cjs/index.js
CHANGED
|
@@ -138,7 +138,9 @@ var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("PREMIUM_CUS
|
|
|
138
138
|
|
|
139
139
|
// src/interfaces-premium-v1-custom-charges-provider.context.ts
|
|
140
140
|
var import_service_plugin_modules = require("@wix/sdk-runtime/service-plugin-modules");
|
|
141
|
-
var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(
|
|
141
|
+
var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(
|
|
142
|
+
provideHandlers
|
|
143
|
+
);
|
|
142
144
|
// Annotate the CommonJS export names for ESM import in node:
|
|
143
145
|
0 && (module.exports = {
|
|
144
146
|
ChargesRejectedReason,
|
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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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> = createServicePluginModule(publicProvideHandlers);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,uBAAwC;AAcxC,uBAAqD;AACrD,6BAA+B;AAC/B,oCAGO;AA2BA,IAAM,sBAAkB,0CAsE5B,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,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;;;AChND,oCAA0C;AAMnC,IAAMC,uBAET,yDAA0B,eAAqB;","names":["provideHandlers","Intent","ChargesRejectedReason","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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKC,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,uBAAwC;AAcxC,uBAAqD;AACrD,6BAA+B;AAC/B,oCAGO;AA2BA,IAAM,sBAAkB,0CAsE5B,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,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;;;AChND,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;","names":["provideHandlers","Intent","ChargesRejectedReason","IdentityType","provideHandlers"]}
|
package/build/es/index.d.mts
CHANGED
|
@@ -2,6 +2,6 @@ import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-p
|
|
|
2
2
|
export { A as AlternativeUri, i as ChargeLimitUpdatedRequest, j as ChargeLimitUpdatedResponse, C as ChargeLineItem, d as ChargesRejectedReason, c as ChargesRejectedRequest, e as ChargesRejectedResponse, l as Context, k as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, n as IdentificationData, o as IdentificationDataIdOneOf, m as IdentityType, I as Intent, f as InvoiceCreatedRequest, h as InvoiceCreatedResponse, g as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, S as SpiBaseUri } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.mjs';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
|
-
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1
|
|
5
|
+
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
|
6
6
|
|
|
7
7
|
export { provideHandlers, provideHandlers$1 as publicProvideHandlers };
|
package/build/es/index.mjs
CHANGED
|
@@ -111,7 +111,9 @@ var provideHandlers = ServicePluginDefinition("PREMIUM_CUSTOM_CHARGES", [
|
|
|
111
111
|
|
|
112
112
|
// src/interfaces-premium-v1-custom-charges-provider.context.ts
|
|
113
113
|
import { createServicePluginModule } from "@wix/sdk-runtime/service-plugin-modules";
|
|
114
|
-
var provideHandlers2 = createServicePluginModule(
|
|
114
|
+
var provideHandlers2 = createServicePluginModule(
|
|
115
|
+
provideHandlers
|
|
116
|
+
);
|
|
115
117
|
export {
|
|
116
118
|
ChargesRejectedReason,
|
|
117
119
|
IdentityType,
|
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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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> = createServicePluginModule(publicProvideHandlers);\n"],"mappings":";AA8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,SAAS,+BAA+B;AAcxC,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AA2BA,IAAM,kBAAkB,wBAsE5B,0BAA0B;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB,eAAe,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,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AChND,SAAS,iCAAiC;AAMnC,IAAMC,mBAET,0BAA0B,eAAqB;","names":["Intent","ChargesRejectedReason","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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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":";AA8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,SAAS,+BAA+B;AAcxC,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AA2BA,IAAM,kBAAkB,wBAsE5B,0BAA0B;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB,eAAe,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,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AChND,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;","names":["Intent","ChargesRejectedReason","IdentityType","provideHandlers"]}
|
|
@@ -2,6 +2,6 @@ import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-p
|
|
|
2
2
|
export { A as AlternativeUri, i as ChargeLimitUpdatedRequest, j as ChargeLimitUpdatedResponse, C as ChargeLineItem, d as ChargesRejectedReason, c as ChargesRejectedRequest, e as ChargesRejectedResponse, l as Context, k as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, n as IdentificationData, o as IdentificationDataIdOneOf, m as IdentityType, I as Intent, f as InvoiceCreatedRequest, h as InvoiceCreatedResponse, g as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, S as SpiBaseUri } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.js';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
|
-
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1
|
|
5
|
+
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
|
6
6
|
|
|
7
7
|
export { provideHandlers, provideHandlers$1 as publicProvideHandlers };
|
|
@@ -138,7 +138,9 @@ var provideHandlers = (0, import_sdk_types.ServicePluginDefinition)("PREMIUM_CUS
|
|
|
138
138
|
|
|
139
139
|
// src/interfaces-premium-v1-custom-charges-provider.context.ts
|
|
140
140
|
var import_service_plugin_modules = require("@wix/sdk-runtime/service-plugin-modules");
|
|
141
|
-
var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(
|
|
141
|
+
var provideHandlers2 = (0, import_service_plugin_modules.createServicePluginModule)(
|
|
142
|
+
provideHandlers
|
|
143
|
+
);
|
|
142
144
|
// Annotate the CommonJS export names for ESM import in node:
|
|
143
145
|
0 && (module.exports = {
|
|
144
146
|
ChargesRejectedReason,
|
|
@@ -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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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> = createServicePluginModule(publicProvideHandlers);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,uBAAwC;AAcxC,uBAAqD;AACrD,6BAA+B;AAC/B,oCAGO;AA2BA,IAAM,sBAAkB,0CAsE5B,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,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;;;AChND,oCAA0C;AAMnC,IAAMC,uBAET,yDAA0B,eAAqB;","names":["provideHandlers","Intent","ChargesRejectedReason","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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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,yBAAAA;AAAA,EAAA;AAAA;AAAA;;;AC8DO,IAAK,SAAL,kBAAKC,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,uBAAwC;AAcxC,uBAAqD;AACrD,6BAA+B;AAC/B,oCAGO;AA2BA,IAAM,sBAAkB,0CAsE5B,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,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;;;AChND,oCAA0C;AAMnC,IAAMC,uBAGoB;AAAA,EAC/B;AACF;","names":["provideHandlers","Intent","ChargesRejectedReason","IdentityType","provideHandlers"]}
|
|
@@ -2,6 +2,6 @@ import { p as provideHandlers$1 } from './interfaces-premium-v1-custom-charges-p
|
|
|
2
2
|
export { A as AlternativeUri, i as ChargeLimitUpdatedRequest, j as ChargeLimitUpdatedResponse, C as ChargeLineItem, d as ChargesRejectedReason, c as ChargesRejectedRequest, e as ChargesRejectedResponse, l as Context, k as CustomChargesConfig, G as GetChargeLimitRequest, a as GetChargeLimitResponse, n as IdentificationData, o as IdentificationDataIdOneOf, m as IdentityType, I as Intent, f as InvoiceCreatedRequest, h as InvoiceCreatedResponse, g as InvoiceLineItem, L as ListChargesRequest, b as ListChargesResponse, S as SpiBaseUri } from './interfaces-premium-v1-custom-charges-provider.public-CGoSuwZ7.mjs';
|
|
3
3
|
import { BuildServicePluginDefinition } from '@wix/sdk-types';
|
|
4
4
|
|
|
5
|
-
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1
|
|
5
|
+
declare const provideHandlers: BuildServicePluginDefinition<typeof provideHandlers$1> & typeof provideHandlers$1;
|
|
6
6
|
|
|
7
7
|
export { provideHandlers, provideHandlers$1 as publicProvideHandlers };
|
|
@@ -111,7 +111,9 @@ var provideHandlers = ServicePluginDefinition("PREMIUM_CUSTOM_CHARGES", [
|
|
|
111
111
|
|
|
112
112
|
// src/interfaces-premium-v1-custom-charges-provider.context.ts
|
|
113
113
|
import { createServicePluginModule } from "@wix/sdk-runtime/service-plugin-modules";
|
|
114
|
-
var provideHandlers2 = createServicePluginModule(
|
|
114
|
+
var provideHandlers2 = createServicePluginModule(
|
|
115
|
+
provideHandlers
|
|
116
|
+
);
|
|
115
117
|
export {
|
|
116
118
|
ChargesRejectedReason,
|
|
117
119
|
IdentityType,
|
|
@@ -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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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> = createServicePluginModule(publicProvideHandlers);\n"],"mappings":";AA8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,SAAS,+BAA+B;AAcxC,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AA2BA,IAAM,kBAAkB,wBAsE5B,0BAA0B;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB,eAAe,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,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AChND,SAAS,iCAAiC;AAMnC,IAAMC,mBAET,0BAA0B,eAAqB;","names":["Intent","ChargesRejectedReason","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 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 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}\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 ChargesRejectedRequest,\n ChargesRejectedResponse,\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 ChargesRejectedEventEnvelope {\n request: ChargesRejectedRequest;\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 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 listCharges(\n payload: ListChargesEnvelope\n ): ListChargesResponse | Promise<ListChargesResponse>;\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 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: '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: '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":";AA8DO,IAAK,SAAL,kBAAKA,YAAL;AAEL,EAAAA,QAAA,kBAAe;AAEf,EAAAA,QAAA,oBAAiB;AAJP,SAAAA;AAAA,GAAA;AAkFL,IAAK,wBAAL,kBAAKC,2BAAL;AAEL,EAAAA,uBAAA,aAAU;AAEV,EAAAA,uBAAA,2BAAwB;AAExB,EAAAA,uBAAA,sBAAmB;AAEnB,EAAAA,uBAAA,oBAAiB;AARP,SAAAA;AAAA,GAAA;AAgKL,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;;;AChTZ,SAAS,+BAA+B;AAcxC,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AA2BA,IAAM,kBAAkB,wBAsE5B,0BAA0B;AAAA,EAC3B;AAAA,IACE,MAAM;AAAA,IACN,wBAAwB;AAAA,IACxB,iBAAiB;AAAA,MACf,QAAQ,CAAC,YAAiB;AACxB,cAAM,iBAAiB;AAEvB,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB,eAAe,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,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,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,eAAO,sCAAsC,cAAc;AAAA,MAC7D;AAAA,MACA,UAAU,CAAC,YAAiB;AAC1B,cAAM,kBAAkB;AAExB,eAAO,wCAAwC,eAAe;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF,CAAC;;;AChND,SAAS,iCAAiC;AAMnC,IAAMC,mBAGoB;AAAA,EAC/B;AACF;","names":["Intent","ChargesRejectedReason","IdentityType","provideHandlers"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/auto_sdk_app-management_custom-charges",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@wix/sdk-runtime": "^0.3.55",
|
|
33
|
-
"@wix/sdk-types": "^1.13.
|
|
33
|
+
"@wix/sdk-types": "^1.13.35"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"tsup": "^8.4.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"fqdn": "wix.interfaces.premium.v1.custom_charges_provider"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"falconPackageHash": "
|
|
53
|
+
"falconPackageHash": "a723072bba939d432f12b7429893fa021e8e77b0c1c2de7fea49d378"
|
|
54
54
|
}
|