@wix/auto_sdk_app-management_custom-charges 1.0.2 → 1.0.4

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