avatax 26.8.3 → 26.10.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a3e1472788c94b587248cf0936bd15f9a5dce475f72f8f3917612403e8b7b087
4
- data.tar.gz: 717b166329c75462d34f9e47f852955980f1d51c4bfead90510d54edb03cf62c
3
+ metadata.gz: '099ec35a196f72ddb27c67d1a53b75943acc79b9f850e4ee88b08ffb8c333a07'
4
+ data.tar.gz: e7afd978e7876ca949d5e604e84c5df2d38adcd85097ad25bcc8125615153f6a
5
5
  SHA512:
6
- metadata.gz: 05725ffcfaf3235c09db4cce6b5d1e7a29c8ba67ecdcd64f847aadf047de8a1e733f6725249205bd794a4b5eb69c99fcf64953e5311962b8defee288b4fc724f
7
- data.tar.gz: b0af7834d8f9b22a7bfac90edbbd81a7d48aa620366985c4c7da6b0c85a949166e0fe214146077b9c4adf237acdfebb986182a64692959a87cb22e9e2ef6dfa0
6
+ metadata.gz: eb0f02dd980361eacf7a571487107527b584274bb856811acba4d08c272bfa27c524a7d4d58880f25f0411f6c2c256d18af0ab1b18673f52dac0c1a52159aea5
7
+ data.tar.gz: 9d31fb692a1188c9d630c2228d673274eee914876b4fbbedcce9f4fa19844c3d4b672dff922047fab4eb31f679f1813ff6bb70721a3086167bc9dc6b5e05bc3c
@@ -69,10 +69,6 @@ module AvaTax
69
69
  # required, please use the
70
70
  # [CreateTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/).
71
71
  #
72
- # Set `skipTransactionValidation` to true to defer transaction type, company code, and
73
- # nested model validation until BatchV2 processes each transaction. Per-transaction
74
- # validation failures are then written to the batch error file without blocking upload.
75
- #
76
72
  # The maximum content length of the request body is limited to 28.6 MB. If this limit
77
73
  # is exceeded, a 404 Not Found status will be returned (possibly with a CORS error if
78
74
  # the API is called from a browser). In this situation, please split the request into
@@ -88,6 +84,33 @@ module AvaTax
88
84
  def create_batches(companyId, model) path = "/api/v2/companies/#{companyId}/batches"
89
85
  post(path, model, {}, AvaTax::VERSION) end
90
86
 
87
+ # Create custom rules import batch.
88
+ #
89
+ # Create a new custom rules import batch object attached to this company.
90
+ #
91
+ # The batch payload is the Custom Rules export envelope (tax rules, custom rules, and
92
+ # advanced rules). It is stored as JSON and processed downstream by BatchV2.
93
+ #
94
+ # When a custom rules import batch is created, it is added to the AvaTax Batch v2 Queue and will be
95
+ # processed in the order it was received. To check the
96
+ # status of a batch, fetch the batch and retrieve the results of the batch
97
+ # operation.
98
+ #
99
+ # The maximum content length of the request body is limited to 28.6 MB. If this limit
100
+ # exceeds then a 404 Not Found status is returned (possibly with a CORS error if
101
+ # the API is called from a browser). In this situation, please split the request into
102
+ # smaller batches.
103
+ #
104
+ # ### Security Policies
105
+ #
106
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, FirmAdmin, SSTAdmin, SystemAdmin, SystemOperator, TechnicalSupportAdmin.
107
+ # Swagger Name: AvaTaxClient
108
+ # @param companyId [Integer] The ID of the company that owns this batch.
109
+ # @param model [Object] The custom rules import batch you wish to create.
110
+ # @return [Object]
111
+ def create_custom_rules_batch(companyId, model) path = "/api/v2/companies/#{companyId}/batches/customrules"
112
+ post(path, model, {}, AvaTax::VERSION) end
113
+
91
114
  # Create item import batch.
92
115
  #
93
116
  # Create a new item import batch objects attached to this company.
@@ -127,6 +150,13 @@ module AvaTax
127
150
  # required, please use the
128
151
  # [CreateTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/).
129
152
  #
153
+ # Set `skipTransactionValidation` to true to defer transaction type, company code
154
+ # existence, and nested model validation until BatchV2 processes each transaction.
155
+ # Per-transaction validation failures are then written to the batch error file without
156
+ # blocking upload. Skipping validation only defers those checks; transactions that omit
157
+ # `companyCode` still inherit the company from this URL, exactly as they do when
158
+ # validation runs at upload time.
159
+ #
130
160
  # The maximum content length of the request body is limited to 28.6 MB. If this limit
131
161
  # is exceeded, a 404 Not Found status will be returned (possibly with a CORS error if
132
162
  # the API is called from a browser). In this situation, please split the request into
@@ -343,6 +343,47 @@ module AvaTax
343
343
  def list_custom_fields_for_certificate(companyId, id) path = "/api/v2/companies/#{companyId}/certificates/#{id}/custom-fields"
344
344
  get(path, {}, AvaTax::VERSION) end
345
345
 
346
+ # List the exemption matrix entries for an exposure zone
347
+ #
348
+ # Returns the entries in this company's exemption matrix for one exposure zone.
349
+ #
350
+ # Each entry carries the `timeLength` rule used to work out when a certificate
351
+ # recorded for that exposure zone and exempt reason expires, and the
352
+ # `qualifyingStatement` shown to the customer. See the `timeLength` field
353
+ # description for the meaning of each rule value.
354
+ #
355
+ # `exposureZoneId` is mandatory. Supplying `exemptReasonId` narrows the result to
356
+ # that one exempt reason; omitting it returns every exempt reason configured for
357
+ # the zone. Call `ListCertificateExposureZones` and `ListCertificateExemptReasons`
358
+ # to look up the available ID numbers.
359
+ #
360
+ # An exposure zone with nothing configured returns an empty list rather than a
361
+ # `404`, so "nothing configured" can be told apart from "no expiration rule".
362
+ # Exempt reasons that are disabled, or that denote exposure rather than exemption,
363
+ # are never listed.
364
+ #
365
+ # Results are paginated with `$top` and `$skip`. As with the other exemption
366
+ # certificate query APIs, `$skip` must be a multiple of `$top`.
367
+ #
368
+ # Before you can use any exemption certificates endpoints, you must set up your company for exemption certificate data storage.
369
+ # Companies that do not have this storage system set up will see `CertCaptureNotConfiguredError` when they call exemption
370
+ # certificate related APIs. To check if this is set up for a company, call `GetCertificateSetup`. To request setup of exemption
371
+ # certificate storage for this company, call `RequestCertificateSetup`.
372
+ #
373
+ # ### Security Policies
374
+ #
375
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
376
+ # * This API depends on the following active services:*Required* (all): AvaTaxPro, ECMEssentials, ECMPro, ECMPremium, VEMPro, VEMPremium, ECMProComms, ECMPremiumComms.
377
+ # Swagger Name: AvaTaxClient
378
+ # @param companyId [Integer] The ID number of the company
379
+ # @param exposureZoneId [Integer] Required. The ID number of the exposure zone.
380
+ # @param exemptReasonId [Integer] Optional. The ID number of an exempt reason. Omit to return every exempt reason configured for the exposure zone.
381
+ # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
382
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
383
+ # @return [FetchResult]
384
+ def list_exemption_matrix(companyId, options={}) path = "/api/v2/companies/#{companyId}/exemptionmatrix"
385
+ get(path, options, AvaTax::VERSION) end
386
+
346
387
  # List local exempt jurisdictions for a given exposure zone and tax code
