@wix/auto_sdk_billing_tax-calculation 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts → cjs/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-Cina_f0e.d.ts} +50 -23
- package/build/cjs/index.d.ts +41 -1
- package/build/cjs/index.js +208 -15
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/meta.d.ts +407 -1
- package/build/cjs/meta.js +135 -15
- package/build/cjs/meta.js.map +1 -1
- package/build/es/{src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts → gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-Cina_f0e.d.mts} +50 -23
- package/build/{internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts → es/index.d.mts} +11 -8
- package/build/es/index.mjs +185 -0
- package/build/es/index.mjs.map +1 -0
- package/build/{cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts → es/meta.d.mts} +35 -22
- package/build/es/meta.mjs +110 -0
- package/build/es/meta.mjs.map +1 -0
- package/build/internal/cjs/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-Cina_f0e.d.ts +421 -0
- package/build/internal/cjs/index.d.ts +41 -1
- package/build/internal/cjs/index.js +208 -15
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +407 -1
- package/build/internal/cjs/meta.js +135 -15
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-Cina_f0e.d.mts +421 -0
- package/build/internal/es/{src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts → index.d.mts} +11 -8
- package/build/internal/es/index.mjs +185 -0
- package/build/internal/es/index.mjs.map +1 -0
- package/build/internal/{cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts → es/meta.d.mts} +35 -22
- package/build/internal/es/meta.mjs +110 -0
- package/build/internal/es/meta.mjs.map +1 -0
- package/package.json +9 -8
- package/build/cjs/index.typings.d.ts +0 -1
- package/build/cjs/index.typings.js +0 -18
- package/build/cjs/index.typings.js.map +0 -1
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -10
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -93
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -66
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts +0 -38
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -20
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -14
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts +0 -480
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -165
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
- package/build/es/index.d.ts +0 -1
- package/build/es/index.js +0 -2
- package/build/es/index.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -1
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/meta.d.ts +0 -1
- package/build/es/meta.js +0 -2
- package/build/es/meta.js.map +0 -1
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -6
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -88
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -38
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts +0 -38
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -14
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -11
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts +0 -480
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -137
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
- package/build/internal/cjs/index.typings.d.ts +0 -1
- package/build/internal/cjs/index.typings.js +0 -18
- package/build/internal/cjs/index.typings.js.map +0 -1
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -10
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -93
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -66
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -20
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -14
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts +0 -480
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -165
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
- package/build/internal/es/index.d.ts +0 -1
- package/build/internal/es/index.js +0 -2
- package/build/internal/es/index.js.map +0 -1
- package/build/internal/es/index.typings.d.ts +0 -1
- package/build/internal/es/index.typings.js +0 -2
- package/build/internal/es/index.typings.js.map +0 -1
- package/build/internal/es/meta.d.ts +0 -1
- package/build/internal/es/meta.js +0 -2
- package/build/internal/es/meta.js.map +0 -1
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -6
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -88
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -38
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -14
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -11
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts +0 -480
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -137
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../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":["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\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\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\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\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\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\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. If no tax group with that `taxGroupId` is found then the\n * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.\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 * @applicableIdentity VISITOR\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 >\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 >\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 }),\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 },\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\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 >\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 };\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. If no tax group with that `taxGroupId` is found then the\n * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.\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 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 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 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 >\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. If no tax group with that `taxGroupId` is found then the\n * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.\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 (options?: CalculateTaxOptions | undefined): Promise<CalculateTaxResponse>;\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<ListTaxCalculatorsResponse>;\n}\n\nexport {\n Address,\n AddressIndex,\n AddressIndexAddressIndexOptionsOneOf,\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 CalculateTaxOptions,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;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,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAoBd,SAAS,aAAa,SAA6C;AACxE,WAAS,eAAe,EAAE,KAAK,GAAQ;AACrC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,KAAK,qCAAqC;AAAA,QACxC,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAOO,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,KAAK,qCAAqC;AAAA,QACxC,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,QAAQ,kBAAkB,OAAO;AAAA,IACnC;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AD9FA,SAAS,wCAAwC;AACjD,SAAS,wCAAwC;AACjD,SAAS,sBAAsB;AAmQxB,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,kBAAA,eAAY;AACZ,EAAAA,kBAAA,aAAU;AACV,EAAAA,kBAAA,WAAQ;AACR,EAAAA,kBAAA,YAAS;AACT,EAAAA,kBAAA,UAAO;AACP,EAAAA,kBAAA,aAAU;AANA,SAAAA;AAAA,GAAA;AAgMZ,eAAsBC,cACpB,SAqCA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU;AAAA,IACd,sCAAsC;AAAA,MACpC,YAAY,SAAS;AAAA,MACrB,UAAU,SAAS;AAAA,MACnB,WAAW,SAAS;AAAA,MACpB,WAAW,SAAS;AAAA,IACtB,CAAC;AAAA,IACD;AAAA,MACE;AAAA,QACE,aAAa;AAAA,QACb,OAAO,CAAC,EAAE,MAAM,aAAa,YAAY,KAAK,CAAC;AAAA,MACjD;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UACgD,aAAa,OAAO;AAE1E,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO;AAAA,MACL,eAAe,OAAO,MAAM;AAAA,QAC1B;AAAA,UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,aAAa,YAAY,KAAK,CAAC;AAAA,QACjD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,YAAY;AAAA,UACZ,UAAU;AAAA,UACV,WAAW;AAAA,UACX,WAAW;AAAA,QACb;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AAsCA,eAAsBC,sBAOpB;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC,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,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;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;;;AE/mBO,SAASC,cAAa,YAA+C;AAC1E,SAAO,CACL,YASAA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAyBO,SAASC,oBACd,YAC6B;AAC7B,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;ACxDA,SAAS,wBAAwB;AAG1B,IAAMC,gBAEK,iCAAiBA,aAAkB;AAC9C,IAAMC,sBAGK,iCAAiBA,mBAAwB;","names":["JurisdictionType","calculateTax","listTaxCalculators","calculateTax","listTaxCalculators","calculateTax","listTaxCalculators"]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export interface CalculateTaxRequest {
|
|
1
|
+
import { b as CalculateTaxRequest$1, a as CalculateTaxResponse$1, l as ListTaxCalculatorsRequest$1, L as ListTaxCalculatorsResponse$1 } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-Cina_f0e.mjs';
|
|
2
|
+
|
|
3
|
+
interface CalculateTaxRequest {
|
|
6
4
|
/**
|
|
7
5
|
* Optional ID of the entity that tax is being calculated for. For example, a cart ID.
|
|
8
6
|
* @format GUID
|
|
@@ -28,7 +26,7 @@ export interface CalculateTaxRequest {
|
|
|
28
26
|
lineItems: LineItem[];
|
|
29
27
|
}
|
|
30
28
|
/** Wix common address format for physical address to use if you plan to store addresses in your service. */
|
|
31
|
-
|
|
29
|
+
interface Address {
|
|
32
30
|
/**
|
|
33
31
|
* 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.
|
|
34
32
|
* @format COUNTRY
|
|
@@ -61,7 +59,7 @@ export interface Address {
|
|
|
61
59
|
addressLine2?: string | null;
|
|
62
60
|
}
|
|
63
61
|
/** Line items to calculate tax for. */
|
|
64
|
-
|
|
62
|
+
interface LineItem {
|
|
65
63
|
/**
|
|
66
64
|
* Line item ID.
|
|
67
65
|
* @minLength 1
|
|
@@ -113,7 +111,7 @@ export interface LineItem {
|
|
|
113
111
|
addressIndex?: AddressIndex;
|
|
114
112
|
}
|
|
115
113
|
/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */
|
|
116
|
-
|
|
114
|
+
interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
117
115
|
/** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
|
|
118
116
|
singleAddress?: number;
|
|
119
117
|
/**
|
|
@@ -123,7 +121,7 @@ export interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
|
123
121
|
multipleAddresses?: MultipleAddresses;
|
|
124
122
|
}
|
|
125
123
|
/** @oneof */
|
|
126
|
-
|
|
124
|
+
interface AddressIndexAddressIndexOptionsOneOf {
|
|
127
125
|
/** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
|
|
128
126
|
singleAddress?: number;
|
|
129
127
|
/**
|
|
@@ -136,13 +134,13 @@ export interface AddressIndexAddressIndexOptionsOneOf {
|
|
|
136
134
|
* Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item
|
|
137
135
|
* is shipped from, as well as the address the item is shipped to.
|
|
138
136
|
*/
|
|
139
|
-
|
|
137
|
+
interface MultipleAddresses {
|
|
140
138
|
/** Index of the origin address. */
|
|
141
139
|
origin?: number;
|
|
142
140
|
/** Index of the destination address. */
|
|
143
141
|
destination?: number;
|
|
144
142
|
}
|
|
145
|
-
|
|
143
|
+
interface CalculateTaxResponse {
|
|
146
144
|
/**
|
|
147
145
|
* Optional ID of the entity that tax is being calculated for. For example, a cart ID.
|
|
148
146
|
* @format GUID
|
|
@@ -174,7 +172,7 @@ export interface CalculateTaxResponse {
|
|
|
174
172
|
*/
|
|
175
173
|
errors?: ApplicationError[];
|
|
176
174
|
}
|
|
177
|
-
|
|
175
|
+
interface TaxSummary {
|
|
178
176
|
/**
|
|
179
177
|
* Total price for all line items.
|
|
180
178
|
* @format DECIMAL_VALUE
|
|
@@ -214,7 +212,7 @@ export interface TaxSummary {
|
|
|
214
212
|
* e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,
|
|
215
213
|
* then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.
|
|
216
214
|
*/
|
|
217
|
-
|
|
215
|
+
interface AggregatedTaxBreakdown {
|
|
218
216
|
/**
|
|
219
217
|
* Name of the tax that was calculated.
|
|
220
218
|
* @maxLength 200
|
|
@@ -245,7 +243,7 @@ export interface AggregatedTaxBreakdown {
|
|
|
245
243
|
aggregatedTaxAmount?: string;
|
|
246
244
|
}
|
|
247
245
|
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"County"`, `"City"`, `"Special"`, etc. */
|
|
248
|
-
|
|
246
|
+
declare enum JurisdictionType {
|
|
249
247
|
UNDEFINED = "UNDEFINED",
|
|
250
248
|
COUNTRY = "COUNTRY",
|
|
251
249
|
STATE = "STATE",
|
|
@@ -254,9 +252,9 @@ export declare enum JurisdictionType {
|
|
|
254
252
|
SPECIAL = "SPECIAL"
|
|
255
253
|
}
|
|
256
254
|
/** @enumType */
|
|
257
|
-
|
|
255
|
+
type JurisdictionTypeWithLiterals = JurisdictionType | 'UNDEFINED' | 'COUNTRY' | 'STATE' | 'COUNTY' | 'CITY' | 'SPECIAL';
|
|
258
256
|
/** Tax details for a specific line item. */
|
|
259
|
-
|
|
257
|
+
interface LineItemTaxDetails {
|
|
260
258
|
/**
|
|
261
259
|
* Line item ID.
|
|
262
260
|
* @minLength 1
|
|
@@ -287,7 +285,7 @@ export interface LineItemTaxDetails {
|
|
|
287
285
|
taxIncludedInPrice?: boolean;
|
|
288
286
|
}
|
|
289
287
|
/** A detailed description of all the tax authorities applied on this item. */
|
|
290
|
-
|
|
288
|
+
interface TaxBreakdown {
|
|
291
289
|
/**
|
|
292
290
|
* Jurisdiction that taxes were calculated for.
|
|
293
291
|
* @maxLength 200
|
|
@@ -330,7 +328,7 @@ export interface TaxBreakdown {
|
|
|
330
328
|
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"Çounty"`, `"City"`, `"Special"`, etc. */
|
|
331
329
|
jurisdictionType?: JurisdictionTypeWithLiterals;
|
|
332
330
|
}
|
|
333
|
-
|
|
331
|
+
interface LineItemTaxSummary {
|
|
334
332
|
/**
|
|
335
333
|
* Total price for this line item.
|
|
336
334
|
* To determine the price for each individual unit of this line item, divide by `quantity`.
|
|
@@ -356,7 +354,7 @@ export interface LineItemTaxSummary {
|
|
|
356
354
|
*/
|
|
357
355
|
appId?: string | null;
|
|
358
356
|
}
|
|
359
|
-
|
|
357
|
+
interface ApplicationError {
|
|
360
358
|
/** Error code. */
|
|
361
359
|
code?: string;
|
|
362
360
|
/** Description of the error. */
|
|
@@ -364,16 +362,16 @@ export interface ApplicationError {
|
|
|
364
362
|
/** Data related to the error. */
|
|
365
363
|
data?: Record<string, any> | null;
|
|
366
364
|
}
|
|
367
|
-
|
|
365
|
+
interface ListTaxCalculatorsRequest {
|
|
368
366
|
}
|
|
369
|
-
|
|
367
|
+
interface ListTaxCalculatorsResponse {
|
|
370
368
|
/**
|
|
371
369
|
* Retrieved tax calculators.
|
|
372
370
|
* @maxSize 10
|
|
373
371
|
*/
|
|
374
372
|
taxCalculatorDetails?: TaxCalculatorDetails[];
|
|
375
373
|
}
|
|
376
|
-
|
|
374
|
+
interface TaxCalculatorDetails {
|
|
377
375
|
/**
|
|
378
376
|
* ID of the tax calculator.
|
|
379
377
|
* @format GUID
|
|
@@ -392,3 +390,18 @@ export interface TaxCalculatorDetails {
|
|
|
392
390
|
*/
|
|
393
391
|
unsupportedCountries?: string[];
|
|
394
392
|
}
|
|
393
|
+
|
|
394
|
+
type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
|
|
395
|
+
getUrl: (context: any) => string;
|
|
396
|
+
httpMethod: K;
|
|
397
|
+
path: string;
|
|
398
|
+
pathParams: M;
|
|
399
|
+
__requestType: T;
|
|
400
|
+
__originalRequestType: S;
|
|
401
|
+
__responseType: Q;
|
|
402
|
+
__originalResponseType: R;
|
|
403
|
+
};
|
|
404
|
+
declare function calculateTax(): __PublicMethodMetaInfo<'POST', {}, CalculateTaxRequest$1, CalculateTaxRequest, CalculateTaxResponse$1, CalculateTaxResponse>;
|
|
405
|
+
declare function listTaxCalculators(): __PublicMethodMetaInfo<'GET', {}, ListTaxCalculatorsRequest$1, ListTaxCalculatorsRequest, ListTaxCalculatorsResponse$1, ListTaxCalculatorsResponse>;
|
|
406
|
+
|
|
407
|
+
export { type __PublicMethodMetaInfo, calculateTax, listTaxCalculators };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts
|
|
2
|
+
import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
|
|
3
|
+
import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
|
|
4
|
+
function resolveWixBillingV1TaxCalculationUrl(opts) {
|
|
5
|
+
const domainToMappings = {
|
|
6
|
+
"manage._base_domain_": [
|
|
7
|
+
{
|
|
8
|
+
srcPath: "/billing/v1/calculate-tax",
|
|
9
|
+
destPath: "/v1/calculate-tax"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
srcPath: "/billing/v1/list-tax-calculators",
|
|
13
|
+
destPath: "/v1/list-tax-calculators"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"www.wixapis.com": [
|
|
17
|
+
{
|
|
18
|
+
srcPath: "/billing/v1/calculate-tax",
|
|
19
|
+
destPath: "/v1/calculate-tax"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
srcPath: "/billing/v1/list-tax-calculators",
|
|
23
|
+
destPath: "/v1/list-tax-calculators"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
28
|
+
}
|
|
29
|
+
var PACKAGE_NAME = "@wix/auto_sdk_billing_tax-calculation";
|
|
30
|
+
function calculateTax(payload) {
|
|
31
|
+
function __calculateTax({ host }) {
|
|
32
|
+
const metadata = {
|
|
33
|
+
entityFqdn: "wix.gateways.billing.v1.tax_calculation_gateway",
|
|
34
|
+
method: "POST",
|
|
35
|
+
methodFqn: "wix.billing.v1.TaxCalculation.CalculateTax",
|
|
36
|
+
packageName: PACKAGE_NAME,
|
|
37
|
+
url: resolveWixBillingV1TaxCalculationUrl({
|
|
38
|
+
protoPath: "/v1/calculate-tax",
|
|
39
|
+
data: payload,
|
|
40
|
+
host
|
|
41
|
+
}),
|
|
42
|
+
data: payload
|
|
43
|
+
};
|
|
44
|
+
return metadata;
|
|
45
|
+
}
|
|
46
|
+
return __calculateTax;
|
|
47
|
+
}
|
|
48
|
+
function listTaxCalculators(payload) {
|
|
49
|
+
function __listTaxCalculators({ host }) {
|
|
50
|
+
const metadata = {
|
|
51
|
+
entityFqdn: "wix.gateways.billing.v1.tax_calculation_gateway",
|
|
52
|
+
method: "GET",
|
|
53
|
+
methodFqn: "wix.billing.v1.TaxCalculation.ListTaxCalculators",
|
|
54
|
+
packageName: PACKAGE_NAME,
|
|
55
|
+
url: resolveWixBillingV1TaxCalculationUrl({
|
|
56
|
+
protoPath: "/v1/list-tax-calculators",
|
|
57
|
+
data: payload,
|
|
58
|
+
host
|
|
59
|
+
}),
|
|
60
|
+
params: toURLSearchParams(payload)
|
|
61
|
+
};
|
|
62
|
+
return metadata;
|
|
63
|
+
}
|
|
64
|
+
return __listTaxCalculators;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.ts
|
|
68
|
+
function calculateTax2() {
|
|
69
|
+
const payload = {};
|
|
70
|
+
const getRequestOptions = calculateTax(payload);
|
|
71
|
+
const getUrl = (context) => {
|
|
72
|
+
const { url } = getRequestOptions(context);
|
|
73
|
+
return url;
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
getUrl,
|
|
77
|
+
httpMethod: "POST",
|
|
78
|
+
path: "/v1/calculate-tax",
|
|
79
|
+
pathParams: {},
|
|
80
|
+
__requestType: null,
|
|
81
|
+
__originalRequestType: null,
|
|
82
|
+
__responseType: null,
|
|
83
|
+
__originalResponseType: null
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function listTaxCalculators2() {
|
|
87
|
+
const payload = {};
|
|
88
|
+
const getRequestOptions = listTaxCalculators(
|
|
89
|
+
payload
|
|
90
|
+
);
|
|
91
|
+
const getUrl = (context) => {
|
|
92
|
+
const { url } = getRequestOptions(context);
|
|
93
|
+
return url;
|
|
94
|
+
};
|
|
95
|
+
return {
|
|
96
|
+
getUrl,
|
|
97
|
+
httpMethod: "GET",
|
|
98
|
+
path: "/v1/list-tax-calculators",
|
|
99
|
+
pathParams: {},
|
|
100
|
+
__requestType: null,
|
|
101
|
+
__originalRequestType: null,
|
|
102
|
+
__responseType: null,
|
|
103
|
+
__originalResponseType: null
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export {
|
|
107
|
+
calculateTax2 as calculateTax,
|
|
108
|
+
listTaxCalculators2 as listTaxCalculators
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=meta.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts","../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.ts"],"sourcesContent":["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 };\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. If no tax group with that `taxGroupId` is found then the\n * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.\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 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 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 * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';\nimport * as ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js';\nimport * as ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function calculateTax(): __PublicMethodMetaInfo<\n 'POST',\n {},\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.CalculateTaxRequest,\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.CalculateTaxRequest,\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.CalculateTaxResponse,\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.CalculateTaxResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'POST',\n path: '/v1/calculate-tax',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n\nexport function listTaxCalculators(): __PublicMethodMetaInfo<\n 'GET',\n {},\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.ListTaxCalculatorsRequest,\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.ListTaxCalculatorsRequest,\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.ListTaxCalculatorsResponse,\n ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.ListTaxCalculatorsResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(\n payload\n );\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'GET',\n path: '/v1/list-tax-calculators',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n"],"mappings":";AAAA,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;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,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAoBd,SAAS,aAAa,SAA6C;AACxE,WAAS,eAAe,EAAE,KAAK,GAAQ;AACrC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,KAAK,qCAAqC;AAAA,QACxC,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAOO,SAAS,mBACd,SAC4B;AAC5B,WAAS,qBAAqB,EAAE,KAAK,GAAQ;AAC3C,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,KAAK,qCAAqC;AAAA,QACxC,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,QAAQ,kBAAkB,OAAO;AAAA,IACnC;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC/EO,SAASA,gBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACgD,aAAa,OAAO;AAE1E,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;AAEO,SAASC,sBAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBACgD;AAAA,IAClD;AAAA,EACF;AAEF,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["calculateTax","listTaxCalculators"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/auto_sdk_billing_tax-calculation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
"keywords": [],
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"main": "./build/cjs/index.js",
|
|
11
|
-
"types": "./build/
|
|
11
|
+
"types": "./build/cjs/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"import": "./build/es/index.
|
|
14
|
+
"import": "./build/es/index.mjs",
|
|
15
15
|
"require": "./build/cjs/index.js",
|
|
16
|
-
"types": "./build/es/index.d.
|
|
16
|
+
"types": "./build/es/index.d.mts"
|
|
17
17
|
},
|
|
18
18
|
"./package.json": "./package.json",
|
|
19
19
|
"./meta": {
|
|
20
|
-
"import": "./build/es/meta.
|
|
20
|
+
"import": "./build/es/meta.mjs",
|
|
21
21
|
"require": "./build/cjs/meta.js",
|
|
22
|
-
"types": "./build/es/meta.d.
|
|
22
|
+
"types": "./build/es/meta.d.mts"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
"@wix/sdk-types": "^1.13.28"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"tsup": "^8.4.0",
|
|
35
36
|
"typescript": "^5.3.2"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
|
-
"build": "
|
|
39
|
+
"build": "tsup",
|
|
39
40
|
"test": ":"
|
|
40
41
|
},
|
|
41
42
|
"wix": {
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"fqdn": "wix.gateways.billing.v1.tax_calculation_gateway"
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
|
-
"falconPackageHash": "
|
|
52
|
+
"falconPackageHash": "5d4408c0467a9f650f12d8d0517e06b61138eb4d4b5f88f3395128e2"
|
|
52
53
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js"), exports);
|
|
18
|
-
//# sourceMappingURL=index.typings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../index.typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iHAA+F"}
|
package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { calculateTax as publicCalculateTax, listTaxCalculators as publicListTaxCalculators } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js';
|
|
2
|
-
import { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
3
|
-
export declare const calculateTax: MaybeContext<BuildRESTFunction<typeof publicCalculateTax> & typeof publicCalculateTax>;
|
|
4
|
-
export declare const listTaxCalculators: MaybeContext<BuildRESTFunction<typeof publicListTaxCalculators> & typeof publicListTaxCalculators>;
|
|
5
|
-
export { JurisdictionType } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
6
|
-
export { TaxCalculationGateway, CalculateTaxRequest, Address, LineItem, AddressIndex, AddressIndexAddressIndexOptionsOneOf, MultipleAddresses, CalculateTaxResponse, TaxSummary, AggregatedTaxBreakdown, LineItemTaxDetails, TaxBreakdown, LineItemTaxSummary, ApplicationError, ListTaxCalculatorsRequest, ListTaxCalculatorsResponse, TaxCalculatorDetails, CalculateTaxOptions, } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JurisdictionType = exports.listTaxCalculators = exports.calculateTax = void 0;
|
|
4
|
-
const gateways_billing_v1_tax_calculation_gateway_tax_calculation_public_js_1 = require("./gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js");
|
|
5
|
-
const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
6
|
-
exports.calculateTax = (0, rest_modules_1.createRESTModule)(gateways_billing_v1_tax_calculation_gateway_tax_calculation_public_js_1.calculateTax);
|
|
7
|
-
exports.listTaxCalculators = (0, rest_modules_1.createRESTModule)(gateways_billing_v1_tax_calculation_gateway_tax_calculation_public_js_1.listTaxCalculators);
|
|
8
|
-
var gateways_billing_v1_tax_calculation_gateway_tax_calculation_universal_js_1 = require("./gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js");
|
|
9
|
-
Object.defineProperty(exports, "JurisdictionType", { enumerable: true, get: function () { return gateways_billing_v1_tax_calculation_gateway_tax_calculation_universal_js_1.JurisdictionType; } });
|
|
10
|
-
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map
|
package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js","sourceRoot":"","sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.ts"],"names":[],"mappings":";;;AAAA,mKAGiF;AACjF,gEAAiE;AAGpD,QAAA,YAAY,GAEP,IAAA,+BAAgB,EAAC,oFAAkB,CAAC,CAAC;AAC1C,QAAA,kBAAkB,GAGb,IAAA,+BAAgB,EAAC,0FAAwB,CAAC,CAAC;AAE7D,uKAA8G;AAArG,4KAAA,gBAAgB,OAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { RequestOptionsFactory } from '@wix/sdk-types';
|
|
2
|
-
/**
|
|
3
|
-
* Calculates tax for the provided line items.
|
|
4
|
-
*
|
|
5
|
-
* Tax is calculated for each line item based on the tax region
|
|
6
|
-
* that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for
|
|
7
|
-
* the line item's address then no tax will be calculated for this line item. If no tax group with that `taxGroupId` is found then the
|
|
8
|
-
* default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.
|
|
9
|
-
*
|
|
10
|
-
* The tax is calculated by a tax calculator app installed on the site.
|
|
11
|
-
* Call List Tax Calculators to see which tax calculators are available.
|
|
12
|
-
* To provide your own tax calculations, use the Tax Calculation service plugin.
|
|
13
|
-
*
|
|
14
|
-
* The breakdown of calculated tax returned, includes:
|
|
15
|
-
* + `taxSummary`: The overall total tax calculated.
|
|
16
|
-
* + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.
|
|
17
|
-
* + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.
|
|
18
|
-
* + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.
|
|
19
|
-
*/
|
|
20
|
-
export declare function calculateTax(payload: object): RequestOptionsFactory<any>;
|
|
21
|
-
/**
|
|
22
|
-
* Retrieves a list of installed tax calculators.
|
|
23
|
-
*
|
|
24
|
-
* Wix uses these calculators to calculate tax.
|
|
25
|
-
*/
|
|
26
|
-
export declare function listTaxCalculators(payload: object): RequestOptionsFactory<any>;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listTaxCalculators = exports.calculateTax = void 0;
|
|
4
|
-
const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
5
|
-
const rest_modules_2 = require("@wix/sdk-runtime/rest-modules");
|
|
6
|
-
function resolveWixBillingV1TaxCalculationUrl(opts) {
|
|
7
|
-
const domainToMappings = {
|
|
8
|
-
'manage._base_domain_': [
|
|
9
|
-
{
|
|
10
|
-
srcPath: '/billing/v1/calculate-tax',
|
|
11
|
-
destPath: '/v1/calculate-tax',
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
srcPath: '/billing/v1/list-tax-calculators',
|
|
15
|
-
destPath: '/v1/list-tax-calculators',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
'www.wixapis.com': [
|
|
19
|
-
{
|
|
20
|
-
srcPath: '/billing/v1/calculate-tax',
|
|
21
|
-
destPath: '/v1/calculate-tax',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
srcPath: '/billing/v1/list-tax-calculators',
|
|
25
|
-
destPath: '/v1/list-tax-calculators',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
};
|
|
29
|
-
return (0, rest_modules_2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
30
|
-
}
|
|
31
|
-
const PACKAGE_NAME = '@wix/auto_sdk_billing_tax-calculation';
|
|
32
|
-
/**
|
|
33
|
-
* Calculates tax for the provided line items.
|
|
34
|
-
*
|
|
35
|
-
* Tax is calculated for each line item based on the tax region
|
|
36
|
-
* that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for
|
|
37
|
-
* the line item's address then no tax will be calculated for this line item. If no tax group with that `taxGroupId` is found then the
|
|
38
|
-
* default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.
|
|
39
|
-
*
|
|
40
|
-
* The tax is calculated by a tax calculator app installed on the site.
|
|
41
|
-
* Call List Tax Calculators to see which tax calculators are available.
|
|
42
|
-
* To provide your own tax calculations, use the Tax Calculation service plugin.
|
|
43
|
-
*
|
|
44
|
-
* The breakdown of calculated tax returned, includes:
|
|
45
|
-
* + `taxSummary`: The overall total tax calculated.
|
|
46
|
-
* + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.
|
|
47
|
-
* + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.
|
|
48
|
-
* + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.
|
|
49
|
-
*/
|
|
50
|
-
function calculateTax(payload) {
|
|
51
|
-
function __calculateTax({ host }) {
|
|
52
|
-
const metadata = {
|
|
53
|
-
entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',
|
|
54
|
-
method: 'POST',
|
|
55
|
-
methodFqn: 'wix.billing.v1.TaxCalculation.CalculateTax',
|
|
56
|
-
packageName: PACKAGE_NAME,
|
|
57
|
-
url: resolveWixBillingV1TaxCalculationUrl({
|
|
58
|
-
protoPath: '/v1/calculate-tax',
|
|
59
|
-
data: payload,
|
|
60
|
-
host,
|
|
61
|
-
}),
|
|
62
|
-
data: payload,
|
|
63
|
-
};
|
|
64
|
-
return metadata;
|
|
65
|
-
}
|
|
66
|
-
return __calculateTax;
|
|
67
|
-
}
|
|
68
|
-
exports.calculateTax = calculateTax;
|
|
69
|
-
/**
|
|
70
|
-
* Retrieves a list of installed tax calculators.
|
|
71
|
-
*
|
|
72
|
-
* Wix uses these calculators to calculate tax.
|
|
73
|
-
*/
|
|
74
|
-
function listTaxCalculators(payload) {
|
|
75
|
-
function __listTaxCalculators({ host }) {
|
|
76
|
-
const metadata = {
|
|
77
|
-
entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',
|
|
78
|
-
method: 'GET',
|
|
79
|
-
methodFqn: 'wix.billing.v1.TaxCalculation.ListTaxCalculators',
|
|
80
|
-
packageName: PACKAGE_NAME,
|
|
81
|
-
url: resolveWixBillingV1TaxCalculationUrl({
|
|
82
|
-
protoPath: '/v1/list-tax-calculators',
|
|
83
|
-
data: payload,
|
|
84
|
-
host,
|
|
85
|
-
}),
|
|
86
|
-
params: (0, rest_modules_1.toURLSearchParams)(payload),
|
|
87
|
-
};
|
|
88
|
-
return metadata;
|
|
89
|
-
}
|
|
90
|
-
return __listTaxCalculators;
|
|
91
|
-
}
|
|
92
|
-
exports.listTaxCalculators = listTaxCalculators;
|
|
93
|
-
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map
|
package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js","sourceRoot":"","sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts"],"names":[],"mappings":";;;AAAA,gEAAkE;AAClE,gEAA2D;AAI3D,SAAS,oCAAoC,CAC3C,IAA8C;IAE9C,MAAM,gBAAgB,GAAG;QACvB,sBAAsB,EAAE;YACtB;gBACE,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,mBAAmB;aAC9B;YACD;gBACE,OAAO,EAAE,kCAAkC;gBAC3C,QAAQ,EAAE,0BAA0B;aACrC;SACF;QACD,iBAAiB,EAAE;YACjB;gBACE,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,mBAAmB;aAC9B;YACD;gBACE,OAAO,EAAE,kCAAkC;gBAC3C,QAAQ,EAAE,0BAA0B;aACrC;SACF;KACF,CAAC;IAEF,OAAO,IAAA,yBAAU,EAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,YAAY,GAAG,uCAAuC,CAAC;AAE7D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,YAAY,CAAC,OAAe;IAC1C,SAAS,cAAc,CAAC,EAAE,IAAI,EAAO;QACnC,MAAM,QAAQ,GAAG;YACf,UAAU,EAAE,iDAAiD;YAC7D,MAAM,EAAE,MAAa;YACrB,SAAS,EAAE,4CAA4C;YACvD,WAAW,EAAE,YAAY;YACzB,GAAG,EAAE,oCAAoC,CAAC;gBACxC,SAAS,EAAE,mBAAmB;gBAC9B,IAAI,EAAE,OAAO;gBACb,IAAI;aACL,CAAC;YACF,IAAI,EAAE,OAAO;SACd,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,cAAc,CAAC;AACxB,CAAC;AAnBD,oCAmBC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,OAAe;IAEf,SAAS,oBAAoB,CAAC,EAAE,IAAI,EAAO;QACzC,MAAM,QAAQ,GAAG;YACf,UAAU,EAAE,iDAAiD;YAC7D,MAAM,EAAE,KAAY;YACpB,SAAS,EAAE,kDAAkD;YAC7D,WAAW,EAAE,YAAY;YACzB,GAAG,EAAE,oCAAoC,CAAC;gBACxC,SAAS,EAAE,0BAA0B;gBACrC,IAAI,EAAE,OAAO;gBACb,IAAI;aACL,CAAC;YACF,MAAM,EAAE,IAAA,gCAAiB,EAAC,OAAO,CAAC;SACnC,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AArBD,gDAqBC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js';
|
|
2
|
-
import * as ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
3
|
-
export type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
|
|
4
|
-
getUrl: (context: any) => string;
|
|
5
|
-
httpMethod: K;
|
|
6
|
-
path: string;
|
|
7
|
-
pathParams: M;
|
|
8
|
-
__requestType: T;
|
|
9
|
-
__originalRequestType: S;
|
|
10
|
-
__responseType: Q;
|
|
11
|
-
__originalResponseType: R;
|
|
12
|
-
};
|
|
13
|
-
export declare function calculateTax(): __PublicMethodMetaInfo<'POST', {}, ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.CalculateTaxRequest, ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.CalculateTaxRequest, ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.CalculateTaxResponse, ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.CalculateTaxResponse>;
|
|
14
|
-
export declare function listTaxCalculators(): __PublicMethodMetaInfo<'GET', {}, ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.ListTaxCalculatorsRequest, ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.ListTaxCalculatorsRequest, ambassadorWixGatewaysBillingV1TaxCalculationGatewayUniversalTypes.ListTaxCalculatorsResponse, ambassadorWixGatewaysBillingV1TaxCalculationGatewayTypes.ListTaxCalculatorsResponse>;
|