@wix/auto_sdk_billing_tax-calculation 1.0.25 → 1.0.26

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 (37) hide show
  1. package/build/cjs/index.d.ts +1 -1
  2. package/build/cjs/index.js +12 -2
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +17 -1
  5. package/build/cjs/index.typings.js +12 -2
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +17 -1
  8. package/build/cjs/meta.js +8 -0
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +1 -1
  11. package/build/es/index.mjs +11 -2
  12. package/build/es/index.mjs.map +1 -1
  13. package/build/es/index.typings.d.mts +17 -1
  14. package/build/es/index.typings.mjs +11 -2
  15. package/build/es/index.typings.mjs.map +1 -1
  16. package/build/es/meta.d.mts +17 -1
  17. package/build/es/meta.mjs +7 -0
  18. package/build/es/meta.mjs.map +1 -1
  19. package/build/internal/cjs/index.d.ts +1 -1
  20. package/build/internal/cjs/index.js +12 -2
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +63 -1
  23. package/build/internal/cjs/index.typings.js +12 -2
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +17 -1
  26. package/build/internal/cjs/meta.js +8 -0
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +1 -1
  29. package/build/internal/es/index.mjs +11 -2
  30. package/build/internal/es/index.mjs.map +1 -1
  31. package/build/internal/es/index.typings.d.mts +63 -1
  32. package/build/internal/es/index.typings.mjs +11 -2
  33. package/build/internal/es/index.typings.mjs.map +1 -1
  34. package/build/internal/es/meta.d.mts +17 -1
  35. package/build/internal/es/meta.mjs +7 -0
  36. package/build/internal/es/meta.mjs.map +1 -1
  37. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
2
  import { CalculateTaxOptions, CalculateTaxResponse, CalculateTaxApplicationErrors, ListTaxCalculatorsResponse } from './index.typings.js';
3
- export { Address, AddressIndex, AddressIndexAddressIndexOptionsOneOf, AggregateTaxBreakdownsRequest, AggregateTaxBreakdownsResponse, AggregatedTaxBreakdown, ApplicationError, CalculateTaxRequest, JurisdictionType, JurisdictionTypeWithLiterals, LineItem, LineItemTaxDetails, LineItemTaxSummary, ListTaxCalculatorsRequest, MultipleAddresses, TaxBreakdown, TaxCalculationGateway, TaxCalculatorDetails, TaxSummary } from './index.typings.js';
3
+ export { Address, AddressIndex, AddressIndexAddressIndexOptionsOneOf, AggregateTaxBreakdownsRequest, AggregateTaxBreakdownsResponse, AggregatedTaxBreakdown, ApplicationError, CalculateTaxRequest, ExemptBy, ExemptByWithLiterals, ExemptCalculationDetails, ExemptCalculationDetailsExemptByOptionsOneOf, JurisdictionType, JurisdictionTypeWithLiterals, LineItem, LineItemTaxDetails, LineItemTaxSummary, ListTaxCalculatorsRequest, MultipleAddresses, TaxBreakdown, TaxCalculationGateway, TaxCalculatorDetails, TaxSummary } from './index.typings.js';
4
4
 
5
5
  declare function calculateTax$1(httpClient: HttpClient): CalculateTaxSignature;