347
388
  #
348
389
  # Returns the list of jurisdictions that are valid for a given combination of exposure zone
@@ -0,0 +1,503 @@
1
+ module AvaTax
2
+ class Client
3
+ module CustomRules
4
+
5
+
6
+ # Create a new custom rule
7
+ #
8
+ # Creates a new custom rule object attached to this company.
9
+ #
10
+ # Custom rules modify the default AvaTax behavior during tax calculation, customizing it to
11
+ # match requirements specific to your business. Rules can be used to change the taxability of
12
+ # an item, change the tax base of an item, alter the tax rate, modify transaction fields
13
+ # and addresses, allocate and split line items, update the location code, and more.
14
+ #
15
+ # Please use custom rules carefully and ensure they match the behavior agreed upon with your
16
+ # auditor, legal representative, and accounting team.
17
+ #
18
+ # ---
19
+ #
20
+ # Rules are built from modular _components_. A component can be a rule-wide variable or a
21
+ # _node_ in the directed acyclic graph defining the rule's behavior. To build a rule from scratch,
22
+ # start with `GetCustomRuleComponents` to retrieve supported components and the JSON `dataSchema` for each.
23
+ #
24
+ # Ensure each component has a unique `id` (for _Variable_ components, this is its name) and that its `data` field conforms to the node subtype's `dataSchema`.
25
+ # The `data` must be a single-escaped JSON string, not a nested object. Do not quote numbers or booleans, use only valid enumeration values, and keep
26
+ # arrays arrays even if they only contain a single element.
27
+ #
28
+ # _Nodes_ may be _Conditions_ or _Actions_. When deciding which node to use, prefer nodes for specific use cases,
29
+ # such as `MatchAddress` and `UpdateAddress`, over generic ones `MatchField` and `UpdateField` when possible.
30
+ #
31
+ # Use the `GetCustomRuleFields` endpoint to query the fields that can be used in nodes which accept arbitrary fields, such as `MatchField` and `UpdateField`.
32
+ #
33
+ # Each node defines its outgoing edges by specifying its child node IDs in the `next` array. The result of a node execution is a set of matches
34
+ # (e.g. which lines on the document met the criteria). Node results behave as follows:
35
+ # - Sequences *intersect* their results ("AND")
36
+ # - Branches *propagate* their results as the input to each child
37
+ # - Merges *union* their results ("OR")
38
+ #
39
+ # The `scope` of a condition is what part of the transaction it operates on: `Document`, `SomeLines`, `OneLine`, `AllLines`, or `NoLines`.
40
+ # The `scope` of an action determines what part of the transaction to apply changes to: `Document`, `MatchedLines`, `NotMatchedLines`, or `AllLines`.
41
+ #
42
+ # When using a rule to adjust taxability,
43
+ # - Prefer classifying the transaction so Avalara's built-in tax content applies
44
+ # (for example by setting a standard tax code or entity use code with
45
+ # `UpdateField`) before using a `TaxRule*` action to override that content.
46
+ # - To treat a line as nontaxable under Avalara's standard nontaxable code, use an
47
+ # `UpdateField` node to set its tax code to `NT`.
48
+ # - Place the UpdateField early in the rule so it takes effect pre-calculation.
49
+ # - To impact tax details, the MatchTax condition node is required to match on jurisdiction + tax type combinations.
50
+ # - There can only be one MatchTax node per rule, but it can have more than one criteria set.
51
+ # - Each criteria set has `matchTaxId` (unique identifier), `country`, `region`, `jurisdictionTypeId`, `jurisCode`, `taxTypeCode`, `taxSubType`, and `rateTypeCode`.
52
+ # - Tax subtypes and rate types may be wildcard (`*` or `ALL`) for most rule types.
53
+ # - Always use full names for `jurisdictionTypeId` (`Country`, `State`, `City`, `County`, `Special`) instead of their abbreviations.
54
+ # - A wildcard jurisdiction code (`*` or `ALL`) applies the treatment to all jurisdictions of the given `jurisdictionTypeId`.
55
+ # - `TaxRule*` action nodes define how the tax is to be adjusted.
56
+ # - `TaxRuleProductTaxability`: sets an item's taxability and assigns its rate type, so it requires a specific (non-wildcard) `rateTypeCode`.
57
+ # - `TaxRuleRateOverride`: overrides Avalara's tax rate.
58
+ # - `TaxRuleBaseOverride`: changes the tax base as a proportion of the original amount (e.g. `0.5` = 50% taxable).
59
+ # - `TaxRuleExemptEntity`: after sourcing, overrides whether the matched line is
60
+ # exempt for the jurisdiction and tax type.
61
+ # - Caps and thresholds can be applied with the `TaxRuleProductTaxability` or `TaxRuleRateOverride` actions.
62
+ # - A threshold buckets amounts up to and including the threshold as non-taxable.
63
+ # - A cap limits the taxable amount (per unit by default, multiplied by quantity); amounts above the cap become non-taxable.
64
+ # - Add the `Document` option to apply the cap across all matching lines of the document.
65
+ # - A `default` value must be provided in `TaxRule*` nodes. Overrides for specific jurisdictions are optional and provided in an `overrides` array (NOT a dictionary).
66
+ # - If the tax treatment (rate, taxability, etc.) is the same for all configured jurisdictions, set only the `default` value and omit `overrides`.
67
+ # - You only need to set overrides for values that differ from the default.
68
+ # - If a `matchTaxId` member is present in an override, it will apply to the corresponding criteria in the MatchTax node.
69
+ # - If a `matchTaxId` member is NOT present in an override, pattern matching is performed on the override criteria fields with omitted fields treated as wildcards.
70
+ # - When multiple tax rules apply, a more specific tax type/subtype beats a wildcard, and the latest effective date wins.
71
+ # - A Tax Code and Tariff Code condition are mutually exclusive.
72
+ # - Expressions cannot be used in nodes which directly affect tax treatment.
73
+ #
74
+ # Some nodes support _expressions_, which may have variable values evaluated at transaction time.
75
+ # Expression-supporting fields should be indicated on the node's data schema. Expressions allow
76
+ # formulas using arithmetic, substitutions, and references to transaction fields; for example:
77
+ # - `{{Document.TotalAmount}} * 0.1` (10% of the total document amount)
78
+ # - `{{Line.UserDefinedFields.Udf8}}` (Line-level user-defined field 8)
79
+ # - `{{Line.Ref1}}{{Line.Ref2}}` (A line's Ref1 and Ref2 values concatenated)
80
+ # - `2 + {{MyVar}}` (The value of the "MyVar" variable defined elsewhere in the rule, plus 2)
81
+ #
82
+ # Use the `GetCustomRuleTokens` endpoint to enumerate or search for valid tokens that can be used in expressions.
83
+ #
84
+ # Lookup files / reference lists may be used where expressions are supported. Use the syntax `{{FileName.ColumnName}}` to match against
85
+ # a column in a Condition and use the value from another column in the matched row in an Action. Matching scopes must be compatible -
86
+ # line-level matches cannot be used to update a document-level field.
87
+ #
88
+ # Rule nodes are assigned execution steps based on their contents and surrounding nodes. For instance, nodes that follow tax
89
+ # rule actions (`TaxRule*`) or require a calculated field (such as taxable amount) are executed after tax calculation instead
90
+ # of before calculation. Not every node type may execute in every step. Place them accordingly to their `validSteps`.
91
+ # A rule will be rejected if an ordering cannot be resolved. Rules execute in the following stages:
92
+ # - `OnRequest`: On the API request values, before document validation.
93
+ # - `AfterAddressValidation`: After addresses have been geo-coded / validated once.
94
+ # - `AfterSourcing`: After jurisdictions and tax types have been evaluated, but before tax calculation.
95
+ # - `AfterDetails`: After tax calculation details have been generated.
96
+ # - `OnResponse`: After the document has been saved, if applicable; on the API response only.
97
+ #
98
+ # ---
99
+ #
100
+ # It is recommended to validate the rule with the `ValidateCustomRule` endpoint before creating it.
101
+ # This will let you review the rule's execution plan and any associated diagnostic information before saving it.
102
+ #
103
+ # ### Security Policies
104
+ #
105
+ # * This API requires one of the following user roles: AccountAdmin, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
106
+ # Swagger Name: AvaTaxClient
107
+ # @param companyId [Integer] The ID of the company to create the rule for.
108
+ # @param model [Object] The rule you wish to create.
109
+ # @return [Object]
110
+ def create_custom_rule(companyId, model) path = "/api/v2/companies/#{companyId}/customrules"
111
+ post(path, model, {}, AvaTax::VERSION) end
112
+
113
+ # Delete a custom rule
114
+ #
115
+ # Delete a single custom rule object attached to this company.
116
+ #
117
+ # To maintain tax calculation consistency for recalculation of backdated transactions, it is
118
+ # recommended to expire a rule (set a definite end date) instead of deleting it when the rule
119
+ # requirements remain accurate for a past time period. This will keep the old version of the
120
+ # rule active for that time period so historical transactions re-calculate with the appropriate rule.
121
+ #
122
+ # If only minor changes are required (i.e. the overall purpose of the rule does not change),
123
+ # and historical transactions would not be significantly impacted by the update, prefer using
124
+ # the UpdateCustomRule operation instead of deleting and re-creating the rule.
125
+ #
126
+ # Please use custom rules carefully and ensure they match the behavior agreed upon with your
127
+ # auditor, legal representative, and accounting team.
128
+ #
129
+ # ### Security Policies
130
+ #
131
+ # * This API requires one of the following user roles: AccountAdmin, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
132
+ # Swagger Name: AvaTaxClient
133
+ # @param companyId [Integer] The ID of the company that owns the rule.
134
+ # @param id [Integer] The ID of the rule to delete.
135
+ # @return [ErrorDetail[]]
136
+ def delete_custom_rule(companyId, id) path = "/api/v2/companies/#{companyId}/customrules/#{id}"
137
+ delete(path, {}, AvaTax::VERSION) end
138
+
139
+ # Export custom rules for a company
140
+ #
141
+ # Export all rule objects defined for this company as a portable JSON envelope.
142
+ #
143
+ # The export set can be filtered and paginated using the same query parameters
144
+ # as the `ListCustomRules` endpoint.
145
+ #
146
+ # This endpoint uses OData filter syntax in order to support querying nested properties;
147
+ # note the following differences from standard AvaTax filtering:
148
+ # - Instead of the infix form, use the contains() function, e.g. `contains(description, 'Amount')`
149
+ # - Query collection fields with the any()/all() lambda operators, e.g. `subtype/any(r: r eq 'UpdateLocationCode')`.
150
+ #
151
+ # The exported envelope can be re-imported into another company or account using the
152
+ # `CreateCustomRulesBatch` endpoint.
153
+ #
154
+ # By default, the export includes all rule types:
155
+ # - Custom Rules, the latest system which provides a new, unified, graph-based interface for engine customization
156
+ # - Advanced Rules, also known as transaction rules, the legacy system for modifying incoming or outgoing transaction fields
157
+ # - Legacy Tax Rules, traditional taxability customization
158
+ #
159
+ # Filtering is applied in two stages: `taxRuleFilter`, `advancedRuleFilter`, and `customRuleFilter` are each
160
+ # applied first, against their respective inner entity type, to select which rules are included. The
161
+ # resulting records are then converted into summary rows, and `filter` is applied afterward against
162
+ # those generated summary records.
163
+ #
164
+ # ### Security Policies
165
+ #
166
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
167
+ # Swagger Name: AvaTaxClient
168
+ # @param companyId [Integer] The ID of the company to produce a rule export for.
169
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).
170
+ # @param taxRuleFilter [String] A simple filter statement to select specific TaxRuleModel records. Applied to the underlying Legacy Tax Rule entities before they are converted into summary records; evaluated before `filter`.
171
+ # @param advancedRuleFilter [String] A simple filter statement to select specific AdvancedRuleExecutionModel records. Applied to the underlying Advanced Rule entities before they are converted into summary records; evaluated before `filter`.
172
+ # @param customRuleFilter [String] A simple filter statement to select specific CustomRuleOutputModel records. Applied to the underlying Custom Rule entities before they are converted into summary records; evaluated before `filter`.
173
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
174
+ # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
175
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
176
+ # @return [Object]
177
+ def export_custom_rules(companyId, options={}) path = "/api/v2/companies/#{companyId}/customrules/export"
178
+ get(path, options, AvaTax::VERSION) end
179
+
180
+ # Retrieve a single custom rule
181
+ #
182
+ # Retrieves a single custom rule object attached to this company.
183
+ #
184
+ # Use this endpoint to verify the persisted state of a specific rule given its ID,
185
+ # or to fetch the latest, most detailed definition for editing and auditing.
186
+ #
187
+ # Custom rules modify the default AvaTax behavior during tax calculation, customizing it to
188
+ # match requirements specific to your business. Rules can be used to change the taxability of
189
+ # an item, change the tax base of an item, alter the tax rate, modify transaction fields
190
+ # and addresses, allocate and split line items, update the location code, and more.
191
+ #
192
+ # Please use custom rules carefully and ensure they match the behavior agreed upon with your
193
+ # auditor, legal representative, and accounting team.
194
+ #
195
+ # ### Security Policies
196
+ #
197
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
198
+ # Swagger Name: AvaTaxClient
199
+ # @param companyId [Integer] The ID of the company that owns the rule.
200
+ # @param id [Integer] The ID of the rule.
201
+ # @return [Object]
202
+ def get_custom_rule(companyId, id) path = "/api/v2/companies/#{companyId}/customrules/#{id}"
203
+ get(path, {}, AvaTax::VERSION) end
204
+
205
+ # Fetch a filtered list of components used in custom rule definitions
206
+ #
207
+ # Retrieve a list of supported custom rule components. Start here to enumerate
208
+ # supported Conditions, Actions, and Variables to design rule graphs.
209
+ #
210
+ # A component may be of the following types:
211
+ # - *Conditions*, which are nodes which evaluate transaction-based criteria
212
+ # - *Actions*, which are nodes that change or update a transaction when preceding conditions pass
213
+ # - *Variables*, which are predefined values or expressions with rule-wide scope
214
+ #
215
+ # A component's subtype is the specific kind of condition, action, or variable it is. Examples include:
216
+ # - *Conditions*: MatchField, MatchAddress, MatchCustomerCode, MatchDocumentType, MatchTariffCode, MatchTaxCode, MatchEntityUseCode, MatchTax
217
+ # - *Actions*: UpdateField, UpdateAddress, UpdateLocationCode, TaxRuleRateOverride, TaxRuleBaseOverride, TaxRuleExemptEntity, TaxRuleProductTaxability, AddMessage
218
+ # - *Variables*: Expression, Aggregation
219
+ #
220
+ # The definition of a custom rule is a directed acyclic graph consisting of condition and action nodes.
221
+ # Variable components have rule-wide scope and are not part of the execution graph, but all three
222
+ # component types conform to the same model.
223
+ #
224
+ # The `dataSchema` member is an escaped JSON string which defines, in JSON schema format,
225
+ # the expected structure of the `data` property of any rule component with the corresponding `subtype`.
226
+ # Swagger Name: AvaTaxClient
227
+ # @param companyId [Integer] The ID of the company to retrieve supported definitions for.
228
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).
229
+ # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
230
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
231
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
232
+ # @return [FetchResult]
233
+ def get_custom_rule_components(companyId, options={}) path = "/api/v2/companies/#{companyId}/customrules/definitions/components"
234
+ get(path, options, AvaTax::VERSION) end
235
+
236
+ # Fetch a filtered list of transaction fields supported by custom rules
237
+ #
238
+ # Query the transaction properties which may be used in custom rules.
239
+ #
240
+ # The following metadata is also included for each property:
241
+ # - A display name and description
242
+ # - The data type
243
+ # - Whether it exists at document and/or line level
244
+ # - Whether it can be read from and/or written to
245
+ # - Whether it is only available in certain steps; examples of such restrictions include: only after address validation, only after tax calculation
246
+ #
247
+ # Note that the name of a field may differ between the rule system and the raw transaction models
248
+ # due to the abstractions the rules system provides. The values returned by this endpoint should
249
+ # be considered authoritative in all custom rules contexts, including:
250
+ # - Components which accept field names, such as `MatchField` and `UpdateField`
251
+ # - In variable expressions; see also `GetCustomRuleTokens`
252
+ # Swagger Name: AvaTaxClient
253
+ # @param companyId [Integer] The ID of the company to retrieve supported fields for.
254
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).
255
+ # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
256
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
257
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
258
+ # @return [FetchResult]
259
+ def get_custom_rule_fields(companyId, options={}) path = "/api/v2/companies/#{companyId}/customrules/definitions/fields"
260
+ get(path, options, AvaTax::VERSION) end
261
+
262
+ # Construct an empty template for a rule definition
263
+ #
264
+ # Generate a starter graph with empty nodes based on parameters specified in the request body.
265
+ #
266
+ # Typically, this is used to initialize an editor interface after selecting basic parameters for rule creation
267
+ # such as the types of conditions and actions to include.
268
+ #
269
+ # Note that this endpoint does not return a complete rule entity, only its behavior definition.
270
+ # The rule definition returned is not guaranteed to pass validation, as most fields for component content are left empty.
271
+ # Fill in any empty fields, then call `ValidateCustomRule` to validate and `CreateCustomRule` to persist.
272
+ # Swagger Name: AvaTaxClient
273
+ # @param companyId [Integer] The ID of the company
274
+ # @param model [Object] The template request
275
+ # @return [Object]
276
+ def get_custom_rule_template(companyId, model) path = "/api/v2/companies/#{companyId}/customrules/definitions/template"
277
+ post(path, model, {}, AvaTax::VERSION) end
278
+
279
+ # Fetch a filtered list of supported custom rule expression tokens
280
+ #
281
+ # Query the list of supported tokens for use in custom rule expressions.
282
+ #
283
+ # Some rule components support _expressions_, which may have variable values evaluated
284
+ # each time the rule runs on a transaction. An _expression token_ is a sequence delimited
285
+ # by double braces, such as `{{Document.Description}}`, which refers to a variable value
286
+ # and evaluates to that value at transaction time when used within a supporting rule.
287
+ #
288
+ # Expressions can contain formulas using many of these tokens. For example, the expression
289
+ # `{{Document.TotalAmount}} * 0.1` evaluates to 10% of the total document amount for
290
+ # the current transaction.
291
+ #
292
+ # Supported tokens include all readable transaction fields, including parameters and user-defined fields,
293
+ # as well as company-specific reference lists. Examples of the different token types include:
294
+ # - Document-level fields: `{{Document.CustomerCode}}`
295
+ # - Line-level fields: `{{Line.TaxCode}}`
296
+ # - Rule-wide variables: `{{MyVar}}`
297
+ # - Company lookup files: `{{FileName.ColumnName}}`
298
+ #
299
+ # String-type tokens support _functions_, which can be used for transforming the evaluated value:
300
+ # - `Substring(start, length)`: Extract up to `length` characters starting at 0-based index `start`; omit `length` to read to end
301
+ # - `Trim(str)`: Trim complete occurrences of `str` from the beginning and end of the string; omit `str` to trim whitespace
302
+ #
303
+ # Place functions inside the braces, e.g. `{{Line.Ref1.Substring(1,2)}}`.
304
+ #
305
+ # When using expressions in escaped JSON component `data`, include them verbatim inside the
306
+ # JSON string value. Only escape the surrounding double quotes required by JSON.
307
+ # Do not double-escape the braces in `{{...}}`.
308
+ # Swagger Name: AvaTaxClient
309
+ # @param companyId [Integer] The ID of the company to retrieve supported tokens for.
310
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).
311
+ # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
312
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
313
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
314
+ # @return [FetchResult]
315
+ def get_custom_rule_tokens(companyId, options={}) path = "/api/v2/companies/#{companyId}/customrules/definitions/tokens"
316
+ get(path, options, AvaTax::VERSION) end
317
+
318
+ # Retrieve all custom rules for a company
319
+ #
320
+ # Query the custom rule objects defined for this company.
321
+ #
322
+ # This endpoint uses OData filter syntax in order to support querying nested properties;
323
+ # note the following differences from standard AvaTax filtering:
324
+ # - Instead of the infix form, use the contains() function, e.g. `contains(description, 'Amount')`
325
+ # - Query collection fields with the any()/all() lambda operators, e.g. `subtype/any(r: r eq 'UpdateLocationCode')`.
326
+ #
327
+ # By default, all rule types are included:
328
+ # - Custom Rules, the latest system which provides a new, unified, graph-based interface for engine customization
329
+ # - Advanced Rules, also known as transaction rules, the legacy system for modifying incoming or outgoing transaction fields
330
+ # - Legacy Tax Rules, traditional taxability customization
331
+ #
332
+ # Note that not every rule type supports every field in `CustomRuleSummaryModel`, so information
333
+ # unavailable for that rule type may be omitted.
334
+ #
335
+ # Filtering is applied in two stages: `taxRuleFilter`, `advancedRuleFilter`, and `customRuleFilter` are each
336
+ # applied first, against their respective inner entity type, to select which rules are included. The
337
+ # resulting records are then converted into summary rows, and `filter` is applied afterward against
338
+ # those generated `CustomRuleSummaryModel` summary records.
339
+ #
340
+ # ### Security Policies
341
+ #
342
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
343
+ # Swagger Name: AvaTaxClient
344
+ # @param companyId [Integer] The ID of the company to query the custom rules for.
345
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* ruleEntity
346
+ # @param taxRuleFilter [String] A simple filter statement to select specific TaxRuleModel records. Applied to the underlying Legacy Tax Rule entities before they are converted into summary records; evaluated before `filter`.
347
+ # @param advancedRuleFilter [String] A simple filter statement to select specific AdvancedRuleExecutionModel records. Applied to the underlying Advanced Rule entities before they are converted into summary records; evaluated before `filter`.
348
+ # @param customRuleFilter [String] A simple filter statement to select specific CustomRuleOutputModel records. Applied to the underlying Custom Rule entities before they are converted into summary records; evaluated before `filter`.
349
+ # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
350
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
351
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
352
+ # @param includeEntities [Boolean] Whether or not to include the full entity definitions in the response; otherwise, only summary information is returned.
353
+ # @return [FetchResult]
354
+ def list_custom_rules(companyId, options={}) path = "/api/v2/companies/#{companyId}/customrules/summary"
355
+ get(path, options, AvaTax::VERSION) end
356
+
357
+ # Update a custom rule
358
+ #
359
+ # Updates an existing custom rule object attached to this company.
360
+ # The rule's ID must be supplied in the request body and must match the request URL path.
361
+ #
362
+ # Prefer updating an existing rule over deletion and re-creation when the overall purpose of the rule is not changing.
363
+ # If required to keep different versions of a rule active (e.g. so historical transactions recalculate consistently),
364
+ # use this endpoint to set an explicit expiry date (end date) for a rule to limit its effective range.
365
+ #
366
+ # Custom rules modify the default AvaTax behavior during tax calculation, customizing it to
367
+ # match requirements specific to your business. Rules can be used to change the taxability of
368
+ # an item, change the tax base of an item, alter the tax rate, modify transaction fields
369
+ # and addresses, allocate and split line items, update the location code, and more.
370
+ #
371
+ # Please use custom rules carefully and ensure they match the behavior agreed upon with your
372
+ # auditor, legal representative, and accounting team.
373
+ #
374
+ # ---
375
+ #
376
+ # Rules are built from modular _components_. A component can be a rule-wide variable or a
377
+ # _node_ in the directed acyclic graph defining the rule's behavior. To build a rule from scratch,
378
+ # start with `GetCustomRuleComponents` to retrieve supported components and the JSON `dataSchema` for each.
379
+ #
380
+ # Ensure each component has a unique `id` (for _Variable_ components, this is its name) and that its `data` field conforms to the node subtype's `dataSchema`.
381
+ # The `data` must be a single-escaped JSON string, not a nested object. Do not quote numbers or booleans, use only valid enumeration values, and keep
382
+ # arrays arrays even if they only contain a single element.
383
+ #
384
+ # _Nodes_ may be _Conditions_ or _Actions_. When deciding which node to use, prefer nodes for specific use cases,
385
+ # such as `MatchAddress` and `UpdateAddress`, over generic ones `MatchField` and `UpdateField` when possible.
386
+ #
387
+ # Use the `GetCustomRuleFields` endpoint to query the fields that can be used in nodes which accept arbitrary fields, such as `MatchField` and `UpdateField`.
388
+ #
389
+ # Each node defines its outgoing edges by specifying its child node IDs in the `next` array. The result of a node execution is a set of matches
390
+ # (e.g. which lines on the document met the criteria). Node results behave as follows:
391
+ # - Sequences *intersect* their results ("AND")
392
+ # - Branches *propagate* their results as the input to each child
393
+ # - Merges *union* their results ("OR")
394
+ #
395
+ # The `scope` of a condition is what part of the transaction it operates on: `Document`, `SomeLines`, `OneLine`, `AllLines`, or `NoLines`.
396
+ # The `scope` of an action determines what part of the transaction to apply changes to: `Document`, `MatchedLines`, `NotMatchedLines`, or `AllLines`.
397
+ #
398
+ # When using a rule to adjust taxability,
399
+ # - Prefer classifying the transaction so Avalara's built-in tax content applies
400
+ # (for example by setting a standard tax code or entity use code with
401
+ # `UpdateField`) before using a `TaxRule*` action to override that content.
402
+ # - To treat a line as nontaxable under Avalara's standard nontaxable code, use an
403
+ # `UpdateField` node to set its tax code to `NT`.
404
+ # - Place the UpdateField early in the rule so it takes effect pre-calculation.
405
+ # - To impact tax details, the MatchTax condition node is required to match on jurisdiction + tax type combinations.
406
+ # - There can only be one MatchTax node per rule, but it can have more than one criteria set.
407
+ # - Each criteria set has `matchTaxId` (unique identifier), `country`, `region`, `jurisdictionTypeId`, `jurisCode`, `taxTypeCode`, `taxSubType`, and `rateTypeCode`.
408
+ # - Tax subtypes and rate types may be wildcard (`*` or `ALL`) for most rule types.
409
+ # - Always use full names for `jurisdictionTypeId` (`Country`, `State`, `City`, `County`, `Special`) instead of their abbreviations.
410
+ # - A wildcard jurisdiction code (`*` or `ALL`) applies the treatment to all jurisdictions of the given `jurisdictionTypeId`.
411
+ # - `TaxRule*` action nodes define how the tax is to be adjusted.
412
+ # - `TaxRuleProductTaxability`: sets an item's taxability and assigns its rate type, so it requires a specific (non-wildcard) `rateTypeCode`.
413
+ # - `TaxRuleRateOverride`: overrides Avalara's tax rate.
414
+ # - `TaxRuleBaseOverride`: changes the tax base as a proportion of the original amount (e.g. `0.5` = 50% taxable).
415
+ # - `TaxRuleExemptEntity`: after sourcing, overrides whether the matched line is
416
+ # exempt for the jurisdiction and tax type.
417
+ # - Caps and thresholds can be applied with the `TaxRuleProductTaxability` or `TaxRuleRateOverride` actions.
418
+ # - A threshold buckets amounts up to and including the threshold as non-taxable.
419
+ # - A cap limits the taxable amount (per unit by default, multiplied by quantity); amounts above the cap become non-taxable.
420
+ # - Add the `Document` option to apply the cap across all matching lines of the document.
421
+ # - A `default` value must be provided in `TaxRule*` nodes. Overrides for specific jurisdictions are optional and provided in an `overrides` array (NOT a dictionary).
422
+ # - If the tax treatment (rate, taxability, etc.) is the same for all configured jurisdictions, set only the `default` value and omit `overrides`.
423
+ # - You only need to set overrides for values that differ from the default.
424
+ # - If a `matchTaxId` member is present in an override, it will apply to the corresponding criteria in the MatchTax node.
425
+ # - If a `matchTaxId` member is NOT present in an override, pattern matching is performed on the override criteria fields with omitted fields treated as wildcards.
426
+ # - When multiple tax rules apply, a more specific tax type/subtype beats a wildcard, and the latest effective date wins.
427
+ # - A Tax Code and Tariff Code condition are mutually exclusive.
428
+ # - Expressions cannot be used in nodes which directly affect tax treatment.
429
+ #
430
+ # Some nodes support _expressions_, which may have variable values evaluated at transaction time.
431
+ # Expression-supporting fields should be indicated on the node's data schema. Expressions allow
432
+ # formulas using arithmetic, substitutions, and references to transaction fields; for example:
433
+ # - `{{Document.TotalAmount}} * 0.1` (10% of the total document amount)
434
+ # - `{{Line.UserDefinedFields.Udf8}}` (Line-level user-defined field 8)
435
+ # - `{{Line.Ref1}}{{Line.Ref2}}` (A line's Ref1 and Ref2 values concatenated)
436
+ # - `2 + {{MyVar}}` (The value of the "MyVar" variable defined elsewhere in the rule, plus 2)
437
+ #
438
+ # Use the `GetCustomRuleTokens` endpoint to enumerate or search for valid tokens that can be used in expressions.
439
+ #
440
+ # Lookup files / reference lists may be used where expressions are supported. Use the syntax `{{FileName.ColumnName}}` to match against
441
+ # a column in a Condition and use the value from another column in the matched row in an Action. Matching scopes must be compatible -
442
+ # line-level matches cannot be used to update a document-level field.
443
+ #
444
+ # Rule nodes are assigned execution steps based on their contents and surrounding nodes. For instance, nodes that follow tax
445
+ # rule actions (`TaxRule*`) or require a calculated field (such as taxable amount) are executed after tax calculation instead
446
+ # of before calculation. Not every node type may execute in every step. Place them accordingly to their `validSteps`.
447
+ # A rule will be rejected if an ordering cannot be resolved. Rules execute in the following stages:
448
+ # - `OnRequest`: On the API request values, before document validation.
449
+ # - `AfterAddressValidation`: After addresses have been geo-coded / validated once.
450
+ # - `AfterSourcing`: After jurisdictions and tax types have been evaluated, but before tax calculation.
451
+ # - `AfterDetails`: After tax calculation details have been generated.
452
+ # - `OnResponse`: After the document has been saved, if applicable; on the API response only.
453
+ #
454
+ # ---
455
+ #
456
+ # It is recommended to validate the rule with the `ValidateCustomRule` endpoint before updating it.
457
+ # This will let you review the rule's execution plan and any associated diagnostic information before saving it.
458
+ #
459
+ # ### Security Policies
460
+ #
461
+ # * This API requires one of the following user roles: AccountAdmin, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
462
+ # Swagger Name: AvaTaxClient
463
+ # @param companyId [Integer] The ID of the company that owns the rule to update.
464
+ # @param id [Integer] The ID of the rule to update. Must match the rule ID passed in the request body.
465
+ # @param model [Object] The new contents of the rule.
466
+ # @return [Object]
467
+ def update_custom_rule(companyId, id, model) path = "/api/v2/companies/#{companyId}/customrules/#{id}"
468
+ put(path, model, {}, AvaTax::VERSION) end
469
+
470
+ # Validate a custom rule
471
+ #
472
+ # Validates a custom rule and returns a detailed validation result.
473
+ #
474
+ # This endpoint allows running rule validation independently of a create or update operation,
475
+ # enabling checking the validity of a proposed rule without persisting changes.
476
+ # It also returns additional diagnostic information about how a rule will be interpreted by the
477
+ # engine, such as how expressions were parsed and what order the graph nodes will be executed in.
478
+ # Therefore, it can also be used to inspect rule behavior when troubleshooting.
479
+ #
480
+ # Validation messages are categorized into "info," "warning," and "error" severity levels:
481
+ # - Info-level messages provide diagnostic details about how the rule was parsed
482
+ # - Warning-level messages flag potential misconfigurations or scenarios which may cause unexpected behavior
483
+ # and should be reviewed for intent, but do not block saving the rule
484
+ # - Error-level messages indicate that the rule has an issue that will prevent it from being saved or executed
485
+ #
486
+ # Examples of validation checks which are run include:
487
+ # - Directed acyclic graph structure compliance
488
+ # - Schema conformance for each `data` string
489
+ # - Enumeration value validity, including scope and condition operators
490
+ # - Field existence and step (set/get) constraints
491
+ # - Requirements verification for nodes with prerequisites
492
+ #
493
+ # Validation messages may reference a specific node in their `refersTo` field.
494
+ # If this field is empty, the message is rule-wide.
495
+ # Swagger Name: AvaTaxClient
496
+ # @param companyId [Integer] The ID of the company to validate the rule for.
497
+ # @param model [Object] Rule content to be validated.
498
+ # @return [Object]
499
+ def validate_custom_rule(companyId, model) path = "/api/v2/companies/#{companyId}/customrules/validate"
500
+ post(path, model, {}, AvaTax::VERSION) end
501
+ end
502
+ end
503
+ end
@@ -529,7 +529,9 @@ module AvaTax
529
529
  #
