avatax 19.12.0 → 20.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/avatax.gemspec +0 -1
  3. data/lib/avatax/client/accounts.rb +269 -193
  4. data/lib/avatax/client/addresses.rb +60 -60
  5. data/lib/avatax/client/advancedrules.rb +81 -162
  6. data/lib/avatax/client/avafileforms.rb +93 -93
  7. data/lib/avatax/client/batches.rb +247 -188
  8. data/lib/avatax/client/certexpressinvites.rb +106 -106
  9. data/lib/avatax/client/certificates.rb +469 -469
  10. data/lib/avatax/client/companies.rb +400 -398
  11. data/lib/avatax/client/compliance.rb +18 -18
  12. data/lib/avatax/client/contacts.rb +124 -124
  13. data/lib/avatax/client/customers.rb +415 -415
  14. data/lib/avatax/client/datasources.rb +117 -117
  15. data/lib/avatax/client/definitions.rb +1039 -1007
  16. data/lib/avatax/client/distancethresholds.rb +140 -140
  17. data/lib/avatax/client/filingcalendars.rb +23 -508
  18. data/lib/avatax/client/filings.rb +29 -29
  19. data/lib/avatax/client/firmclientlinkages.rb +150 -150
  20. data/lib/avatax/client/free.rb +109 -109
  21. data/lib/avatax/client/fundingrequests.rb +58 -58
  22. data/lib/avatax/client/items.rb +480 -480
  23. data/lib/avatax/client/jurisdictionoverrides.rb +136 -136
  24. data/lib/avatax/client/locations.rb +163 -160
  25. data/lib/avatax/client/multidocument.rb +420 -340
  26. data/lib/avatax/client/nexus.rb +240 -225
  27. data/lib/avatax/client/notifications.rb +84 -84
  28. data/lib/avatax/client/provisioning.rb +55 -55
  29. data/lib/avatax/client/registrar.rb +228 -228
  30. data/lib/avatax/client/reports.rb +109 -109
  31. data/lib/avatax/client/settings.rb +174 -174
  32. data/lib/avatax/client/subscriptions.rb +71 -71
  33. data/lib/avatax/client/taxcodes.rb +138 -138
  34. data/lib/avatax/client/taxcontent.rb +142 -142
  35. data/lib/avatax/client/taxrules.rb +188 -188
  36. data/lib/avatax/client/transactions.rb +899 -854
  37. data/lib/avatax/client/upcs.rb +129 -129
  38. data/lib/avatax/client/users.rb +207 -207
  39. data/lib/avatax/client/utilities.rb +70 -70
  40. data/lib/avatax/connection.rb +3 -3
  41. data/lib/avatax/request.rb +2 -0
  42. data/lib/avatax/version.rb +1 -1
  43. metadata +4 -25
@@ -1,189 +1,189 @@
1
- module AvaTax
2
- class Client
3
- module TaxRules
4
-
5
-
6
- # Create a new tax rule
7
- #
8
- # Create one or more custom tax rules attached to this company.
9
- #
10
- # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
11
- # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
12
- # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
13
- # with the transaction.
14
- #
15
- # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
16
- # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
17
- # custom tax rules to redefine the behavior for your company or item.
18
- #
19
- # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
20
- # auditor, legal representative, and accounting team.
21
- #
22
- # ### Security Policies
23
- #
24
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
25
- # @param companyId [Integer] The ID of the company that owns this tax rule.
26
- # @param model [TaxRuleModel[]] The tax rule you wish to create.
27
- # @return [TaxRuleModel[]]
28
- def create_tax_rules(companyId, model)
29
- path = "/api/v2/companies/#{companyId}/taxrules"
30
- post(path, model)
31
- end
32
-
33
-
34
- # Delete a single tax rule
35
- #
36
- # Mark the custom tax rule identified by this URL as deleted.
37
- #
38
- # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
39
- # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
40
- # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
41
- # with the transaction.
42
- #
43
- # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
44
- # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
45
- # custom tax rules to redefine the behavior for your company or item.
46
- #
47
- # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
48
- # auditor, legal representative, and accounting team.
49
- #
50
- # ### Security Policies
51
- #
52
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
53
- # @param companyId [Integer] The ID of the company that owns this tax rule.
54
- # @param id [Integer] The ID of the tax rule you wish to delete.
55
- # @return [ErrorDetail[]]
56
- def delete_tax_rule(companyId, id)
57
- path = "/api/v2/companies/#{companyId}/taxrules/#{id}"
58
- delete(path)
59
- end
60
-
61
-
62
- # Retrieve a single tax rule
63
- #
64
- # Get the taxrule object identified by this URL.
65
- #
66
- # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
67
- # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
68
- # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
69
- # with the transaction.
70
- #
71
- # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
72
- # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
73
- # custom tax rules to redefine the behavior for your company or item.
74
- #
75
- # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
76
- # auditor, legal representative, and accounting team.
77
- #
78
- # ### Security Policies
79
- #
80
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
81
- # @param companyId [Integer] The ID of the company that owns this tax rule
82
- # @param id [Integer] The primary key of this tax rule
83
- # @return [Object]
84
- def get_tax_rule(companyId, id)
85
- path = "/api/v2/companies/#{companyId}/taxrules/#{id}"
86
- get(path)
87
- end
88
-
89
-
90
- # Retrieve tax rules for this company
91
- #
92
- # List all taxrule objects attached to this company.
93
- #
94
- # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
95
- # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
96
- # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
97
- # with the transaction.
98
- #
99
- # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
100
- # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
101
- # custom tax rules to redefine the behavior for your company or item.
102
- #
103
- # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
104
- # auditor, legal representative, and accounting team.
105
- #
106
- # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
107
- # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
108
- #
109
- # ### Security Policies
110
- #
111
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
112
- # @param companyId [Integer] The ID of the company that owns these tax rules
113
- # @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:* taxCode, rateTypeCode, taxTypeGroup, taxSubType
114
- # @param include [String] A comma separated list of additional data to retrieve.
115
- # @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.
116
- # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
117
- # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
118
- # @return [FetchResult]
119
- def list_tax_rules(companyId, options={})
120
- path = "/api/v2/companies/#{companyId}/taxrules"
121
- get(path, options)
122
- end
123
-
124
-
125
- # Retrieve all tax rules
126
- #
127
- # Get multiple taxrule objects across all companies.
128
- #
129
- # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
130
- # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
131
- # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
132
- # with the transaction.
133
- #
134
- # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
135
- # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
136
- # custom tax rules to redefine the behavior for your company or item.
137
- #
138
- # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
139
- # auditor, legal representative, and accounting team.
140
- #
141
- # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
142
- # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
143
- #
144
- # ### Security Policies
145
- #
146
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
147
- # @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:* taxCode, rateTypeCode, taxTypeGroup, taxSubType
148
- # @param include [String] A comma separated list of additional data to retrieve.
149
- # @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.
150
- # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
151
- # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
152
- # @return [FetchResult]
153
- def query_tax_rules(options={})
154
- path = "/api/v2/taxrules"
155
- get(path, options)
156
- end
157
-
158
-
159
- # Update a single tax rule
160
- #
161
- # Replace the existing custom tax rule object at this URL with an updated object.
162
- #
163
- # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
164
- # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
165
- # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
166
- # with the transaction.
167
- #
168
- # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
169
- # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
170
- # custom tax rules to redefine the behavior for your company or item.
171
- #
172
- # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
173
- # auditor, legal representative, and accounting team.
174
- #
175
- # ### Security Policies
176
- #
177
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
178
- # @param companyId [Integer] The ID of the company that this tax rule belongs to.
179
- # @param id [Integer] The ID of the tax rule you wish to update
180
- # @param model [Object] The tax rule you wish to update.
181
- # @return [Object]
182
- def update_tax_rule(companyId, id, model)
183
- path = "/api/v2/companies/#{companyId}/taxrules/#{id}"
184
- put(path, model)
185
- end
186
-
187
- end
188
- end
1
+ module AvaTax
2
+ class Client
3
+ module TaxRules
4
+
5
+
6
+ # Create a new tax rule
7
+ #
8
+ # Create one or more custom tax rules attached to this company.
9
+ #
10
+ # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
11
+ # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
12
+ # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
13
+ # with the transaction.
14
+ #
15
+ # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
16
+ # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
17
+ # custom tax rules to redefine the behavior for your company or item.
18
+ #
19
+ # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
20
+ # auditor, legal representative, and accounting team.
21
+ #
22
+ # ### Security Policies
23
+ #
24
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
25
+ # @param companyId [Integer] The ID of the company that owns this tax rule.
26
+ # @param model [TaxRuleModel[]] The tax rule you wish to create.
27
+ # @return [TaxRuleModel[]]
28
+ def create_tax_rules(companyId, model)
29
+ path = "/api/v2/companies/#{companyId}/taxrules"
30
+ post(path, model)
31
+ end
32
+
33
+
34
+ # Delete a single tax rule
35
+ #
36
+ # Mark the custom tax rule identified by this URL as deleted.
37
+ #
38
+ # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
39
+ # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
40
+ # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
41
+ # with the transaction.
42
+ #
43
+ # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
44
+ # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
45
+ # custom tax rules to redefine the behavior for your company or item.
46
+ #
47
+ # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
48
+ # auditor, legal representative, and accounting team.
49
+ #
50
+ # ### Security Policies
51
+ #
52
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
53
+ # @param companyId [Integer] The ID of the company that owns this tax rule.
54
+ # @param id [Integer] The ID of the tax rule you wish to delete.
55
+ # @return [ErrorDetail[]]
56
+ def delete_tax_rule(companyId, id)
57
+ path = "/api/v2/companies/#{companyId}/taxrules/#{id}"
58
+ delete(path)
59
+ end
60
+
61
+
62
+ # Retrieve a single tax rule
63
+ #
64
+ # Get the taxrule object identified by this URL.
65
+ #
66
+ # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
67
+ # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
68
+ # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
69
+ # with the transaction.
70
+ #
71
+ # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
72
+ # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
73
+ # custom tax rules to redefine the behavior for your company or item.
74
+ #
75
+ # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
76
+ # auditor, legal representative, and accounting team.
77
+ #
78
+ # ### Security Policies
79
+ #
80
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
81
+ # @param companyId [Integer] The ID of the company that owns this tax rule
82
+ # @param id [Integer] The primary key of this tax rule
83
+ # @return [Object]
84
+ def get_tax_rule(companyId, id)
85
+ path = "/api/v2/companies/#{companyId}/taxrules/#{id}"
86
+ get(path)
87
+ end
88
+
89
+
90
+ # Retrieve tax rules for this company
91
+ #
92
+ # List all taxrule objects attached to this company.
93
+ #
94
+ # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
95
+ # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
96
+ # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
97
+ # with the transaction.
98
+ #
99
+ # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
100
+ # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
101
+ # custom tax rules to redefine the behavior for your company or item.
102
+ #
103
+ # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
104
+ # auditor, legal representative, and accounting team.
105
+ #
106
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
107
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
108
+ #
109
+ # ### Security Policies
110
+ #
111
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
112
+ # @param companyId [Integer] The ID of the company that owns these tax rules
113
+ # @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:* taxCode, rateTypeCode, taxTypeGroup, taxSubType
114
+ # @param include [String] A comma separated list of additional data to retrieve.
115
+ # @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.
116
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
117
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
118
+ # @return [FetchResult]
119
+ def list_tax_rules(companyId, options={})
120
+ path = "/api/v2/companies/#{companyId}/taxrules"
121
+ get(path, options)
122
+ end
123
+
124
+
125
+ # Retrieve all tax rules
126
+ #
127
+ # Get multiple taxrule objects across all companies.
128
+ #
129
+ # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
130
+ # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
131
+ # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
132
+ # with the transaction.
133
+ #
134
+ # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
135
+ # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
136
+ # custom tax rules to redefine the behavior for your company or item.
137
+ #
138
+ # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
139
+ # auditor, legal representative, and accounting team.
140
+ #
141
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
142
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
143
+ #
144
+ # ### Security Policies
145
+ #
146
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
147
+ # @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:* taxCode, rateTypeCode, taxTypeGroup, taxSubType
148
+ # @param include [String] A comma separated list of additional data to retrieve.
149
+ # @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.
150
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
151
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
152
+ # @return [FetchResult]
153
+ def query_tax_rules(options={})
154
+ path = "/api/v2/taxrules"
155
+ get(path, options)
156
+ end
157
+
158
+
159
+ # Update a single tax rule
160
+ #
161
+ # Replace the existing custom tax rule object at this URL with an updated object.
162
+ #
163
+ # A tax rule represents a rule that changes the default AvaTax behavior for a product or jurisdiction. Custom tax rules
164
+ # can be used to change the taxability of an item, to change the tax base of an item, or to change the tax rate
165
+ # charged when selling an item. Tax rules can also change tax behavior depending on the `entityUseCode` value submitted
166
+ # with the transaction.
167
+ #
168
+ # You can create custom tax rules to customize the behavior of AvaTax to match specific rules that are custom to your
169
+ # business. If you have obtained a ruling from a tax auditor that requires custom tax calculations, you can use
170
+ # custom tax rules to redefine the behavior for your company or item.
171
+ #
172
+ # Please use custom tax rules carefully and ensure that these tax rules match the behavior agreed upon with your
173
+ # auditor, legal representative, and accounting team.
174
+ #
175
+ # ### Security Policies
176
+ #
177
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
178
+ # @param companyId [Integer] The ID of the company that this tax rule belongs to.
179
+ # @param id [Integer] The ID of the tax rule you wish to update
180
+ # @param model [Object] The tax rule you wish to update.
181
+ # @return [Object]
182
+ def update_tax_rule(companyId, id, model)
183
+ path = "/api/v2/companies/#{companyId}/taxrules/#{id}"
184
+ put(path, model)
185
+ end
186
+
187
+ end
188
+ end
189
189
  end