6
6
  interface CalculateTaxSignature {
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
+ ExemptBy: () => ExemptBy,
23
24
  JurisdictionType: () => JurisdictionType,
24
25
  calculateTax: () => calculateTax4,
25
26
  listTaxCalculators: () => listTaxCalculators4
@@ -118,6 +119,12 @@ function listTaxCalculators(payload) {
118
119
  var import_address = require("@wix/sdk-runtime/transformations/address");
119
120
  var import_address2 = require("@wix/sdk-runtime/transformations/address");
120
121
  var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
122
+ var ExemptBy = /* @__PURE__ */ ((ExemptBy2) => {
123
+ ExemptBy2["UNKNOWN_EXEMPT_BY"] = "UNKNOWN_EXEMPT_BY";
124
+ ExemptBy2["EXEMPT_GROUP"] = "EXEMPT_GROUP";
125
+ ExemptBy2["CONTACT"] = "CONTACT";
126
+ return ExemptBy2;
127
+ })(ExemptBy || {});
121
128
  var JurisdictionType = /* @__PURE__ */ ((JurisdictionType2) => {
122
129
  JurisdictionType2["UNDEFINED"] = "UNDEFINED";
123
130
  JurisdictionType2["COUNTRY"] = "COUNTRY";
@@ -136,7 +143,8 @@ async function calculateTax2(options) {
136
143
  addresses: options?.addresses,
137
144
  lineItems: options?.lineItems,
138
145
  contactId: options?.contactId,
139
- taxExemptGroupId: options?.taxExemptGroupId
146
+ taxExemptGroupId: options?.taxExemptGroupId,
147
+ exemptDetails: options?.exemptDetails
140
148
  }),
141
149
  [
142
150
  {
@@ -169,7 +177,8 @@ async function calculateTax2(options) {
169
177
  addresses: "$[0].addresses",
170
178
  lineItems: "$[0].lineItems",
171
179
  contactId: "$[0].contactId",
172
- taxExemptGroupId: "$[0].taxExemptGroupId"
180
+ taxExemptGroupId: "$[0].taxExemptGroupId",
181
+ exemptDetails: "$[0].exemptDetails"
173
182
  },
174
183
  singleArgumentUnchanged: false
175
184
  },
@@ -226,6 +235,7 @@ var calculateTax4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(c
226
235
  var listTaxCalculators4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(listTaxCalculators3);
227
236
  // Annotate the CommonJS export names for ESM import in node:
228
237
  0 && (module.exports = {
238
+ ExemptBy,
229
239
  JurisdictionType,
230
240
  calculateTax,
231
241
  listTaxCalculators
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.ts"],"sourcesContent":["export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';\nimport { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface TaxCalculationGateway {\n /** @format GUID */\n _id?: string | null;\n}\n\nexport interface CalculateTaxRequest {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n taxExemptGroupId?: string | null;\n}\n\n/** Wix common address format for physical address to use if you plan to store addresses in your service. */\nexport interface Address {\n /**\n * 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.\n * @format COUNTRY\n */\n country?: string | null;\n /**\n * Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.\n * @maxLength 50\n */\n subdivision?: string | null;\n /**\n * City name.\n * @maxLength 100\n */\n city?: string | null;\n /**\n * Postal or zip code.\n * @maxLength 50\n */\n postalCode?: string | null;\n /**\n * Main address line, usually street and number as free text.\n * @maxLength 200\n */\n addressLine1?: string | null;\n /**\n * Free text providing more detailed address information, such as apartment, suite, or floor.\n * @maxLength 200\n */\n addressLine2?: string | null;\n}\n\n/** Line items to calculate tax for. */\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Line item price.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n price?: string;\n /**\n * Stock keeping unit for this line item. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku).\n * @maxLength 40\n */\n itemCode?: string | null;\n /**\n * Tax group ID for this line item. If not provided, the default tax group applies.\n * @format GUID\n */\n taxGroupId?: string | null;\n /**\n * ID of the app providing the catalog for this line item.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @format GUID\n */\n appId?: string | null;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean | null;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n}\n\n/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\nexport interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/** @oneof */\nexport interface AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item\n * is shipped from, as well as the address the item is shipped to.\n */\nexport interface MultipleAddresses {\n /** Index of the origin address. */\n origin?: number;\n /** Index of the destination address. */\n destination?: number;\n}\n\nexport interface CalculateTaxResponse {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses?: Address[];\n /** Summary of the tax calculated. */\n taxSummary?: TaxSummary;\n /**\n * Details of each tax applied to each line item.\n * @minSize 1\n * @maxSize 300\n */\n lineItemTaxDetails?: LineItemTaxDetails[];\n /**\n * Errors that occurred during the tax calculation.\n * @maxSize 100\n */\n errors?: ApplicationError[];\n}\n\nexport interface TaxSummary {\n /**\n * Total price for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalAmount?: string;\n /**\n * Total amount of tax calculated for all line items.\n * Note that due to rounding, `totalTax` may not equal the sum of `lineItemTaxDetails.taxSummary.taxAmount`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTax?: string;\n /**\n * Total taxable amount for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxableAmount?: string;\n /**\n * Total amount of `totalTax` that is included in price. Applies to line items with `taxIncludedInPrice` set to `true`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxIncludedInPrice?: string;\n /**\n * Array of each tax applied, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n /**\n * Total exempt amount for all line items.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalExempt?: string | null;\n /**\n * Default name of the tax that was calculated.\n * @internal\n * @maxLength 200\n */\n taxName?: string | null;\n}\n\n/**\n * The summary of the tax breakdown for all the line items. It will hold for each tax name, the aggregated tax amount paid for it and the tax rate.\n * Tax breakdown is the tax amount split to the tax authorities that applied on the line item.\n *\n * Note: Because that the tax is calculated only on the taxable amount, the tax amount may be looks strange.\n * e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,\n * then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.\n */\nexport interface AggregatedTaxBreakdown {\n /**\n * Name of the tax that was calculated.\n * @maxLength 200\n */\n taxName?: string;\n /**\n * Type of tax that was calculated.\n * @maxLength 200\n */\n taxType?: string;\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string;\n /** Type of jurisdiction that taxes were calculated for. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @decimalValue options { gte:0, maxScale:6 }\n */\n rate?: string;\n /**\n * Total amount of this tax for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n aggregatedTaxAmount?: string;\n /**\n * Total exempt amount of this tax.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3 }\n */\n aggregatedExemptAmount?: string | null;\n}\n\n/** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"County\"`, `\"City\"`, `\"Special\"`, etc. */\nexport enum JurisdictionType {\n UNDEFINED = 'UNDEFINED',\n COUNTRY = 'COUNTRY',\n STATE = 'STATE',\n COUNTY = 'COUNTY',\n CITY = 'CITY',\n SPECIAL = 'SPECIAL',\n}\n\n/** @enumType */\nexport type JurisdictionTypeWithLiterals =\n | JurisdictionType\n | 'UNDEFINED'\n | 'COUNTRY'\n | 'STATE'\n | 'COUNTY'\n | 'CITY'\n | 'SPECIAL';\n\n/** Tax details for a specific line item. */\nexport interface LineItemTaxDetails {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Array of each tax applied, grouped by `jurisdiction`.\n * @maxSize 7\n */\n taxBreakdown?: TaxBreakdown[];\n /** Summary of this line item's total price and tax. */\n taxSummary?: LineItemTaxSummary;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean;\n}\n\n/** A detailed description of all the tax authorities applied on this item. */\nexport interface TaxBreakdown {\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string | null;\n /**\n * Non-taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n nonTaxableAmount?: string | null;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:6, gte:0 }\n */\n rate?: string | null;\n /**\n * Amount of this tax calculated for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string | null;\n /**\n * Taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n taxableAmount?: string | null;\n /**\n * Type of tax that was calculated. For example, `\"Sales Tax\"`, `\"Income Tax\"`, `\"Value Added Tax\"`, etc.\n * @maxLength 200\n */\n taxType?: string | null;\n /**\n * Name of the tax that was calculated. For example, `\"NY State Sales Tax\"`, `\"Quebec GST\"`, etc.\n * @maxLength 200\n */\n taxName?: string | null;\n /** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"Çounty\"`, `\"City\"`, `\"Special\"`, etc. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Amount of the price that was exempt from this authority.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3, gte:0 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface LineItemTaxSummary {\n /**\n * Total price for this line item.\n * To determine the price for each individual unit of this line item, divide by `quantity`.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n fullPrice?: string | null;\n /**\n * Total amount of tax calculated for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string;\n /**\n * Total taxable amount for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxableAmount?: string;\n /**\n * ID of the calculator app that calculated tax for this line item.\n * @maxLength 50\n */\n appId?: string | null;\n /**\n * Total exempt amount or this line item.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface ListTaxCalculatorsRequest {}\n\nexport interface ListTaxCalculatorsResponse {\n /**\n * Retrieved tax calculators.\n * @maxSize 10\n */\n taxCalculatorDetails?: TaxCalculatorDetails[];\n}\n\nexport interface TaxCalculatorDetails {\n /**\n * ID of the tax calculator.\n * @format GUID\n */\n appId?: string;\n /**\n * Display name of the tax calculator.\n * @minLength 1\n * @maxLength 200\n */\n displayName?: string;\n /**\n * List of countries, in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format, that the calculator does not support.\n * @format COUNTRY\n * @maxSize 195\n */\n unsupportedCountries?: string[];\n}\n\nexport interface AggregateTaxBreakdownsRequest {\n /**\n * Array of tax breakdowns to aggregate.\n * @maxSize 200\n */\n taxBreakdowns?: TaxBreakdown[];\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface AggregateTaxBreakdownsResponse {\n /**\n * Array of each aggregated tax breakdowns, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n}\n\n/** @docsIgnore */\nexport type CalculateTaxApplicationErrors =\n | {\n code?: 'INVALID_LINE_ITEM_ADDRESS_INDEX';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_TAXABLE_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_COUNTRY_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_SUBDIVISION_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @public\n * @documentationMaturity preview\n * @requiredField options.addresses\n * @requiredField options.lineItems\n * @requiredField options.lineItems._id\n * @requiredField options.lineItems.addressIndex\n * @requiredField options.lineItems.price\n * @param options - Calculate tax options.\n * @permissionId BILLING.CALCULATE_TAX\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.CalculateTax\n */\nexport async function calculateTax(\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`,\n 6\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = transformPaths(\n renameKeysFromSDKRequestToRESTRequest({\n externalId: options?.externalId,\n currency: options?.currency,\n addresses: options?.addresses,\n lineItems: options?.lineItems,\n contactId: options?.contactId,\n taxExemptGroupId: options?.taxExemptGroupId,\n }),\n [\n {\n transformFn: transformSDKAddressToRESTAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ]\n );\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n externalId: '$[0].externalId',\n currency: '$[0].currency',\n addresses: '$[0].addresses',\n lineItems: '$[0].lineItems',\n contactId: '$[0].contactId',\n taxExemptGroupId: '$[0].taxExemptGroupId',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CalculateTaxOptions {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n taxExemptGroupId?: string | null;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n * @public\n * @documentationMaturity preview\n * @permissionId BILLING.TAX_CALCULATORS_READ\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators\n */\nexport async function listTaxCalculators(): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixBillingV1TaxCalculationUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n _: [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_billing_tax-calculation';\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n */\nexport function calculateTax(payload: object): RequestOptionsFactory<any> {\n function __calculateTax({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'POST' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.CalculateTax',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/calculate-tax',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __calculateTax;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\nexport function listTaxCalculators(\n payload: object\n): RequestOptionsFactory<any> {\n function __listTaxCalculators({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'GET' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.ListTaxCalculators',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/list-tax-calculators',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listTaxCalculators;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n CalculateTaxApplicationErrors,\n CalculateTaxOptions,\n CalculateTaxResponse,\n ListTaxCalculatorsResponse,\n calculateTax as universalCalculateTax,\n listTaxCalculators as universalListTaxCalculators,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/billing' };\n\nexport function calculateTax(httpClient: HttpClient): CalculateTaxSignature {\n return (\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n ) =>\n universalCalculateTax(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface CalculateTaxSignature {\n /**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @param - Calculate tax options.\n */\n (\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n ): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`,\n 6\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n >;\n}\n\nexport function listTaxCalculators(\n httpClient: HttpClient\n): ListTaxCalculatorsSignature {\n return () =>\n universalListTaxCalculators(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListTaxCalculatorsSignature {\n /**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\n (): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`,\n 4\n >\n >;\n}\n\nexport {\n Address,\n AddressIndex,\n AddressIndexAddressIndexOptionsOneOf,\n AggregateTaxBreakdownsRequest,\n AggregateTaxBreakdownsResponse,\n AggregatedTaxBreakdown,\n ApplicationError,\n CalculateTaxOptions,\n CalculateTaxRequest,\n CalculateTaxResponse,\n JurisdictionType,\n LineItem,\n LineItemTaxDetails,\n LineItemTaxSummary,\n ListTaxCalculatorsRequest,\n ListTaxCalculatorsResponse,\n MultipleAddresses,\n TaxBreakdown,\n TaxCalculationGateway,\n TaxCalculatorDetails,\n TaxSummary,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n","import {\n calculateTax as publicCalculateTax,\n listTaxCalculators as publicListTaxCalculators,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const calculateTax: MaybeContext<\n BuildRESTFunction<typeof publicCalculateTax> & typeof publicCalculateTax\n> = /*#__PURE__*/ createRESTModule(publicCalculateTax);\nexport const listTaxCalculators: MaybeContext<\n BuildRESTFunction<typeof publicListTaxCalculators> &\n typeof publicListTaxCalculators\n> = /*#__PURE__*/ createRESTModule(publicListTaxCalculators);\n\nexport { JurisdictionType } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\nexport {\n TaxCalculationGateway,\n CalculateTaxRequest,\n Address,\n LineItem,\n AddressIndex,\n AddressIndexAddressIndexOptionsOneOf,\n MultipleAddresses,\n CalculateTaxResponse,\n TaxSummary,\n AggregatedTaxBreakdown,\n LineItemTaxDetails,\n TaxBreakdown,\n LineItemTaxSummary,\n ApplicationError,\n ListTaxCalculatorsRequest,\n ListTaxCalculatorsResponse,\n TaxCalculatorDetails,\n AggregateTaxBreakdownsRequest,\n AggregateTaxBreakdownsResponse,\n CalculateTaxOptions,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\nexport {\n JurisdictionTypeWithLiterals,\n CalculateTaxApplicationErrors,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,sBAAAA;AAAA,EAAA,0BAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,IAAAC,uBAA2B;AAI3B,SAAS,qCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,iCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAmBd,SAAS,aAAa,SAA6C;AACxE,WAAS,eAAe,EAAE,KAAK,GAAQ;AACrC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,M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EACR;AACF;;;AE3tBO,SAASE,cAAa,YAA+C;AAC1E,SAAO,CACL,YAUAA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAkEO,SAASC,oBACd,YAC6B;AAC7B,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnGA,IAAAC,uBAAiC;AAG1B,IAAMC,gBAEK,2DAAiBA,aAAkB;AAC9C,IAAMC,sBAGK,2DAAiBA,mBAAwB;","names":["calculateTax","listTaxCalculators","import_rest_modules","import_address","JurisdictionType","calculateTax","sdkTransformError","listTaxCalculators","calculateTax","listTaxCalculators","import_rest_modules","calculateTax","listTaxCalculators"]}
1
+ {"version":3,"sources":["../../index.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.ts"],"sourcesContent":["export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';\nimport { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface TaxCalculationGateway {\n /** @format GUID */\n _id?: string | null;\n}\n\nexport interface CalculateTaxRequest {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Contact ID to use for tax exemptions.\n * @replacedBy exempt_details.contact_id\n * @targetRemovalDate 2026-01-01\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Tax exempt group ID to use for tax exemptions.\n * @replacedBy exempt_details.tax_exempt_group_id\n * @targetRemovalDate 2026-01-01\n */\n taxExemptGroupId?: string | null;\n /**\n * Tax exempt details.\n * @internal\n */\n exemptDetails?: ExemptCalculationDetails;\n}\n\n/** Wix common address format for physical address to use if you plan to store addresses in your service. */\nexport interface Address {\n /**\n * 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.\n * @format COUNTRY\n */\n country?: string | null;\n /**\n * Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.\n * @maxLength 50\n */\n subdivision?: string | null;\n /**\n * City name.\n * @maxLength 100\n */\n city?: string | null;\n /**\n * Postal or zip code.\n * @maxLength 50\n */\n postalCode?: string | null;\n /**\n * Main address line, usually street and number as free text.\n * @maxLength 200\n */\n addressLine1?: string | null;\n /**\n * Free text providing more detailed address information, such as apartment, suite, or floor.\n * @maxLength 200\n */\n addressLine2?: string | null;\n}\n\n/** Line items to calculate tax for. */\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Line item price.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n price?: string;\n /**\n * Stock keeping unit for this line item. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku).\n * @maxLength 40\n */\n itemCode?: string | null;\n /**\n * Tax group ID for this line item. If not provided, the default tax group applies.\n * @format GUID\n */\n taxGroupId?: string | null;\n /**\n * ID of the app providing the catalog for this line item.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @format GUID\n */\n appId?: string | null;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean | null;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n}\n\n/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\nexport interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/** @oneof */\nexport interface AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item\n * is shipped from, as well as the address the item is shipped to.\n */\nexport interface MultipleAddresses {\n /** Index of the origin address. */\n origin?: number;\n /** Index of the destination address. */\n destination?: number;\n}\n\nexport interface ExemptCalculationDetails\n extends ExemptCalculationDetailsExemptByOptionsOneOf {\n /**\n * Exempt group ID to use for exemption calculation when mode is EXEMPT_GROUP.\n * @internal\n * @format GUID\n */\n exemptGroupId?: string | null;\n /**\n * Contact ID to use to use for exemption calculation when mode is CONTACT.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n /** Supports different logic for calculating the exempt group id. */\n exemptBy?: ExemptByWithLiterals;\n}\n\n/** @oneof */\nexport interface ExemptCalculationDetailsExemptByOptionsOneOf {\n /**\n * Exempt group ID to use for exemption calculation when mode is EXEMPT_GROUP.\n * @internal\n * @format GUID\n */\n exemptGroupId?: string | null;\n /**\n * Contact ID to use to use for exemption calculation when mode is CONTACT.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n}\n\nexport enum ExemptBy {\n UNKNOWN_EXEMPT_BY = 'UNKNOWN_EXEMPT_BY',\n /** Exempt calculation should be based on tax exempt group. */\n EXEMPT_GROUP = 'EXEMPT_GROUP',\n /** Exempt calculation should be based on contactId. */\n CONTACT = 'CONTACT',\n}\n\n/** @enumType */\nexport type ExemptByWithLiterals =\n | ExemptBy\n | 'UNKNOWN_EXEMPT_BY'\n | 'EXEMPT_GROUP'\n | 'CONTACT';\n\nexport interface CalculateTaxResponse {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses?: Address[];\n /** Summary of the tax calculated. */\n taxSummary?: TaxSummary;\n /**\n * Details of each tax applied to each line item.\n * @minSize 1\n * @maxSize 300\n */\n lineItemTaxDetails?: LineItemTaxDetails[];\n /**\n * Errors that occurred during the tax calculation.\n * @maxSize 100\n */\n errors?: ApplicationError[];\n}\n\nexport interface TaxSummary {\n /**\n * Total price for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalAmount?: string;\n /**\n * Total amount of tax calculated for all line items.\n * Note that due to rounding, `totalTax` may not equal the sum of `lineItemTaxDetails.taxSummary.taxAmount`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTax?: string;\n /**\n * Total taxable amount for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxableAmount?: string;\n /**\n * Total amount of `totalTax` that is included in price. Applies to line items with `taxIncludedInPrice` set to `true`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxIncludedInPrice?: string;\n /**\n * Array of each tax applied, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n /**\n * Total exempt amount for all line items.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalExempt?: string | null;\n /**\n * Default name of the tax that was calculated.\n * @internal\n * @maxLength 200\n */\n taxName?: string | null;\n}\n\n/**\n * The summary of the tax breakdown for all the line items. It will hold for each tax name, the aggregated tax amount paid for it and the tax rate.\n * Tax breakdown is the tax amount split to the tax authorities that applied on the line item.\n *\n * Note: Because that the tax is calculated only on the taxable amount, the tax amount may be looks strange.\n * e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,\n * then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.\n */\nexport interface AggregatedTaxBreakdown {\n /**\n * Name of the tax that was calculated.\n * @maxLength 200\n */\n taxName?: string;\n /**\n * Type of tax that was calculated.\n * @maxLength 200\n */\n taxType?: string;\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string;\n /** Type of jurisdiction that taxes were calculated for. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @decimalValue options { gte:0, maxScale:6 }\n */\n rate?: string;\n /**\n * Total amount of this tax for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n aggregatedTaxAmount?: string;\n /**\n * Total exempt amount of this tax.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3 }\n */\n aggregatedExemptAmount?: string | null;\n}\n\n/** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"County\"`, `\"City\"`, `\"Special\"`, etc. */\nexport enum JurisdictionType {\n UNDEFINED = 'UNDEFINED',\n COUNTRY = 'COUNTRY',\n STATE = 'STATE',\n COUNTY = 'COUNTY',\n CITY = 'CITY',\n SPECIAL = 'SPECIAL',\n}\n\n/** @enumType */\nexport type JurisdictionTypeWithLiterals =\n | JurisdictionType\n | 'UNDEFINED'\n | 'COUNTRY'\n | 'STATE'\n | 'COUNTY'\n | 'CITY'\n | 'SPECIAL';\n\n/** Tax details for a specific line item. */\nexport interface LineItemTaxDetails {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Array of each tax applied, grouped by `jurisdiction`.\n * @maxSize 7\n */\n taxBreakdown?: TaxBreakdown[];\n /** Summary of this line item's total price and tax. */\n taxSummary?: LineItemTaxSummary;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean;\n}\n\n/** A detailed description of all the tax authorities applied on this item. */\nexport interface TaxBreakdown {\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string | null;\n /**\n * Non-taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n nonTaxableAmount?: string | null;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:6, gte:0 }\n */\n rate?: string | null;\n /**\n * Amount of this tax calculated for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string | null;\n /**\n * Taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n taxableAmount?: string | null;\n /**\n * Type of tax that was calculated. For example, `\"Sales Tax\"`, `\"Income Tax\"`, `\"Value Added Tax\"`, etc.\n * @maxLength 200\n */\n taxType?: string | null;\n /**\n * Name of the tax that was calculated. For example, `\"NY State Sales Tax\"`, `\"Quebec GST\"`, etc.\n * @maxLength 200\n */\n taxName?: string | null;\n /** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"Çounty\"`, `\"City\"`, `\"Special\"`, etc. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Amount of the price that was exempt from this authority.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3, gte:0 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface LineItemTaxSummary {\n /**\n * Total price for this line item.\n * To determine the price for each individual unit of this line item, divide by `quantity`.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n fullPrice?: string | null;\n /**\n * Total amount of tax calculated for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string;\n /**\n * Total taxable amount for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxableAmount?: string;\n /**\n * ID of the calculator app that calculated tax for this line item.\n * @maxLength 50\n */\n appId?: string | null;\n /**\n * Total exempt amount or this line item.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface ListTaxCalculatorsRequest {}\n\nexport interface ListTaxCalculatorsResponse {\n /**\n * Retrieved tax calculators.\n * @maxSize 10\n */\n taxCalculatorDetails?: TaxCalculatorDetails[];\n}\n\nexport interface TaxCalculatorDetails {\n /**\n * ID of the tax calculator.\n * @format GUID\n */\n appId?: string;\n /**\n * Display name of the tax calculator.\n * @minLength 1\n * @maxLength 200\n */\n displayName?: string;\n /**\n * List of countries, in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format, that the calculator does not support.\n * @format COUNTRY\n * @maxSize 195\n */\n unsupportedCountries?: string[];\n}\n\nexport interface AggregateTaxBreakdownsRequest {\n /**\n * Array of tax breakdowns to aggregate.\n * @maxSize 200\n */\n taxBreakdowns?: TaxBreakdown[];\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface AggregateTaxBreakdownsResponse {\n /**\n * Array of each aggregated tax breakdowns, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n}\n\n/** @docsIgnore */\nexport type CalculateTaxApplicationErrors =\n | {\n code?: 'INVALID_LINE_ITEM_ADDRESS_INDEX';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_TAXABLE_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_COUNTRY_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_SUBDIVISION_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @public\n * @documentationMaturity preview\n * @requiredField options.addresses\n * @requiredField options.lineItems\n * @requiredField options.lineItems._id\n * @requiredField options.lineItems.addressIndex\n * @requiredField options.lineItems.price\n * @param options - Calculate tax options.\n * @permissionId BILLING.CALCULATE_TAX\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.CalculateTax\n */\nexport async function calculateTax(\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`,\n 6\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = transformPaths(\n renameKeysFromSDKRequestToRESTRequest({\n externalId: options?.externalId,\n currency: options?.currency,\n addresses: options?.addresses,\n lineItems: options?.lineItems,\n contactId: options?.contactId,\n taxExemptGroupId: options?.taxExemptGroupId,\n exemptDetails: options?.exemptDetails,\n }),\n [\n {\n transformFn: transformSDKAddressToRESTAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ]\n );\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n externalId: '$[0].externalId',\n currency: '$[0].currency',\n addresses: '$[0].addresses',\n lineItems: '$[0].lineItems',\n contactId: '$[0].contactId',\n taxExemptGroupId: '$[0].taxExemptGroupId',\n exemptDetails: '$[0].exemptDetails',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CalculateTaxOptions {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Contact ID to use for tax exemptions.\n * @replacedBy exempt_details.contact_id\n * @targetRemovalDate 2026-01-01\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Tax exempt group ID to use for tax exemptions.\n * @replacedBy exempt_details.tax_exempt_group_id\n * @targetRemovalDate 2026-01-01\n */\n taxExemptGroupId?: string | null;\n /**\n * Tax exempt details.\n * @internal\n */\n exemptDetails?: ExemptCalculationDetails;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n * @public\n * @documentationMaturity preview\n * @permissionId BILLING.TAX_CALCULATORS_READ\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators\n */\nexport async function listTaxCalculators(): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixBillingV1TaxCalculationUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n _: [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_billing_tax-calculation';\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n */\nexport function calculateTax(payload: object): RequestOptionsFactory<any> {\n function __calculateTax({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'POST' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.CalculateTax',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/calculate-tax',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __calculateTax;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\nexport function listTaxCalculators(\n payload: object\n): RequestOptionsFactory<any> {\n function __listTaxCalculators({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'GET' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.ListTaxCalculators',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/list-tax-calculators',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listTaxCalculators;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n CalculateTaxApplicationErrors,\n CalculateTaxOptions,\n CalculateTaxResponse,\n ListTaxCalculatorsResponse,\n calculateTax as universalCalculateTax,\n listTaxCalculators as universalListTaxCalculators,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/billing' };\n\nexport function calculateTax(httpClient: HttpClient): CalculateTaxSignature {\n return (\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n ) =>\n universalCalculateTax(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface CalculateTaxSignature {\n /**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @param - Calculate tax options.\n */\n (\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n ): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`,\n 6\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n >;\n}\n\nexport function listTaxCalculators(\n httpClient: HttpClient\n): ListTaxCalculatorsSignature {\n return () =>\n universalListTaxCalculators(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListTaxCalculatorsSignature {\n /**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\n (): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`,\n 4\n >\n >;\n}\n\nexport {\n Address,\n AddressIndex,\n AddressIndexAddressIndexOptionsOneOf,\n AggregateTaxBreakdownsRequest,\n AggregateTaxBreakdownsResponse,\n AggregatedTaxBreakdown,\n ApplicationError,\n CalculateTaxOptions,\n CalculateTaxRequest,\n CalculateTaxResponse,\n ExemptBy,\n ExemptCalculationDetails,\n ExemptCalculationDetailsExemptByOptionsOneOf,\n JurisdictionType,\n LineItem,\n LineItemTaxDetails,\n LineItemTaxSummary,\n ListTaxCalculatorsRequest,\n ListTaxCalculatorsResponse,\n MultipleAddresses,\n TaxBreakdown,\n TaxCalculationGateway,\n TaxCalculatorDetails,\n TaxSummary,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n","import {\n calculateTax as publicCalculateTax,\n listTaxCalculators as publicListTaxCalculators,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const calculateTax: MaybeContext<\n BuildRESTFunction<typeof publicCalculateTax> & typeof publicCalculateTax\n> = /*#__PURE__*/ createRESTModule(publicCalculateTax);\nexport const listTaxCalculators: MaybeContext<\n BuildRESTFunction<typeof publicListTaxCalculators> &\n typeof publicListTaxCalculators\n> = /*#__PURE__*/ createRESTModule(publicListTaxCalculators);\n\nexport {\n ExemptBy,\n JurisdictionType,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\nexport {\n TaxCalculationGateway,\n CalculateTaxRequest,\n Address,\n LineItem,\n AddressIndex,\n AddressIndexAddressIndexOptionsOneOf,\n MultipleAddresses,\n ExemptCalculationDetails,\n ExemptCalculationDetailsExemptByOptionsOneOf,\n CalculateTaxResponse,\n TaxSummary,\n AggregatedTaxBreakdown,\n LineItemTaxDetails,\n TaxBreakdown,\n LineItemTaxSummary,\n ApplicationError,\n ListTaxCalculatorsRequest,\n ListTaxCalculatorsResponse,\n TaxCalculatorDetails,\n AggregateTaxBreakdownsRequest,\n AggregateTaxBreakdownsResponse,\n CalculateTaxOptions,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\nexport {\n ExemptByWithLiterals,\n JurisdictionTypeWithLiterals,\n CalculateTaxApplicationErrors,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAAA;AAAA,EAAA,0BAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0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kB;AAC9C,IAAMC,sBAGK,2DAAiBA,mBAAwB;","names":["calculateTax","listTaxCalculators","import_rest_modules","import_address","ExemptBy","JurisdictionType","calculateTax","sdkTransformError","listTaxCalculators","calculateTax","listTaxCalculators","import_rest_modules","calculateTax","listTaxCalculators"]}
@@ -144,6 +144,22 @@ interface MultipleAddresses {
144
144
  /** Index of the destination address. */
145
145
  destination?: number;
146
146
  }
147
+ interface ExemptCalculationDetails extends ExemptCalculationDetailsExemptByOptionsOneOf {
148
+ /** Supports different logic for calculating the exempt group id. */
149
+ exemptBy?: ExemptByWithLiterals;
150
+ }
151
+ /** @oneof */
152
+ interface ExemptCalculationDetailsExemptByOptionsOneOf {
153
+ }
154
+ declare enum ExemptBy {
155
+ UNKNOWN_EXEMPT_BY = "UNKNOWN_EXEMPT_BY",
156
+ /** Exempt calculation should be based on tax exempt group. */
157
+ EXEMPT_GROUP = "EXEMPT_GROUP",
158
+ /** Exempt calculation should be based on contactId. */
159
+ CONTACT = "CONTACT"
160
+ }
161
+ /** @enumType */
162
+ type ExemptByWithLiterals = ExemptBy | 'UNKNOWN_EXEMPT_BY' | 'EXEMPT_GROUP' | 'CONTACT';
147
163
  interface CalculateTaxResponse {
148
164
  /**
149
165
  * Optional ID of the entity that tax is being calculated for. For example, a cart ID.
@@ -499,4 +515,4 @@ interface CalculateTaxOptions {
499
515
  */
500
516
  declare function listTaxCalculators(): Promise<NonNullablePaths<ListTaxCalculatorsResponse, `taxCalculatorDetails` | `taxCalculatorDetails.${number}.appId` | `taxCalculatorDetails.${number}.displayName`, 4>>;
501
517
 
502
- export { type Address, type AddressIndex, type AddressIndexAddressIndexOptionsOneOf, type AggregateTaxBreakdownsRequest, type AggregateTaxBreakdownsResponse, type AggregatedTaxBreakdown, type ApplicationError, type CalculateTaxApplicationErrors, type CalculateTaxOptions, type CalculateTaxRequest, type CalculateTaxResponse, JurisdictionType, type JurisdictionTypeWithLiterals, type LineItem, type LineItemTaxDetails, type LineItemTaxSummary, type ListTaxCalculatorsRequest, type ListTaxCalculatorsResponse, type MultipleAddresses, type TaxBreakdown, type TaxCalculationGateway, type TaxCalculatorDetails, type TaxSummary, calculateTax, listTaxCalculators };
518
+ export { type Address, type AddressIndex, type AddressIndexAddressIndexOptionsOneOf, type AggregateTaxBreakdownsRequest, type AggregateTaxBreakdownsResponse, type AggregatedTaxBreakdown, type ApplicationError, type CalculateTaxApplicationErrors, type CalculateTaxOptions, type CalculateTaxRequest, type CalculateTaxResponse, ExemptBy, type ExemptByWithLiterals, type ExemptCalculationDetails, type ExemptCalculationDetailsExemptByOptionsOneOf, JurisdictionType, type JurisdictionTypeWithLiterals, type LineItem, type LineItemTaxDetails, type LineItemTaxSummary, type ListTaxCalculatorsRequest, type ListTaxCalculatorsResponse, type MultipleAddresses, type TaxBreakdown, type TaxCalculationGateway, type TaxCalculatorDetails, type TaxSummary, calculateTax, listTaxCalculators };
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // index.typings.ts
21
21
  var index_typings_exports = {};
22
22
  __export(index_typings_exports, {
23
+ ExemptBy: () => ExemptBy,
23
24
  JurisdictionType: () => JurisdictionType,
24
25
  calculateTax: () => calculateTax2,
25
26
  listTaxCalculators: () => listTaxCalculators2
@@ -118,6 +119,12 @@ function listTaxCalculators(payload) {
118
119
  var import_address = require("@wix/sdk-runtime/transformations/address");
119
120
  var import_address2 = require("@wix/sdk-runtime/transformations/address");
120
121
  var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
122
+ var ExemptBy = /* @__PURE__ */ ((ExemptBy2) => {
123
+ ExemptBy2["UNKNOWN_EXEMPT_BY"] = "UNKNOWN_EXEMPT_BY";
124
+ ExemptBy2["EXEMPT_GROUP"] = "EXEMPT_GROUP";
125
+ ExemptBy2["CONTACT"] = "CONTACT";
126
+ return ExemptBy2;
127
+ })(ExemptBy || {});
121
128
  var JurisdictionType = /* @__PURE__ */ ((JurisdictionType2) => {
122
129
  JurisdictionType2["UNDEFINED"] = "UNDEFINED";
123
130
  JurisdictionType2["COUNTRY"] = "COUNTRY";
@@ -136,7 +143,8 @@ async function calculateTax2(options) {
136
143
  addresses: options?.addresses,
137
144
  lineItems: options?.lineItems,
138
145
  contactId: options?.contactId,
139
- taxExemptGroupId: options?.taxExemptGroupId
146
+ taxExemptGroupId: options?.taxExemptGroupId,
147
+ exemptDetails: options?.exemptDetails
140
148
  }),
141
149
  [
142
150
  {
@@ -169,7 +177,8 @@ async function calculateTax2(options) {
169
177
  addresses: "$[0].addresses",
170
178
  lineItems: "$[0].lineItems",
171
179
  contactId: "$[0].contactId",
172
- taxExemptGroupId: "$[0].taxExemptGroupId"
180
+ taxExemptGroupId: "$[0].taxExemptGroupId",
181
+ exemptDetails: "$[0].exemptDetails"
173
182
  },
174
183
  singleArgumentUnchanged: false
175
184
  },
@@ -206,6 +215,7 @@ async function listTaxCalculators2() {
206
215
  }
207
216
  // Annotate the CommonJS export names for ESM import in node:
208
217
  0 && (module.exports = {
218
+ ExemptBy,
209
219
  JurisdictionType,
210
220
  calculateTax,
211
221
  listTaxCalculators
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.typings.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts"],"sourcesContent":["export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';\nimport { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface TaxCalculationGateway {\n /** @format GUID */\n _id?: string | null;\n}\n\nexport interface CalculateTaxRequest {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n taxExemptGroupId?: string | null;\n}\n\n/** Wix common address format for physical address to use if you plan to store addresses in your service. */\nexport interface Address {\n /**\n * 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.\n * @format COUNTRY\n */\n country?: string | null;\n /**\n * Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.\n * @maxLength 50\n */\n subdivision?: string | null;\n /**\n * City name.\n * @maxLength 100\n */\n city?: string | null;\n /**\n * Postal or zip code.\n * @maxLength 50\n */\n postalCode?: string | null;\n /**\n * Main address line, usually street and number as free text.\n * @maxLength 200\n */\n addressLine1?: string | null;\n /**\n * Free text providing more detailed address information, such as apartment, suite, or floor.\n * @maxLength 200\n */\n addressLine2?: string | null;\n}\n\n/** Line items to calculate tax for. */\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Line item price.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n price?: string;\n /**\n * Stock keeping unit for this line item. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku).\n * @maxLength 40\n */\n itemCode?: string | null;\n /**\n * Tax group ID for this line item. If not provided, the default tax group applies.\n * @format GUID\n */\n taxGroupId?: string | null;\n /**\n * ID of the app providing the catalog for this line item.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @format GUID\n */\n appId?: string | null;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean | null;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n}\n\n/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\nexport interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/** @oneof */\nexport interface AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item\n * is shipped from, as well as the address the item is shipped to.\n */\nexport interface MultipleAddresses {\n /** Index of the origin address. */\n origin?: number;\n /** Index of the destination address. */\n destination?: number;\n}\n\nexport interface CalculateTaxResponse {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses?: Address[];\n /** Summary of the tax calculated. */\n taxSummary?: TaxSummary;\n /**\n * Details of each tax applied to each line item.\n * @minSize 1\n * @maxSize 300\n */\n lineItemTaxDetails?: LineItemTaxDetails[];\n /**\n * Errors that occurred during the tax calculation.\n * @maxSize 100\n */\n errors?: ApplicationError[];\n}\n\nexport interface TaxSummary {\n /**\n * Total price for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalAmount?: string;\n /**\n * Total amount of tax calculated for all line items.\n * Note that due to rounding, `totalTax` may not equal the sum of `lineItemTaxDetails.taxSummary.taxAmount`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTax?: string;\n /**\n * Total taxable amount for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxableAmount?: string;\n /**\n * Total amount of `totalTax` that is included in price. Applies to line items with `taxIncludedInPrice` set to `true`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxIncludedInPrice?: string;\n /**\n * Array of each tax applied, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n /**\n * Total exempt amount for all line items.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalExempt?: string | null;\n /**\n * Default name of the tax that was calculated.\n * @internal\n * @maxLength 200\n */\n taxName?: string | null;\n}\n\n/**\n * The summary of the tax breakdown for all the line items. It will hold for each tax name, the aggregated tax amount paid for it and the tax rate.\n * Tax breakdown is the tax amount split to the tax authorities that applied on the line item.\n *\n * Note: Because that the tax is calculated only on the taxable amount, the tax amount may be looks strange.\n * e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,\n * then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.\n */\nexport interface AggregatedTaxBreakdown {\n /**\n * Name of the tax that was calculated.\n * @maxLength 200\n */\n taxName?: string;\n /**\n * Type of tax that was calculated.\n * @maxLength 200\n */\n taxType?: string;\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string;\n /** Type of jurisdiction that taxes were calculated for. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @decimalValue options { gte:0, maxScale:6 }\n */\n rate?: string;\n /**\n * Total amount of this tax for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n aggregatedTaxAmount?: string;\n /**\n * Total exempt amount of this tax.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3 }\n */\n aggregatedExemptAmount?: string | null;\n}\n\n/** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"County\"`, `\"City\"`, `\"Special\"`, etc. */\nexport enum JurisdictionType {\n UNDEFINED = 'UNDEFINED',\n COUNTRY = 'COUNTRY',\n STATE = 'STATE',\n COUNTY = 'COUNTY',\n CITY = 'CITY',\n SPECIAL = 'SPECIAL',\n}\n\n/** @enumType */\nexport type JurisdictionTypeWithLiterals =\n | JurisdictionType\n | 'UNDEFINED'\n | 'COUNTRY'\n | 'STATE'\n | 'COUNTY'\n | 'CITY'\n | 'SPECIAL';\n\n/** Tax details for a specific line item. */\nexport interface LineItemTaxDetails {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Array of each tax applied, grouped by `jurisdiction`.\n * @maxSize 7\n */\n taxBreakdown?: TaxBreakdown[];\n /** Summary of this line item's total price and tax. */\n taxSummary?: LineItemTaxSummary;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean;\n}\n\n/** A detailed description of all the tax authorities applied on this item. */\nexport interface TaxBreakdown {\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string | null;\n /**\n * Non-taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n nonTaxableAmount?: string | null;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:6, gte:0 }\n */\n rate?: string | null;\n /**\n * Amount of this tax calculated for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string | null;\n /**\n * Taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n taxableAmount?: string | null;\n /**\n * Type of tax that was calculated. For example, `\"Sales Tax\"`, `\"Income Tax\"`, `\"Value Added Tax\"`, etc.\n * @maxLength 200\n */\n taxType?: string | null;\n /**\n * Name of the tax that was calculated. For example, `\"NY State Sales Tax\"`, `\"Quebec GST\"`, etc.\n * @maxLength 200\n */\n taxName?: string | null;\n /** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"Çounty\"`, `\"City\"`, `\"Special\"`, etc. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Amount of the price that was exempt from this authority.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3, gte:0 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface LineItemTaxSummary {\n /**\n * Total price for this line item.\n * To determine the price for each individual unit of this line item, divide by `quantity`.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n fullPrice?: string | null;\n /**\n * Total amount of tax calculated for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string;\n /**\n * Total taxable amount for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxableAmount?: string;\n /**\n * ID of the calculator app that calculated tax for this line item.\n * @maxLength 50\n */\n appId?: string | null;\n /**\n * Total exempt amount or this line item.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface ListTaxCalculatorsRequest {}\n\nexport interface ListTaxCalculatorsResponse {\n /**\n * Retrieved tax calculators.\n * @maxSize 10\n */\n taxCalculatorDetails?: TaxCalculatorDetails[];\n}\n\nexport interface TaxCalculatorDetails {\n /**\n * ID of the tax calculator.\n * @format GUID\n */\n appId?: string;\n /**\n * Display name of the tax calculator.\n * @minLength 1\n * @maxLength 200\n */\n displayName?: string;\n /**\n * List of countries, in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format, that the calculator does not support.\n * @format COUNTRY\n * @maxSize 195\n */\n unsupportedCountries?: string[];\n}\n\nexport interface AggregateTaxBreakdownsRequest {\n /**\n * Array of tax breakdowns to aggregate.\n * @maxSize 200\n */\n taxBreakdowns?: TaxBreakdown[];\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface AggregateTaxBreakdownsResponse {\n /**\n * Array of each aggregated tax breakdowns, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n}\n\n/** @docsIgnore */\nexport type CalculateTaxApplicationErrors =\n | {\n code?: 'INVALID_LINE_ITEM_ADDRESS_INDEX';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_TAXABLE_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_COUNTRY_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_SUBDIVISION_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @public\n * @documentationMaturity preview\n * @requiredField options.addresses\n * @requiredField options.lineItems\n * @requiredField options.lineItems._id\n * @requiredField options.lineItems.addressIndex\n * @requiredField options.lineItems.price\n * @param options - Calculate tax options.\n * @permissionId BILLING.CALCULATE_TAX\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.CalculateTax\n */\nexport async function calculateTax(\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`,\n 6\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = transformPaths(\n renameKeysFromSDKRequestToRESTRequest({\n externalId: options?.externalId,\n currency: options?.currency,\n addresses: options?.addresses,\n lineItems: options?.lineItems,\n contactId: options?.contactId,\n taxExemptGroupId: options?.taxExemptGroupId,\n }),\n [\n {\n transformFn: transformSDKAddressToRESTAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ]\n );\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n externalId: '$[0].externalId',\n currency: '$[0].currency',\n addresses: '$[0].addresses',\n lineItems: '$[0].lineItems',\n contactId: '$[0].contactId',\n taxExemptGroupId: '$[0].taxExemptGroupId',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CalculateTaxOptions {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n */\n taxExemptGroupId?: string | null;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n * @public\n * @documentationMaturity preview\n * @permissionId BILLING.TAX_CALCULATORS_READ\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators\n */\nexport async function listTaxCalculators(): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixBillingV1TaxCalculationUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n _: [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_billing_tax-calculation';\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n */\nexport function calculateTax(payload: object): RequestOptionsFactory<any> {\n function __calculateTax({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'POST' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.CalculateTax',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/calculate-tax',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __calculateTax;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\nexport function listTaxCalculators(\n payload: object\n): RequestOptionsFactory<any> {\n function __listTaxCalculators({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'GET' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.ListTaxCalculators',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/list-tax-calculators',\n data: payload,\n host,\n }),\n params: toURLSearchPar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CAAC,EAAE,MAAM,aAAa,YAAY,KAAK,CAAC;AAAA,QACjD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,WAAW;AAAA,UACX,WAAW;AAAA,UACX,WAAW;AAAA,UACX,kBAAkB;AAAA,QACpB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAkDA,eAAsBC,sBAQpB;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC,CAAC,CAAC;AAExD,QAAM,UACgD;AAAA,IAClD;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["calculateTax","listTaxCalculators","import_rest_modules","import_address","JurisdictionType","calculateTax","sdkTransformError","listTaxCalculators"]}
1
+ {"version":3,"sources":["../../index.typings.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts","../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts"],"sourcesContent":["export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';\nimport { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface TaxCalculationGateway {\n /** @format GUID */\n _id?: string | null;\n}\n\nexport interface CalculateTaxRequest {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Contact ID to use for tax exemptions.\n * @replacedBy exempt_details.contact_id\n * @targetRemovalDate 2026-01-01\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Tax exempt group ID to use for tax exemptions.\n * @replacedBy exempt_details.tax_exempt_group_id\n * @targetRemovalDate 2026-01-01\n */\n taxExemptGroupId?: string | null;\n /**\n * Tax exempt details.\n * @internal\n */\n exemptDetails?: ExemptCalculationDetails;\n}\n\n/** Wix common address format for physical address to use if you plan to store addresses in your service. */\nexport interface Address {\n /**\n * 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.\n * @format COUNTRY\n */\n country?: string | null;\n /**\n * Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.\n * @maxLength 50\n */\n subdivision?: string | null;\n /**\n * City name.\n * @maxLength 100\n */\n city?: string | null;\n /**\n * Postal or zip code.\n * @maxLength 50\n */\n postalCode?: string | null;\n /**\n * Main address line, usually street and number as free text.\n * @maxLength 200\n */\n addressLine1?: string | null;\n /**\n * Free text providing more detailed address information, such as apartment, suite, or floor.\n * @maxLength 200\n */\n addressLine2?: string | null;\n}\n\n/** Line items to calculate tax for. */\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Line item price.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n price?: string;\n /**\n * Stock keeping unit for this line item. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku).\n * @maxLength 40\n */\n itemCode?: string | null;\n /**\n * Tax group ID for this line item. If not provided, the default tax group applies.\n * @format GUID\n */\n taxGroupId?: string | null;\n /**\n * ID of the app providing the catalog for this line item.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @format GUID\n */\n appId?: string | null;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean | null;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n}\n\n/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\nexport interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/** @oneof */\nexport interface AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item\n * is shipped from, as well as the address the item is shipped to.\n */\nexport interface MultipleAddresses {\n /** Index of the origin address. */\n origin?: number;\n /** Index of the destination address. */\n destination?: number;\n}\n\nexport interface ExemptCalculationDetails\n extends ExemptCalculationDetailsExemptByOptionsOneOf {\n /**\n * Exempt group ID to use for exemption calculation when mode is EXEMPT_GROUP.\n * @internal\n * @format GUID\n */\n exemptGroupId?: string | null;\n /**\n * Contact ID to use to use for exemption calculation when mode is CONTACT.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n /** Supports different logic for calculating the exempt group id. */\n exemptBy?: ExemptByWithLiterals;\n}\n\n/** @oneof */\nexport interface ExemptCalculationDetailsExemptByOptionsOneOf {\n /**\n * Exempt group ID to use for exemption calculation when mode is EXEMPT_GROUP.\n * @internal\n * @format GUID\n */\n exemptGroupId?: string | null;\n /**\n * Contact ID to use to use for exemption calculation when mode is CONTACT.\n * @internal\n * @format GUID\n */\n contactId?: string | null;\n}\n\nexport enum ExemptBy {\n UNKNOWN_EXEMPT_BY = 'UNKNOWN_EXEMPT_BY',\n /** Exempt calculation should be based on tax exempt group. */\n EXEMPT_GROUP = 'EXEMPT_GROUP',\n /** Exempt calculation should be based on contactId. */\n CONTACT = 'CONTACT',\n}\n\n/** @enumType */\nexport type ExemptByWithLiterals =\n | ExemptBy\n | 'UNKNOWN_EXEMPT_BY'\n | 'EXEMPT_GROUP'\n | 'CONTACT';\n\nexport interface CalculateTaxResponse {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses?: Address[];\n /** Summary of the tax calculated. */\n taxSummary?: TaxSummary;\n /**\n * Details of each tax applied to each line item.\n * @minSize 1\n * @maxSize 300\n */\n lineItemTaxDetails?: LineItemTaxDetails[];\n /**\n * Errors that occurred during the tax calculation.\n * @maxSize 100\n */\n errors?: ApplicationError[];\n}\n\nexport interface TaxSummary {\n /**\n * Total price for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalAmount?: string;\n /**\n * Total amount of tax calculated for all line items.\n * Note that due to rounding, `totalTax` may not equal the sum of `lineItemTaxDetails.taxSummary.taxAmount`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTax?: string;\n /**\n * Total taxable amount for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxableAmount?: string;\n /**\n * Total amount of `totalTax` that is included in price. Applies to line items with `taxIncludedInPrice` set to `true`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxIncludedInPrice?: string;\n /**\n * Array of each tax applied, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n /**\n * Total exempt amount for all line items.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalExempt?: string | null;\n /**\n * Default name of the tax that was calculated.\n * @internal\n * @maxLength 200\n */\n taxName?: string | null;\n}\n\n/**\n * The summary of the tax breakdown for all the line items. It will hold for each tax name, the aggregated tax amount paid for it and the tax rate.\n * Tax breakdown is the tax amount split to the tax authorities that applied on the line item.\n *\n * Note: Because that the tax is calculated only on the taxable amount, the tax amount may be looks strange.\n * e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,\n * then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.\n */\nexport interface AggregatedTaxBreakdown {\n /**\n * Name of the tax that was calculated.\n * @maxLength 200\n */\n taxName?: string;\n /**\n * Type of tax that was calculated.\n * @maxLength 200\n */\n taxType?: string;\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string;\n /** Type of jurisdiction that taxes were calculated for. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @decimalValue options { gte:0, maxScale:6 }\n */\n rate?: string;\n /**\n * Total amount of this tax for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n aggregatedTaxAmount?: string;\n /**\n * Total exempt amount of this tax.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3 }\n */\n aggregatedExemptAmount?: string | null;\n}\n\n/** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"County\"`, `\"City\"`, `\"Special\"`, etc. */\nexport enum JurisdictionType {\n UNDEFINED = 'UNDEFINED',\n COUNTRY = 'COUNTRY',\n STATE = 'STATE',\n COUNTY = 'COUNTY',\n CITY = 'CITY',\n SPECIAL = 'SPECIAL',\n}\n\n/** @enumType */\nexport type JurisdictionTypeWithLiterals =\n | JurisdictionType\n | 'UNDEFINED'\n | 'COUNTRY'\n | 'STATE'\n | 'COUNTY'\n | 'CITY'\n | 'SPECIAL';\n\n/** Tax details for a specific line item. */\nexport interface LineItemTaxDetails {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Array of each tax applied, grouped by `jurisdiction`.\n * @maxSize 7\n */\n taxBreakdown?: TaxBreakdown[];\n /** Summary of this line item's total price and tax. */\n taxSummary?: LineItemTaxSummary;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean;\n}\n\n/** A detailed description of all the tax authorities applied on this item. */\nexport interface TaxBreakdown {\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string | null;\n /**\n * Non-taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n nonTaxableAmount?: string | null;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:6, gte:0 }\n */\n rate?: string | null;\n /**\n * Amount of this tax calculated for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string | null;\n /**\n * Taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n taxableAmount?: string | null;\n /**\n * Type of tax that was calculated. For example, `\"Sales Tax\"`, `\"Income Tax\"`, `\"Value Added Tax\"`, etc.\n * @maxLength 200\n */\n taxType?: string | null;\n /**\n * Name of the tax that was calculated. For example, `\"NY State Sales Tax\"`, `\"Quebec GST\"`, etc.\n * @maxLength 200\n */\n taxName?: string | null;\n /** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"Çounty\"`, `\"City\"`, `\"Special\"`, etc. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Amount of the price that was exempt from this authority.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:3, gte:0 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface LineItemTaxSummary {\n /**\n * Total price for this line item.\n * To determine the price for each individual unit of this line item, divide by `quantity`.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n fullPrice?: string | null;\n /**\n * Total amount of tax calculated for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string;\n /**\n * Total taxable amount for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxableAmount?: string;\n /**\n * ID of the calculator app that calculated tax for this line item.\n * @maxLength 50\n */\n appId?: string | null;\n /**\n * Total exempt amount or this line item.\n * @internal\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n exemptAmount?: string | null;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface ListTaxCalculatorsRequest {}\n\nexport interface ListTaxCalculatorsResponse {\n /**\n * Retrieved tax calculators.\n * @maxSize 10\n */\n taxCalculatorDetails?: TaxCalculatorDetails[];\n}\n\nexport interface TaxCalculatorDetails {\n /**\n * ID of the tax calculator.\n * @format GUID\n */\n appId?: string;\n /**\n * Display name of the tax calculator.\n * @minLength 1\n * @maxLength 200\n */\n displayName?: string;\n /**\n * List of countries, in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format, that the calculator does not support.\n * @format COUNTRY\n * @maxSize 195\n */\n unsupportedCountries?: string[];\n}\n\nexport interface AggregateTaxBreakdownsRequest {\n /**\n * Array of tax breakdowns to aggregate.\n * @maxSize 200\n */\n taxBreakdowns?: TaxBreakdown[];\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n}\n\nexport interface AggregateTaxBreakdownsResponse {\n /**\n * Array of each aggregated tax breakdowns, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n}\n\n/** @docsIgnore */\nexport type CalculateTaxApplicationErrors =\n | {\n code?: 'INVALID_LINE_ITEM_ADDRESS_INDEX';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_TAXABLE_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_COUNTRY_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_SUBDIVISION_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @public\n * @documentationMaturity preview\n * @requiredField options.addresses\n * @requiredField options.lineItems\n * @requiredField options.lineItems._id\n * @requiredField options.lineItems.addressIndex\n * @requiredField options.lineItems.price\n * @param options - Calculate tax options.\n * @permissionId BILLING.CALCULATE_TAX\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.CalculateTax\n */\nexport async function calculateTax(\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`,\n 4\n >\n): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`,\n 6\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = transformPaths(\n renameKeysFromSDKRequestToRESTRequest({\n externalId: options?.externalId,\n currency: options?.currency,\n addresses: options?.addresses,\n lineItems: options?.lineItems,\n contactId: options?.contactId,\n taxExemptGroupId: options?.taxExemptGroupId,\n exemptDetails: options?.exemptDetails,\n }),\n [\n {\n transformFn: transformSDKAddressToRESTAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ]\n );\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n externalId: '$[0].externalId',\n currency: '$[0].currency',\n addresses: '$[0].addresses',\n lineItems: '$[0].lineItems',\n contactId: '$[0].contactId',\n taxExemptGroupId: '$[0].taxExemptGroupId',\n exemptDetails: '$[0].exemptDetails',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CalculateTaxOptions {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n /**\n * Contact ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Contact ID to use for tax exemptions.\n * @replacedBy exempt_details.contact_id\n * @targetRemovalDate 2026-01-01\n */\n contactId?: string | null;\n /**\n * Tax exempt group ID to use for tax exemptions.\n * @internal\n * @format GUID\n * @deprecated Tax exempt group ID to use for tax exemptions.\n * @replacedBy exempt_details.tax_exempt_group_id\n * @targetRemovalDate 2026-01-01\n */\n taxExemptGroupId?: string | null;\n /**\n * Tax exempt details.\n * @internal\n */\n exemptDetails?: ExemptCalculationDetails;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n * @public\n * @documentationMaturity preview\n * @permissionId BILLING.TAX_CALCULATORS_READ\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators\n */\nexport async function listTaxCalculators(): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`,\n 4\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixBillingV1TaxCalculationUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n _: [\n {\n srcPath: '/gateways/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_billing_tax-calculation';\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n */\nexport function calculateTax(payload: object): RequestOptionsFactory<any> {\n function __calculateTax({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'POST' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.CalculateTax',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/calculate-tax',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __calculateTax;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\nexport function listTaxCalculators(\n payload: object\n): RequestOptionsFactory<any> {\n function __listTaxCalculators({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'GET' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.ListTaxCalculators',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/list-tax-calculators',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listTaxCalculators;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAAA;AAAA,EAAA,0BAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,IAAAC,uBAA2B;AAI3B,SAAS,qCACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,iCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAmBd,SAAS,aAAa,SAA6C;AACxE,WAAS,eAAe,EAAE,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AM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAD;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["calculateTax","listTaxCalculators","import_rest_modules","import_address","ExemptBy","JurisdictionType","calculateTax","sdkTransformError","listTaxCalculators"]}
@@ -145,6 +145,22 @@ interface MultipleAddresses {
145
145
  /** Index of the destination address. */
146
146
  destination?: number;
147
147
  }
148
+ interface ExemptCalculationDetails extends ExemptCalculationDetailsExemptByOptionsOneOf {
149
+ /** Supports different logic for calculating the exempt group id. */
150
+ exemptBy?: ExemptByWithLiterals;
151
+ }
152
+ /** @oneof */
153
+ interface ExemptCalculationDetailsExemptByOptionsOneOf {
154
+ }
155
+ declare enum ExemptBy {
156
+ UNKNOWN_EXEMPT_BY = "UNKNOWN_EXEMPT_BY",
157
+ /** Exempt calculation should be based on tax exempt group. */
158
+ EXEMPT_GROUP = "EXEMPT_GROUP",
159
+ /** Exempt calculation should be based on contactId. */
160
+ CONTACT = "CONTACT"
161
+ }
162
+ /** @enumType */
163
+ type ExemptByWithLiterals = ExemptBy | 'UNKNOWN_EXEMPT_BY' | 'EXEMPT_GROUP' | 'CONTACT';
148
164
  interface CalculateTaxResponse {
149
165
  /**
150
166
  * Optional ID of the entity that tax is being calculated for. For example, a cart ID.
@@ -446,4 +462,4 @@ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q
446
462
  declare function calculateTax(): __PublicMethodMetaInfo<'POST', {}, CalculateTaxRequest$1, CalculateTaxRequest, CalculateTaxResponse$1, CalculateTaxResponse>;
447
463
  declare function listTaxCalculators(): __PublicMethodMetaInfo<'GET', {}, ListTaxCalculatorsRequest$1, ListTaxCalculatorsRequest, ListTaxCalculatorsResponse$1, ListTaxCalculatorsResponse>;
448
464
 
449
- export { type AddressIndexAddressIndexOptionsOneOf as AddressIndexAddressIndexOptionsOneOfOriginal, type AddressIndex as AddressIndexOriginal, type Address as AddressOriginal, type AggregateTaxBreakdownsRequest as AggregateTaxBreakdownsRequestOriginal, type AggregateTaxBreakdownsResponse as AggregateTaxBreakdownsResponseOriginal, type AggregatedTaxBreakdown as AggregatedTaxBreakdownOriginal, type ApplicationError as ApplicationErrorOriginal, type CalculateTaxApplicationErrors as CalculateTaxApplicationErrorsOriginal, type CalculateTaxRequest as CalculateTaxRequestOriginal, type CalculateTaxResponse as CalculateTaxResponseOriginal, JurisdictionType as JurisdictionTypeOriginal, type JurisdictionTypeWithLiterals as JurisdictionTypeWithLiteralsOriginal, type LineItem as LineItemOriginal, type LineItemTaxDetails as LineItemTaxDetailsOriginal, type LineItemTaxSummary as LineItemTaxSummaryOriginal, type ListTaxCalculatorsRequest as ListTaxCalculatorsRequestOriginal, type ListTaxCalculatorsResponse as ListTaxCalculatorsResponseOriginal, type MultipleAddresses as MultipleAddressesOriginal, type TaxBreakdown as TaxBreakdownOriginal, type TaxCalculationGateway as TaxCalculationGatewayOriginal, type TaxCalculatorDetails as TaxCalculatorDetailsOriginal, type TaxSummary as TaxSummaryOriginal, type __PublicMethodMetaInfo, calculateTax, listTaxCalculators };
465
+ export { type AddressIndexAddressIndexOptionsOneOf as AddressIndexAddressIndexOptionsOneOfOriginal, type AddressIndex as AddressIndexOriginal, type Address as AddressOriginal, type AggregateTaxBreakdownsRequest as AggregateTaxBreakdownsRequestOriginal, type AggregateTaxBreakdownsResponse as AggregateTaxBreakdownsResponseOriginal, type AggregatedTaxBreakdown as AggregatedTaxBreakdownOriginal, type ApplicationError as ApplicationErrorOriginal, type CalculateTaxApplicationErrors as CalculateTaxApplicationErrorsOriginal, type CalculateTaxRequest as CalculateTaxRequestOriginal, type CalculateTaxResponse as CalculateTaxResponseOriginal, ExemptBy as ExemptByOriginal, type ExemptByWithLiterals as ExemptByWithLiteralsOriginal, type ExemptCalculationDetailsExemptByOptionsOneOf as ExemptCalculationDetailsExemptByOptionsOneOfOriginal, type ExemptCalculationDetails as ExemptCalculationDetailsOriginal, JurisdictionType as JurisdictionTypeOriginal, type JurisdictionTypeWithLiterals as JurisdictionTypeWithLiteralsOriginal, type LineItem as LineItemOriginal, type LineItemTaxDetails as LineItemTaxDetailsOriginal, type LineItemTaxSummary as LineItemTaxSummaryOriginal, type ListTaxCalculatorsRequest as ListTaxCalculatorsRequestOriginal, type ListTaxCalculatorsResponse as ListTaxCalculatorsResponseOriginal, type MultipleAddresses as MultipleAddressesOriginal, type TaxBreakdown as TaxBreakdownOriginal, type TaxCalculationGateway as TaxCalculationGatewayOriginal, type TaxCalculatorDetails as TaxCalculatorDetailsOriginal, type TaxSummary as TaxSummaryOriginal, type __PublicMethodMetaInfo, calculateTax, listTaxCalculators };
package/build/cjs/meta.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // meta.ts
21
21
  var meta_exports = {};
22
22
  __export(meta_exports, {
23
+ ExemptByOriginal: () => ExemptBy,
23
24
  JurisdictionTypeOriginal: () => JurisdictionType,
24
25
  calculateTax: () => calculateTax2,
25
26
  listTaxCalculators: () => listTaxCalculators2
@@ -111,6 +112,12 @@ function listTaxCalculators(payload) {
111
112
  }
112
113
 
113
114
  // src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.ts
115
+ var ExemptBy = /* @__PURE__ */ ((ExemptBy2) => {
116
+ ExemptBy2["UNKNOWN_EXEMPT_BY"] = "UNKNOWN_EXEMPT_BY";
117
+ ExemptBy2["EXEMPT_GROUP"] = "EXEMPT_GROUP";
118
+ ExemptBy2["CONTACT"] = "CONTACT";
119
+ return ExemptBy2;
120
+ })(ExemptBy || {});
114
121
  var JurisdictionType = /* @__PURE__ */ ((JurisdictionType2) => {
115
122
  JurisdictionType2["UNDEFINED"] = "UNDEFINED";
116
123
  JurisdictionType2["COUNTRY"] = "COUNTRY";
@@ -162,6 +169,7 @@ function listTaxCalculators2() {
162
169
  }
163
170
  // Annotate the CommonJS export names for ESM import in node:
164
171
  0 && (module.exports = {
172
+ ExemptByOriginal,
165
173
  JurisdictionTypeOriginal,
166
174
  calculateTax,
167
175
  listTaxCalculators