530
530
  # Returns the full list of all Avalara-supported nexus for all countries and regions.
531
531
  #
532
- # This API is intended to be useful if your user interface needs to display a selectable list of nexus.
532
+ # This API is intended to be useful if your user interface needs to display a selectable list of nexus.
533
+ #
534
+ # The `localNexusTypeId` field can be null. Treat null as `Selected`, the same as the Tax Calculation Service does.
533
535
  # Swagger Name: AvaTaxClient
534
536
  # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* streamlinedSalesTax, isSSTActive, taxTypeGroup, taxAuthorityId, taxName, parameters
535
537
  # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
@@ -566,7 +568,9 @@ module AvaTax
566
568
  #
567
569
  # Returns all Avalara-supported nexus for the specified country.
568
570
  #
569
- # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by country.
571
+ # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by country.
572
+ #
573
+ # The `localNexusTypeId` field can be null. Treat null as `Selected`, the same as the Tax Calculation Service does.
570
574
  # Swagger Name: AvaTaxClient
571
575
  # @param country [String] The country in which you want to fetch the system nexus
572
576
  # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* streamlinedSalesTax, isSSTActive, taxTypeGroup, taxAuthorityId, taxName, parameters
@@ -581,7 +585,9 @@ module AvaTax
581
585
  #