@@ -1,855 +1,900 @@
1
- module AvaTax
2
- class Client
3
- module Transactions
4
-
5
-
6
- # Add lines to an existing unlocked transaction
7
- #
8
- # Add lines to an existing unlocked transaction.
9
- #
10
- # The `AddLines` API allows you to add additional transaction lines to existing transaction, so that customer will
11
- # be able to append multiple calls together and form an extremely large transaction. If customer does not specify line number
12
- # in the lines to be added, a new random Guid string will be generated for line number. If customer are not satisfied with
13
- # the line number for the transaction lines, they can turn on the renumber switch to have REST v2 automatically renumber all
14
- # transaction lines for them, in this case, the line number becomes: "1", "2", "3", ...
15
- #
16
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
17
- # sales, purchases, inventory transfer, and returns (also called refunds).
18
- # 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:
19
- #
20
- # * Lines
21
- # * Details (implies lines)
22
- # * Summary (implies details)
23
- # * Addresses
24
- # * SummaryOnly (omit lines and details - reduces API response size)
25
- # * LinesOnly (omit details - reduces API response size)
26
- #
27
- # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
28
- #
29
- # ### Security Policies
30
- #
31
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
32
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
33
- # @param include [String] Specifies objects to include in the response after transaction is created
34
- # @param model [Object] information about the transaction and lines to be added
35
- # @return [Object]
36
- def add_lines(model, options={})
37
- path = "/api/v2/companies/transactions/lines/add"
38
- post(path, model, options)
39
- end
40
-
41
-
42
- # Correct a previously created transaction
43
- #
44
- # Replaces the current transaction uniquely identified by this URL with a new transaction.
45
- #
46
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
47
- # sales, purchases, inventory transfer, and returns (also called refunds).
48
- #
49
- # When you adjust a committed transaction, the original transaction will be updated with the status code `Adjusted`, and
50
- # both revisions will be available for retrieval based on their code and ID numbers.
51
- # Only transactions in `Committed` status are reported by Avalara Managed Returns.
52
- #
53
- # Transactions that have been previously reported to a tax authority by Avalara Managed Returns are considered `locked` and are
54
- # no longer available for adjustments.
55
- #
56
- # 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:
57
- #
58
- # * Lines
59
- # * Details (implies lines)
60
- # * Summary (implies details)
61
- # * Addresses
62
- # * SummaryOnly (omit lines and details - reduces API response size)
63
- # * LinesOnly (omit details - reduces API response size)
64
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
65
- #
66
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
67
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
68
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
69
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
70
- #
71
- # ### Security Policies
72
- #
73
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
74
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
75
- # @param companyCode [String] The company code of the company that recorded this transaction
76
- # @param transactionCode [String] The transaction code to adjust
77
- # @param documentType [String] (Optional): The document type of the transaction to adjust. (See DocumentType::* for a list of allowable values)
78
- # @param include [String] Specifies objects to include in this fetch call
79
- # @param model [Object] The adjustment you wish to make
80
- # @return [Object]
81
- def adjust_transaction(companyCode, transactionCode, model, options={})
82
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/adjust"
83
- post(path, model, options)
84
- end
85
-
86
-
87
- # Get audit information about a transaction
88
- #
89
- # Retrieve audit information about a transaction stored in AvaTax.
90
- #
91
- # The `AuditTransaction` API retrieves audit information related to a specific transaction. This audit
92
- # information includes the following:
93
- #
94
- # * The `CompanyId` of the company that created the transaction
95
- # * The server timestamp representing the exact server time when the transaction was created
96
- # * The server duration - how long it took to process this transaction
97
- # * Whether exact API call details were logged
98
- # * A reconstructed API call showing what the original CreateTransaction call looked like
99
- #
100
- # This API can be used to examine information about a previously created transaction.
101
- #
102
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
103
- # sales, purchases, inventory transfer, and returns (also called refunds).
104
- #
105
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
106
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
107
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
108
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
109
- #
110
- # ### Security Policies
111
- #
112
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
113
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
114
- # @param companyCode [String] The code identifying the company that owns this transaction
115
- # @param transactionCode [String] The code identifying the transaction
116
- # @return [Object]
117
- def audit_transaction(companyCode, transactionCode)
118
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/audit"
119
- get(path)
120
- end
121
-
122
-
123
- # Get audit information about a transaction
124
- #
125
- # Retrieve audit information about a transaction stored in AvaTax.
126
- #
127
- # The `AuditTransaction` API retrieves audit information related to a specific transaction. This audit
128
- # information includes the following:
129
- #
130
- # * The `CompanyId` of the company that created the transaction
131
- # * The server timestamp representing the exact server time when the transaction was created
132
- # * The server duration - how long it took to process this transaction
133
- # * Whether exact API call details were logged
134
- # * A reconstructed API call showing what the original CreateTransaction call looked like
135
- #
136
- # This API can be used to examine information about a previously created transaction.
137
- #
138
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
139
- # sales, purchases, inventory transfer, and returns (also called refunds).
140
- #
141
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
142
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
143
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
144
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
145
- #
146
- # ### Security Policies
147
- #
148
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
149
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
150
- # @param companyCode [String] The code identifying the company that owns this transaction
151
- # @param transactionCode [String] The code identifying the transaction
152
- # @param documentType [String] The document type of the original transaction (See DocumentType::* for a list of allowable values)
153
- # @return [Object]
154
- def audit_transaction_with_type(companyCode, transactionCode, documentType)
155
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/types/#{documentType}/audit"
156
- get(path)
157
- end
158
-
159
-
160
- # Lock a set of documents
161
- #
162
- # This API is available by invitation only.
163
- #
164
- # Lock a set of transactions uniquely identified by DocumentIds provided. This API allows locking multiple documents at once.
165
- # After this API call succeeds, documents will be locked and can't be voided.
166
- #
167
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
168
- # sales, purchases, inventory transfer, and returns (also called refunds).
169
- #
170
- # ### Security Policies
171
- #
172
- # * This API requires the user role Compliance Root User.
173
- # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
174
- # @param model [Object] bulk lock request
175
- # @return [Object]
176
- def bulk_lock_transaction(model)
177
- path = "/api/v2/transactions/lock"
178
- post(path, model)
179
- end
180
-
181
-
182
- # Change a transaction's code
183
- #
184
- # Renames a transaction uniquely identified by this URL by changing its `code` value.
185
- #
186
- # This API is available as long as the transaction is in `saved` or `posted` status. When a transaction
187
- # is `committed`, it can be modified by using the [AdjustTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/AdjustTransaction/) method.
188
- #
189
- # After this API call succeeds, the transaction will have a new URL matching its new `code`.
190
- #
191
- # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
192
- #
193
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
194
- # sales, purchases, inventory transfer, and returns (also called refunds).
195
- #
196
- # 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:
197
- #
198
- # * Lines
199
- # * Details (implies lines)
200
- # * Summary (implies details)
201
- # * Addresses
202
- # * SummaryOnly (omit lines and details - reduces API response size)
203
- # * LinesOnly (omit details - reduces API response size)
204
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
205
- #
206
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
207
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
208
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
209
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
210
- #
211
- # ### Security Policies
212
- #
213
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
214
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, AvaTaxST.
215
- # @param companyCode [String] The company code of the company that recorded this transaction
216
- # @param transactionCode [String] The transaction code to change
217
- # @param documentType [String] (Optional): The document type of the transaction to change document code. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
218
- # @param include [String] Specifies objects to include in this fetch call
219
- # @param model [Object] The code change request you wish to execute
220
- # @return [Object]
221
- def change_transaction_code(companyCode, transactionCode, model, options={})
222
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/changecode"
223
- post(path, model, options)
224
- end
225
-
226
-
227
- # Commit a transaction for reporting
228
- #
229
- # Marks a transaction by changing its status to `Committed`.
230
- #
231
- # Transactions that are committed are available to be reported to a tax authority by Avalara Managed Returns.
232
- #
233
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
234
- # sales, purchases, inventory transfer, and returns (also called refunds).
235
- #
236
- # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
237
- #
238
- # Any changes made to a committed transaction will generate a transaction history.
239
- #
240
- # 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:
241
- #
242
- # * Lines
243
- # * Details (implies lines)
244
- # * Summary (implies details)
245
- # * Addresses
246
- # * SummaryOnly (omit lines and details - reduces API response size)
247
- # * LinesOnly (omit details - reduces API response size)
248
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
249
- #
250
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
251
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
252
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
253
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
254
- #
255
- # ### Security Policies
256
- #
257
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
258
- # @param companyCode [String] The company code of the company that recorded this transaction
259
- # @param transactionCode [String] The transaction code to commit
260
- # @param documentType [String] (Optional): The document type of the transaction to commit. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
261
- # @param include [String] Specifies objects to include in this fetch call
262
- # @param model [Object] The commit request you wish to execute
263
- # @return [Object]
264
- def commit_transaction(companyCode, transactionCode, model, options={})
265
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/commit"
266
- post(path, model, options)
267
- end
268
-
269
-
270
- # Create or adjust a transaction
271
- #
272
- # Records a new transaction or adjust an existing transaction in AvaTax.
273
- #
274
- # The `CreateOrAdjustTransaction` endpoint is used to create a new transaction or update an existing one. This API
275
- # can help you create an idempotent service that creates transactions
276
- # If there exists a transaction identified by code, the original transaction will be adjusted by using the meta data
277
- # in the input transaction.
278
- #
279
- # The `CreateOrAdjustTransaction` API cannot modify any transaction that has been reported to a tax authority using
280
- # the Avalara Managed Returns Service or any other tax filing service. If you call this API to attempt to modify
281
- # a transaction that has been reported on a tax filing, you will receive the error `CannotModifyLockedTransaction`.
282
- #
283
- # To generate a refund for a transaction, use the `RefundTransaction` API.
284
- #
285
- # If you don't specify the field `type` in your request, you will get an estimate of type `SalesOrder`, which will not be recorded in the database.
286
- #
287
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
288
- # sales, purchases, inventory transfer, and returns (also called refunds).
289
- # 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:
290
- #
291
- # * Lines
292
- # * Details (implies lines)
293
- # * Summary (implies details)
294
- # * Addresses
295
- # * SummaryOnly (omit lines and details - reduces API response size)
296
- # * LinesOnly (omit details - reduces API response size)
297
- # * ForceTimeout - Simulates a timeout. This adds a 30 second delay and error to your API call. This can be used to test your code to ensure it can respond correctly in the case of a dropped connection.
298
- #
299
- # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
300
- #
301
- # NOTE: Avoid using the following strings in your transaction codes as they are encoding strings and will be interpreted differently:
302
- # * \_-ava2f-\_
303
- # * \_-ava2b-\_
304
- # * \_-ava3f-\_
305
- #
306
- # ### Security Policies
307
- #
308
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
309
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
310
- # @param include [String] Specifies objects to include in the response after transaction is created
311
- # @param model [Object] The transaction you wish to create or adjust
312
- # @return [Object]
313
- def create_or_adjust_transaction(model, options={})
314
- path = "/api/v2/transactions/createoradjust"
315
- post(path, model, options)
316
- end
317
-
318
-
319
- # Create a new transaction
320
- #
321
- # Records a new transaction in AvaTax.
322
- #
323
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
324
- # sales, purchases, inventory transfer, and returns (also called refunds).
325
- #
326
- # The `CreateTransaction` endpoint uses the tax profile of your company to identify the correct tax rules
327
- # and rates to apply to all line items in this transaction. The end result will be the total tax calculated by AvaTax based on your
328
- # company's configuration and the data provided in this API call.
329
- #
330
- # The `CreateTransaction` API will report an error if a committed transaction already exists with the same `code`. To
331
- # avoid this error, use the `CreateOrAdjustTransaction` API - it will create the transaction if it does not exist, or
332
- # update it if it does exist.
333
- #
334
- # To generate a refund for a transaction, use the `RefundTransaction` API.
335
- #
336
- # The field `type` identifies the kind of transaction - for example, a sale, purchase, or refund. If you do not specify
337
- # a `type` value, you will receive an estimate of type `SalesOrder`, which will not be recorded.
338
- #
339
- # The origin and destination locations for a transaction must be identified by either address or geocode. For address-based transactions, please
340
- # provide addresses in the fields `line`, `city`, `region`, `country` and `postalCode`. For geocode-based transactions, please provide the geocode
341
- # information in the fields `latitude` and `longitude`. If either `latitude` or `longitude` or both are null, the transaction will be calculated
342
- # using the best available address location information.
343
- #
344
- # 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:
345
- #
346
- # * Lines
347
- # * Details (implies lines)
348
- # * Summary (implies details)
349
- # * Addresses
350
- # * SummaryOnly (omit lines and details - reduces API response size)
351
- # * LinesOnly (omit details - reduces API response size)
352
- # * ForceTimeout - Simulates a timeout. This adds a 30 second delay and error to your API call. This can be used to test your code to ensure it can respond correctly in the case of a dropped connection.
353
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
354
- #
355
- # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
356
- #
357
- # NOTE: Avoid using the following strings in your transaction codes as they are encoding strings and will be interpreted differently:
358
- # * \_-ava2f-\_
359
- # * \_-ava2b-\_
360
- # * \_-ava3f-\_
361
- #
362
- # ### Security Policies
363
- #
364
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
365
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
366
- # @param include [String] Specifies objects to include in the response after transaction is created
367
- # @param model [Object] The transaction you wish to create
368
- # @return [Object]
369
- def create_transaction(model, options={})
370
- path = "/api/v2/transactions/create"
371
- post(path, model, options)
372
- end
373
-
374
-
375
- # Remove lines from an existing unlocked transaction
376
- #
377
- # Remove lines to an existing unlocked transaction.
378
- #
379
- # The `DeleteLines` API allows you to remove transaction lines from existing unlocked transaction, so that customer will
380
- # be able to delete transaction lines and adjust original transaction the way they like
381
- #
382
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
383
- # sales, purchases, inventory transfer, and returns (also called refunds).
384
- # 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:
385
- #
386
- # * Lines
387
- # * Details (implies lines)
388
- # * Summary (implies details)
389
- # * Addresses
390
- # * SummaryOnly (omit lines and details - reduces API response size)
391
- # * LinesOnly (omit details - reduces API response size)
392
- #
393
- # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
394
- #
395
- # ### Security Policies
396
- #
397
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
398
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
399
- # @param include [String] Specifies objects to include in the response after transaction is created
400
- # @param model [Object] information about the transaction and lines to be removed
401
- # @return [Object]
402
- def delete_lines(model, options={})
403
- path = "/api/v2/companies/transactions/lines/delete"
404
- post(path, model, options)
405
- end
406
-
407
-
408
- # Retrieve a single transaction by code
409
- #
410
- # Get the current transaction identified by this company code, transaction code, and document type.
411
- #
412
- # A transaction is uniquely identified by `companyCode`, `code` (often called Transaction Code), and `documentType`.
413
- #
414
- # For compatibility purposes, when this API finds multiple transactions with the same transaction code, and if you have not specified
415
- # the `type` parameter to this API, it will default to selecting the `SalesInvoices` transaction. To change this behavior, use the
416
- # optional `documentType` parameter to specify the specific document type you wish to find.
417
- #
418
- # If this transaction was adjusted, the return value of this API will be the current transaction with this code.
419
- #
420
- # 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:
421
- #
422
- # * Lines
423
- # * Details (implies lines)
424
- # * Summary (implies details)
425
- # * Addresses
426
- # * SummaryOnly (omit lines and details - reduces API response size)
427
- # * LinesOnly (omit details - reduces API response size)
428
- #
429
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
430
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
431
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
432
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
433
- #
434
- # ### Security Policies
435
- #
436
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
437
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
438
- # @param companyCode [String] The company code of the company that recorded this transaction
439
- # @param transactionCode [String] The transaction code to retrieve
440
- # @param documentType [String] (Optional): The document type of the transaction to retrieve (See DocumentType::* for a list of allowable values)
441
- # @param include [String] Specifies objects to include in this fetch call
442
- # @return [Object]
443
- def get_transaction_by_code(companyCode, transactionCode, options={})
444
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}"
445
- get(path, options)
446
- end
447
-
448
-
449
- # Retrieve a single transaction by code
450
- #
451
- # DEPRECATED: Please use the `GetTransactionByCode` API instead.
452
- #
453
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
454
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
455
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
456
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
457
- #
458
- # ### Security Policies
459
- #
460
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
461
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
462
- # @param companyCode [String] The company code of the company that recorded this transaction
463
- # @param transactionCode [String] The transaction code to retrieve
464
- # @param documentType [String] The transaction type to retrieve (See DocumentType::* for a list of allowable values)
465
- # @param include [String] Specifies objects to include in this fetch call
466
- # @return [Object]
467
- def get_transaction_by_code_and_type(companyCode, transactionCode, documentType, options={})
468
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/types/#{documentType}"
469
- get(path, options)
470
- end
471
-
472
-
473
- # Retrieve a single transaction by ID
474
- #
475
- # Get the unique transaction identified by this URL.
476
- #
477
- # This endpoint retrieves the exact transaction identified by this ID number even if that transaction was later adjusted
478
- # by using the `AdjustTransaction` endpoint.
479
- #
480
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
481
- # sales, purchases, inventory transfer, and returns (also called refunds).
482
- #
483
- # 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:
484
- #
485
- # * Lines
486
- # * Details (implies lines)
487
- # * Summary (implies details)
488
- # * Addresses
489
- # * SummaryOnly (omit lines and details - reduces API response size)
490
- # * LinesOnly (omit details - reduces API response size)
491
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
492
- #
493
- # ### Security Policies
494
- #
495
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
496
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
497
- # @param id [Integer] The unique ID number of the transaction to retrieve
498
- # @param include [String] Specifies objects to include in this fetch call
499
- # @return [Object]
500
- def get_transaction_by_id(id, options={})
501
- path = "/api/v2/transactions/#{id}"
502
- get(path, options)
503
- end
504
-
505
-
506
- # Retrieve all transactions
507
- #
508
- # List all transactions attached to this company.
509
- #
510
- # This endpoint is limited to returning 1,000 transactions at a time maximum.
511
- #
512
- # When listing transactions, you must specify a `date` range filter. If you do not specify a `$filter` that includes a `date` field
513
- # criteria, the query will default to looking at only those transactions with `date` in the past 30 days.
514
- #
515
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
516
- # sales, purchases, inventory transfer, and returns (also called refunds).
517
- #
518
- # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
519
- # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
520
- #
521
- # 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:
522
- #
523
- # * Lines
524
- # * Details (implies lines)
525
- # * Summary (implies details)
526
- # * Addresses
527
- # * SummaryOnly (omit lines and details - reduces API response size)
528
- # * LinesOnly (omit details - reduces API response size)
529
- #
530
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
531
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
532
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
533
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
534
- #
535
- # ### Security Policies
536
- #
537
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
538
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
539
- # @param companyCode [String] The company code of the company that recorded this transaction
540
- # @param dataSourceId [Integer] Optionally filter transactions to those from a specific data source.
541
- # @param include [String] Specifies objects to include in this fetch call
542
- # @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:* totalDiscount, lines, addresses, locationTypes, summary, taxDetailsByTaxType, parameters, messages, invoiceMessages, isFakeTransaction
543
- # @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.
544
- # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
545
- # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
546
- # @return [FetchResult]
547
- def list_transactions_by_company(companyCode, options={})
548
- path = "/api/v2/companies/#{companyCode}/transactions"
549
- get(path, options)
550
- end
551
-
552
-
553
- # Lock a single transaction
554
- #
555
- # Lock a transaction uniquely identified by this URL.
556
- #
557
- # This API is mainly used for connector developer to simulate what happens when Returns product locks a document.
558
- # After this API call succeeds, the document will be locked and can't be voided or adjusted.
559
- #
560
- # This API is only available to customers in Sandbox with AvaTaxPro subscription. On production servers, this API is available by invitation only.
561
- #
562
- # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
563
- #
564
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
565
- # sales, purchases, inventory transfer, and returns (also called refunds).
566
- #
567
- # 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:
568
- #
569
- # * Lines
570
- # * Details (implies lines)
571
- # * Summary (implies details)
572
- # * Addresses
573
- # * SummaryOnly (omit lines and details - reduces API response size)
574
- # * LinesOnly (omit details - reduces API response size)
575
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
576
- #
577
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
578
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
579
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
580
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
581
- #
582
- # ### Security Policies
583
- #
584
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
585
- # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
586
- # @param companyCode [String] The company code of the company that recorded this transaction
587
- # @param transactionCode [String] The transaction code to lock
588
- # @param documentType [String] (Optional): The document type of the transaction to lock. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
589
- # @param include [String] Specifies objects to include in this fetch call
590
- # @param model [Object] The lock request you wish to execute
591
- # @return [Object]
592
- def lock_transaction(companyCode, transactionCode, model, options={})
593
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/lock"
594
- post(path, model, options)
595
- end
596
-
597
-
598
- # Create a refund for a transaction
599
- #
600
- # Create a refund for a transaction.
601
- #
602
- # The `RefundTransaction` API allows you to quickly and easily create a `ReturnInvoice` representing a refund
603
- # for a previously created `SalesInvoice` transaction. You can choose to create a full or partial refund, and
604
- # specify individual line items from the original sale for refund.
605
- #
606
- # The `RefundTransaction` API ensures that the tax amount you refund to the customer exactly matches the tax that
607
- # was calculated during the original transaction, regardless of any changes to your company's configuration, rules,
608
- # nexus, or any other setting.
609
- #
610
- # This API is intended to be a shortcut to allow you to quickly and accurately generate a refund for the following
611
- # common refund scenarios:
612
- #
613
- # * A full refund of a previous sale
614
- # * Refunding the tax that was charged on a previous sale, when the customer provides an exemption certificate after the purchase
615
- # * Refunding one or more items (lines) from a previous sale
616
- # * Granting a customer a percentage refund of a previous sale
617
- #
618
- # For more complex scenarios than the ones above, please use `CreateTransaction` with document type `ReturnInvoice` to
619
- # create a custom refund transaction.
620
- #
621
- # 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:
622
- #
623
- # * Lines
624
- # * Details (implies lines)
625
- # * Summary (implies details)
626
- # * Addresses
627
- # * SummaryOnly (omit lines and details - reduces API response size)
628
- # * LinesOnly (omit details - reduces API response size)
629
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
630
- # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
631
- #
632
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
633
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
634
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
635
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
636
- #
637
- # ### Security Policies
638
- #
639
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
640
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
641
- # @param companyCode [String] The code of the company that made the original sale
642
- # @param transactionCode [String] The transaction code of the original sale
643
- # @param include [String] Specifies objects to include in the response after transaction is created
644
- # @param documentType [String] (Optional): The document type of the transaction to refund. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
645
- # @param useTaxDateOverride [Boolean] (Optional): If set to true, processes refund using taxDateOverride rather than taxAmountOverride (Note: taxAmountOverride is not allowed for SST states).
646
- # @param model [Object] Information about the refund to create
647
- # @return [Object]
648
- def refund_transaction(companyCode, transactionCode, model, options={})
649
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/refund"
650
- post(path, model, options)
651
- end
652
-
653
-
654
- # Perform multiple actions on a transaction
655
- #
656
- # Performs one or more actions against the current transaction uniquely identified by this URL.
657
- #
658
- # The `SettleTransaction` API call can perform the work of `ChangeCode`, `VerifyTransaction`, and `CommitTransaction`.
659
- #
660
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
661
- # sales, purchases, inventory transfer, and returns (also called refunds).
662
- #
663
- # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
664
- #
665
- # This API is available for users who want to execute more than one action at a time.
666
- #
667
- # 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:
668
- #
669
- # * Lines
670
- # * Details (implies lines)
671
- # * Summary (implies details)
672
- # * Addresses
673
- # * SummaryOnly (omit lines and details - reduces API response size)
674
- # * LinesOnly (omit details - reduces API response size)
675
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
676
- #
677
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
678
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
679
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
680
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
681
- #
682
- # ### Security Policies
683
- #
684
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
685
- # @param companyCode [String] The company code of the company that recorded this transaction
686
- # @param transactionCode [String] The transaction code to settle
687
- # @param documentType [String] (Optional): The document type of the transaction to settle. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
688
- # @param include [String] Specifies objects to include in this fetch call
689
- # @param model [Object] The data from an external system to reconcile against AvaTax
690
- # @return [Object]
691
- def settle_transaction(companyCode, transactionCode, model, options={})
692
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/settle"
693
- post(path, model, options)
694
- end
695
-
696
-
697
- # Uncommit a transaction for reporting
698
- #
699
- # Adjusts a transaction by changing it to an uncommitted status.
700
- #
701
- # Transactions that have been previously reported to a tax authority by Avalara Managed Returns are considered `locked` and are
702
- # no longer available to be uncommitted.
703
- #
704
- # 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:
705
- #
706
- # * Lines
707
- # * Details (implies lines)
708
- # * Summary (implies details)
709
- # * Addresses
710
- # * SummaryOnly (omit lines and details - reduces API response size)
711
- # * LinesOnly (omit details - reduces API response size)
712
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
713
- #
714
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
715
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
716
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
717
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
718
- #
719
- # ### Security Policies
720
- #
721
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
722
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
723
- # @param companyCode [String] The company code of the company that recorded this transaction
724
- # @param transactionCode [String] The transaction code to Uncommit
725
- # @param documentType [String] (Optional): The document type of the transaction to Uncommit. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
726
- # @param include [String] Specifies objects to include in this fetch call
727
- # @return [Object]
728
- def uncommit_transaction(companyCode, transactionCode, options={})
729
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/uncommit"
730
- post(path, options)
731
- end
732
-
733
-
734
- # Unvoids a transaction
735
- #
736
- # Unvoids a voided transaction
737
- #
738
- # 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:
739
- #
740
- # * Lines
741
- # * Details (implies lines)
742
- # * Summary (implies details)
743
- # * Addresses
744
- # * SummaryOnly (omit lines and details - reduces API response size)
745
- # * LinesOnly (omit details - reduces API response size)
746
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
747
- #
748
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
749
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
750
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
751
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
752
- #
753
- # ### Security Policies
754
- #
755
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
756
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
757
- # @param companyCode [String] The company code of the company that recorded this transaction
758
- # @param transactionCode [String] The transaction code to commit
759
- # @param documentType [String] (Optional): The document type of the transaction to commit. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
760
- # @param include [String] Specifies objects to include in this fetch call
761
- # @return [Object]
762
- def unvoid_transaction(companyCode, transactionCode, options={})
763
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/unvoid"
764
- post(path, options)
765
- end
766
-
767
-
768
- # Verify a transaction
769
- #
770
- # Verifies that the transaction uniquely identified by this URL matches certain expected values.
771
- #
772
- # If the transaction does not match these expected values, this API will return an error code indicating which value did not match.
773
- #
774
- # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
775
- #
776
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
777
- # sales, purchases, inventory transfer, and returns (also called refunds).
778
- #
779
- # 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:
780
- #
781
- # * Lines
782
- # * Details (implies lines)
783
- # * Summary (implies details)
784
- # * Addresses
785
- # * SummaryOnly (omit lines and details - reduces API response size)
786
- # * LinesOnly (omit details - reduces API response size)
787
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
788
- #
789
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
790
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
791
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
792
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
793
- #
794
- # ### Security Policies
795
- #
796
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
797
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
798
- # @param companyCode [String] The company code of the company that recorded this transaction
799
- # @param transactionCode [String] The transaction code to settle
800
- # @param documentType [String] (Optional): The document type of the transaction to verify. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
801
- # @param include [String] Specifies objects to include in this fetch call
802
- # @param model [Object] The data from an external system to reconcile against AvaTax
803
- # @return [Object]
804
- def verify_transaction(companyCode, transactionCode, model, options={})
805
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/verify"
806
- post(path, model, options)
807
- end
808
-
809
-
810
- # Void a transaction
811
- #
812
- # Voids the current transaction uniquely identified by this URL.
813
- #
814
- # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
815
- # sales, purchases, inventory transfer, and returns (also called refunds).
816
- #
817
- # When you void a transaction, that transaction's status is recorded as `DocVoided`.
818
- #
819
- # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
820
- #
821
- # Transactions that have been previously reported to a tax authority by Avalara Managed Returns are no longer available to be voided.
822
- #
823
- # 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:
824
- #
825
- # * Lines
826
- # * Details (implies lines)
827
- # * Summary (implies details)
828
- # * Addresses
829
- # * SummaryOnly (omit lines and details - reduces API response size)
830
- # * LinesOnly (omit details - reduces API response size)
831
- # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
832
- #
833
- # NOTE: If your companyCode or transactionCode contains any of these characters /, + or ? please use the following encoding before making a request:
834
- # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
835
- # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
836
- # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
837
- #
838
- # ### Security Policies
839
- #
840
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
841
- # * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
842
- # @param companyCode [String] The company code of the company that recorded this transaction
843
- # @param transactionCode [String] The transaction code to void
844
- # @param documentType [String] (Optional): The document type of the transaction to void. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
845
- # @param include [String] Specifies objects to include in this fetch call
846
- # @param model [Object] The void request you wish to execute. To void a transaction the code must be set to 'DocVoided'
847
- # @return [Object]
848
- def void_transaction(companyCode, transactionCode, model, options={})
849
- path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/void"
850
- post(path, model, options)
851
- end
852
-
853
- end
854
- end
1
+ module AvaTax
2
+ class Client
3
+ module Transactions
4
+
5
+
6
+ # Add lines to an existing unlocked transaction
7
+ #
8
+ # Add lines to an existing unlocked transaction.
9
+ #
10
+ # The `AddLines` API allows you to add additional transaction lines to existing transaction, so that customer will
11
+ # be able to append multiple calls together and form an extremely large transaction. If customer does not specify line number
12
+ # in the lines to be added, a new random Guid string will be generated for line number. If customer are not satisfied with
13
+ # the line number for the transaction lines, they can turn on the renumber switch to have REST v2 automatically renumber all
14
+ # transaction lines for them, in this case, the line number becomes: "1", "2", "3", ...
15
+ #
16
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
17
+ # sales, purchases, inventory transfer, and returns (also called refunds).
18
+ # 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:
19
+ #
20
+ # * Lines
21
+ # * Details (implies lines)
22
+ # * Summary (implies details)
23
+ # * Addresses
24
+ # * SummaryOnly (omit lines and details - reduces API response size)
25
+ # * LinesOnly (omit details - reduces API response size)
26
+ #
27
+ # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
28
+ #
29
+ # ### Security Policies
30
+ #
31
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
32
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
33
+ # @param include [String] Specifies objects to include in the response after transaction is created
34
+ # @param model [Object] information about the transaction and lines to be added
35
+ # @return [Object]
36
+ def add_lines(model, options={})
37
+ path = "/api/v2/companies/transactions/lines/add"
38
+ post(path, model, options)
39
+ end
40
+
41
+
42
+ # Correct a previously created transaction
43
+ #
44
+ # Replaces the current transaction uniquely identified by this URL with a new transaction.
45
+ #
46
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
47
+ # sales, purchases, inventory transfer, and returns (also called refunds).
48
+ #
49
+ # When you adjust a committed transaction, the original transaction will be updated with the status code `Adjusted`, and
50
+ # both revisions will be available for retrieval based on their code and ID numbers.
51
+ # Only transactions in `Committed` status are reported by Avalara Managed Returns.
52
+ #
53
+ # Transactions that have been previously reported to a tax authority by Avalara Managed Returns are considered `locked` and are
54
+ # no longer available for adjustments.
55
+ #
56
+ # 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:
57
+ #
58
+ # * Lines
59
+ # * Details (implies lines)
60
+ # * Summary (implies details)
61
+ # * Addresses
62
+ # * SummaryOnly (omit lines and details - reduces API response size)
63
+ # * LinesOnly (omit details - reduces API response size)
64
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
65
+ #
66
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
67
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
68
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
69
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
70
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
71
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
72
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
73
+ #
74
+ # ### Security Policies
75
+ #
76
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
77
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
78
+ # @param companyCode [String] The company code of the company that recorded this transaction
79
+ # @param transactionCode [String] The transaction code to adjust
80
+ # @param documentType [String] (Optional): The document type of the transaction to adjust. (See DocumentType::* for a list of allowable values)
81
+ # @param include [String] Specifies objects to include in this fetch call
82
+ # @param model [Object] The adjustment you wish to make
83
+ # @return [Object]
84
+ def adjust_transaction(companyCode, transactionCode, model, options={})
85
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/adjust"
86
+ post(path, model, options)
87
+ end
88
+
89
+
90
+ # Get audit information about a transaction
91
+ #
92
+ # Retrieve audit information about a transaction stored in AvaTax.
93
+ #
94
+ # The `AuditTransaction` API retrieves audit information related to a specific transaction. This audit
95
+ # information includes the following:
96
+ #
97
+ # * The `CompanyId` of the company that created the transaction
98
+ # * The server timestamp representing the exact server time when the transaction was created
99
+ # * The server duration - how long it took to process this transaction
100
+ # * Whether exact API call details were logged
101
+ # * A reconstructed API call showing what the original CreateTransaction call looked like
102
+ #
103
+ # This API can be used to examine information about a previously created transaction.
104
+ #
105
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
106
+ # sales, purchases, inventory transfer, and returns (also called refunds).
107
+ #
108
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
109
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
110
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
111
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
112
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
113
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
114
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
115
+ #
116
+ # ### Security Policies
117
+ #
118
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
119
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
120
+ # @param companyCode [String] The code identifying the company that owns this transaction
121
+ # @param transactionCode [String] The code identifying the transaction
122
+ # @return [Object]
123
+ def audit_transaction(companyCode, transactionCode)
124
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/audit"
125
+ get(path)
126
+ end
127
+
128
+
129
+ # Get audit information about a transaction
130
+ #
131
+ # Retrieve audit information about a transaction stored in AvaTax.
132
+ #
133
+ # The `AuditTransaction` API retrieves audit information related to a specific transaction. This audit
134
+ # information includes the following:
135
+ #
136
+ # * The `CompanyId` of the company that created the transaction
137
+ # * The server timestamp representing the exact server time when the transaction was created
138
+ # * The server duration - how long it took to process this transaction
139
+ # * Whether exact API call details were logged
140
+ # * A reconstructed API call showing what the original CreateTransaction call looked like
141
+ #
142
+ # This API can be used to examine information about a previously created transaction.
143
+ #
144
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
145
+ # sales, purchases, inventory transfer, and returns (also called refunds).
146
+ #
147
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
148
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
149
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
150
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
151
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
152
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
153
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
154
+ #
155
+ # ### Security Policies
156
+ #
157
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
158
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
159
+ # @param companyCode [String] The code identifying the company that owns this transaction
160
+ # @param transactionCode [String] The code identifying the transaction
161
+ # @param documentType [String] The document type of the original transaction (See DocumentType::* for a list of allowable values)
162
+ # @return [Object]
163
+ def audit_transaction_with_type(companyCode, transactionCode, documentType)
164
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/types/#{documentType}/audit"
165
+ get(path)
166
+ end
167
+
168
+
169
+ # Lock a set of documents
170
+ #
171
+ # This API is available by invitation only.
172
+ #
173
+ # Lock a set of transactions uniquely identified by DocumentIds provided. This API allows locking multiple documents at once.
174
+ # After this API call succeeds, documents will be locked and can't be voided.
175
+ #
176
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
177
+ # sales, purchases, inventory transfer, and returns (also called refunds).
178
+ #
179
+ # ### Security Policies
180
+ #
181
+ # * This API requires the user role Compliance Root User.
182
+ # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
183
+ # @param model [Object] bulk lock request
184
+ # @return [Object]
185
+ def bulk_lock_transaction(model)
186
+ path = "/api/v2/transactions/lock"
187
+ post(path, model)
188
+ end
189
+
190
+
191
+ # Change a transaction's code
192
+ #
193
+ # Renames a transaction uniquely identified by this URL by changing its `code` value.
194
+ #
195
+ # This API is available as long as the transaction is in `saved` or `posted` status. When a transaction
196
+ # is `committed`, it can be modified by using the [AdjustTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/AdjustTransaction/) method.
197
+ #
198
+ # After this API call succeeds, the transaction will have a new URL matching its new `code`.
199
+ #
200
+ # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
201
+ #
202
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
203
+ # sales, purchases, inventory transfer, and returns (also called refunds).
204
+ #
205
+ # 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:
206
+ #
207
+ # * Lines
208
+ # * Details (implies lines)
209
+ # * Summary (implies details)
210
+ # * Addresses
211
+ # * SummaryOnly (omit lines and details - reduces API response size)
212
+ # * LinesOnly (omit details - reduces API response size)
213
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
214
+ #
215
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
216
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
217
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
218
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
219
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
220
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
221
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
222
+ #
223
+ # ### Security Policies
224
+ #
225
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
226
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
227
+ # @param companyCode [String] The company code of the company that recorded this transaction
228
+ # @param transactionCode [String] The transaction code to change
229
+ # @param documentType [String] (Optional): The document type of the transaction to change document code. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
230
+ # @param include [String] Specifies objects to include in this fetch call
231
+ # @param model [Object] The code change request you wish to execute
232
+ # @return [Object]
233
+ def change_transaction_code(companyCode, transactionCode, model, options={})
234
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/changecode"
235
+ post(path, model, options)
236
+ end
237
+
238
+
239
+ # Commit a transaction for reporting
240
+ #
241
+ # Marks a transaction by changing its status to `Committed`.
242
+ #
243
+ # Transactions that are committed are available to be reported to a tax authority by Avalara Managed Returns.
244
+ #
245
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
246
+ # sales, purchases, inventory transfer, and returns (also called refunds).
247
+ #
248
+ # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
249
+ #
250
+ # Any changes made to a committed transaction will generate a transaction history.
251
+ #
252
+ # 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:
253
+ #
254
+ # * Lines
255
+ # * Details (implies lines)
256
+ # * Summary (implies details)
257
+ # * Addresses
258
+ # * SummaryOnly (omit lines and details - reduces API response size)
259
+ # * LinesOnly (omit details - reduces API response size)
260
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
261
+ #
262
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
263
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
264
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
265
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
266
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
267
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
268
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
269
+ #
270
+ # ### Security Policies
271
+ #
272
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
273
+ # @param companyCode [String] The company code of the company that recorded this transaction
274
+ # @param transactionCode [String] The transaction code to commit
275
+ # @param documentType [String] (Optional): The document type of the transaction to commit. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
276
+ # @param include [String] Specifies objects to include in this fetch call
277
+ # @param model [Object] The commit request you wish to execute
278
+ # @return [Object]
279
+ def commit_transaction(companyCode, transactionCode, model, options={})
280
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/commit"
281
+ post(path, model, options)
282
+ end
283
+
284
+
285
+ # Create or adjust a transaction
286
+ #
287
+ # Records a new transaction or adjust an existing transaction in AvaTax.
288
+ #
289
+ # The `CreateOrAdjustTransaction` endpoint is used to create a new transaction or update an existing one. This API
290
+ # can help you create an idempotent service that creates transactions
291
+ # If there exists a transaction identified by code, the original transaction will be adjusted by using the meta data
292
+ # in the input transaction.
293
+ #
294
+ # The `CreateOrAdjustTransaction` API cannot modify any transaction that has been reported to a tax authority using
295
+ # the Avalara Managed Returns Service or any other tax filing service. If you call this API to attempt to modify
296
+ # a transaction that has been reported on a tax filing, you will receive the error `CannotModifyLockedTransaction`.
297
+ #
298
+ # To generate a refund for a transaction, use the `RefundTransaction` API.
299
+ #
300
+ # If you don't specify the field `type` in your request, you will get an estimate of type `SalesOrder`, which will not be recorded in the database.
301
+ #
302
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
303
+ # sales, purchases, inventory transfer, and returns (also called refunds).
304
+ # 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:
305
+ #
306
+ # * Lines
307
+ # * Details (implies lines)
308
+ # * Summary (implies details)
309
+ # * Addresses
310
+ # * SummaryOnly (omit lines and details - reduces API response size)
311
+ # * LinesOnly (omit details - reduces API response size)
312
+ # * ForceTimeout - Simulates a timeout. This adds a 30 second delay and error to your API call. This can be used to test your code to ensure it can respond correctly in the case of a dropped connection.
313
+ #
314
+ # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
315
+ #
316
+ # NOTE: Avoid using the following strings in your transaction codes as they are encoding strings and will be interpreted differently:
317
+ # * \_-ava2f-\_
318
+ # * \_-ava2b-\_
319
+ # * \_-ava3f-\_
320
+ #
321
+ # ### Security Policies
322
+ #
323
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
324
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
325
+ # @param include [String] Specifies objects to include in the response after transaction is created
326
+ # @param model [Object] The transaction you wish to create or adjust
327
+ # @return [Object]
328
+ def create_or_adjust_transaction(model, options={})
329
+ path = "/api/v2/transactions/createoradjust"
330
+ post(path, model, options)
331
+ end
332
+
333
+
334
+ # Create a new transaction
335
+ #
336
+ # Records a new transaction in AvaTax.
337
+ #
338
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
339
+ # sales, purchases, inventory transfer, and returns (also called refunds).
340
+ #
341
+ # The `CreateTransaction` endpoint uses the tax profile of your company to identify the correct tax rules
342
+ # and rates to apply to all line items in this transaction. The end result will be the total tax calculated by AvaTax based on your
343
+ # company's configuration and the data provided in this API call.
344
+ #
345
+ # The `CreateTransaction` API will report an error if a committed transaction already exists with the same `code`. To
346
+ # avoid this error, use the `CreateOrAdjustTransaction` API - it will create the transaction if it does not exist, or
347
+ # update it if it does exist.
348
+ #
349
+ # To generate a refund for a transaction, use the `RefundTransaction` API.
350
+ #
351
+ # The field `type` identifies the kind of transaction - for example, a sale, purchase, or refund. If you do not specify
352
+ # a `type` value, you will receive an estimate of type `SalesOrder`, which will not be recorded.
353
+ #
354
+ # The origin and destination locations for a transaction must be identified by either address or geocode. For address-based transactions, please
355
+ # provide addresses in the fields `line`, `city`, `region`, `country` and `postalCode`. For geocode-based transactions, please provide the geocode
356
+ # information in the fields `latitude` and `longitude`. If either `latitude` or `longitude` or both are null, the transaction will be calculated
357
+ # using the best available address location information.
358
+ #
359
+ # 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:
360
+ #
361
+ # * Lines
362
+ # * Details (implies lines)
363
+ # * Summary (implies details)
364
+ # * Addresses
365
+ # * SummaryOnly (omit lines and details - reduces API response size)
366
+ # * LinesOnly (omit details - reduces API response size)
367
+ # * ForceTimeout - Simulates a timeout. This adds a 30 second delay and error to your API call. This can be used to test your code to ensure it can respond correctly in the case of a dropped connection.
368
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
369
+ #
370
+ # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
371
+ #
372
+ # NOTE: Avoid using the following strings in your transaction codes as they are encoding strings and will be interpreted differently:
373
+ # * \_-ava2f-\_
374
+ # * \_-ava2b-\_
375
+ # * \_-ava3f-\_
376
+ #
377
+ # ### Security Policies
378
+ #
379
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
380
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
381
+ # @param include [String] Specifies objects to include in the response after transaction is created
382
+ # @param model [Object] The transaction you wish to create
383
+ # @return [Object]
384
+ def create_transaction(model, options={})
385
+ path = "/api/v2/transactions/create"
386
+ post(path, model, options)
387
+ end
388
+
389
+
390
+ # Remove lines from an existing unlocked transaction
391
+ #
392
+ # Remove lines to an existing unlocked transaction.
393
+ #
394
+ # The `DeleteLines` API allows you to remove transaction lines from existing unlocked transaction, so that customer will
395
+ # be able to delete transaction lines and adjust original transaction the way they like
396
+ #
397
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
398
+ # sales, purchases, inventory transfer, and returns (also called refunds).
399
+ # 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:
400
+ #
401
+ # * Lines
402
+ # * Details (implies lines)
403
+ # * Summary (implies details)
404
+ # * Addresses
405
+ # * SummaryOnly (omit lines and details - reduces API response size)
406
+ # * LinesOnly (omit details - reduces API response size)
407
+ #
408
+ # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
409
+ #
410
+ # ### Security Policies
411
+ #
412
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
413
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
414
+ # @param include [String] Specifies objects to include in the response after transaction is created
415
+ # @param model [Object] information about the transaction and lines to be removed
416
+ # @return [Object]
417
+ def delete_lines(model, options={})
418
+ path = "/api/v2/companies/transactions/lines/delete"
419
+ post(path, model, options)
420
+ end
421
+
422
+
423
+ # Retrieve a single transaction by code
424
+ #
425
+ # Get the current transaction identified by this company code, transaction code, and document type.
426
+ #
427
+ # A transaction is uniquely identified by `companyCode`, `code` (often called Transaction Code), and `documentType`.
428
+ #
429
+ # For compatibility purposes, when this API finds multiple transactions with the same transaction code, and if you have not specified
430
+ # the `type` parameter to this API, it will default to selecting the `SalesInvoices` transaction. To change this behavior, use the
431
+ # optional `documentType` parameter to specify the specific document type you wish to find.
432
+ #
433
+ # If this transaction was adjusted, the return value of this API will be the current transaction with this code.
434
+ #
435
+ # 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:
436
+ #
437
+ # * Lines
438
+ # * Details (implies lines)
439
+ # * Summary (implies details)
440
+ # * Addresses
441
+ # * SummaryOnly (omit lines and details - reduces API response size)
442
+ # * LinesOnly (omit details - reduces API response size)
443
+ #
444
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
445
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
446
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
447
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
448
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
449
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
450
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
451
+ #
452
+ # ### Security Policies
453
+ #
454
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
455
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
456
+ # @param companyCode [String] The company code of the company that recorded this transaction
457
+ # @param transactionCode [String] The transaction code to retrieve
458
+ # @param documentType [String] (Optional): The document type of the transaction to retrieve (See DocumentType::* for a list of allowable values)
459
+ # @param include [String] Specifies objects to include in this fetch call
460
+ # @return [Object]
461
+ def get_transaction_by_code(companyCode, transactionCode, options={})
462
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}"
463
+ get(path, options)
464
+ end
465
+
466
+
467
+ # Retrieve a single transaction by code
468
+ #
469
+ # DEPRECATED: Please use the `GetTransactionByCode` API instead.
470
+ #
471
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
472
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
473
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
474
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
475
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
476
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
477
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
478
+ #
479
+ # ### Security Policies
480
+ #
481
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
482
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
483
+ # @param companyCode [String] The company code of the company that recorded this transaction
484
+ # @param transactionCode [String] The transaction code to retrieve
485
+ # @param documentType [String] The transaction type to retrieve (See DocumentType::* for a list of allowable values)
486
+ # @param include [String] Specifies objects to include in this fetch call
487
+ # @return [Object]
488
+ def get_transaction_by_code_and_type(companyCode, transactionCode, documentType, options={})
489
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/types/#{documentType}"
490
+ get(path, options)
491
+ end
492
+
493
+
494
+ # Retrieve a single transaction by ID
495
+ #
496
+ # Get the unique transaction identified by this URL.
497
+ #
498
+ # This endpoint retrieves the exact transaction identified by this ID number even if that transaction was later adjusted
499
+ # by using the `AdjustTransaction` endpoint.
500
+ #
501
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
502
+ # sales, purchases, inventory transfer, and returns (also called refunds).
503
+ #
504
+ # 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:
505
+ #
506
+ # * Lines
507
+ # * Details (implies lines)
508
+ # * Summary (implies details)
509
+ # * Addresses
510
+ # * SummaryOnly (omit lines and details - reduces API response size)
511
+ # * LinesOnly (omit details - reduces API response size)
512
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
513
+ #
514
+ # ### Security Policies
515
+ #
516
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
517
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
518
+ # @param id [Integer] The unique ID number of the transaction to retrieve
519
+ # @param include [String] Specifies objects to include in this fetch call
520
+ # @return [Object]
521
+ def get_transaction_by_id(id, options={})
522
+ path = "/api/v2/transactions/#{id}"
523
+ get(path, options)
524
+ end
525
+
526
+
527
+ # Retrieve all transactions
528
+ #
529
+ # List all transactions attached to this company.
530
+ #
531
+ # This endpoint is limited to returning 1,000 transactions at a time maximum.
532
+ #
533
+ # When listing transactions, you must specify a `date` range filter. If you do not specify a `$filter` that includes a `date` field
534
+ # criteria, the query will default to looking at only those transactions with `date` in the past 30 days.
535
+ #
536
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
537
+ # sales, purchases, inventory transfer, and returns (also called refunds).
538
+ #
539
+ # Search for specific objects using the criteria in the `$filter` parameter; full documentation is available on [Filtering in REST](http://developer.avalara.com/avatax/filtering-in-rest/) .
540
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
541
+ #
542
+ # 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:
543
+ #
544
+ # * Lines
545
+ # * Details (implies lines)
546
+ # * Summary (implies details)
547
+ # * Addresses
548
+ # * SummaryOnly (omit lines and details - reduces API response size)
549
+ # * LinesOnly (omit details - reduces API response size)
550
+ #
551
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
552
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
553
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
554
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
555
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
556
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
557
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
558
+ #
559
+ # ### Security Policies
560
+ #
561
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
562
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
563
+ # @param companyCode [String] The company code of the company that recorded this transaction
564
+ # @param dataSourceId [Integer] Optionally filter transactions to those from a specific data source.
565
+ # @param include [String] Specifies objects to include in this fetch call
566
+ # @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:* totalDiscount, lines, addresses, locationTypes, summary, taxDetailsByTaxType, parameters, messages, invoiceMessages, isFakeTransaction
567
+ # @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.
568
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
569
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
570
+ # @return [FetchResult]
571
+ def list_transactions_by_company(companyCode, options={})
572
+ path = "/api/v2/companies/#{companyCode}/transactions"
573
+ get(path, options)
574
+ end
575
+
576
+
577
+ # Lock a single transaction
578
+ #
579
+ # Lock a transaction uniquely identified by this URL.
580
+ #
581
+ # This API is mainly used for connector developer to simulate what happens when Returns product locks a document.
582
+ # After this API call succeeds, the document will be locked and can't be voided or adjusted.
583
+ #
584
+ # This API is only available to customers in Sandbox with AvaTaxPro subscription. On production servers, this API is available by invitation only.
585
+ #
586
+ # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
587
+ #
588
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
589
+ # sales, purchases, inventory transfer, and returns (also called refunds).
590
+ #
591
+ # 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:
592
+ #
593
+ # * Lines
594
+ # * Details (implies lines)
595
+ # * Summary (implies details)
596
+ # * Addresses
597
+ # * SummaryOnly (omit lines and details - reduces API response size)
598
+ # * LinesOnly (omit details - reduces API response size)
599
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
600
+ #
601
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
602
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
603
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
604
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
605
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
606
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
607
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
608
+ #
609
+ # ### Security Policies
610
+ #
611
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
612
+ # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
613
+ # @param companyCode [String] The company code of the company that recorded this transaction
614
+ # @param transactionCode [String] The transaction code to lock
615
+ # @param documentType [String] (Optional): The document type of the transaction to lock. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
616
+ # @param include [String] Specifies objects to include in this fetch call
617
+ # @param model [Object] The lock request you wish to execute
618
+ # @return [Object]
619
+ def lock_transaction(companyCode, transactionCode, model, options={})
620
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/lock"
621
+ post(path, model, options)
622
+ end
623
+
624
+
625
+ # Create a refund for a transaction
626
+ #
627
+ # Create a refund for a transaction.
628
+ #
629
+ # The `RefundTransaction` API allows you to quickly and easily create a `ReturnInvoice` representing a refund
630
+ # for a previously created `SalesInvoice` transaction. You can choose to create a full or partial refund, and
631
+ # specify individual line items from the original sale for refund.
632
+ #
633
+ # The `RefundTransaction` API ensures that the tax amount you refund to the customer exactly matches the tax that
634
+ # was calculated during the original transaction, regardless of any changes to your company's configuration, rules,
635
+ # nexus, or any other setting.
636
+ #
637
+ # This API is intended to be a shortcut to allow you to quickly and accurately generate a refund for the following
638
+ # common refund scenarios:
639
+ #
640
+ # * A full refund of a previous sale
641
+ # * Refunding the tax that was charged on a previous sale, when the customer provides an exemption certificate after the purchase
642
+ # * Refunding one or more items (lines) from a previous sale
643
+ # * Granting a customer a percentage refund of a previous sale
644
+ #
645
+ # For more complex scenarios than the ones above, please use `CreateTransaction` with document type `ReturnInvoice` to
646
+ # create a custom refund transaction.
647
+ #
648
+ # 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:
649
+ #
650
+ # * Lines
651
+ # * Details (implies lines)
652
+ # * Summary (implies details)
653
+ # * Addresses
654
+ # * SummaryOnly (omit lines and details - reduces API response size)
655
+ # * LinesOnly (omit details - reduces API response size)
656
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
657
+ # If you omit the `$include` parameter, the API will assume you want `Summary,Addresses`.
658
+ #
659
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
660
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
661
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
662
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
663
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
664
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
665
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
666
+ #
667
+ # ### Security Policies
668
+ #
669
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
670
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
671
+ # @param companyCode [String] The code of the company that made the original sale
672
+ # @param transactionCode [String] The transaction code of the original sale
673
+ # @param include [String] Specifies objects to include in the response after transaction is created
674
+ # @param documentType [String] (Optional): The document type of the transaction to refund. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
675
+ # @param useTaxDateOverride [Boolean] (Optional): If set to true, processes refund using taxDateOverride rather than taxAmountOverride (Note: taxAmountOverride is not allowed for SST states).
676
+ # @param model [Object] Information about the refund to create
677
+ # @return [Object]
678
+ def refund_transaction(companyCode, transactionCode, model, options={})
679
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/refund"
680
+ post(path, model, options)
681
+ end
682
+
683
+
684
+ # Perform multiple actions on a transaction
685
+ #
686
+ # Performs one or more actions against the current transaction uniquely identified by this URL.
687
+ #
688
+ # The `SettleTransaction` API call can perform the work of `ChangeCode`, `VerifyTransaction`, and `CommitTransaction`.
689
+ #
690
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
691
+ # sales, purchases, inventory transfer, and returns (also called refunds).
692
+ #
693
+ # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
694
+ #
695
+ # This API is available for users who want to execute more than one action at a time.
696
+ #
697
+ # 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:
698
+ #
699
+ # * Lines
700
+ # * Details (implies lines)
701
+ # * Summary (implies details)
702
+ # * Addresses
703
+ # * SummaryOnly (omit lines and details - reduces API response size)
704
+ # * LinesOnly (omit details - reduces API response size)
705
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
706
+ #
707
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
708
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
709
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
710
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
711
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
712
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
713
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
714
+ #
715
+ # ### Security Policies
716
+ #
717
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
718
+ # @param companyCode [String] The company code of the company that recorded this transaction
719
+ # @param transactionCode [String] The transaction code to settle
720
+ # @param documentType [String] (Optional): The document type of the transaction to settle. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
721
+ # @param include [String] Specifies objects to include in this fetch call
722
+ # @param model [Object] The data from an external system to reconcile against AvaTax
723
+ # @return [Object]
724
+ def settle_transaction(companyCode, transactionCode, model, options={})
725
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/settle"
726
+ post(path, model, options)
727
+ end
728
+
729
+
730
+ # Uncommit a transaction for reporting
731
+ #
732
+ # Adjusts a transaction by changing it to an uncommitted status.
733
+ #
734
+ # Transactions that have been previously reported to a tax authority by Avalara Managed Returns are considered `locked` and are
735
+ # no longer available to be uncommitted.
736
+ #
737
+ # 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:
738
+ #
739
+ # * Lines
740
+ # * Details (implies lines)
741
+ # * Summary (implies details)
742
+ # * Addresses
743
+ # * SummaryOnly (omit lines and details - reduces API response size)
744
+ # * LinesOnly (omit details - reduces API response size)
745
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
746
+ #
747
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
748
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
749
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
750
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
751
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
752
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
753
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
754
+ #
755
+ # ### Security Policies
756
+ #
757
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
758
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
759
+ # @param companyCode [String] The company code of the company that recorded this transaction
760
+ # @param transactionCode [String] The transaction code to Uncommit
761
+ # @param documentType [String] (Optional): The document type of the transaction to Uncommit. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
762
+ # @param include [String] Specifies objects to include in this fetch call
763
+ # @return [Object]
764
+ def uncommit_transaction(companyCode, transactionCode, options={})
765
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/uncommit"
766
+ post(path, options)
767
+ end
768
+
769
+
770
+ # Unvoids a transaction
771
+ #
772
+ # Unvoids a voided transaction
773
+ #
774
+ # 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:
775
+ #
776
+ # * Lines
777
+ # * Details (implies lines)
778
+ # * Summary (implies details)
779
+ # * Addresses
780
+ # * SummaryOnly (omit lines and details - reduces API response size)
781
+ # * LinesOnly (omit details - reduces API response size)
782
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
783
+ #
784
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
785
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
786
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
787
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
788
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
789
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
790
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
791
+ #
792
+ # ### Security Policies
793
+ #
794
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
795
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
796
+ # @param companyCode [String] The company code of the company that recorded this transaction
797
+ # @param transactionCode [String] The transaction code to commit
798
+ # @param documentType [String] (Optional): The document type of the transaction to commit. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
799
+ # @param include [String] Specifies objects to include in this fetch call
800
+ # @return [Object]
801
+ def unvoid_transaction(companyCode, transactionCode, options={})
802
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/unvoid"
803
+ post(path, options)
804
+ end
805
+
806
+
807
+ # Verify a transaction
808
+ #
809
+ # Verifies that the transaction uniquely identified by this URL matches certain expected values.
810
+ #
811
+ # If the transaction does not match these expected values, this API will return an error code indicating which value did not match.
812
+ #
813
+ # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
814
+ #
815
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
816
+ # sales, purchases, inventory transfer, and returns (also called refunds).
817
+ #
818
+ # 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:
819
+ #
820
+ # * Lines
821
+ # * Details (implies lines)
822
+ # * Summary (implies details)
823
+ # * Addresses
824
+ # * SummaryOnly (omit lines and details - reduces API response size)
825
+ # * LinesOnly (omit details - reduces API response size)
826
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
827
+ #
828
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
829
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
830
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
831
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
832
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
833
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
834
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
835
+ #
836
+ # ### Security Policies
837
+ #
838
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
839
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
840
+ # @param companyCode [String] The company code of the company that recorded this transaction
841
+ # @param transactionCode [String] The transaction code to settle
842
+ # @param documentType [String] (Optional): The document type of the transaction to verify. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
843
+ # @param include [String] Specifies objects to include in this fetch call
844
+ # @param model [Object] The data from an external system to reconcile against AvaTax
845
+ # @return [Object]
846
+ def verify_transaction(companyCode, transactionCode, model, options={})
847
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/verify"
848
+ post(path, model, options)
849
+ end
850
+
851
+
852
+ # Void a transaction
853
+ #
854
+ # Voids the current transaction uniquely identified by this URL.
855
+ #
856
+ # A transaction represents a unique potentially taxable action that your company has recorded, and transactions include actions like
857
+ # sales, purchases, inventory transfer, and returns (also called refunds).
858
+ #
859
+ # When you void a transaction, that transaction's status is recorded as `DocVoided`.
860
+ #
861
+ # If you have more than one document with the same `code`, specify the `documentType` parameter to choose between them.
862
+ #
863
+ # Transactions that have been previously reported to a tax authority by Avalara Managed Returns are no longer available to be voided.
864
+ #
865
+ # 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:
866
+ #
867
+ # * Lines
868
+ # * Details (implies lines)
869
+ # * Summary (implies details)
870
+ # * Addresses
871
+ # * SummaryOnly (omit lines and details - reduces API response size)
872
+ # * LinesOnly (omit details - reduces API response size)
873
+ # * TaxDetailsByTaxType - Includes the aggregated tax, exempt tax, taxable and non-taxable for each tax type returned in the transaction summary.
874
+ #
875
+ # NOTE: If your companyCode or transactionCode contains any of these characters /, +, ? or a space please use the following encoding before making a request:
876
+ # * Replace '/' with '\_-ava2f-\_' For example: document/Code becomes document_-ava2f-_Code
877
+ # * Replace '+' with '\_-ava2b-\_' For example: document+Code becomes document_-ava2b-_Code
878
+ # * Replace '?' with '\_-ava3f-\_' For example: document?Code becomes document_-ava3f-_Code
879
+ # * Replace '%' with '\_-ava25-\_' For example: document%Code becomes document_-ava25-_Code
880
+ # * Replace '#' with '\_-ava23-\_' For example: document#Code becomes document_-ava23-_Code
881
+ # * Replace ' ' with '%20' For example: document Code becomes document%20Code
882
+ #
883
+ # ### Security Policies
884
+ #
885
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CSPTester, ProStoresOperator, SSTAdmin, TechnicalSupportAdmin.
886
+ # * This API depends on the following active services<br />*Required* (all): AvaTaxPro, BasicReturns.
887
+ # @param companyCode [String] The company code of the company that recorded this transaction
888
+ # @param transactionCode [String] The transaction code to void
889
+ # @param documentType [String] (Optional): The document type of the transaction to void. If not provided, the default is SalesInvoice. (See DocumentType::* for a list of allowable values)
890
+ # @param include [String] Specifies objects to include in this fetch call
891
+ # @param model [Object] The void request you wish to execute. To void a transaction the code must be set to 'DocVoided'
892
+ # @return [Object]
893
+ def void_transaction(companyCode, transactionCode, model, options={})
894
+ path = "/api/v2/companies/#{companyCode}/transactions/#{transactionCode}/void"
895
+ post(path, model, options)
896
+ end
897
+
898
+ end
899
+ end
855
900
  end