@wix/auto_sdk_billing_tax-calculation 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/build/cjs/index.d.ts +43 -1
  2. package/build/cjs/index.js +208 -15
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +484 -1
  5. package/build/cjs/index.typings.js +188 -15
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +408 -1
  8. package/build/cjs/meta.js +135 -15
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +43 -0
  11. package/build/es/index.mjs +185 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/{internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts → es/index.typings.d.mts} +44 -40
  14. package/build/es/index.typings.mjs +165 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/{cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts → es/meta.d.mts} +36 -22
  17. package/build/es/meta.mjs +110 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/internal/cjs/index.d.ts +43 -1
  20. package/build/internal/cjs/index.js +208 -15
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +484 -1
  23. package/build/internal/cjs/index.typings.js +188 -15
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +408 -1
  26. package/build/internal/cjs/meta.js +135 -15
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +43 -0
  29. package/build/internal/es/index.mjs +185 -0
  30. package/build/internal/es/index.mjs.map +1 -0
  31. package/build/{cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts → internal/es/index.typings.d.mts} +44 -40
  32. package/build/internal/es/index.typings.mjs +165 -0
  33. package/build/internal/es/index.typings.mjs.map +1 -0
  34. package/build/internal/{cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts → es/meta.d.mts} +36 -22
  35. package/build/internal/es/meta.mjs +110 -0
  36. package/build/internal/es/meta.mjs.map +1 -0
  37. package/package.json +11 -9
  38. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
  39. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -10
  40. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
  41. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
  42. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -93
  43. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
  44. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
  45. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -66
  46. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
  47. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts +0 -38
  48. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -20
  49. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
  50. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -14
  51. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
  52. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -165
  53. package/build/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
  54. package/build/es/index.d.ts +0 -1
  55. package/build/es/index.js +0 -2
  56. package/build/es/index.js.map +0 -1
  57. package/build/es/index.typings.d.ts +0 -1
  58. package/build/es/index.typings.js +0 -2
  59. package/build/es/index.typings.js.map +0 -1
  60. package/build/es/meta.d.ts +0 -1
  61. package/build/es/meta.js +0 -2
  62. package/build/es/meta.js.map +0 -1
  63. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
  64. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -6
  65. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
  66. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
  67. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -88
  68. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
  69. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
  70. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -38
  71. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
  72. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts +0 -38
  73. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -14
  74. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
  75. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts +0 -394
  76. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -11
  77. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
  78. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts +0 -480
  79. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -137
  80. package/build/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
  81. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
  82. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -10
  83. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
  84. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
  85. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -93
  86. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
  87. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
  88. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -66
  89. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
  90. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts +0 -38
  91. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -20
  92. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
  93. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -14
  94. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
  95. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -165
  96. package/build/internal/cjs/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
  97. package/build/internal/es/index.d.ts +0 -1
  98. package/build/internal/es/index.js +0 -2
  99. package/build/internal/es/index.js.map +0 -1
  100. package/build/internal/es/index.typings.d.ts +0 -1
  101. package/build/internal/es/index.typings.js +0 -2
  102. package/build/internal/es/index.typings.js.map +0 -1
  103. package/build/internal/es/meta.d.ts +0 -1
  104. package/build/internal/es/meta.js +0 -2
  105. package/build/internal/es/meta.js.map +0 -1
  106. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.d.ts +0 -6
  107. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js +0 -6
  108. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.js.map +0 -1
  109. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.d.ts +0 -26
  110. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js +0 -88
  111. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js.map +0 -1
  112. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.d.ts +0 -14
  113. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js +0 -38
  114. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.meta.js.map +0 -1
  115. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.d.ts +0 -38
  116. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js +0 -14
  117. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js.map +0 -1
  118. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.d.ts +0 -394
  119. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js +0 -11
  120. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.types.js.map +0 -1
  121. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.d.ts +0 -480
  122. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js +0 -137
  123. package/build/internal/es/src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js.map +0 -1