582
586
  # Returns all Avalara-supported nexus for the specified country and region.
583
587
  #
584
- # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by country and region.
588
+ # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by country and region.
589
+ #
590
+ # The `localNexusTypeId` field can be null. Treat null as `Selected`, the same as the Tax Calculation Service does.
585
591
  # Swagger Name: AvaTaxClient
586
592
  # @param country [String] The two-character ISO-3166 code for the country.
587
593
  # @param region [String] The two or three character region code for the region.
@@ -620,7 +626,9 @@ module AvaTax
620
626
  #
621
627
  # Returns all Avalara-supported nexus for the specified specified tax type group.
622
628
  #
623
- # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by tax type group.
629
+ # This API is intended to be useful if your user interface needs to display a selectable list of nexus filtered by tax type group.
630
+ #
631
+ # The `localNexusTypeId` field can be null. Treat null as `Selected`, the same as the Tax Calculation Service does.
624
632
  # Swagger Name: AvaTaxClient
625
633
  # @param taxTypeGroup [String] The tax type group to fetch the supporting system nexus for.
626
634
  # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* streamlinedSalesTax, isSSTActive, taxTypeGroup, taxAuthorityId, taxName, parameters
@@ -825,10 +833,11 @@ module AvaTax
825
833
  # This list of parameters is available for use when configuring your transaction.
