@wix/auto_sdk_ecom_tax-calculation 1.0.4 → 1.0.5
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
|
-
import { HttpClient
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { HttpClient } from '@wix/sdk-types';
|
|
2
|
+
import { CalculateTaxOptions, CalculateTaxResponse, ListTaxCalculatorsResponse } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
3
|
+
export declare const __metadata: {
|
|
4
|
+
PACKAGE_NAME: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function calculateTax(httpClient: HttpClient): CalculateTaxSignature;
|
|
6
7
|
interface CalculateTaxSignature {
|
|
7
8
|
/**
|
|
8
9
|
* Calculates tax for the provided line items.
|
|
@@ -25,7 +26,7 @@ interface CalculateTaxSignature {
|
|
|
25
26
|
*/
|
|
26
27
|
(options?: CalculateTaxOptions | undefined): Promise<CalculateTaxResponse>;
|
|
27
28
|
}
|
|
28
|
-
declare function listTaxCalculators
|
|
29
|
+
export declare function listTaxCalculators(httpClient: HttpClient): ListTaxCalculatorsSignature;
|
|
29
30
|
interface ListTaxCalculatorsSignature {
|
|
30
31
|
/**
|
|
31
32
|
* Retrieves a list of installed tax calculators.
|
|
@@ -34,8 +35,4 @@ interface ListTaxCalculatorsSignature {
|
|
|
34
35
|
*/
|
|
35
36
|
(): Promise<ListTaxCalculatorsResponse>;
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
-
declare const calculateTax: MaybeContext<BuildRESTFunction<typeof calculateTax$1> & typeof calculateTax$1>;
|
|
39
|
-
declare const listTaxCalculators: MaybeContext<BuildRESTFunction<typeof listTaxCalculators$1> & typeof listTaxCalculators$1>;
|
|
40
|
-
|
|
41
|
-
export { CalculateTaxOptions, CalculateTaxResponse, ListTaxCalculatorsResponse, calculateTax, listTaxCalculators };
|
|
38
|
+
export { Address, AddressIndex, AddressIndexAddressIndexOptionsOneOf, AggregatedTaxBreakdown, ApplicationError, CalculateTaxOptions, CalculateTaxRequest, CalculateTaxResponse, JurisdictionType, LineItem, LineItemTaxDetails, LineItemTaxSummary, ListTaxCalculatorsRequest, ListTaxCalculatorsResponse, MultipleAddresses, TaxBreakdown, TaxCalculationGateway, TaxCalculatorDetails, TaxSummary, } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { calculateTax as universalCalculateTax, listTaxCalculators as universalListTaxCalculators, } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
2
|
+
export const __metadata = { PACKAGE_NAME: '@wix/ecom' };
|
|
3
|
+
export function calculateTax(httpClient) {
|
|
4
|
+
return (options) => universalCalculateTax(options,
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
{ httpClient });
|
|
7
|
+
}
|
|
8
|
+
export function listTaxCalculators(httpClient) {
|
|
9
|
+
return () => universalListTaxCalculators(
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
{ httpClient });
|
|
12
|
+
}
|
|
13
|
+
export { JurisdictionType, } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
14
|
+
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map
|
package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js","sourceRoot":"","sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,YAAY,IAAI,qBAAqB,EACrC,kBAAkB,IAAI,2BAA2B,GAClD,MAAM,4EAA4E,CAAC;AAEpF,MAAM,CAAC,MAAM,UAAU,GAAG,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAExD,MAAM,UAAU,YAAY,CAAC,UAAsB;IACjD,OAAO,CACL,OAOC,EACD,EAAE,CACF,qBAAqB,CACnB,OAAO;IACP,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AAyBD,MAAM,UAAU,kBAAkB,CAChC,UAAsB;IAEtB,OAAO,GAAG,EAAE,CACV,2BAA2B;IACzB,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AAWD,OAAO,EASL,gBAAgB,GAWjB,MAAM,4EAA4E,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface TaxCalculationGateway {
|
|
2
|
+
/** @format GUID */
|
|
3
|
+
id?: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface CalculateTaxRequest {
|
|
4
6
|
/**
|
|
5
7
|
* Optional ID of the entity that tax is being calculated for. For example, a cart ID.
|
|
6
8
|
* @format GUID
|
|
@@ -26,7 +28,7 @@ interface CalculateTaxRequest {
|
|
|
26
28
|
lineItems: LineItem[];
|
|
27
29
|
}
|
|
28
30
|
/** Wix common address format for physical address to use if you plan to store addresses in your service. */
|
|
29
|
-
interface Address {
|
|
31
|
+
export interface Address {
|
|
30
32
|
/**
|
|
31
33
|
* 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.
|
|
32
34
|
* @format COUNTRY
|
|
@@ -59,7 +61,7 @@ interface Address {
|
|
|
59
61
|
addressLine2?: string | null;
|
|
60
62
|
}
|
|
61
63
|
/** Line items to calculate tax for. */
|
|
62
|
-
interface LineItem {
|
|
64
|
+
export interface LineItem {
|
|
63
65
|
/**
|
|
64
66
|
* Line item ID.
|
|
65
67
|
* @minLength 1
|
|
@@ -111,7 +113,7 @@ interface LineItem {
|
|
|
111
113
|
addressIndex?: AddressIndex;
|
|
112
114
|
}
|
|
113
115
|
/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */
|
|
114
|
-
interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
116
|
+
export interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
115
117
|
/** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
|
|
116
118
|
singleAddress?: number;
|
|
117
119
|
/**
|
|
@@ -121,7 +123,7 @@ interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
|
|
|
121
123
|
multipleAddresses?: MultipleAddresses;
|
|
122
124
|
}
|
|
123
125
|
/** @oneof */
|
|
124
|
-
interface AddressIndexAddressIndexOptionsOneOf {
|
|
126
|
+
export interface AddressIndexAddressIndexOptionsOneOf {
|
|
125
127
|
/** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
|
|
126
128
|
singleAddress?: number;
|
|
127
129
|
/**
|
|
@@ -134,13 +136,13 @@ interface AddressIndexAddressIndexOptionsOneOf {
|
|
|
134
136
|
* Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item
|
|
135
137
|
* is shipped from, as well as the address the item is shipped to.
|
|
136
138
|
*/
|
|
137
|
-
interface MultipleAddresses {
|
|
139
|
+
export interface MultipleAddresses {
|
|
138
140
|
/** Index of the origin address. */
|
|
139
141
|
origin?: number;
|
|
140
142
|
/** Index of the destination address. */
|
|
141
143
|
destination?: number;
|
|
142
144
|
}
|
|
143
|
-
interface CalculateTaxResponse {
|
|
145
|
+
export interface CalculateTaxResponse {
|
|
144
146
|
/**
|
|
145
147
|
* Optional ID of the entity that tax is being calculated for. For example, a cart ID.
|
|
146
148
|
* @format GUID
|
|
@@ -172,7 +174,7 @@ interface CalculateTaxResponse {
|
|
|
172
174
|
*/
|
|
173
175
|
errors?: ApplicationError[];
|
|
174
176
|
}
|
|
175
|
-
interface TaxSummary {
|
|
177
|
+
export interface TaxSummary {
|
|
176
178
|
/**
|
|
177
179
|
* Total price for all line items.
|
|
178
180
|
* @format DECIMAL_VALUE
|
|
@@ -212,7 +214,7 @@ interface TaxSummary {
|
|
|
212
214
|
* e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,
|
|
213
215
|
* then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.
|
|
214
216
|
*/
|
|
215
|
-
interface AggregatedTaxBreakdown {
|
|
217
|
+
export interface AggregatedTaxBreakdown {
|
|
216
218
|
/**
|
|
217
219
|
* Name of the tax that was calculated.
|
|
218
220
|
* @maxLength 200
|
|
@@ -243,7 +245,7 @@ interface AggregatedTaxBreakdown {
|
|
|
243
245
|
aggregatedTaxAmount?: string;
|
|
244
246
|
}
|
|
245
247
|
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"County"`, `"City"`, `"Special"`, etc. */
|
|
246
|
-
declare enum JurisdictionType {
|
|
248
|
+
export declare enum JurisdictionType {
|
|
247
249
|
UNDEFINED = "UNDEFINED",
|
|
248
250
|
COUNTRY = "COUNTRY",
|
|
249
251
|
STATE = "STATE",
|
|
@@ -252,7 +254,7 @@ declare enum JurisdictionType {
|
|
|
252
254
|
SPECIAL = "SPECIAL"
|
|
253
255
|
}
|
|
254
256
|
/** Tax details for a specific line item. */
|
|
255
|
-
interface LineItemTaxDetails {
|
|
257
|
+
export interface LineItemTaxDetails {
|
|
256
258
|
/**
|
|
257
259
|
* Line item ID.
|
|
258
260
|
* @minLength 1
|
|
@@ -283,7 +285,7 @@ interface LineItemTaxDetails {
|
|
|
283
285
|
taxIncludedInPrice?: boolean;
|
|
284
286
|
}
|
|
285
287
|
/** A detailed description of all the tax authorities applied on this item. */
|
|
286
|
-
interface TaxBreakdown {
|
|
288
|
+
export interface TaxBreakdown {
|
|
287
289
|
/**
|
|
288
290
|
* Jurisdiction that taxes were calculated for.
|
|
289
291
|
* @maxLength 200
|
|
@@ -326,7 +328,7 @@ interface TaxBreakdown {
|
|
|
326
328
|
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"Çounty"`, `"City"`, `"Special"`, etc. */
|
|
327
329
|
jurisdictionType?: JurisdictionType;
|
|
328
330
|
}
|
|
329
|
-
interface LineItemTaxSummary {
|
|
331
|
+
export interface LineItemTaxSummary {
|
|
330
332
|
/**
|
|
331
333
|
* Total price for this line item.
|
|
332
334
|
* To determine the price for each individual unit of this line item, divide by `quantity`.
|
|
@@ -352,7 +354,7 @@ interface LineItemTaxSummary {
|
|
|
352
354
|
*/
|
|
353
355
|
appId?: string | null;
|
|
354
356
|
}
|
|
355
|
-
interface ApplicationError {
|
|
357
|
+
export interface ApplicationError {
|
|
356
358
|
/** Error code. */
|
|
357
359
|
code?: string;
|
|
358
360
|
/** Description of the error. */
|
|
@@ -360,16 +362,16 @@ interface ApplicationError {
|
|
|
360
362
|
/** Data related to the error. */
|
|
361
363
|
data?: Record<string, any> | null;
|
|
362
364
|
}
|
|
363
|
-
interface ListTaxCalculatorsRequest {
|
|
365
|
+
export interface ListTaxCalculatorsRequest {
|
|
364
366
|
}
|
|
365
|
-
interface ListTaxCalculatorsResponse {
|
|
367
|
+
export interface ListTaxCalculatorsResponse {
|
|
366
368
|
/**
|
|
367
369
|
* Retrieved tax calculators.
|
|
368
370
|
* @maxSize 10
|
|
369
371
|
*/
|
|
370
372
|
taxCalculatorDetails?: TaxCalculatorDetails[];
|
|
371
373
|
}
|
|
372
|
-
interface TaxCalculatorDetails {
|
|
374
|
+
export interface TaxCalculatorDetails {
|
|
373
375
|
/**
|
|
374
376
|
* ID of the tax calculator.
|
|
375
377
|
* @format GUID
|
|
@@ -388,18 +390,3 @@ interface TaxCalculatorDetails {
|
|
|
388
390
|
*/
|
|
389
391
|
unsupportedCountries?: string[];
|
|
390
392
|
}
|
|
391
|
-
|
|
392
|
-
type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
|
|
393
|
-
getUrl: (context: any) => string;
|
|
394
|
-
httpMethod: K;
|
|
395
|
-
path: string;
|
|
396
|
-
pathParams: M;
|
|
397
|
-
__requestType: T;
|
|
398
|
-
__originalRequestType: S;
|
|
399
|
-
__responseType: Q;
|
|
400
|
-
__originalResponseType: R;
|
|
401
|
-
};
|
|
402
|
-
declare function calculateTax(): __PublicMethodMetaInfo<'POST', {}, CalculateTaxRequest$1, CalculateTaxRequest, CalculateTaxResponse$1, CalculateTaxResponse>;
|
|
403
|
-
declare function listTaxCalculators(): __PublicMethodMetaInfo<'GET', {}, ListTaxCalculatorsRequest$1, ListTaxCalculatorsRequest, ListTaxCalculatorsResponse$1, ListTaxCalculatorsResponse>;
|
|
404
|
-
|
|
405
|
-
export { type __PublicMethodMetaInfo, calculateTax, listTaxCalculators };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"County"`, `"City"`, `"Special"`, etc. */
|
|
2
|
+
export var JurisdictionType;
|
|
3
|
+
(function (JurisdictionType) {
|
|
4
|
+
JurisdictionType["UNDEFINED"] = "UNDEFINED";
|
|
5
|
+
JurisdictionType["COUNTRY"] = "COUNTRY";
|
|
6
|
+
JurisdictionType["STATE"] = "STATE";
|
|
7
|
+
JurisdictionType["COUNTY"] = "COUNTY";
|
|
8
|
+
JurisdictionType["CITY"] = "CITY";
|
|
9
|
+
JurisdictionType["SPECIAL"] = "SPECIAL";
|
|
10
|
+
})(JurisdictionType || (JurisdictionType = {}));
|
|
11
|
+
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js","sourceRoot":"","sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.ts"],"names":[],"mappings":"AAgQA,2HAA2H;AAC3H,MAAM,CAAN,IAAY,gBAOX;AAPD,WAAY,gBAAgB;IAC1B,2CAAuB,CAAA;IACvB,uCAAmB,CAAA;IACnB,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,iCAAa,CAAA;IACb,uCAAmB,CAAA;AACrB,CAAC,EAPW,gBAAgB,KAAhB,gBAAgB,QAO3B"}
|
|
@@ -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}.taxBreakdown` | `lineItemTaxDetails.${number}.taxBreakdown.${number}.jurisdictionType` | `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` | `taxCalculatorDetails.${number}.unsupportedCountries`>>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';
|
|
2
|
+
import { renameKeysFromSDKRequestToRESTRequest, renameKeysFromRESTResponseToSDKResponse, } from '@wix/sdk-runtime/rename-all-nested-keys';
|
|
3
|
+
import * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';
|
|
4
|
+
import { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';
|
|
5
|
+
import { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';
|
|
6
|
+
import { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';
|
|
7
|
+
/** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"County"`, `"City"`, `"Special"`, etc. */
|
|
8
|
+
export var JurisdictionType;
|
|
9
|
+
(function (JurisdictionType) {
|
|
10
|
+
JurisdictionType["UNDEFINED"] = "UNDEFINED";
|
|
11
|
+
JurisdictionType["COUNTRY"] = "COUNTRY";
|
|
12
|
+
JurisdictionType["STATE"] = "STATE";
|
|
13
|
+
JurisdictionType["COUNTY"] = "COUNTY";
|
|
14
|
+
JurisdictionType["CITY"] = "CITY";
|
|
15
|
+
JurisdictionType["SPECIAL"] = "SPECIAL";
|
|
16
|
+
})(JurisdictionType || (JurisdictionType = {}));
|
|
17
|
+
/**
|
|
18
|
+
* Calculates tax for the provided line items.
|
|
19
|
+
*
|
|
20
|
+
* Tax is calculated for each line item based on the tax region
|
|
21
|
+
* that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for
|
|
22
|
+
* 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
|
|
23
|
+
* default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.
|
|
24
|
+
*
|
|
25
|
+
* The tax is calculated by a tax calculator app installed on the site.
|
|
26
|
+
* Call List Tax Calculators to see which tax calculators are available.
|
|
27
|
+
* To provide your own tax calculations, use the Tax Calculation service plugin.
|
|
28
|
+
*
|
|
29
|
+
* The breakdown of calculated tax returned, includes:
|
|
30
|
+
* + `taxSummary`: The overall total tax calculated.
|
|
31
|
+
* + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.
|
|
32
|
+
* + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.
|
|
33
|
+
* + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.
|
|
34
|
+
* @public
|
|
35
|
+
* @documentationMaturity preview
|
|
36
|
+
* @requiredField options.addresses
|
|
37
|
+
* @requiredField options.lineItems
|
|
38
|
+
* @requiredField options.lineItems._id
|
|
39
|
+
* @requiredField options.lineItems.addressIndex
|
|
40
|
+
* @requiredField options.lineItems.price
|
|
41
|
+
* @param options - Calculate tax options.
|
|
42
|
+
* @permissionId BILLING.CALCULATE_TAX
|
|
43
|
+
* @permissionScope Manage Stores - all permissions
|
|
44
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
45
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
46
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
47
|
+
* @permissionScope Manage eCommerce - all permissions
|
|
48
|
+
* @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
|
|
49
|
+
* @permissionScope Manage Orders
|
|
50
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
51
|
+
* @applicableIdentity APP
|
|
52
|
+
* @applicableIdentity VISITOR
|
|
53
|
+
* @fqn wix.billing.v1.TaxCalculation.CalculateTax
|
|
54
|
+
*/
|
|
55
|
+
export async function calculateTax(options) {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
58
|
+
const payload = transformPaths(renameKeysFromSDKRequestToRESTRequest({
|
|
59
|
+
externalId: options?.externalId,
|
|
60
|
+
currency: options?.currency,
|
|
61
|
+
addresses: options?.addresses,
|
|
62
|
+
lineItems: options?.lineItems,
|
|
63
|
+
}), [
|
|
64
|
+
{
|
|
65
|
+
transformFn: transformSDKAddressToRESTAddress,
|
|
66
|
+
paths: [{ path: 'addresses', isRepeated: true }],
|
|
67
|
+
},
|
|
68
|
+
]);
|
|
69
|
+
const reqOpts = ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);
|
|
70
|
+
sideEffects?.onSiteCall?.();
|
|
71
|
+
try {
|
|
72
|
+
const result = await httpClient.request(reqOpts);
|
|
73
|
+
sideEffects?.onSuccess?.(result);
|
|
74
|
+
return renameKeysFromRESTResponseToSDKResponse(transformPaths(result.data, [
|
|
75
|
+
{
|
|
76
|
+
transformFn: transformRESTAddressToSDKAddress,
|
|
77
|
+
paths: [{ path: 'addresses', isRepeated: true }],
|
|
78
|
+
},
|
|
79
|
+
]));
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
const transformedError = sdkTransformError(err, {
|
|
83
|
+
spreadPathsToArguments: {},
|
|
84
|
+
explicitPathsToArguments: {
|
|
85
|
+
externalId: '$[0].externalId',
|
|
86
|
+
currency: '$[0].currency',
|
|
87
|
+
addresses: '$[0].addresses',
|
|
88
|
+
lineItems: '$[0].lineItems',
|
|
89
|
+
},
|
|
90
|
+
singleArgumentUnchanged: false,
|
|
91
|
+
}, ['options']);
|
|
92
|
+
sideEffects?.onError?.(err);
|
|
93
|
+
throw transformedError;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Retrieves a list of installed tax calculators.
|
|
98
|
+
*
|
|
99
|
+
* Wix uses these calculators to calculate tax.
|
|
100
|
+
* @public
|
|
101
|
+
* @documentationMaturity preview
|
|
102
|
+
* @permissionId BILLING.TAX_CALCULATORS_READ
|
|
103
|
+
* @permissionScope Manage Stores - all permissions
|
|
104
|
+
* @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
|
|
105
|
+
* @permissionScope Manage Restaurants - all permissions
|
|
106
|
+
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
107
|
+
* @permissionScope Manage Orders
|
|
108
|
+
* @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
|
|
109
|
+
* @applicableIdentity APP
|
|
110
|
+
* @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators
|
|
111
|
+
*/
|
|
112
|
+
export async function listTaxCalculators() {
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
115
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({});
|
|
116
|
+
const reqOpts = ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(payload);
|
|
117
|
+
sideEffects?.onSiteCall?.();
|
|
118
|
+
try {
|
|
119
|
+
const result = await httpClient.request(reqOpts);
|
|
120
|
+
sideEffects?.onSuccess?.(result);
|
|
121
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
const transformedError = sdkTransformError(err, {
|
|
125
|
+
spreadPathsToArguments: {},
|
|
126
|
+
explicitPathsToArguments: {},
|
|
127
|
+
singleArgumentUnchanged: false,
|
|
128
|
+
}, []);
|
|
129
|
+
sideEffects?.onError?.(err);
|
|
130
|
+
throw transformedError;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map
|
package/build/es/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,18 @@
|
|
|
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.context.js"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+GAA6F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../../index.typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iHAA+F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js';
|