@wix/auto_sdk_ecom_tax-groups 1.0.22 → 1.0.24

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.
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  /**
2
4
  * A tax group is a category of specific line items grouped together based on their tax treatment.
3
5
  * You can create new tax groups to apply distinct tax rates and rules.
@@ -361,6 +363,11 @@ declare enum WebhookIdentityType {
361
363
  }
362
364
  /** @enumType */
363
365
  type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP';
366
+ type UpdateTaxGroupApplicationErrors = {
367
+ code?: 'ILLEGAL_UPDATE_ON_SYSTEM_DEFINED_TAX_GROUP';
368
+ description?: string;
369
+ data?: Record<string, any>;
370
+ };
364
371
  interface BaseEventMetadata {
365
372
  /**
366
373
  * App instance ID.
@@ -409,13 +416,130 @@ interface TaxGroupCreatedEnvelope {
409
416
  entity: TaxGroup;
410
417
  metadata: EventMetadata;
411
418
  }
419
+ /**
420
+ * Triggered when a tax group is created.
421
+ * @permissionScope Manage Stores - all permissions
422
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
423
+ * @permissionScope Manage Stores
424
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
425
+ * @permissionScope Manage Restaurants - all permissions
426
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
427
+ * @permissionScope Manage eCommerce - all permissions
428
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
429
+ * @permissionScope Manage Orders
430
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
431
+ * @permissionId BILLING.TAX_GROUP_READ
432
+ * @webhook
433
+ * @eventType wix.billing.v1.tax_group_created
434
+ * @serviceIdentifier wix.billing.v1.TaxGroups
435
+ * @slug created
436
+ * @documentationMaturity preview
437
+ */
438
+ declare function onTaxGroupCreated(handler: (event: TaxGroupCreatedEnvelope) => void | Promise<void>): void;
412
439
  interface TaxGroupDeletedEnvelope {
413
440
  metadata: EventMetadata;
414
441
  }
442
+ /**
443
+ * Triggered when a tax group is deleted.
444
+ * @permissionScope Manage Stores - all permissions
445
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
446
+ * @permissionScope Manage Stores
447
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
448
+ * @permissionScope Manage Restaurants - all permissions
449
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
450
+ * @permissionScope Manage eCommerce - all permissions
451
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
452
+ * @permissionScope Manage Orders
453
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
454
+ * @permissionId BILLING.TAX_GROUP_READ
455
+ * @webhook
456
+ * @eventType wix.billing.v1.tax_group_deleted
457
+ * @serviceIdentifier wix.billing.v1.TaxGroups
458
+ * @slug deleted
459
+ * @documentationMaturity preview
460
+ */
461
+ declare function onTaxGroupDeleted(handler: (event: TaxGroupDeletedEnvelope) => void | Promise<void>): void;
415
462
  interface TaxGroupUpdatedEnvelope {
416
463
  entity: TaxGroup;
417
464
  metadata: EventMetadata;
418
465
  }
466
+ /**
467
+ * Triggered when a tax group is updated.
468
+ * @permissionScope Manage Stores - all permissions
469
+ * @permissionScopeId SCOPE.DC-STORES-MEGA.MANAGE-STORES
470
+ * @permissionScope Manage Stores
471
+ * @permissionScopeId SCOPE.STORES.MANAGE-STORES
472
+ * @permissionScope Manage Restaurants - all permissions
473
+ * @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
474
+ * @permissionScope Manage eCommerce - all permissions
475
+ * @permissionScopeId SCOPE.DC-ECOM-MEGA.MANAGE-ECOM
476
+ * @permissionScope Manage Orders
477
+ * @permissionScopeId SCOPE.DC-STORES.MANAGE-ORDERS
478
+ * @permissionId BILLING.TAX_GROUP_READ
479
+ * @webhook
480
+ * @eventType wix.billing.v1.tax_group_updated
481
+ * @serviceIdentifier wix.billing.v1.TaxGroups
482
+ * @slug updated
483
+ * @documentationMaturity preview
484
+ */
485
+ declare function onTaxGroupUpdated(handler: (event: TaxGroupUpdatedEnvelope) => void | Promise<void>): void;
486
+ type TaxGroupNonNullablePaths = `name`;
487
+ /**
488
+ * Creates a tax group.
489
+ *
490
+ * Call Stores Update Product to add the `taxGroupId` to specific products to categorize as a group based on distinct tax treatment.
491
+ * Wix uses tax groups to calculate tax.
492
+ *
493
+ * In addition to tax groups you create, default tax groups are already included in all Wix catalogs.
494
+ * Call List Default Tax Groups to retrieve them. You can also use the Tax Groups Integration service plugin (REST only)
495
+ * to create new default tax groups that can be applied directly to an entire catalog of products.
496
+ * @param taxGroup - Tax group to create.
497
+ * @public
498
+ * @documentationMaturity preview
499
+ * @requiredField taxGroup
500
+ * @requiredField taxGroup.name
501
+ * @permissionId BILLING.TAX_GROUP_CREATE
502
+ * @applicableIdentity APP
503
+ * @returns Created tax group.
504
+ * @fqn wix.billing.v1.TaxGroups.CreateTaxGroup
505
+ */
506
+ declare function createTaxGroup(taxGroup: NonNullablePaths<TaxGroup, `name`>): Promise<NonNullablePaths<TaxGroup, TaxGroupNonNullablePaths>>;
507
+ /**
508
+ * Retrieves a tax group.
509
+ * @param taxGroupId - ID of the tax group to retrieve.
510
+ * @public
511
+ * @documentationMaturity preview
512
+ * @requiredField taxGroupId
513
+ * @permissionId BILLING.TAX_GROUP_READ
514
+ * @applicableIdentity APP
515
+ * @applicableIdentity VISITOR
516
+ * @returns Retrieved tax group.
517
+ * @fqn wix.billing.v1.TaxGroups.GetTaxGroup
518
+ */
519
+ declare function getTaxGroup(taxGroupId: string): Promise<NonNullablePaths<TaxGroup, TaxGroupNonNullablePaths>>;
520
+ /**
521
+ * Updates a tax group.
522
+ *
523
+ * Each time the tax group is updated, `revision` increments by 1.
524
+ * The current `revision` must be passed when updating the tax group.
525
+ * This ensures you're working with the latest tax group and prevents
526
+ * unintended overwrites.
527
+ * @param _id - Tax group ID.
528
+ * @public
529
+ * @documentationMaturity preview
530
+ * @requiredField _id
531
+ * @requiredField taxGroup
532
+ * @requiredField taxGroup.name
533
+ * @requiredField taxGroup.revision
534
+ * @param taxGroup - Tax group info.
535
+ * @permissionId BILLING.TAX_GROUP_UPDATE
536
+ * @applicableIdentity APP
537
+ * @returns Updated tax group.
538
+ * @fqn wix.billing.v1.TaxGroups.UpdateTaxGroup
539
+ */
540
+ declare function updateTaxGroup(_id: string, taxGroup: NonNullablePaths<UpdateTaxGroup, `name` | `revision`>): Promise<NonNullablePaths<TaxGroup, TaxGroupNonNullablePaths> & {
541
+ __applicationErrorsType?: UpdateTaxGroupApplicationErrors;
542
+ }>;
419
543
  interface UpdateTaxGroup {
420
544
  /**
421
545
  * Tax group ID.
@@ -448,6 +572,42 @@ interface UpdateTaxGroup {
448
572
  */
449
573
  _updatedDate?: Date | null;
450
574
  }
575
+ /**
576
+ * Deletes a tax group.
577
+ *
578
+ * If a tax group is deleted but the `taxGroupId` is still assigned to a product (see Stores Products API) then the default tax group is used to calculate tax.
579
+ * @param taxGroupId - ID of the tax group to delete.
580
+ * @public
581
+ * @documentationMaturity preview
582
+ * @requiredField taxGroupId
583
+ * @permissionId BILLING.TAX_GROUP_DELETE
584
+ * @applicableIdentity APP
585
+ * @fqn wix.billing.v1.TaxGroups.DeleteTaxGroup
586
+ */
587
+ declare function deleteTaxGroup(taxGroupId: string): Promise<void>;
588
+ /**
589
+ * Creates a query to retrieve a list of tax groups.
590
+ *
591
+ * The `queryTaxGroups()` function builds a query to retrieve a list of tax groups and returns a `TaxGroupsQueryBuilder` object.
592
+ *
593
+ * The returned object contains the query definition, which is typically used to run the query using the `find()` function.
594
+ *
595
+ * You can refine the query by chaining `TaxGroupsQueryBuilder` functions onto the query. `TaxGroupsQueryBuilder` functions enable you to sort, filter, and control the results that `queryTaxGroups()` returns.
596
+ *
597
+ * `queryTaxGroups()` runs with the following `TaxGroupsQueryBuilder` default that you can override:
598
+ * + `ascending("_id")`
599
+ *
600
+ * The functions that are chained to `queryTaxGroups()` are applied in the order they are called. For example, if you apply `ascending("name")` and then `ascending("_createdDate")`, the results are sorted first by the `"name"`, and then, if there are multiple results with the same `"name"`, the items are sorted by `"_createdDate"`.
601
+ *
602
+ * The following `TaxGroupsQueryBuilder` functions are supported for the `queryTaxGroups()` function. For a full description of the tax group object, see the object returned for the `items` property in `TaxGroupsQueryResult`.
603
+ * @public
604
+ * @documentationMaturity preview
605
+ * @permissionId BILLING.TAX_GROUP_READ
606
+ * @applicableIdentity APP
607
+ * @applicableIdentity VISITOR
608
+ * @fqn wix.billing.v1.TaxGroups.QueryTaxGroups
609
+ */
610
+ declare function queryTaxGroups(): TaxGroupsQueryBuilder;
451
611
  interface QueryCursorResult {
452
612
  cursors: Cursors;
453
613
  hasNext: () => boolean;
@@ -520,5 +680,36 @@ interface TaxGroupsQueryBuilder {
520
680
  /** @documentationMaturity preview */
521
681
  find: () => Promise<TaxGroupsQueryResult>;
522
682
  }
683
+ /**
684
+ * Retrieves a list of default tax groups.
685
+ *
686
+ * The default tax groups for a site are inherited by the apps installed on the site.
687
+ * For example, the Wix Stores app includes a `"Products"` tax group by default.
688
+ *
689
+ * Add additional default tax groups with the Tax Groups Integration service plugin (REST only).
690
+ * @public
691
+ * @documentationMaturity preview
692
+ * @permissionId BILLING.TAX_GROUP_READ
693
+ * @applicableIdentity APP
694
+ * @applicableIdentity VISITOR
695
+ * @fqn wix.billing.v1.TaxGroups.ListDefaultTaxGroups
696
+ */
697
+ declare function listDefaultTaxGroups(): Promise<NonNullablePaths<ListDefaultTaxGroupsResponse, {
698
+ [P in TaxGroupNonNullablePaths]: `taxGroups.${number}.${P}`;
699
+ }[TaxGroupNonNullablePaths]>>;
700
+ /**
701
+ * Retrieves default tax groups for specific apps.
702
+ * @param appIds - App IDs to retrieve default tax groups for.
703
+ * @public
704
+ * @documentationMaturity preview
705
+ * @requiredField appIds
706
+ * @permissionId BILLING.TAX_GROUP_READ
707
+ * @applicableIdentity APP
708
+ * @applicableIdentity VISITOR
709
+ * @fqn wix.billing.v1.TaxGroups.ListDefaultTaxGroupsByAppIds
710
+ */
711
+ declare function listDefaultTaxGroupsByAppIds(appIds: string[]): Promise<NonNullablePaths<ListDefaultTaxGroupsByAppIdsResponse, `results` | `results.${number}.taxGroupMetadata.originalIndex` | `results.${number}.taxGroupMetadata.success` | `results.${number}.taxGroupMetadata.error.code` | `results.${number}.taxGroupMetadata.error.description` | {
712
+ [P in TaxGroupNonNullablePaths]: `results.${number}.taxGroup.${P}`;
713
+ }[TaxGroupNonNullablePaths] | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`>>;
523
714
 
524
- export { type ApplicationError as A, type BulkActionMetadata as B, type CreateTaxGroupRequest as C, type DeleteTaxGroupRequest as D, type EntityCreatedEvent as E, type IdentificationDataIdOneOf as F, type GetTaxGroupRequest as G, type BaseEventMetadata as H, type ItemMetadata as I, type EventMetadata as J, type TaxGroupsQueryResult as K, type ListDefaultTaxGroupsResponse as L, type MessageEnvelope as M, type Paging as P, type QueryTaxGroupsRequest as Q, type RestoreInfo as R, SortOrder as S, type TaxGroup as T, type UpdateTaxGroup as U, WebhookIdentityType as W, type TaxGroupsQueryBuilder as a, type ListDefaultTaxGroupsByAppIdsResponse as b, type TaxGroupCreatedEnvelope as c, type TaxGroupDeletedEnvelope as d, type TaxGroupUpdatedEnvelope as e, type CreateTaxGroupResponse as f, type GetTaxGroupResponse as g, type UpdateTaxGroupRequest as h, type UpdateTaxGroupResponse as i, type DeleteTaxGroupResponse as j, type QueryV2 as k, type QueryV2PagingMethodOneOf as l, type Sorting as m, type CursorPaging as n, type QueryTaxGroupsResponse as o, type CursorPagingMetadata as p, type Cursors as q, type ListDefaultTaxGroupsRequest as r, type ListDefaultTaxGroupsByAppIdsRequest as s, type ListDefaultTaxGroupsByAppIdsResult as t, type DomainEvent as u, type DomainEventBodyOneOf as v, type EntityUpdatedEvent as w, type EntityDeletedEvent as x, type ActionEvent as y, type IdentificationData as z };
715
+ export { type ActionEvent, type ApplicationError, type BaseEventMetadata, type BulkActionMetadata, type CreateTaxGroupRequest, type CreateTaxGroupResponse, type CursorPaging, type CursorPagingMetadata, type Cursors, type DeleteTaxGroupRequest, type DeleteTaxGroupResponse, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type GetTaxGroupRequest, type GetTaxGroupResponse, type IdentificationData, type IdentificationDataIdOneOf, type ItemMetadata, type ListDefaultTaxGroupsByAppIdsRequest, type ListDefaultTaxGroupsByAppIdsResponse, type ListDefaultTaxGroupsByAppIdsResult, type ListDefaultTaxGroupsRequest, type ListDefaultTaxGroupsResponse, type MessageEnvelope, type Paging, type QueryTaxGroupsRequest, type QueryTaxGroupsResponse, type QueryV2, type QueryV2PagingMethodOneOf, type RestoreInfo, SortOrder, type SortOrderWithLiterals, type Sorting, type TaxGroup, type TaxGroupCreatedEnvelope, type TaxGroupDeletedEnvelope, type TaxGroupUpdatedEnvelope, type TaxGroupsQueryBuilder, type TaxGroupsQueryResult, type UpdateTaxGroup, type UpdateTaxGroupApplicationErrors, type UpdateTaxGroupRequest, type UpdateTaxGroupResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, createTaxGroup, deleteTaxGroup, getTaxGroup, listDefaultTaxGroups, listDefaultTaxGroupsByAppIds, onTaxGroupCreated, onTaxGroupDeleted, onTaxGroupUpdated, queryTaxGroups, updateTaxGroup };
@@ -0,0 +1,449 @@
1
+ // src/billing-v1-tax-group-tax-groups.universal.ts
2
+ import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
3
+ import { queryBuilder } from "@wix/sdk-runtime/query-builder";
4
+ import {
5
+ renameKeysFromSDKRequestToRESTRequest,
6
+ renameKeysFromRESTResponseToSDKResponse
7
+ } from "@wix/sdk-runtime/rename-all-nested-keys";
8
+
9
+ // src/billing-v1-tax-group-tax-groups.http.ts
10
+ import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
11
+ import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
12
+ import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
13
+ import { transformSDKFieldMaskToRESTFieldMask } from "@wix/sdk-runtime/transformations/field-mask";
14
+ import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
15
+ import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
16
+ function resolveWixBillingV1TaxGroupsUrl(opts) {
17
+ const domainToMappings = {
18
+ "www.wixapis.com": [
19
+ {
20
+ srcPath: "/billing/v1/tax-groups",
21
+ destPath: "/v1/tax-groups"
22
+ }
23
+ ],
24
+ "manage._base_domain_": [
25
+ {
26
+ srcPath: "/billing/v1/tax-groups",
27
+ destPath: "/v1/tax-groups"
28
+ }
29
+ ]
30
+ };
31
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
32
+ }
33
+ var PACKAGE_NAME = "@wix/auto_sdk_ecom_tax-groups";
34
+ function createTaxGroup(payload) {
35
+ function __createTaxGroup({ host }) {
36
+ const serializedData = transformPaths(payload, [
37
+ {
38
+ transformFn: transformSDKTimestampToRESTTimestamp,
39
+ paths: [
40
+ { path: "taxGroup.createdDate" },
41
+ { path: "taxGroup.updatedDate" }
42
+ ]
43
+ }
44
+ ]);
45
+ const metadata = {
46
+ entityFqdn: "wix.billing.v1.tax_group",
47
+ method: "POST",
48
+ methodFqn: "wix.billing.v1.TaxGroups.CreateTaxGroup",
49
+ packageName: PACKAGE_NAME,
50
+ url: resolveWixBillingV1TaxGroupsUrl({
51
+ protoPath: "/v1/tax-groups",
52
+ data: serializedData,
53
+ host
54
+ }),
55
+ data: serializedData,
56
+ transformResponse: (payload2) => transformPaths(payload2, [
57
+ {
58
+ transformFn: transformRESTTimestampToSDKTimestamp,
59
+ paths: [
60
+ { path: "taxGroup.createdDate" },
61
+ { path: "taxGroup.updatedDate" }
62
+ ]
63
+ }
64
+ ])
65
+ };
66
+ return metadata;
67
+ }
68
+ return __createTaxGroup;
69
+ }
70
+ function getTaxGroup(payload) {
71
+ function __getTaxGroup({ host }) {
72
+ const metadata = {
73
+ entityFqdn: "wix.billing.v1.tax_group",
74
+ method: "GET",
75
+ methodFqn: "wix.billing.v1.TaxGroups.GetTaxGroup",
76
+ packageName: PACKAGE_NAME,
77
+ url: resolveWixBillingV1TaxGroupsUrl({
78
+ protoPath: "/v1/tax-groups/{taxGroupId}",
79
+ data: payload,
80
+ host
81
+ }),
82
+ params: toURLSearchParams(payload),
83
+ transformResponse: (payload2) => transformPaths(payload2, [
84
+ {
85
+ transformFn: transformRESTTimestampToSDKTimestamp,
86
+ paths: [
87
+ { path: "taxGroup.createdDate" },
88
+ { path: "taxGroup.updatedDate" }
89
+ ]
90
+ }
91
+ ])
92
+ };
93
+ return metadata;
94
+ }
95
+ return __getTaxGroup;
96
+ }
97
+ function updateTaxGroup(payload) {
98
+ function __updateTaxGroup({ host }) {
99
+ const serializedData = transformPaths(payload, [
100
+ {
101
+ transformFn: transformSDKFieldMaskToRESTFieldMask,
102
+ paths: [{ path: "fieldMask" }]
103
+ },
104
+ {
105
+ transformFn: transformSDKTimestampToRESTTimestamp,
106
+ paths: [
107
+ { path: "taxGroup.createdDate" },
108
+ { path: "taxGroup.updatedDate" }
109
+ ]
110
+ }
111
+ ]);
112
+ const metadata = {
113
+ entityFqdn: "wix.billing.v1.tax_group",
114
+ method: "PATCH",
115
+ methodFqn: "wix.billing.v1.TaxGroups.UpdateTaxGroup",
116
+ packageName: PACKAGE_NAME,
117
+ url: resolveWixBillingV1TaxGroupsUrl({
118
+ protoPath: "/v1/tax-groups/{taxGroup.id}",
119
+ data: serializedData,
120
+ host
121
+ }),
122
+ data: serializedData,
123
+ transformResponse: (payload2) => transformPaths(payload2, [
124
+ {
125
+ transformFn: transformRESTTimestampToSDKTimestamp,
126
+ paths: [
127
+ { path: "taxGroup.createdDate" },
128
+ { path: "taxGroup.updatedDate" }
129
+ ]
130
+ }
131
+ ])
132
+ };
133
+ return metadata;
134
+ }
135
+ return __updateTaxGroup;
136
+ }
137
+ function deleteTaxGroup(payload) {
138
+ function __deleteTaxGroup({ host }) {
139
+ const metadata = {
140
+ entityFqdn: "wix.billing.v1.tax_group",
141
+ method: "DELETE",
142
+ methodFqn: "wix.billing.v1.TaxGroups.DeleteTaxGroup",
143
+ packageName: PACKAGE_NAME,
144
+ url: resolveWixBillingV1TaxGroupsUrl({
145
+ protoPath: "/v1/tax-groups/{taxGroupId}",
146
+ data: payload,
147
+ host
148
+ }),
149
+ params: toURLSearchParams(payload)
150
+ };
151
+ return metadata;
152
+ }
153
+ return __deleteTaxGroup;
154
+ }
155
+ function queryTaxGroups(payload) {
156
+ function __queryTaxGroups({ host }) {
157
+ const metadata = {
158
+ entityFqdn: "wix.billing.v1.tax_group",
159
+ method: "POST",
160
+ methodFqn: "wix.billing.v1.TaxGroups.QueryTaxGroups",
161
+ packageName: PACKAGE_NAME,
162
+ url: resolveWixBillingV1TaxGroupsUrl({
163
+ protoPath: "/v1/tax-groups/query",
164
+ data: payload,
165
+ host
166
+ }),
167
+ data: payload,
168
+ transformResponse: (payload2) => transformPaths(payload2, [
169
+ {
170
+ transformFn: transformRESTTimestampToSDKTimestamp,
171
+ paths: [
172
+ { path: "taxGroups.createdDate" },
173
+ { path: "taxGroups.updatedDate" }
174
+ ]
175
+ }
176
+ ])
177
+ };
178
+ return metadata;
179
+ }
180
+ return __queryTaxGroups;
181
+ }
182
+ function listDefaultTaxGroups(payload) {
183
+ function __listDefaultTaxGroups({ host }) {
184
+ const metadata = {
185
+ entityFqdn: "wix.billing.v1.tax_group",
186
+ method: "GET",
187
+ methodFqn: "wix.billing.v1.TaxGroups.ListDefaultTaxGroups",
188
+ packageName: PACKAGE_NAME,
189
+ url: resolveWixBillingV1TaxGroupsUrl({
190
+ protoPath: "/v1/tax-groups/default-tax-groups",
191
+ data: payload,
192
+ host
193
+ }),
194
+ params: toURLSearchParams(payload),
195
+ transformResponse: (payload2) => transformPaths(payload2, [
196
+ {
197
+ transformFn: transformRESTTimestampToSDKTimestamp,
198
+ paths: [
199
+ { path: "taxGroups.createdDate" },
200
+ { path: "taxGroups.updatedDate" }
201
+ ]
202
+ }
203
+ ])
204
+ };
205
+ return metadata;
206
+ }
207
+ return __listDefaultTaxGroups;
208
+ }
209
+ function listDefaultTaxGroupsByAppIds(payload) {
210
+ function __listDefaultTaxGroupsByAppIds({ host }) {
211
+ const metadata = {
212
+ entityFqdn: "wix.billing.v1.tax_group",
213
+ method: "POST",
214
+ methodFqn: "wix.billing.v1.TaxGroups.ListDefaultTaxGroupsByAppIds",
215
+ packageName: PACKAGE_NAME,
216
+ url: resolveWixBillingV1TaxGroupsUrl({
217
+ protoPath: "/v1/tax-groups/list-default-tax-groups-by-app-ids",
218
+ data: payload,
219
+ host
220
+ }),
221
+ data: payload,
222
+ transformResponse: (payload2) => transformPaths(payload2, [
223
+ {
224
+ transformFn: transformRESTTimestampToSDKTimestamp,
225
+ paths: [
226
+ { path: "results.taxGroup.createdDate" },
227
+ { path: "results.taxGroup.updatedDate" }
228
+ ]
229
+ }
230
+ ])
231
+ };
232
+ return metadata;
233
+ }
234
+ return __listDefaultTaxGroupsByAppIds;
235
+ }
236
+
237
+ // src/billing-v1-tax-group-tax-groups.universal.ts
238
+ import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
239
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
240
+ SortOrder2["ASC"] = "ASC";
241
+ SortOrder2["DESC"] = "DESC";
242
+ return SortOrder2;
243
+ })(SortOrder || {});
244
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
245
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
246
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
247
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
248
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
249
+ WebhookIdentityType2["APP"] = "APP";
250
+ return WebhookIdentityType2;
251
+ })(WebhookIdentityType || {});
252
+ async function createTaxGroup2(taxGroup) {
253
+ const { httpClient, sideEffects } = arguments[1];
254
+ const payload = renameKeysFromSDKRequestToRESTRequest({ taxGroup });
255
+ const reqOpts = createTaxGroup(payload);
256
+ sideEffects?.onSiteCall?.();
257
+ try {
258
+ const result = await httpClient.request(reqOpts);
259
+ sideEffects?.onSuccess?.(result);
260
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.taxGroup;
261
+ } catch (err) {
262
+ const transformedError = sdkTransformError(
263
+ err,
264
+ {
265
+ spreadPathsToArguments: {},
266
+ explicitPathsToArguments: { taxGroup: "$[0]" },
267
+ singleArgumentUnchanged: false
268
+ },
269
+ ["taxGroup"]
270
+ );
271
+ sideEffects?.onError?.(err);
272
+ throw transformedError;
273
+ }
274
+ }
275
+ async function getTaxGroup2(taxGroupId) {
276
+ const { httpClient, sideEffects } = arguments[1];
277
+ const payload = renameKeysFromSDKRequestToRESTRequest({
278
+ taxGroupId
279
+ });
280
+ const reqOpts = getTaxGroup(payload);
281
+ sideEffects?.onSiteCall?.();
282
+ try {
283
+ const result = await httpClient.request(reqOpts);
284
+ sideEffects?.onSuccess?.(result);
285
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.taxGroup;
286
+ } catch (err) {
287
+ const transformedError = sdkTransformError(
288
+ err,
289
+ {
290
+ spreadPathsToArguments: {},
291
+ explicitPathsToArguments: { taxGroupId: "$[0]" },
292
+ singleArgumentUnchanged: false
293
+ },
294
+ ["taxGroupId"]
295
+ );
296
+ sideEffects?.onError?.(err);
297
+ throw transformedError;
298
+ }
299
+ }
300
+ async function updateTaxGroup2(_id, taxGroup) {
301
+ const { httpClient, sideEffects } = arguments[2];
302
+ const payload = renameKeysFromSDKRequestToRESTRequest({
303
+ taxGroup: { ...taxGroup, id: _id }
304
+ });
305
+ const reqOpts = updateTaxGroup(payload);
306
+ sideEffects?.onSiteCall?.();
307
+ try {
308
+ const result = await httpClient.request(reqOpts);
309
+ sideEffects?.onSuccess?.(result);
310
+ return renameKeysFromRESTResponseToSDKResponse(result.data)?.taxGroup;
311
+ } catch (err) {
312
+ const transformedError = sdkTransformError(
313
+ err,
314
+ {
315
+ spreadPathsToArguments: { taxGroup: "$[1]" },
316
+ explicitPathsToArguments: { "taxGroup.id": "$[0]" },
317
+ singleArgumentUnchanged: false
318
+ },
319
+ ["_id", "taxGroup"]
320
+ );
321
+ sideEffects?.onError?.(err);
322
+ throw transformedError;
323
+ }
324
+ }
325
+ async function deleteTaxGroup2(taxGroupId) {
326
+ const { httpClient, sideEffects } = arguments[1];
327
+ const payload = renameKeysFromSDKRequestToRESTRequest({
328
+ taxGroupId
329
+ });
330
+ const reqOpts = deleteTaxGroup(payload);
331
+ sideEffects?.onSiteCall?.();
332
+ try {
333
+ const result = await httpClient.request(reqOpts);
334
+ sideEffects?.onSuccess?.(result);
335
+ } catch (err) {
336
+ const transformedError = sdkTransformError(
337
+ err,
338
+ {
339
+ spreadPathsToArguments: {},
340
+ explicitPathsToArguments: { taxGroupId: "$[0]" },
341
+ singleArgumentUnchanged: false
342
+ },
343
+ ["taxGroupId"]
344
+ );
345
+ sideEffects?.onError?.(err);
346
+ throw transformedError;
347
+ }
348
+ }
349
+ function queryTaxGroups2() {
350
+ const { httpClient, sideEffects } = arguments[0];
351
+ return queryBuilder({
352
+ func: async (payload) => {
353
+ const reqOpts = queryTaxGroups(payload);
354
+ sideEffects?.onSiteCall?.();
355
+ try {
356
+ const result = await httpClient.request(reqOpts);
357
+ sideEffects?.onSuccess?.(result);
358
+ return result;
359
+ } catch (err) {
360
+ sideEffects?.onError?.(err);
361
+ throw err;
362
+ }
363
+ },
364
+ requestTransformer: (query) => {
365
+ const args = [query, {}];
366
+ return renameKeysFromSDKRequestToRESTRequest({
367
+ ...args?.[1],
368
+ query: args?.[0]
369
+ });
370
+ },
371
+ responseTransformer: ({ data }) => {
372
+ const transformedData = renameKeysFromRESTResponseToSDKResponse(
373
+ transformPaths2(data, [])
374
+ );
375
+ return {
376
+ items: transformedData?.taxGroups,
377
+ pagingMetadata: transformedData?.pagingMetadata
378
+ };
379
+ },
380
+ errorTransformer: (err) => {
381
+ const transformedError = sdkTransformError(err, {
382
+ spreadPathsToArguments: {},
383
+ explicitPathsToArguments: { query: "$[0]" },
384
+ singleArgumentUnchanged: false
385
+ });
386
+ throw transformedError;
387
+ },
388
+ pagingMethod: "CURSOR",
389
+ transformationPaths: {}
390
+ });
391
+ }
392
+ async function listDefaultTaxGroups2() {
393
+ const { httpClient, sideEffects } = arguments[0];
394
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
395
+ const reqOpts = listDefaultTaxGroups(payload);
396
+ sideEffects?.onSiteCall?.();
397
+ try {
398
+ const result = await httpClient.request(reqOpts);
399
+ sideEffects?.onSuccess?.(result);
400
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
401
+ } catch (err) {
402
+ const transformedError = sdkTransformError(
403
+ err,
404
+ {
405
+ spreadPathsToArguments: {},
406
+ explicitPathsToArguments: {},
407
+ singleArgumentUnchanged: false
408
+ },
409
+ []
410
+ );
411
+ sideEffects?.onError?.(err);
412
+ throw transformedError;
413
+ }
414
+ }
415
+ async function listDefaultTaxGroupsByAppIds2(appIds) {
416
+ const { httpClient, sideEffects } = arguments[1];
417
+ const payload = renameKeysFromSDKRequestToRESTRequest({ appIds });
418
+ const reqOpts = listDefaultTaxGroupsByAppIds(payload);
419
+ sideEffects?.onSiteCall?.();
420
+ try {
421
+ const result = await httpClient.request(reqOpts);
422
+ sideEffects?.onSuccess?.(result);
423
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
424
+ } catch (err) {
425
+ const transformedError = sdkTransformError(
426
+ err,
427
+ {
428
+ spreadPathsToArguments: {},
429
+ explicitPathsToArguments: { appIds: "$[0]" },
430
+ singleArgumentUnchanged: false
431
+ },
432
+ ["appIds"]
433
+ );
434
+ sideEffects?.onError?.(err);
435
+ throw transformedError;
436
+ }
437
+ }
438
+ export {
439
+ SortOrder,
440
+ WebhookIdentityType,
441
+ createTaxGroup2 as createTaxGroup,
442
+ deleteTaxGroup2 as deleteTaxGroup,
443
+ getTaxGroup2 as getTaxGroup,
444
+ listDefaultTaxGroups2 as listDefaultTaxGroups,
445
+ listDefaultTaxGroupsByAppIds2 as listDefaultTaxGroupsByAppIds,
446
+ queryTaxGroups2 as queryTaxGroups,
447
+ updateTaxGroup2 as updateTaxGroup
448
+ };
449
+ //# sourceMappingURL=index.typings.mjs.map