826
834
  # Some parameters are only available for use if you have subscribed to certain features of AvaTax.
827
835
  # Swagger Name: AvaTaxClient
828
- # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* attributeSubType, values, valueDescriptions
836
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* attributeSubType, values, valueDescriptions, jurisdictionTypeId, jurisdictionCode, jurisdictionName, unitOfBasis, taxSubTypeId
829
837
  # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
830
838
  # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
831
839
  # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
840
+ # @param include [String] A comma separated list of additional data to retrieve, for example "jurisdictionDetail" (case-insensitive). When present, the response includes jurisdictionTypeId, jurisdictionCode, jurisdictionName, unitOfBasis and taxSubTypeId for each result. These fields are not available to $filter/$orderBy.
832
841
  # @return [FetchResult]
833
842
  def list_parameters_usage(options={}) path = "/api/v2/definitions/parametersusage"
834
843
  get(path, options, AvaTax::VERSION) end
@@ -1106,7 +1115,7 @@ module AvaTax
1106
1115
  #
1107
1116
  # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ECMAccountUser, ECMCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
1108
1117
  # Swagger Name: AvaTaxClient
1109
- # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).
1118
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* hasParameters
1110
1119
  # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
1111
1120
  # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
1112
1121
  # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
@@ -5,18 +5,18 @@ module AvaTax
5
5
 