@@ -0,0 +1,43 @@
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
+ import { CalculateTaxOptions, CalculateTaxResponse, CalculateTaxApplicationErrors, ListTaxCalculatorsResponse } from './index.typings.mjs';
3
+ export { Address, AddressIndex, AddressIndexAddressIndexOptionsOneOf, AggregatedTaxBreakdown, ApplicationError, CalculateTaxRequest, JurisdictionType, LineItem, LineItemTaxDetails, LineItemTaxSummary, ListTaxCalculatorsRequest, MultipleAddresses, TaxBreakdown, TaxCalculationGateway, TaxCalculatorDetails, TaxSummary } from './index.typings.mjs';
4
+
5
+ declare function calculateTax$1(httpClient: HttpClient): CalculateTaxSignature;
6
+ interface CalculateTaxSignature {
7
+ /**
8
+ * Calculates tax for the provided line items.
9
+ *
10
+ * Tax is calculated for each line item based on the tax region
11
+ * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for
12
+ * 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
13
+ * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.
14
+ *
15
+ * The tax is calculated by a tax calculator app installed on the site.
16
+ * Call List Tax Calculators to see which tax calculators are available.
17
+ * To provide your own tax calculations, use the Tax Calculation service plugin.
18
+ *
19
+ * The breakdown of calculated tax returned, includes:
20
+ * + `taxSummary`: The overall total tax calculated.
21
+ * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.
22
+ * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.
23
+ * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.
24
+ * @param - Calculate tax options.
25
+ */
26
+ (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`> & {
27
+ __applicationErrorsType?: CalculateTaxApplicationErrors;
28
+ }>;
29
+ }
30
+ declare function listTaxCalculators$1(httpClient: HttpClient): ListTaxCalculatorsSignature;
31
+ interface ListTaxCalculatorsSignature {
32
+ /**
33
+ * Retrieves a list of installed tax calculators.
34
+ *
35
+ * Wix uses these calculators to calculate tax.
36
+ */
37
+ (): Promise<NonNullablePaths<ListTaxCalculatorsResponse, `taxCalculatorDetails` | `taxCalculatorDetails.${number}.appId` | `taxCalculatorDetails.${number}.displayName`>>;
38
+ }
39
+
40
+ declare const calculateTax: MaybeContext<BuildRESTFunction<typeof calculateTax$1> & typeof calculateTax$1>;
41
+ declare const listTaxCalculators: MaybeContext<BuildRESTFunction<typeof listTaxCalculators$1> & typeof listTaxCalculators$1>;
42
+
43
+ export { CalculateTaxOptions, CalculateTaxResponse, ListTaxCalculatorsResponse, calculateTax, listTaxCalculators };
@@ -0,0 +1,185 @@
1
+ // src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts
2
+ import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
3
+ import {
4
+ renameKeysFromSDKRequestToRESTRequest,
5
+ renameKeysFromRESTResponseToSDKResponse
6
+ } from "@wix/sdk-runtime/rename-all-nested-keys";
7
+
8
+ // src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts
9
+ import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
10
+ import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
11
+ function resolveWixBillingV1TaxCalculationUrl(opts) {
12
+ const domainToMappings = {
13
+ "manage._base_domain_": [
14
+ {
15
+ srcPath: "/billing/v1/calculate-tax",
16
+ destPath: "/v1/calculate-tax"
17
+ },
18
+ {
19
+ srcPath: "/billing/v1/list-tax-calculators",
20
+ destPath: "/v1/list-tax-calculators"
21
+ }
22
+ ],
23
+ "www.wixapis.com": [
24
+ {
25
+ srcPath: "/billing/v1/calculate-tax",
26
+ destPath: "/v1/calculate-tax"
27
+ },
28
+ {
29
+ srcPath: "/billing/v1/list-tax-calculators",
30
+ destPath: "/v1/list-tax-calculators"
31
+ }
32
+ ]
33
+ };
34
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
35
+ }
36
+ var PACKAGE_NAME = "@wix/auto_sdk_billing_tax-calculation";
37
+ function calculateTax(payload) {
38
+ function __calculateTax({ host }) {
39
+ const metadata = {
40
+ entityFqdn: "wix.gateways.billing.v1.tax_calculation_gateway",
41
+ method: "POST",
42
+ methodFqn: "wix.billing.v1.TaxCalculation.CalculateTax",
43
+ packageName: PACKAGE_NAME,
44
+ url: resolveWixBillingV1TaxCalculationUrl({
45
+ protoPath: "/v1/calculate-tax",
46
+ data: payload,
47
+ host
48
+ }),
49
+ data: payload
50
+ };
51
+ return metadata;
52
+ }
53
+ return __calculateTax;
54
+ }
55
+ function listTaxCalculators(payload) {
56
+ function __listTaxCalculators({ host }) {
57
+ const metadata = {
58
+ entityFqdn: "wix.gateways.billing.v1.tax_calculation_gateway",
59
+ method: "GET",
60
+ methodFqn: "wix.billing.v1.TaxCalculation.ListTaxCalculators",
61
+ packageName: PACKAGE_NAME,
62
+ url: resolveWixBillingV1TaxCalculationUrl({
63
+ protoPath: "/v1/list-tax-calculators",
64
+ data: payload,
65
+ host
66
+ }),
67
+ params: toURLSearchParams(payload)
68
+ };
69
+ return metadata;
70
+ }
71
+ return __listTaxCalculators;
72
+ }
73
+
74
+ // src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts
75
+ import { transformSDKAddressToRESTAddress } from "@wix/sdk-runtime/transformations/address";
76
+ import { transformRESTAddressToSDKAddress } from "@wix/sdk-runtime/transformations/address";
77
+ import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
78
+ var JurisdictionType = /* @__PURE__ */ ((JurisdictionType2) => {
79
+ JurisdictionType2["UNDEFINED"] = "UNDEFINED";
80
+ JurisdictionType2["COUNTRY"] = "COUNTRY";
81
+ JurisdictionType2["STATE"] = "STATE";
82
+ JurisdictionType2["COUNTY"] = "COUNTY";
83
+ JurisdictionType2["CITY"] = "CITY";
84
+ JurisdictionType2["SPECIAL"] = "SPECIAL";
85
+ return JurisdictionType2;
86
+ })(JurisdictionType || {});
87
+ async function calculateTax2(options) {
88
+ const { httpClient, sideEffects } = arguments[1];
89
+ const payload = transformPaths(
90
+ renameKeysFromSDKRequestToRESTRequest({
91
+ externalId: options?.externalId,
92
+ currency: options?.currency,
93
+ addresses: options?.addresses,
94
+ lineItems: options?.lineItems
95
+ }),
96
+ [
97
+ {
98
+ transformFn: transformSDKAddressToRESTAddress,
99
+ paths: [{ path: "addresses", isRepeated: true }]
100
+ }
101
+ ]
102
+ );
103
+ const reqOpts = calculateTax(payload);
104
+ sideEffects?.onSiteCall?.();
105
+ try {
106
+ const result = await httpClient.request(reqOpts);
107
+ sideEffects?.onSuccess?.(result);
108
+ return renameKeysFromRESTResponseToSDKResponse(
109
+ transformPaths(result.data, [
110
+ {
111
+ transformFn: transformRESTAddressToSDKAddress,
112
+ paths: [{ path: "addresses", isRepeated: true }]
113
+ }
114
+ ])
115
+ );
116
+ } catch (err) {
117
+ const transformedError = sdkTransformError(
118
+ err,
119
+ {
120
+ spreadPathsToArguments: {},
121
+ explicitPathsToArguments: {
122
+ externalId: "$[0].externalId",
123
+ currency: "$[0].currency",
124
+ addresses: "$[0].addresses",
125
+ lineItems: "$[0].lineItems"
126
+ },
127
+ singleArgumentUnchanged: false
128
+ },
129
+ ["options"]
130
+ );
131
+ sideEffects?.onError?.(err);
132
+ throw transformedError;
133
+ }
134
+ }
135
+ async function listTaxCalculators2() {
136
+ const { httpClient, sideEffects } = arguments[0];
137
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
138
+ const reqOpts = listTaxCalculators(
139
+ payload
140
+ );
141
+ sideEffects?.onSiteCall?.();
142
+ try {
143
+ const result = await httpClient.request(reqOpts);
144
+ sideEffects?.onSuccess?.(result);
145
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
146
+ } catch (err) {
147
+ const transformedError = sdkTransformError(
148
+ err,
149
+ {
150
+ spreadPathsToArguments: {},
151
+ explicitPathsToArguments: {},
152
+ singleArgumentUnchanged: false
153
+ },
154
+ []
155
+ );
156
+ sideEffects?.onError?.(err);
157
+ throw transformedError;
158
+ }
159
+ }
160
+
161
+ // src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.ts
162
+ function calculateTax3(httpClient) {
163
+ return (options) => calculateTax2(
164
+ options,
165
+ // @ts-ignore
166
+ { httpClient }
167
+ );
168
+ }
169
+ function listTaxCalculators3(httpClient) {
170
+ return () => listTaxCalculators2(
171
+ // @ts-ignore
172
+ { httpClient }
173
+ );
174
+ }
175
+
176
+ // src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.ts
177
+ import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
178
+ var calculateTax4 = /* @__PURE__ */ createRESTModule(calculateTax3);
179
+ var listTaxCalculators4 = /* @__PURE__ */ createRESTModule(listTaxCalculators3);
180
+ export {
181
+ JurisdictionType,
182
+ calculateTax4 as calculateTax,
183
+ listTaxCalculators4 as listTaxCalculators
184
+ };
185
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.ts","../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.ts","../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.ts","../../../src/gateways-billing-v1-tax-calculation-gateway-tax-calculation.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixGatewaysBillingV1TaxCalculationGateway from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.http.js';\nimport { transformSDKAddressToRESTAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface TaxCalculationGateway {\n /** @format GUID */\n _id?: string | null;\n}\n\nexport interface CalculateTaxRequest {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n}\n\n/** Wix common address format for physical address to use if you plan to store addresses in your service. */\nexport interface Address {\n /**\n * 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.\n * @format COUNTRY\n */\n country?: string | null;\n /**\n * Subdivision (such as state, prefecture, or province) in [ISO-3166 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-2) format.\n * @maxLength 50\n */\n subdivision?: string | null;\n /**\n * City name.\n * @maxLength 100\n */\n city?: string | null;\n /**\n * Postal or zip code.\n * @maxLength 50\n */\n postalCode?: string | null;\n /**\n * Main address line, usually street and number as free text.\n * @maxLength 200\n */\n addressLine1?: string | null;\n /**\n * Free text providing more detailed address information, such as apartment, suite, or floor.\n * @maxLength 200\n */\n addressLine2?: string | null;\n}\n\n/** Line items to calculate tax for. */\nexport interface LineItem {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Line item price.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n price?: string;\n /**\n * Stock keeping unit for this line item. Learn more about [SKUs](https://www.wix.com/encyclopedia/definition/stock-keeping-unit-sku).\n * @maxLength 40\n */\n itemCode?: string | null;\n /**\n * Tax group ID for this line item. If not provided, the default tax group applies.\n * @format GUID\n */\n taxGroupId?: string | null;\n /**\n * ID of the app providing the catalog for this line item.\n *\n * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n *\n * For items from Wix catalogs, the following values always apply:\n * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n * @format GUID\n */\n appId?: string | null;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean | null;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n}\n\n/** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\nexport interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/** @oneof */\nexport interface AddressIndexAddressIndexOptionsOneOf {\n /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */\n singleAddress?: number;\n /**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item is shipped from,\n * as well as the address the item is shipped to.\n */\n multipleAddresses?: MultipleAddresses;\n}\n\n/**\n * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item\n * is shipped from, as well as the address the item is shipped to.\n */\nexport interface MultipleAddresses {\n /** Index of the origin address. */\n origin?: number;\n /** Index of the destination address. */\n destination?: number;\n}\n\nexport interface CalculateTaxResponse {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses?: Address[];\n /** Summary of the tax calculated. */\n taxSummary?: TaxSummary;\n /**\n * Details of each tax applied to each line item.\n * @minSize 1\n * @maxSize 300\n */\n lineItemTaxDetails?: LineItemTaxDetails[];\n /**\n * Errors that occurred during the tax calculation.\n * @maxSize 100\n */\n errors?: ApplicationError[];\n}\n\nexport interface TaxSummary {\n /**\n * Total price for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalAmount?: string;\n /**\n * Total amount of tax calculated for all line items.\n * Note that due to rounding, `totalTax` may not equal the sum of `lineItemTaxDetails.taxSummary.taxAmount`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTax?: string;\n /**\n * Total taxable amount for all line items.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxableAmount?: string;\n /**\n * Total amount of `totalTax` that is included in price. Applies to line items with `taxIncludedInPrice` set to `true`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n totalTaxIncludedInPrice?: string;\n /**\n * Array of each tax applied, grouped by `\"jurisdiction\"`, `\"jurisdictionType\"`, `\"taxType\"`, `\"taxName\"` and `\"rate\"`.\n * @maxSize 50\n */\n aggregatedTaxBreakdown?: AggregatedTaxBreakdown[];\n}\n\n/**\n * The summary of the tax breakdown for all the line items. It will hold for each tax name, the aggregated tax amount paid for it and the tax rate.\n * Tax breakdown is the tax amount split to the tax authorities that applied on the line item.\n *\n * Note: Because that the tax is calculated only on the taxable amount, the tax amount may be looks strange.\n * e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,\n * then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.\n */\nexport interface AggregatedTaxBreakdown {\n /**\n * Name of the tax that was calculated.\n * @maxLength 200\n */\n taxName?: string;\n /**\n * Type of tax that was calculated.\n * @maxLength 200\n */\n taxType?: string;\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string;\n /** Type of jurisdiction that taxes were calculated for. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @decimalValue options { gte:0, maxScale:6 }\n */\n rate?: string;\n /**\n * Total amount of this tax for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n aggregatedTaxAmount?: string;\n}\n\n/** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"County\"`, `\"City\"`, `\"Special\"`, etc. */\nexport enum JurisdictionType {\n UNDEFINED = 'UNDEFINED',\n COUNTRY = 'COUNTRY',\n STATE = 'STATE',\n COUNTY = 'COUNTY',\n CITY = 'CITY',\n SPECIAL = 'SPECIAL',\n}\n\n/** @enumType */\nexport type JurisdictionTypeWithLiterals =\n | JurisdictionType\n | 'UNDEFINED'\n | 'COUNTRY'\n | 'STATE'\n | 'COUNTY'\n | 'CITY'\n | 'SPECIAL';\n\n/** Tax details for a specific line item. */\nexport interface LineItemTaxDetails {\n /**\n * Line item ID.\n * @minLength 1\n * @maxLength 100\n */\n _id?: string;\n /**\n * Line item name to display.\n * @maxLength 250\n */\n itemName?: string | null;\n /**\n * Line item quantity.\n * @min 1\n * @max 100000\n */\n quantity?: number;\n /**\n * Array of each tax applied, grouped by `jurisdiction`.\n * @maxSize 7\n */\n taxBreakdown?: TaxBreakdown[];\n /** Summary of this line item's total price and tax. */\n taxSummary?: LineItemTaxSummary;\n /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */\n addressIndex?: AddressIndex;\n /** Whether tax is included in the price. */\n taxIncludedInPrice?: boolean;\n}\n\n/** A detailed description of all the tax authorities applied on this item. */\nexport interface TaxBreakdown {\n /**\n * Jurisdiction that taxes were calculated for.\n * @maxLength 200\n */\n jurisdiction?: string | null;\n /**\n * Non-taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n nonTaxableAmount?: string | null;\n /**\n * Tax rate used for this jurisdiction, as a decimal. For example, 10% tax is `\"0.1000\"` and 200% tax is `\"2.0000\"`.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:6, gte:0 }\n */\n rate?: string | null;\n /**\n * Amount of this tax calculated for this jurisdiction.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string | null;\n /**\n * Taxable amount of the price.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4, gte:0 }\n */\n taxableAmount?: string | null;\n /**\n * Type of tax that was calculated. For example, `\"Sales Tax\"`, `\"Income Tax\"`, `\"Value Added Tax\"`, etc.\n * @maxLength 200\n */\n taxType?: string | null;\n /**\n * Name of the tax that was calculated. For example, `\"NY State Sales Tax\"`, `\"Quebec GST\"`, etc.\n * @maxLength 200\n */\n taxName?: string | null;\n /** Type of jurisdiction that taxes were calculated for. For example, `\"State\"`, `\"Çounty\"`, `\"City\"`, `\"Special\"`, etc. */\n jurisdictionType?: JurisdictionTypeWithLiterals;\n}\n\nexport interface LineItemTaxSummary {\n /**\n * Total price for this line item.\n * To determine the price for each individual unit of this line item, divide by `quantity`.\n * @format DECIMAL_VALUE\n * @decimalValue options { lte:1000000000000000 }\n */\n fullPrice?: string | null;\n /**\n * Total amount of tax calculated for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxAmount?: string;\n /**\n * Total taxable amount for this line item.\n * @format DECIMAL_VALUE\n * @decimalValue options { maxScale:4 }\n */\n taxableAmount?: string;\n /**\n * ID of the calculator app that calculated tax for this line item.\n * @maxLength 50\n */\n appId?: string | null;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface ListTaxCalculatorsRequest {}\n\nexport interface ListTaxCalculatorsResponse {\n /**\n * Retrieved tax calculators.\n * @maxSize 10\n */\n taxCalculatorDetails?: TaxCalculatorDetails[];\n}\n\nexport interface TaxCalculatorDetails {\n /**\n * ID of the tax calculator.\n * @format GUID\n */\n appId?: string;\n /**\n * Display name of the tax calculator.\n * @minLength 1\n * @maxLength 200\n */\n displayName?: string;\n /**\n * List of countries, in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format, that the calculator does not support.\n * @format COUNTRY\n * @maxSize 195\n */\n unsupportedCountries?: string[];\n}\n\nexport type CalculateTaxApplicationErrors =\n | {\n code?: 'INVALID_LINE_ITEM_ADDRESS_INDEX';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_TAXABLE_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_COUNTRY_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_SUBDIVISION_IN_ADDRESS';\n description?: string;\n data?: Record<string, any>;\n };\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item. If no tax group with that `taxGroupId` is found then the\n * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @public\n * @documentationMaturity preview\n * @requiredField options.addresses\n * @requiredField options.lineItems\n * @requiredField options.lineItems._id\n * @requiredField options.lineItems.addressIndex\n * @requiredField options.lineItems.price\n * @param options - Calculate tax options.\n * @permissionId BILLING.CALCULATE_TAX\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn wix.billing.v1.TaxCalculation.CalculateTax\n */\nexport async function calculateTax(\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`\n >\n): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = transformPaths(\n renameKeysFromSDKRequestToRESTRequest({\n externalId: options?.externalId,\n currency: options?.currency,\n addresses: options?.addresses,\n lineItems: options?.lineItems,\n }),\n [\n {\n transformFn: transformSDKAddressToRESTAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ]\n );\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.calculateTax(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'addresses', isRepeated: true }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n externalId: '$[0].externalId',\n currency: '$[0].currency',\n addresses: '$[0].addresses',\n lineItems: '$[0].lineItems',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface CalculateTaxOptions {\n /**\n * Optional ID of the entity that tax is being calculated for. For example, a cart ID.\n * @format GUID\n * @immutable\n */\n externalId?: string | null;\n /**\n * 3-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.\n * @format CURRENCY\n */\n currency?: string;\n /**\n * Array of addresses. Each line item can individually reference the address to apply with `lineItems.addressIndex`.\n * @minSize 1\n * @maxSize 3\n */\n addresses: Address[];\n /**\n * Line items to calculate tax for.\n * @minSize 1\n * @maxSize 300\n */\n lineItems: LineItem[];\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n * @public\n * @documentationMaturity preview\n * @permissionId BILLING.TAX_CALCULATORS_READ\n * @applicableIdentity APP\n * @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators\n */\nexport async function listTaxCalculators(): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixGatewaysBillingV1TaxCalculationGateway.listTaxCalculators(\n payload\n );\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixBillingV1TaxCalculationUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/billing/v1/calculate-tax',\n destPath: '/v1/calculate-tax',\n },\n {\n srcPath: '/billing/v1/list-tax-calculators',\n destPath: '/v1/list-tax-calculators',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_billing_tax-calculation';\n\n/**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item. If no tax group with that `taxGroupId` is found then the\n * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n */\nexport function calculateTax(payload: object): RequestOptionsFactory<any> {\n function __calculateTax({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'POST' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.CalculateTax',\n packageName: PACKAGE_NAME,\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/calculate-tax',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __calculateTax;\n}\n\n/**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\nexport function listTaxCalculators(\n payload: object\n): RequestOptionsFactory<any> {\n function __listTaxCalculators({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.gateways.billing.v1.tax_calculation_gateway',\n method: 'GET' as any,\n methodFqn: 'wix.billing.v1.TaxCalculation.ListTaxCalculators',\n packageName: PACKAGE_NAME,\n url: resolveWixBillingV1TaxCalculationUrl({\n protoPath: '/v1/list-tax-calculators',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n };\n\n return metadata;\n }\n\n return __listTaxCalculators;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n CalculateTaxApplicationErrors,\n CalculateTaxOptions,\n CalculateTaxResponse,\n ListTaxCalculatorsResponse,\n calculateTax as universalCalculateTax,\n listTaxCalculators as universalListTaxCalculators,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/billing' };\n\nexport function calculateTax(httpClient: HttpClient): CalculateTaxSignature {\n return (\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`\n >\n ) =>\n universalCalculateTax(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface CalculateTaxSignature {\n /**\n * Calculates tax for the provided line items.\n *\n * Tax is calculated for each line item based on the tax region\n * that corresponds to the address provided in `lineItems.addressIndex` and the tax group in `taxGroupId`. If no tax region is found for\n * the line item's address then no tax will be calculated for this line item. If no tax group with that `taxGroupId` is found then the\n * default tax group is used to calculate tax. Call List Default Tax Groups to retrieve a site's default tax groups.\n *\n * The tax is calculated by a tax calculator app installed on the site.\n * Call List Tax Calculators to see which tax calculators are available.\n * To provide your own tax calculations, use the Tax Calculation service plugin.\n *\n * The breakdown of calculated tax returned, includes:\n * + `taxSummary`: The overall total tax calculated.\n * + `taxSummary.aggregatedTaxBreakdown`: The total tax calculated for each jurisdiction.\n * + `lineItemTaxDetails.taxSummary`: The total tax calculated for each line item.\n * + `lineItemTaxDetails.taxBreakdown`: The tax calculated for each line item in each jurisdiction.\n * @param - Calculate tax options.\n */\n (\n options?: NonNullablePaths<\n CalculateTaxOptions,\n | `addresses`\n | `lineItems`\n | `lineItems.${number}._id`\n | `lineItems.${number}.addressIndex`\n | `lineItems.${number}.price`\n >\n ): Promise<\n NonNullablePaths<\n CalculateTaxResponse,\n | `currency`\n | `addresses`\n | `taxSummary.totalAmount`\n | `taxSummary.totalTax`\n | `taxSummary.totalTaxableAmount`\n | `taxSummary.totalTaxIncludedInPrice`\n | `taxSummary.aggregatedTaxBreakdown`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxName`\n | `taxSummary.aggregatedTaxBreakdown.${number}.taxType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdiction`\n | `taxSummary.aggregatedTaxBreakdown.${number}.jurisdictionType`\n | `taxSummary.aggregatedTaxBreakdown.${number}.rate`\n | `taxSummary.aggregatedTaxBreakdown.${number}.aggregatedTaxAmount`\n | `lineItemTaxDetails`\n | `lineItemTaxDetails.${number}._id`\n | `lineItemTaxDetails.${number}.quantity`\n | `lineItemTaxDetails.${number}.taxSummary.taxAmount`\n | `lineItemTaxDetails.${number}.taxSummary.taxableAmount`\n | `lineItemTaxDetails.${number}.addressIndex.singleAddress`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.origin`\n | `lineItemTaxDetails.${number}.addressIndex.multipleAddresses.destination`\n | `lineItemTaxDetails.${number}.taxIncludedInPrice`\n | `errors`\n | `errors.${number}.code`\n | `errors.${number}.description`\n > & {\n __applicationErrorsType?: CalculateTaxApplicationErrors;\n }\n >;\n}\n\nexport function listTaxCalculators(\n httpClient: HttpClient\n): ListTaxCalculatorsSignature {\n return () =>\n universalListTaxCalculators(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListTaxCalculatorsSignature {\n /**\n * Retrieves a list of installed tax calculators.\n *\n * Wix uses these calculators to calculate tax.\n */\n (): Promise<\n NonNullablePaths<\n ListTaxCalculatorsResponse,\n | `taxCalculatorDetails`\n | `taxCalculatorDetails.${number}.appId`\n | `taxCalculatorDetails.${number}.displayName`\n >\n >;\n}\n\nexport {\n Address,\n AddressIndex,\n AddressIndexAddressIndexOptionsOneOf,\n AggregatedTaxBreakdown,\n ApplicationError,\n CalculateTaxOptions,\n CalculateTaxRequest,\n CalculateTaxResponse,\n JurisdictionType,\n LineItem,\n LineItemTaxDetails,\n LineItemTaxSummary,\n ListTaxCalculatorsRequest,\n ListTaxCalculatorsResponse,\n MultipleAddresses,\n TaxBreakdown,\n TaxCalculationGateway,\n TaxCalculatorDetails,\n TaxSummary,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n","import {\n calculateTax as publicCalculateTax,\n listTaxCalculators as publicListTaxCalculators,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const calculateTax: MaybeContext<\n BuildRESTFunction<typeof publicCalculateTax> & typeof publicCalculateTax\n> = /*#__PURE__*/ createRESTModule(publicCalculateTax);\nexport const listTaxCalculators: MaybeContext<\n BuildRESTFunction<typeof publicListTaxCalculators> &\n typeof publicListTaxCalculators\n> = /*#__PURE__*/ createRESTModule(publicListTaxCalculators);\n\nexport { JurisdictionType } from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\nexport {\n TaxCalculationGateway,\n CalculateTaxRequest,\n Address,\n LineItem,\n AddressIndex,\n AddressIndexAddressIndexOptionsOneOf,\n MultipleAddresses,\n CalculateTaxResponse,\n TaxSummary,\n AggregatedTaxBreakdown,\n LineItemTaxDetails,\n TaxBreakdown,\n LineItemTaxSummary,\n ApplicationError,\n ListTaxCalculatorsRequest,\n ListTaxCalculatorsResponse,\n TaxCalculatorDetails,\n CalculateTaxOptions,\n} from './gateways-billing-v1-tax-calculation-gateway-tax-calculation.universal.js';\n"],"mappings":"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","names":["JurisdictionType","calculateTax","listTaxCalculators","calculateTax","listTaxCalculators","calculateTax","listTaxCalculators"]}
@@ -1,9 +1,10 @@
1
1
  import { NonNullablePaths } from '@wix/sdk-types';
