@wix/auto_sdk_ecom_tax-calculation 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +18 -0
- package/build/cjs/index.js.map +1 -0
- package/build/cjs/index.typings.d.ts +1 -0
- package/build/cjs/index.typings.js +18 -0
- package/build/cjs/index.typings.js.map +1 -0
- package/build/cjs/meta.d.ts +1 -0
- package/build/cjs/meta.js +18 -0
- package/build/cjs/meta.js.map +1 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +6 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +10 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +1 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +26 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +93 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +1 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +14 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +66 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +1 -0
- package/build/{internal/index.d.ts → cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts} +8 -11
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +20 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +1 -0
- package/build/{internal/meta.d.ts → cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts} +21 -34
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +14 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +1 -0
- package/build/{gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-ps-Yz0Nn.d.mts → cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts} +76 -21
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +161 -0
- package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +1 -0
- package/build/es/index.d.ts +1 -0
- package/build/es/index.js +2 -0
- package/build/es/index.js.map +1 -0
- package/build/es/index.typings.d.ts +1 -0
- package/build/es/index.typings.js +2 -0
- package/build/es/index.typings.js.map +1 -0
- package/build/es/meta.d.ts +1 -0
- package/build/es/meta.js +2 -0
- package/build/es/meta.js.map +1 -0
- package/build/es/package.json +3 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +6 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +6 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +1 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +26 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +88 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +1 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +14 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +38 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +1 -0
- package/build/{index.d.ts → es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts} +8 -11
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +14 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +1 -0
- package/build/{meta.d.ts → es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts} +21 -34
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +11 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +1 -0
- package/build/{gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-ps-Yz0Nn.d.ts → es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts} +76 -21
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +133 -0
- package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +1 -0
- package/build/internal/cjs/index.d.ts +1 -0
- package/build/internal/cjs/index.js +18 -0
- package/build/internal/cjs/index.js.map +1 -0
- package/build/internal/cjs/index.typings.d.ts +1 -0
- package/build/internal/cjs/index.typings.js +18 -0
- package/build/internal/cjs/index.typings.js.map +1 -0
- package/build/internal/cjs/meta.d.ts +1 -0
- package/build/internal/cjs/meta.js +18 -0
- package/build/internal/cjs/meta.js.map +1 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +6 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +10 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +1 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +26 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +93 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +1 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +14 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +66 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +1 -0
- package/build/internal/{index.d.mts → cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts} +8 -11
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +20 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +1 -0
- package/build/internal/{meta.d.mts → cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts} +21 -34
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +14 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +1 -0
- package/build/internal/{gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-ps-Yz0Nn.d.mts → cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts} +76 -21
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +161 -0
- package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +1 -0
- package/build/internal/es/index.d.ts +1 -0
- package/build/internal/es/index.js +2 -0
- package/build/internal/es/index.js.map +1 -0
- package/build/internal/es/index.typings.d.ts +1 -0
- package/build/internal/es/index.typings.js +2 -0
- package/build/internal/es/index.typings.js.map +1 -0
- package/build/internal/es/meta.d.ts +1 -0
- package/build/internal/es/meta.js +2 -0
- package/build/internal/es/meta.js.map +1 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +6 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +6 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +1 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +26 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +88 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +1 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +14 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +38 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +1 -0
- package/build/{index.d.mts → internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts} +8 -11
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +14 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +1 -0
- package/build/{meta.d.mts → internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts} +21 -34
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +11 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +1 -0
- package/build/internal/{gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal-ps-Yz0Nn.d.ts → es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts} +76 -21
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +133 -0
- package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +1 -0
- package/package.json +11 -12
- package/build/index.js +0 -211
- package/build/index.js.map +0 -1
- package/build/index.mjs +0 -185
- package/build/index.mjs.map +0 -1
- package/build/internal/index.js +0 -211
- package/build/internal/index.js.map +0 -1
- package/build/internal/index.mjs +0 -185
- package/build/internal/index.mjs.map +0 -1
- package/build/internal/meta.js +0 -138
- package/build/internal/meta.js.map +0 -1
- package/build/internal/meta.mjs +0 -110
- package/build/internal/meta.mjs.map +0 -1
- package/build/meta.js +0 -138
- package/build/meta.js.map +0 -1
- package/build/meta.mjs +0 -110
- package/build/meta.mjs.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { NonNullablePaths } from '@wix/sdk-types';
|
|
2
|
+
export interface TaxCalculationGateway {
|
|
2
3
|
/** @format GUID */
|
|
3
4
|
_id?: string | null;
|
|
4
5
|
}
|
|
5
|
-
interface CalculateTaxRequest {
|
|
6
|
+
export interface CalculateTaxRequest {
|
|
6
7
|
/**
|
|
7
8
|
* Optional ID of the entity that tax is being calculated for. For example, a cart ID.
|
|
8
9
|
* @format GUID
|
|
@@ -28,7 +29,7 @@ interface CalculateTaxRequest {
|
|
|
28
29
|
lineItems: LineItem[];
|
|
29
30
|
}
|
|
30
31
|
/** Wix common address format for physical address to use if you plan to store addresses in your service. */
|
|
31
|
-
interface Address {
|
|
32
|
+
export interface Address {
|
|
32
33
|
/**
|
|
33
34
|
* 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
35
|
* @format COUNTRY
|
|
@@ -61,7 +62,7 @@ interface Address {
|
|
|
61
62
|
addressLine2?: string | null;
|
|
62
63
|
}
|
|
63
64
|
/** Line items to calculate tax for. */
|
|
64
|
-
interface LineItem {
|
|
65
|
+
export interface LineItem {
|
|
65
66
|
/**
|
|
66
67
|
* Line item ID.
|
|
67
68
|
* @minLength 1
|
|
@@ -113,7 +114,7 @@ interface LineItem {
|
|
|
113
114
|
addressIndex?: AddressIndex;
|
|
114
115
|
}
|
|
115
116
|
/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */
|
|
116
|
-
interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
117
|
+
export interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
117
118
|
/** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
|
|
118
119
|
singleAddress?: number;
|
|
119
120
|
/**
|
|
@@ -123,7 +124,7 @@ interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
|
123
124
|
multipleAddresses?: MultipleAddresses;
|
|
124
125
|
}
|
|
125
126
|
/** @oneof */
|
|
126
|
-
interface AddressIndexAddressIndexOptionsOneOf {
|
|
127
|
+
export interface AddressIndexAddressIndexOptionsOneOf {
|
|
127
128
|
/** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
|
|
128
129
|
singleAddress?: number;
|
|
129
130
|
/**
|
|
@@ -136,13 +137,13 @@ interface AddressIndexAddressIndexOptionsOneOf {
|
|
|
136
137
|
* Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item
|
|
137
138
|
* is shipped from, as well as the address the item is shipped to.
|
|
138
139
|
*/
|
|
139
|
-
interface MultipleAddresses {
|
|
140
|
+
export interface MultipleAddresses {
|
|
140
141
|
/** Index of the origin address. */
|
|
141
142
|
origin?: number;
|
|
142
143
|
/** Index of the destination address. */
|
|
143
144
|
destination?: number;
|
|
144
145
|
}
|
|
145
|
-
interface CalculateTaxResponse {
|
|
146
|
+
export interface CalculateTaxResponse {
|
|
146
147
|
/**
|
|
147
148
|
* Optional ID of the entity that tax is being calculated for. For example, a cart ID.
|
|
148
149
|
* @format GUID
|
|
@@ -174,7 +175,7 @@ interface CalculateTaxResponse {
|
|
|
174
175
|
*/
|
|
175
176
|
errors?: ApplicationError[];
|
|
176
177
|
}
|
|
177
|
-
interface TaxSummary {
|
|
178
|
+
export interface TaxSummary {
|
|
178
179
|
/**
|
|
179
180
|
* Total price for all line items.
|
|
180
181
|
* @format DECIMAL_VALUE
|
|
@@ -214,7 +215,7 @@ interface TaxSummary {
|
|
|
214
215
|
* e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,
|
|
215
216
|
* then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.
|
|
216
217
|
*/
|
|
217
|
-
interface AggregatedTaxBreakdown {
|
|
218
|
+
export interface AggregatedTaxBreakdown {
|
|
218
219
|
/**
|
|
219
220
|
* Name of the tax that was calculated.
|
|
220
221
|
* @maxLength 200
|
|
@@ -245,7 +246,7 @@ interface AggregatedTaxBreakdown {
|
|
|
245
246
|
aggregatedTaxAmount?: string;
|
|
246
247
|
}
|
|
247
248
|
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"County"`, `"City"`, `"Special"`, etc. */
|
|
248
|
-
declare enum JurisdictionType {
|
|
249
|
+
export declare enum JurisdictionType {
|
|
249
250
|
UNDEFINED = "UNDEFINED",
|
|
250
251
|
COUNTRY = "COUNTRY",
|
|
251
252
|
STATE = "STATE",
|
|
@@ -254,7 +255,7 @@ declare enum JurisdictionType {
|
|
|
254
255
|
SPECIAL = "SPECIAL"
|
|
255
256
|
}
|
|
256
257
|
/** Tax details for a specific line item. */
|
|
257
|
-
interface LineItemTaxDetails {
|
|
258
|
+
export interface LineItemTaxDetails {
|
|
258
259
|
/**
|
|
259
260
|
* Line item ID.
|
|
260
261
|
* @minLength 1
|
|
@@ -285,7 +286,7 @@ interface LineItemTaxDetails {
|
|
|
285
286
|
taxIncludedInPrice?: boolean;
|
|
286
287
|
}
|
|
287
288
|
/** A detailed description of all the tax authorities applied on this item. */
|
|
288
|
-
interface TaxBreakdown {
|
|
289
|
+
export interface TaxBreakdown {
|
|
289
290
|
/**
|
|
290
291
|
* Jurisdiction that taxes were calculated for.
|
|
291
292
|
* @maxLength 200
|
|
@@ -328,7 +329,7 @@ interface TaxBreakdown {
|
|
|
328
329
|
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"Çounty"`, `"City"`, `"Special"`, etc. */
|
|
329
330
|
jurisdictionType?: JurisdictionType;
|
|
330
331
|
}
|
|
331
|
-
interface LineItemTaxSummary {
|
|
332
|
+
export interface LineItemTaxSummary {
|
|
332
333
|
/**
|
|
333
334
|
* Total price for this line item.
|
|
334
335
|
* To determine the price for each individual unit of this line item, divide by `quantity`.
|
|
@@ -354,7 +355,7 @@ interface LineItemTaxSummary {
|
|
|
354
355
|
*/
|
|
355
356
|
appId?: string | null;
|
|
356
357
|
}
|
|
357
|
-
interface ApplicationError {
|
|
358
|
+
export interface ApplicationError {
|
|
358
359
|
/** Error code. */
|
|
359
360
|
code?: string;
|
|
360
361
|
/** Description of the error. */
|
|
@@ -362,16 +363,16 @@ interface ApplicationError {
|
|
|
362
363
|
/** Data related to the error. */
|
|
363
364
|
data?: Record<string, any> | null;
|
|
364
365
|
}
|
|
365
|
-
interface ListTaxCalculatorsRequest {
|
|
366
|
+
export interface ListTaxCalculatorsRequest {
|
|
366
367
|
}
|
|
367
|
-
interface ListTaxCalculatorsResponse {
|
|
368
|
+
export interface ListTaxCalculatorsResponse {
|
|
368
369
|
/**
|
|
369
370
|
* Retrieved tax calculators.
|
|
370
371
|
* @maxSize 10
|
|
371
372
|
*/
|
|
372
373
|
taxCalculatorDetails?: TaxCalculatorDetails[];
|
|
373
374
|
}
|
|
374
|
-
interface TaxCalculatorDetails {
|
|
375
|
+
export interface TaxCalculatorDetails {
|
|
375
376
|
/**
|
|
376
377
|
* ID of the tax calculator.
|
|
377
378
|
* @format GUID
|
|
@@ -390,7 +391,46 @@ interface TaxCalculatorDetails {
|
|
|
390
391
|
*/
|
|
391
392
|
unsupportedCountries?: string[];
|
|
392
393
|
}
|
|
393
|
-
|
|
394
|
+
/**
|
|
395
|
+
* Calculates tax for the provided line items.
|
|
396
|
+
*
|
|
397
|
+
* Tax is calculated for each line item based on the tax region
|
|
398
|
+
* that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for
|
|
399
|
+
* 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
|
|
400
|
+
* default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.
|
|
401
|
+
*
|
|
402
|
+
* The tax is calculated by a tax calculator app installed on the site.
|
|
403
|
+
* Call List Tax Calculators to see which tax calculators are available.
|
|
404
|
+
* To provide your own tax calculations, use the Tax Calculation service plugin.
|
|
405
|
+
*
|
|
406
|
+
* The breakdown of calculated tax returned, includes:
|
|
407
|
+
* + `taxSummary`: The overall total tax calculated.
|
|
408
|
+
* + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.
|
|
409
|
+
* + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.
|
|
410
|
+
* + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.
|
|
411
|
+
* @public
|
|
412
|
+
* @documentationMaturity preview
|
|
413
|
+
* @requiredField options.addresses
|
|
414
|
+
* @requiredField options.lineItems
|
|
415
|
+
* @requiredField options.lineItems._id
|
|
416
|
+
* @requiredField options.lineItems.addressIndex
|
|
417
|
+
* @requiredField options.lineItems.price
|
|
418
|
+
* @param options - Calculate tax options.
|
|
419
|
+
* @permissionId BILLING.CALCULATE_TAX
|
|
420
|
+
* @permissionScope Manage Stores - all permissions
|
|
421
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
422
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
423
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
424
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
425
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
426
|
+
* @permissionScope Manage Orders
|
|
427
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
428
|
+
* @applicableIdentity APP
|
|
429
|
+
* @applicableIdentity VISITOR
|
|
430
|
+
* @fqn wix.billing.v1.TaxCalculation.CalculateTax
|
|
431
|
+
*/
|
|
432
|
+
export declare function calculateTax(options?: NonNullablePaths<CalculateTaxOptions, `addresses` | `lineItems` | `lineItems.${number}._id` | `lineItems.${number}.addressIndex` | `lineItems.${number}.price`>): Promise<NonNullablePaths<CalculateTaxResponse, `currency` | `addresses` | `taxSummary.totalAmount` | `taxSummary.totalTax` | `taxSummary.totalTaxableAmount` | `taxSummary.totalTaxIncludedInPrice` | `taxSummary.aggregatedTaxBreakdown` | `taxSummary.aggregatedTaxBreakdown.${number}.taxName` | `taxSummary.aggregatedTaxBreakdown.${number}.taxType` | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction` | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType` | `taxSummary.aggregatedTaxBreakdown.${number}.rate` | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount` | `lineItemTaxDetails` | `lineItemTaxDetails.${number}._id` | `lineItemTaxDetails.${number}.quantity` | `lineItemTaxDetails.${number}.taxSummary.taxAmount` | `lineItemTaxDetails.${number}.taxSummary.taxableAmount` | `lineItemTaxDetails.${number}.addressIndex.singleAddress` | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin` | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination` | `lineItemTaxDetails.${number}.taxIncludedInPrice` | `errors` | `errors.${number}.code` | `errors.${number}.description`>>;
|
|
433
|
+
export interface CalculateTaxOptions {
|
|
394
434
|
/**
|
|
395
435
|
* Optional ID of the entity that tax is being calculated for. For example, a cart ID.
|
|
396
436
|
* @format GUID
|
|
@@ -415,5 +455,20 @@ interface CalculateTaxOptions {
|
|
|
415
455
|
*/
|
|
416
456
|
lineItems: LineItem[];
|
|
417
457
|
}
|
|
418
|
-
|
|
419
|
-
|
|
458
|
+
/**
|
|
459
|
+
* Retrieves a list of installed tax calculators.
|
|
460
|
+
*
|
|
461
|
+
* Wix uses these calculators to calculate tax.
|
|
462
|
+
* @public
|
|
463
|
+
* @documentationMaturity preview
|
|
464
|
+
* @permissionId BILLING.TAX_CALCULATORS_READ
|
|
465
|
+
* @permissionScope Manage Stores - all permissions
|
|
466
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
467
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
468
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
469
|
+
* @permissionScope Manage Orders
|
|
470
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
471
|
+
* @applicableIdentity APP
|
|
472
|
+
* @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators
|
|
473
|
+
*/
|
|
474
|
+
export declare function listTaxCalculators(): Promise<NonNullablePaths<ListTaxCalculatorsResponse, `taxCalculatorDetails` | `taxCalculatorDetails.${number}.appId` | `taxCalculatorDetails.${number}.displayName`>>;
|
package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.listTaxCalculators = exports.calculateTax = exports.JurisdictionType = void 0;
|
|
27
|
+
const transform_error_1 = require("@wix/sdk-runtime/transform-error");
|
|
28
|
+
const rename_all_nested_keys_1 = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
29
|
+
const ambassadorWixGatewaysBillingV1TaxCalculationGateway = __importStar(require("./gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js"));
|
|
30
|
+
const address_1 = require("@wix/sdk-runtime/transformations/address");
|
|
31
|
+
const address_2 = require("@wix/sdk-runtime/transformations/address");
|
|
32
|
+
const transform_paths_1 = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
33
|
+
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"County"`, `"City"`, `"Special"`, etc. */
|
|
34
|
+
var JurisdictionType;
|
|
35
|
+
(function (JurisdictionType) {
|
|
36
|
+
JurisdictionType["UNDEFINED"] = "UNDEFINED";
|
|
37
|
+
JurisdictionType["COUNTRY"] = "COUNTRY";
|
|
38
|
+
JurisdictionType["STATE"] = "STATE";
|
|
39
|
+
JurisdictionType["COUNTY"] = "COUNTY";
|
|
40
|
+
JurisdictionType["CITY"] = "CITY";
|
|
41
|
+
JurisdictionType["SPECIAL"] = "SPECIAL";
|
|
42
|
+
})(JurisdictionType || (exports.JurisdictionType = JurisdictionType = {}));
|
|
43
|
+
/**
|
|
44
|
+
* Calculates tax for the provided line items.
|
|
45
|
+
*
|
|
46
|
+
* Tax is calculated for each line item based on the tax region
|
|
47
|
+
* that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for
|
|
48
|
+
* 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
|
|
49
|
+
* default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.
|
|
50
|
+
*
|
|
51
|
+
* The tax is calculated by a tax calculator app installed on the site.
|
|
52
|
+
* Call List Tax Calculators to see which tax calculators are available.
|
|
53
|
+
* To provide your own tax calculations, use the Tax Calculation service plugin.
|
|
54
|
+
*
|
|
55
|
+
* The breakdown of calculated tax returned, includes:
|
|
56
|
+
* + `taxSummary`: The overall total tax calculated.
|
|
57
|
+
* + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.
|
|
58
|
+
* + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.
|
|
59
|
+
* + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.
|
|
60
|
+
* @public
|
|
61
|
+
* @documentationMaturity preview
|
|
62
|
+
* @requiredField options.addresses
|
|
63
|
+
* @requiredField options.lineItems
|
|
64
|
+
* @requiredField options.lineItems._id
|
|
65
|
+
* @requiredField options.lineItems.addressIndex
|
|
66
|
+
* @requiredField options.lineItems.price
|
|
67
|
+
* @param options - Calculate tax options.
|
|
68
|
+
* @permissionId BILLING.CALCULATE_TAX
|
|
69
|
+
* @permissionScope Manage Stores - all permissions
|
|
70
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
71
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
72
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
73
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
74
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
75
|
+
* @permissionScope Manage Orders
|
|
76
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
77
|
+
* @applicableIdentity APP
|
|
78
|
+
* @applicableIdentity VISITOR
|
|
79
|
+
* @fqn wix.billing.v1.TaxCalculation.CalculateTax
|
|
80
|
+
*/
|
|
81
|
+
async function calculateTax(options) {
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
84
|
+
const payload = (0, transform_paths_1.transformPaths)((0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({
|
|
85
|
+
externalId: options?.externalId,
|
|
86
|
+
currency: options?.currency,
|
|
87
|
+
addresses: options?.addresses,
|
|
88
|
+
lineItems: options?.lineItems,
|
|
89
|
+
}), [
|
|
90
|
+
{
|
|
91
|
+
transformFn: address_1.transformSDKAddressToRESTAddress,
|
|
92
|
+
paths: [{ path: 'addresses', isRepeated: true }],
|
|
93
|
+
},
|
|
94
|
+
]);
|
|
95
|
+
const reqOpts = ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);
|
|
96
|
+
sideEffects?.onSiteCall?.();
|
|
97
|
+
try {
|
|
98
|
+
const result = await httpClient.request(reqOpts);
|
|
99
|
+
sideEffects?.onSuccess?.(result);
|
|
100
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)((0, transform_paths_1.transformPaths)(result.data, [
|
|
101
|
+
{
|
|
102
|
+
transformFn: address_2.transformRESTAddressToSDKAddress,
|
|
103
|
+
paths: [{ path: 'addresses', isRepeated: true }],
|
|
104
|
+
},
|
|
105
|
+
]));
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
109
|
+
spreadPathsToArguments: {},
|
|
110
|
+
explicitPathsToArguments: {
|
|
111
|
+
externalId: '$[0].externalId',
|
|
112
|
+
currency: '$[0].currency',
|
|
113
|
+
addresses: '$[0].addresses',
|
|
114
|
+
lineItems: '$[0].lineItems',
|
|
115
|
+
},
|
|
116
|
+
singleArgumentUnchanged: false,
|
|
117
|
+
}, ['options']);
|
|
118
|
+
sideEffects?.onError?.(err);
|
|
119
|
+
throw transformedError;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.calculateTax = calculateTax;
|
|
123
|
+
/**
|
|
124
|
+
* Retrieves a list of installed tax calculators.
|
|
125
|
+
*
|
|
126
|
+
* Wix uses these calculators to calculate tax.
|
|
127
|
+
* @public
|
|
128
|
+
* @documentationMaturity preview
|
|
129
|
+
* @permissionId BILLING.TAX_CALCULATORS_READ
|
|
130
|
+
* @permissionScope Manage Stores - all permissions
|
|
131
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
132
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
133
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
134
|
+
* @permissionScope Manage Orders
|
|
135
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
136
|
+
* @applicableIdentity APP
|
|
137
|
+
* @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators
|
|
138
|
+
*/
|
|
139
|
+
async function listTaxCalculators() {
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
142
|
+
const payload = (0, rename_all_nested_keys_1.renameKeysFromSDKRequestToRESTRequest)({});
|
|
143
|
+
const reqOpts = ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(payload);
|
|
144
|
+
sideEffects?.onSiteCall?.();
|
|
145
|
+
try {
|
|
146
|
+
const result = await httpClient.request(reqOpts);
|
|
147
|
+
sideEffects?.onSuccess?.(result);
|
|
148
|
+
return (0, rename_all_nested_keys_1.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
const transformedError = (0, transform_error_1.transformError)(err, {
|
|
152
|
+
spreadPathsToArguments: {},
|
|
153
|
+
explicitPathsToArguments: {},
|
|
154
|
+
singleArgumentUnchanged: false,
|
|
155
|
+
}, []);
|
|
156
|
+
sideEffects?.onError?.(err);
|
|
157
|
+
throw transformedError;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.listTaxCalculators = listTaxCalculators;
|
|
161
|
+
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map
|
package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js","sourceRoot":"","sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,8EAA8E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../index.typings.ts"],"names":[],"mappings":"AAAA,cAAc,gFAAgF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js';
|
package/build/es/meta.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../meta.ts"],"names":[],"mappings":"AAAA,cAAc,2EAA2E,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
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';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { calculateTax as publicCalculateTax, listTaxCalculators as publicListTaxCalculators, } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js';
|
|
2
|
+
import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
|
|
3
|
+
export const calculateTax = /*#__PURE__*/ createRESTModule(publicCalculateTax);
|
|
4
|
+
export const listTaxCalculators = /*#__PURE__*/ createRESTModule(publicListTaxCalculators);
|
|
5
|
+
export { JurisdictionType } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
6
|
+
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map
|
package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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,OAAO,EACL,YAAY,IAAI,kBAAkB,EAClC,kBAAkB,IAAI,wBAAwB,GAC/C,MAAM,yEAAyE,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,MAAM,CAAC,MAAM,YAAY,GAErB,aAAa,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAG3B,aAAa,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;AAE7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4EAA4E,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';
|
|
2
|
+
import { resolveUrl } from '@wix/sdk-runtime/rest-modules';
|
|
3
|
+
function resolveWixBillingV1TaxCalculationUrl(opts) {
|
|
4
|
+
const domainToMappings = {
|
|
5
|
+
'manage._base_domain_': [
|
|
6
|
+
{
|
|
7
|
+
srcPath: '/billing/v1/calculate-tax',
|
|
8
|
+
destPath: '/v1/calculate-tax',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
srcPath: '/billing/v1/list-tax-calculators',
|
|
12
|
+
destPath: '/v1/list-tax-calculators',
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
'www.wixapis.com': [
|
|
16
|
+
{
|
|
17
|
+
srcPath: '/billing/v1/calculate-tax',
|
|
18
|
+
destPath: '/v1/calculate-tax',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
srcPath: '/billing/v1/list-tax-calculators',
|
|
22
|
+
destPath: '/v1/list-tax-calculators',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
27
|
+
}
|
|
28
|
+
const PACKAGE_NAME = '@wix/auto_sdk_ecom_tax-calculation';
|
|
29
|
+
/**
|
|
30
|
+
* Calculates tax for the provided line items.
|
|
31
|
+
*
|
|
32
|
+
* Tax is calculated for each line item based on the tax region
|
|
33
|
+
* that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for
|
|
34
|
+
* 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
|
|
35
|
+
* default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.
|
|
36
|
+
*
|
|
37
|
+
* The tax is calculated by a tax calculator app installed on the site.
|
|
38
|
+
* Call List Tax Calculators to see which tax calculators are available.
|
|
39
|
+
* To provide your own tax calculations, use the Tax Calculation service plugin.
|
|
40
|
+
*
|
|
41
|
+
* The breakdown of calculated tax returned, includes:
|
|
42
|
+
* + `taxSummary`: The overall total tax calculated.
|
|
43
|
+
* + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.
|
|
44
|
+
* + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.
|
|
45
|
+
* + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.
|
|
46
|
+
*/
|
|
47
|
+
export function calculateTax(payload) {
|
|
48
|
+
function __calculateTax({ host }) {
|
|
49
|
+
const metadata = {
|
|
50
|
+
entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',
|
|
51
|
+
method: 'POST',
|
|
52
|
+
methodFqn: 'wix.billing.v1.TaxCalculation.CalculateTax',
|
|
53
|
+
packageName: PACKAGE_NAME,
|
|
54
|
+
url: resolveWixBillingV1TaxCalculationUrl({
|
|
55
|
+
protoPath: '/v1/calculate-tax',
|
|
56
|
+
data: payload,
|
|
57
|
+
host,
|
|
58
|
+
}),
|
|
59
|
+
data: payload,
|
|
60
|
+
};
|
|
61
|
+
return metadata;
|
|
62
|
+
}
|
|
63
|
+
return __calculateTax;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Retrieves a list of installed tax calculators.
|
|
67
|
+
*
|
|
68
|
+
* Wix uses these calculators to calculate tax.
|
|
69
|
+
*/
|
|
70
|
+
export function listTaxCalculators(payload) {
|
|
71
|
+
function __listTaxCalculators({ host }) {
|
|
72
|
+
const metadata = {
|
|
73
|
+
entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',
|
|
74
|
+
method: 'GET',
|
|
75
|
+
methodFqn: 'wix.billing.v1.TaxCalculation.ListTaxCalculators',
|
|
76
|
+
packageName: PACKAGE_NAME,
|
|
77
|
+
url: resolveWixBillingV1TaxCalculationUrl({
|
|
78
|
+
protoPath: '/v1/list-tax-calculators',
|
|
79
|
+
data: payload,
|
|
80
|
+
host,
|
|
81
|
+
}),
|
|
82
|
+
params: toURLSearchParams(payload),
|
|
83
|
+
};
|
|
84
|
+
return metadata;
|
|
85
|
+
}
|
|
86
|
+
return __listTaxCalculators;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;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,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,YAAY,GAAG,oCAAoC,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,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;AAED;;;;GAIG;AACH,MAAM,UAAU,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,iBAAiB,CAAC,OAAO,CAAC;SACnC,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';
|
|
2
|
+
export function calculateTax() {
|
|
3
|
+
const payload = {};
|
|
4
|
+
const getRequestOptions = ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);
|
|
5
|
+
const getUrl = (context) => {
|
|
6
|
+
const { url } = getRequestOptions(context);
|
|
7
|
+
return url;
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
getUrl,
|
|
11
|
+
httpMethod: 'POST',
|
|
12
|
+
path: '/v1/calculate-tax',
|
|
13
|
+
pathParams: {},
|
|
14
|
+
__requestType: null,
|
|
15
|
+
__originalRequestType: null,
|
|
16
|
+
__responseType: null,
|
|
17
|
+
__originalResponseType: null,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function listTaxCalculators() {
|
|
21
|
+
const payload = {};
|
|
22
|
+
const getRequestOptions = ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(payload);
|
|
23
|
+
const getUrl = (context) => {
|
|
24
|
+
const { url } = getRequestOptions(context);
|
|
25
|
+
return url;
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
getUrl,
|
|
29
|
+
httpMethod: 'GET',
|
|
30
|
+
path: '/v1/list-tax-calculators',
|
|
31
|
+
pathParams: {},
|
|
32
|
+
__requestType: null,
|
|
33
|
+
__originalRequestType: null,
|
|
34
|
+
__responseType: null,
|
|
35
|
+
__originalResponseType: null,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js","sourceRoot":"","sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,mDAAmD,MAAM,uEAAuE,CAAC;AAsB7I,MAAM,UAAU,YAAY;IAQ1B,MAAM,OAAO,GAAG,EAAS,CAAC;IAE1B,MAAM,iBAAiB,GACrB,mDAAmD,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAE5E,MAAM,MAAM,GAAG,CAAC,OAAY,EAAU,EAAE;QACtC,MAAM,EAAE,GAAG,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC3C,OAAO,GAAI,CAAC;IACd,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,UAAU,EAAE,MAAM;QAClB,IAAI,EAAE,mBAAmB;QACzB,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,IAAW;QAC1B,qBAAqB,EAAE,IAAW;QAClC,cAAc,EAAE,IAAW;QAC3B,sBAAsB,EAAE,IAAW;KACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB;IAQhC,MAAM,OAAO,GAAG,EAAS,CAAC;IAE1B,MAAM,iBAAiB,GACrB,mDAAmD,CAAC,kBAAkB,CACpE,OAAO,CACR,CAAC;IAEJ,MAAM,MAAM,GAAG,CAAC,OAAY,EAAU,EAAE;QACtC,MAAM,EAAE,GAAG,EAAE,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC3C,OAAO,GAAI,CAAC;IACd,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,0BAA0B;QAChC,UAAU,EAAE,EAAE;QACd,aAAa,EAAE,IAAW;QAC1B,qBAAqB,EAAE,IAAW;QAClC,cAAc,EAAE,IAAW;QAC3B,sBAAsB,EAAE,IAAW;KACpC,CAAC;AACJ,CAAC"}
|