6
6
  # Retrieve economic nexus threshold statuses for a company
7
7
  #
8
- # Retrieve the economic nexus threshold status for each US state in which activity has been
8
+ # Retrieve the economic nexus threshold status for each US region in which activity has been
9
9
  # evaluated for this company.
10
10
  #
11
11
  # Each entry in `states` describes the measurement window used, the sales and transaction
12
- # thresholds that apply to that state, the company's totals for the window, and whether
12
+ # thresholds that apply to that region, the company's totals for the window, and whether
13
13
  # the threshold has been met.
14
14
  #
15
15
  # Threshold statuses are evaluated on a recurring schedule rather than at request time.
16
16
  # Use `lastRefreshedAt` to determine how current the returned data is; when it is absent
17
17
  # from the response, the age of the data is not known.
18
18
  #
19
- # When the optional `region` query parameter is provided, only the matching state is included
19
+ # When the optional `region` query parameter is provided, only the matching region is included
20
20
  # in `states`. If no threshold status exists for that company and region, `states` is returned
21
21
  # as an empty array with a 200 response.
22
22
  #
@@ -27,7 +27,7 @@ module AvaTax
27
27
  # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
28
28
  # Swagger Name: AvaTaxClient
29
29
  # @param companyId [Integer] The ID of the company to retrieve threshold statuses for.