2
- export interface TaxCalculationGateway {
2
+
3
+ interface TaxCalculationGateway {
3
4
  /** @format GUID */
4
5
  _id?: string | null;
5
6
  }
6
- export interface CalculateTaxRequest {
7
+ interface CalculateTaxRequest {
7
8
  /**
8
9
  * Optional ID of the entity that tax is being calculated for. For example, a cart ID.
9
10
  * @format GUID
@@ -29,7 +30,7 @@ export interface CalculateTaxRequest {
29
30
  lineItems: LineItem[];
30
31
  }
31
32
  /** Wix common address format for physical address to use if you plan to store addresses in your service. */
32
- export interface Address {
33
+ interface Address {
33
34
  /**
34
35
  * 2-letter country code in [ISO-3166 alpha-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) format.
35
36
  * @format COUNTRY
@@ -62,7 +63,7 @@ export interface Address {
62
63
  addressLine2?: string | null;
63
64
  }
64
65
  /** Line items to calculate tax for. */
65
- export interface LineItem {
66
+ interface LineItem {
66
67
  /**
67
68
  * Line item ID.
68
69
  * @minLength 1
@@ -114,7 +115,7 @@ export interface LineItem {
114
115
  addressIndex?: AddressIndex;
115
116
  }
116
117
  /** Index of the address from `addresses` to use to calculate tax for this specific line item. The index is zero-based. */
117
- export interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
118
+ interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
118
119
  /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
119
120
  singleAddress?: number;
120
121
  /**
@@ -124,7 +125,7 @@ export interface AddressIndex extends AddressIndexAddressIndexOptionsOneOf {
124
125
  multipleAddresses?: MultipleAddresses;
125
126
  }
126
127
  /** @oneof */
127
- export interface AddressIndexAddressIndexOptionsOneOf {
128
+ interface AddressIndexAddressIndexOptionsOneOf {
128
129
  /** Single address to use for a sale location when only one address is required for tax calculations. The index is zero-based. */
129
130
  singleAddress?: number;
130
131
  /**
@@ -137,13 +138,13 @@ export interface AddressIndexAddressIndexOptionsOneOf {
137
138
  * Multiple addresses to use for a sale. For example, some tax calculations may require both the address where an item
138
139
  * is shipped from, as well as the address the item is shipped to.
139
140
  */
140
- export interface MultipleAddresses {
141
+ interface MultipleAddresses {
141
142
  /** Index of the origin address. */
142
143
  origin?: number;
143
144
  /** Index of the destination address. */
144
145
  destination?: number;
145
146
  }
146
- export interface CalculateTaxResponse {
147
+ interface CalculateTaxResponse {
147
148
  /**
148
149
  * Optional ID of the entity that tax is being calculated for. For example, a cart ID.
149
150
  * @format GUID
@@ -175,7 +176,7 @@ export interface CalculateTaxResponse {
175
176
  */
176
177
  errors?: ApplicationError[];
177
178
  }
178
- export interface TaxSummary {
179
+ interface TaxSummary {
179
180
  /**
180
181
  * Total price for all line items.
181
182
  * @format DECIMAL_VALUE
@@ -215,7 +216,7 @@ export interface TaxSummary {
215
216
  * e.g. if you pay 100$ and the tax applies only on 50$ from it with tax rate of 10%,
216
217
  * then the tax rate will be remain 10% but tax amount in the breakdown will be 5$ instead of 10$.
217
218
  */
218
- export interface AggregatedTaxBreakdown {
219
+ interface AggregatedTaxBreakdown {
219
220
  /**
220
221
  * Name of the tax that was calculated.
221
222
  * @maxLength 200
@@ -246,7 +247,7 @@ export interface AggregatedTaxBreakdown {
246
247
  aggregatedTaxAmount?: string;
247
248
  }
248
249
  /** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"County"`, `"City"`, `"Special"`, etc. */
249
- export declare enum JurisdictionType {
250
+ declare enum JurisdictionType {
250
251
  UNDEFINED = "UNDEFINED",
251
252
  COUNTRY = "COUNTRY",
252
253
  STATE = "STATE",
@@ -255,9 +256,9 @@ export declare enum JurisdictionType {
255
256
  SPECIAL = "SPECIAL"
256
257
  }
257
258
  /** @enumType */
258
- export type JurisdictionTypeWithLiterals = JurisdictionType | 'UNDEFINED' | 'COUNTRY' | 'STATE' | 'COUNTY' | 'CITY' | 'SPECIAL';
259
+ type JurisdictionTypeWithLiterals = JurisdictionType | 'UNDEFINED' | 'COUNTRY' | 'STATE' | 'COUNTY' | 'CITY' | 'SPECIAL';
259
260
  /** Tax details for a specific line item. */
260
- export interface LineItemTaxDetails {
261
+ interface LineItemTaxDetails {
261
262
  /**
262
263
  * Line item ID.
263
264
  * @minLength 1
@@ -288,7 +289,7 @@ export interface LineItemTaxDetails {
288
289
  taxIncludedInPrice?: boolean;
289
290
  }
290
291
  /** A detailed description of all the tax authorities applied on this item. */
291
- export interface TaxBreakdown {
292
+ interface TaxBreakdown {
292
293
  /**
293
294
  * Jurisdiction that taxes were calculated for.
294
295
  * @maxLength 200
@@ -331,7 +332,7 @@ export interface TaxBreakdown {
331
332
  /** Type of jurisdiction that taxes were calculated for. For example, `"State"`, `"Çounty"`, `"City"`, `"Special"`, etc. */
332
333
  jurisdictionType?: JurisdictionTypeWithLiterals;
333
334
  }
334
- export interface LineItemTaxSummary {
335
+ interface LineItemTaxSummary {
335
336
  /**
336
337
  * Total price for this line item.
337
338
  * To determine the price for each individual unit of this line item, divide by `quantity`.
@@ -357,7 +358,7 @@ export interface LineItemTaxSummary {
357
358
  */
358
359
  appId?: string | null;
359
360
  }
360
- export interface ApplicationError {
361
+ interface ApplicationError {
361
362
  /** Error code. */
362
363
  code?: string;
363
364
  /** Description of the error. */
@@ -365,16 +366,16 @@ export interface ApplicationError {
365
366
  /** Data related to the error. */
366
367
  data?: Record<string, any> | null;
367
368
  }
368
- export interface ListTaxCalculatorsRequest {
369
+ interface ListTaxCalculatorsRequest {
369
370
  }
370
- export interface ListTaxCalculatorsResponse {
371
+ interface ListTaxCalculatorsResponse {
371
372
  /**
372
373
  * Retrieved tax calculators.
373
374
  * @maxSize 10
374
375
  */
375
376
  taxCalculatorDetails?: TaxCalculatorDetails[];
376
377
  }
377
- export interface TaxCalculatorDetails {
378
+ interface TaxCalculatorDetails {
378
379
  /**
379
380
  * ID of the tax calculator.
380
381
  * @format GUID
@@ -393,6 +394,23 @@ export interface TaxCalculatorDetails {
393
394
  */
394
395
  unsupportedCountries?: string[];
395
396
  }
397
+ type CalculateTaxApplicationErrors = {
398
+ code?: 'INVALID_LINE_ITEM_ADDRESS_INDEX';
399
+ description?: string;
400
+ data?: Record<string, any>;
401
+ } | {
402
+ code?: 'MISSING_TAXABLE_ADDRESS';
403
+ description?: string;
404
+ data?: Record<string, any>;
405
+ } | {
406
+ code?: 'MISSING_COUNTRY_IN_ADDRESS';
407
+ description?: string;
408
+ data?: Record<string, any>;
409
+ } | {
410
+ code?: 'MISSING_SUBDIVISION_IN_ADDRESS';
411
+ description?: string;
412
+ data?: Record<string, any>;
413
+ };
396
414
  /**
397
415
  * Calculates tax for the provided line items.
398
416
  *
@@ -419,22 +437,14 @@ export interface TaxCalculatorDetails {
419
437
  * @requiredField options.lineItems.price
420
438
  * @param options - Calculate tax options.
421
439
  * @permissionId BILLING.CALCULATE_TAX
422
- * @permissionScope Manage Stores - all permissions
423
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
424
- * @permissionScope Manage Stores
425
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
426
- * @permissionScope Manage Restaurants - all permissions
427
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
428
- * @permissionScope Manage eCommerce - all permissions
429
- * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
430
- * @permissionScope Manage Orders
431
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
432
440
  * @applicableIdentity APP
433
441
  * @applicableIdentity VISITOR
434
442
  * @fqn wix.billing.v1.TaxCalculation.CalculateTax
435
443
  */
436
- 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`>>;
437
- export interface CalculateTaxOptions {
444
+ 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`> & {
445
+ __applicationErrorsType?: CalculateTaxApplicationErrors;
446
+ }>;
447
+ interface CalculateTaxOptions {
438
448
  /**
439
449
  * Optional ID of the entity that tax is being calculated for. For example, a cart ID.
440
450
  * @format GUID
@@ -466,15 +476,9 @@ export interface CalculateTaxOptions {
466
476
  * @public
467
477
  * @documentationMaturity preview
468
478
  * @permissionId BILLING.TAX_CALCULATORS_READ
469
- * @permissionScope Manage Stores - all permissions
470
- * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
471
- * @permissionScope Manage Stores
472
- * @permissionScopeId SCOPE.STORES.MANAGE-STORES
473
- * @permissionScope Manage Restaurants - all permissions
474
- * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
475
- * @permissionScope Manage Orders
476
- * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
477
479
  * @applicableIdentity APP
478
480
  * @fqn wix.billing.v1.TaxCalculation.ListTaxCalculators
479
481
  */
480
- export declare function listTaxCalculators(): Promise<NonNullablePaths<ListTaxCalculatorsResponse, `taxCalculatorDetails` | `taxCalculatorDetails.${number}.appId` | `taxCalculatorDetails.${number}.displayName`>>;
482
+ declare function listTaxCalculators(): Promise<NonNullablePaths<ListTaxCalculatorsResponse, `taxCalculatorDetails` | `taxCalculatorDetails.${number}.appId` | `taxCalculatorDetails.${number}.displayName`>>;
483
+
484
+ export { type Address, type AddressIndex, type AddressIndexAddressIndexOptionsOneOf, type AggregatedTaxBreakdown, type ApplicationError, type CalculateTaxApplicationErrors, type CalculateTaxOptions, type CalculateTaxRequest, type CalculateTaxResponse, JurisdictionType, type JurisdictionTypeWithLiterals, type LineItem, type LineItemTaxDetails, type LineItemTaxSummary, type ListTaxCalculatorsRequest, type ListTaxCalculatorsResponse, type MultipleAddresses, type TaxBreakdown, type TaxCalculationGateway, type TaxCalculatorDetails, type TaxSummary, calculateTax, listTaxCalculators };