30
- # @param region [String] Optional two-letter US state postal code used to filter the results (case-insensitive). When provided, `states` contains at most one entry, matched against the `region` field of each entry. Must be exactly two characters; otherwise this endpoint returns 400.
30
+ # @param region [String] Optional two-letter US region postal code used to filter the results (case-insensitive). When provided, `states` contains at most one entry, matched against the `region` field of each entry. Must be exactly two characters; otherwise this endpoint returns 400.
31
31
  # @return [Object]
32
32
  def get_eco_nexus_thresholds(companyId, options={}) path = "/api/v2/companies/#{companyId}/econexusthresholds"
33
33
  get(path, options, AvaTax::VERSION) end
@@ -116,10 +116,17 @@ module AvaTax
116
116
  # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
117
117
  # Swagger Name: AvaTaxClient
118
118
  # @param companyId [Integer] The ID of the company that owns this items.
119
+ # @param x-Avalara-Batch-Id [String] Optional. The `X-Avalara-Batch-Id` header (for example: `batchv2-98421`). Ties chunks of one source file together; consumed by downstream services.
120
+ # @param x-Avalara-Is-Last-Chunk [String] Optional. The `X-Avalara-Is-Last-Chunk` header. Accepts the string values `true` or `false`. Marks the final chunk of a file; consumed by downstream services.
121
+ # @param x-Avalara-Tax-Mode [String] Optional. The `X-Avalara-Tax-Mode` header (for example: `HIGH`). Governs downstream ICP tax code classification; consumed by downstream services.
119
122
  # @param model [Object] The items you wish to upload.
120
123
  # @return [Object]
121
- def bulk_upload_items(companyId, model) path = "/api/v2/companies/#{companyId}/items/upload"
122
- post(path, model, {}, AvaTax::VERSION) end
124
+ def bulk_upload_items(companyId, model, x_Avalara_Batch_Id="", x_Avalara_Is_Last_Chunk="", x_Avalara_Tax_Mode="") path = "/api/v2/companies/#{companyId}/items/upload"
125
+ headers= Hash.new
126
+ headers["x-Avalara-Batch-Id"]=x_Avalara_Batch_Id;
127
+ headers["x-Avalara-Is-Last-Chunk"]=x_Avalara_Is_Last_Chunk;
128
+ headers["x-Avalara-Tax-Mode"]=x_Avalara_Tax_Mode;
129
+ post(path, model, {}, AvaTax::VERSION, headers) end
123
130
 
124
131
  # Add classifications to an item.
125
132
  #
@@ -215,10 +222,13 @@ module AvaTax
215
222
  # Swagger Name: AvaTaxClient
216
223
  # @param companyId [Integer] The ID of the company that owns this item.
217
224
  # @param processRecommendationsSynchronously [Boolean] If true then Indix api will be called synchronously to get tax code recommendations.
225
+ # @param x-Avalara-Tax-Mode [String] Optional. The `X-Avalara-Tax-Mode` header (for example: `HIGH`). Governs downstream ICP tax code classification; consumed by downstream services.
218
226
  # @param model [ItemModel[]] The item you wish to create.
219
227
  # @return [ItemModel[]]
220
- def create_items(companyId, model, options={}) path = "/api/v2/companies/#{companyId}/items"
221
- post(path, model, options, AvaTax::VERSION) end
228
+ def create_items(companyId, model, options={}, x_Avalara_Tax_Mode="") path = "/api/v2/companies/#{companyId}/items"
229
+ headers= Hash.new
230
+ headers["x-Avalara-Tax-Mode"]=x_Avalara_Tax_Mode;
231
+ post(path, model, options, AvaTax::VERSION, headers) end
222
232
 
223
233
  # Create tags for a item
224
234
  #
@@ -699,10 +709,13 @@ module AvaTax
699
709
  # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
700
710
  # Swagger Name: AvaTaxClient
701
711
  # @param companyId [Integer] The unique ID of the company.
712
+ # @param x-Avalara-Tax-Mode [String] Optional. The `X-Avalara-Tax-Mode` header (Accepted values:'HIGH', 'MEDIUM', 'LOW'). Governs downstream ICP tax code classification.
702
713
  # @param model [ItemTaxcodeRecommendationBatchesInputModel[]] The list of items to analyze for tax code recommendations (maximum 50).
703
714
  # @return [ItemTaxcodeRecommendationBatchesOutputModel[]]
704
- def get_sync_tax_code_recommendations(companyId, model) path = "/api/v2/companies/#{companyId}/$taxcode-recommendations"
705
- post(path, model, {}, AvaTax::VERSION) end
715
+ def get_sync_tax_code_recommendations(companyId, model, x_Avalara_Tax_Mode="") path = "/api/v2/companies/#{companyId}/$taxcode-recommendations"
716
+ headers= Hash.new
717
+ headers["x-Avalara-Tax-Mode"]=x_Avalara_Tax_Mode;
718
+ post(path, model, {}, AvaTax::VERSION, headers) end
706
719
 
707
720
  # Create an HS code classification request.
708
721
  #
@@ -1091,6 +1104,19 @@ module AvaTax
1091
1104
  def sync_items(companyId, model) path = "/api/v2/companies/#{companyId}/items/sync"
1092
1105
  post(path, model, {}, AvaTax::VERSION) end
1093
1106
 
1107
+ # Update HS Duty Details for an item.
1108
+ #
1109
+ # ### Security Policies
1110
+ #
1111
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AvaTaxOnlyAccountAdmin, AvaTaxOnlyCompanyAdmin, BatchServiceAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
1112
+ # Swagger Name: AvaTaxClient
1113
+ # @param companyId [Integer] The ID of the company for which you want to update HS Duty Details.
1114
+ # @param itemId [Integer] The ID of the item for which you want to update HS Duty Details.
1115
+ # @param model [ItemHSCodeDutyDetailModel[]] The complete HS Code Duty Details body (as returned by fetch-additional-hsdutydetails) to update.
1116
+ # @return [ItemHSCodeDutyDetailModel[]]
1117
+ def update_h_s_code_duty_details(companyId, itemId, model) path = "/api/v2/companies/#{companyId}/items/#{itemId}/hsdutydetails"
1118
+ put(path, model, {}, AvaTax::VERSION) end
1119
+
1094
1120
  # Update an existing image for an item.
1095
1121
  #
1096
1122
  # This endpoint allows users to update the existing image associated with a specific item by uploading a new image file.
@@ -157,6 +157,7 @@ module AvaTax
157
157
  # accountant or lawyer prior to declaring nexus.
158
158
  # You may specify one or more of the following values in the '$include' parameter to fetch additional nested data, using commas to separate multiple values:
159
159
  #
160
+ # The `localNexusTypeId` field can be null. Treat null as `Selected`, the same as the Tax Calculation Service does.
160
161
  # * Parameters
161
162
  #
162
163
  # ### Security Policies
@@ -228,6 +229,7 @@ module AvaTax
228
229
  # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
229
230
  # You may specify one or more of the following values in the '$include' parameter to fetch additional nested data, using commas to separate multiple values:
230
231
  #
232
+ # The `localNexusTypeId` field can be null. Treat null as `Selected`, the same as the Tax Calculation Service does.
231
233
  # * Parameters
232
234
  #
233
235
  # ### Security Policies
@@ -311,6 +313,7 @@ module AvaTax
311
313
  # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
312
314
  # You may specify one or more of the following values in the '$include' parameter to fetch additional nested data, using commas to separate multiple values:
313
315
  #
316
+ # The `localNexusTypeId` field can be null. Treat null as `Selected`, the same as the Tax Calculation Service does.
314
317
  # * Parameters
315
318
  #
316
319
  # ### Security Policies
@@ -83,6 +83,9 @@ module AvaTax
83
83
  # `COMPANYRETURNSETTING`, `ITEM`, `SERVICE`, `EXEMPTCERT`, `AVACERTSERVICECONFIG`, `JURISDICTIONOVERRIDE`, `COSTCENTER`,
84
84
  # `FILINGTASKSTATUSHISTORY`, `COMPANYSTATUSHISTORY`.
85
85
  #
86
+ # Use `reportSubType` = `All` to run the report across all supported tables. When `All` is used it must be
87
+ # the only `reportSubType` and cannot carry filters.
88
+ #
86
89
  # Set `compression` to `GZIP` to reduce the size of the report file and increase download speed.
87
90
  #
88
91
  # ### Security Policies
@@ -98,7 +98,7 @@ module AvaTax
98
98
  # * This API requires one of the following user roles: AccountAdmin, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, ECMAccountUser, ECMCompanyUser, FirmAdmin, FirmUser, ProStoresOperator, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
99
99
  # Swagger Name: AvaTaxClient
100
100
  # @param companyId [Integer] The ID of the company that owns these settings
101
- # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* modifiedDate, ModifiedUserId
101
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).
102
102
  # @param include [String] A comma separated list of additional data to retrieve.
103
103
  # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
104
104
  # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
@@ -127,7 +127,7 @@ module AvaTax
127
127
  #
128
128
  # * This API requires one of the following user roles: AccountAdmin, AccountUser, AvaTaxOnlyAccountAdmin, AvaTaxOnlyAccountUser, AvaTaxOnlyCompanyAdmin, AvaTaxOnlyCompanyUser, BatchServiceAdmin, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, ECMAccountUser, ECMCompanyUser, FirmAdmin, FirmUser, ProStoresOperator, ReturnsOnlyAccountAdmin, ReturnsOnlyAccountUser, ReturnsOnlyCompanyAdmin, ReturnsOnlyCompanyUser, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
129
129
  # Swagger Name: AvaTaxClient
130
- # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* modifiedDate, ModifiedUserId
130
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).
131
131
  # @param include [String] A comma separated list of additional data to retrieve.
132
132
  # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
133
133
  # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
@@ -576,7 +576,7 @@ module AvaTax
576
576
  # @param companyCode [String] The company code of the company that recorded this transaction
577
577
  # @param dataSourceId [Integer] Optionally filter transactions to those from a specific data source.
578
578
  # @param include [String] Specifies objects to include in this fetch call
579
- # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* exchangeRateCurrencyCode, exchangeRateProvider, totalDiscount, lines, addresses, locationTypes, summary, taxDetailsByTaxType, parameters, userDefinedFields, messages, invoiceMessages, isFakeTransaction, deliveryTerms, apStatusCode, apStatus, vendorName, varianceAmount
579
+ # @param filter [String] A filter statement to identify specific records to retrieve. For more information on filtering, see [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/).<br />*Not filterable:* exchangeRateCurrencyCode, exchangeRateProvider, totalDiscount, lines, addresses, locationTypes, summary, taxDetailsByTaxType, parameters, userDefinedFields, messages, invoiceMessages, isFakeTransaction, deliveryTerms, apStatusCode, apStatus, vendorName, varianceAmount, customClearanceFees
580
580
  # @param top [Integer] If nonzero, return no more than this number of results. Used with `$skip` to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 1,000 records.
581
581
  # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
582
582
  # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
@@ -26,7 +26,7 @@ module AvaTax
26
26
  # * This API depends on the following active services:*Required* (all): AvaTaxPro, BasicReturns.
27
27
  # Swagger Name: AvaTaxClient
28
28
  # @param companyId [Integer]
29
- # @param udfType [String] Document or Line level UDF (See UserDefinedFieldType::* for a list of allowable values)
29
+ # @param udfType [String] Document, Line, or Detail level UDF (See UserDefinedFieldType::* for a list of allowable values)
30
30
  # @param allowDefaults [Boolean] If true this will add defaulted UDFs to the list that are not named yet
31
31
  # @return [FetchResult]
32
32
  def list_user_defined_fields_by_company_id(companyId, options={}) path = "/api/v2/companies/#{companyId}/userdefinedfields"
@@ -1,3 +1,3 @@
1
1
  module AvaTax
2
- VERSION = '26.8.3'.freeze unless defined?(::AvaTax::VERSION)
2
+ VERSION = '26.10.0'.freeze unless defined?(::AvaTax::VERSION)
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avatax
3
3
  version: !ruby/object:Gem::Version
4
- version: 26.8.3
4
+ version: 26.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Vorwaller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-24 00:00:00.000000000 Z
11
+ date: 2026-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -136,6 +136,7 @@ files:
136
136
  - lib/avatax/client/costcenter.rb
137
137
  - lib/avatax/client/currencyroundingrules.rb
138
138
  - lib/avatax/client/customers.rb
139
+ - lib/avatax/client/customrules.rb
139
140
  - lib/avatax/client/datasources.rb
140
141
  - lib/avatax/client/definitions.rb
141
142
  - lib/avatax/client/distancethresholds.rb