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,399 +1,401 @@
1
- module AvaTax
2
- class Client
3
- module Companies
4
-
5
-
6
- # Checks whether the integration being used to set up this company and run transactions onto this company is compliant to all requirements.
7
- #
8
- # Examines the most recent 100 transactions or data from the last month when verifying transaction-related integrations.
9
- # For partners who write integrations against AvaTax for many clients, this API is a way to do a quick self testing to verify whether the
10
- # written integrations for a company are sufficient enough to be delivered to the respective customers to start using it.
11
- #
12
- # This API provides messages specific enough (through predefined checks) to guide the partner on what integrations are still missing from the company to get fully certified.
13
- # The API makes the following checks to conclude if the company is NOT fully certified:
14
- # 1. Any past month items contains generic tax code of P0000000.
15
- # 2. All the companies on the requesting account are test companies.
16
- # 3. No Voided/Cancelled documents in the past 30 days.
17
- # 4. There are less than 2 committed documents.
18
- # 5. Any documentCode is a generic GUID string.
19
- # 6. Any customerCode on document is a generic GUID string.
20
- # 7. No document has more than 1 documentLine.
21
- # 8. All of the documents have missing exemptionNo, customerUsageType, taxDateOverride or negative amount.
22
- # 9. Any document quantity is a negative number.
23
- # 10. Any document have repeated lines.
24
- # 11. No document has shipping charge.
25
- # 12. All documents have same ItemCodes, descriptions and taxCodes.
26
- # 13. Less than 2 addresses used across all documents.
27
- # 14. Whether locationCode was used in documents.
28
- # 15. Account with AvaGlobal subscription and no documents have VATBuyerId.
29
- # 16. Any document has currencyCode not being USD for accounts with AvaGlobal subscription.
30
- # 17. All documents have countryCode used for accounts with AvaGlobal subscription.
31
- #
32
- # ### Security Policies
33
- #
34
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
35
- # @param id [Integer] The ID of the company to check if its integration is certified.
36
- # @return [String]
37
- def certify_integration(id)
38
- path = "/api/v2/companies/#{id}/certify"
39
- get(path)
40
- end
41
-
42
-
43
- # Change the filing status of this company
44
- #
45
- # Changes the current filing status of this company.
46
- #
47
- # For customers using Avalara's Managed Returns Service, each company within their account can request
48
- # for Avalara to file tax returns on their behalf. Avalara compliance team members will review all
49
- # requested filing calendars prior to beginning filing tax returns on behalf of this company.
50
- #
51
- # The following changes may be requested through this API:
52
- #
53
- # * If a company is in `NotYetFiling` status, the customer may request this be changed to `FilingRequested`.
54
- # * Avalara compliance team members may change a company from `FilingRequested` to `FirstFiling`.
55
- # * Avalara compliance team members may change a company from `FirstFiling` to `Active`.
56
- #
57
- # All other status changes must be requested through the Avalara customer support team.
58
- #
59
- # ### Security Policies
60
- #
61
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
62
- # @param id [Integer]
63
- # @param model [Object]
64
- # @return [String]
65
- def change_filing_status(id, model)
66
- path = "/api/v2/companies/#{id}/filingstatus"
67
- post(path, model)
68
- end
69
-
70
-
71
- # Quick setup for a company with a single physical address
72
- #
73
- # Shortcut to quickly setup a single-physical-location company with critical information and activate it.
74
- # This API provides quick and simple company setup functionality and does the following things:
75
- #
76
- # * Create a company object with its own tax profile
77
- # * Add a key contact person for the company
78
- # * Set up one physical location for the main office
79
- # * Declare nexus in all taxing jurisdictions for that main office address
80
- # * Activate the company
81
- #
82
- # This API only provides a limited subset of functionality compared to the 'Create Company' API call.
83
- # If you need additional features or options not present in this 'Quick Setup' API call, please use the full 'Create Company' call instead.
84
- # Please allow 1 minute before making transactions using the company.
85
- #
86
- # ### Security Policies
87
- #
88
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
89
- # @param model [Object] Information about the company you wish to create.
90
- # @return [Object]
91
- def company_initialize(model)
92
- path = "/api/v2/companies/initialize"
93
- post(path, model)
94
- end
95
-
96
-
97
- # Create new companies
98
- #
99
- # Create one or more new company objects.
100
- # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
101
- # You may attach nested data objects such as contacts, locations, and nexus with this CREATE call, and those objects will be created with the company.
102
- #
103
- # NOTE: Please do not use these blacklisted characters in company name and code: ';', '\', '|'.
104
- #
105
- # ### Security Policies
106
- #
107
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
108
- # @param model [CompanyModel[]] Either a single company object or an array of companies to create
109
- # @return [CompanyModel[]]
110
- def create_companies(model)
111
- path = "/api/v2/companies"
112
- post(path, model)
113
- end
114
-
115
-
116
- # Request managed returns funding setup for a company
117
- #
118
- # This API is available by invitation only.
119
- # Companies that use the Avalara Managed Returns or the SST Certified Service Provider services are
120
- # required to setup their funding configuration before Avalara can begin filing tax returns on their
121
- # behalf.
122
- # Funding configuration for each company is set up by submitting a funding setup request, which can
123
- # be sent either via email or via an embedded HTML widget.
124
- # When the funding configuration is submitted to Avalara, it will be reviewed by treasury team members
125
- # before approval.
126
- # This API records that an ambedded HTML funding setup widget was activated.
127
- # This API requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
128
- #
129
- # ### Security Policies
130
- #
131
- # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
132
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
133
- # @param id [Integer] The unique identifier of the company
134
- # @param model [Object] The funding initialization request
135
- # @return [Object]
136
- def create_funding_request(id, model)
137
- path = "/api/v2/companies/#{id}/funding/setup"
138
- post(path, model)
139
- end
140
-
141
-
142
- # Delete a single company
143
- #
144
- # Deleting a company will delete all child companies, and all users attached to this company.
145
- #
146
- # ### Security Policies
147
- #
148
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, SSTAdmin, TechnicalSupportAdmin.
149
- # @param id [Integer] The ID of the company you wish to delete.
150
- # @return [ErrorDetail[]]
151
- def delete_company(id)
152
- path = "/api/v2/companies/#{id}"
153
- delete(path)
154
- end
155
-
156
-
157
- # Check the funding configuration of a company
158
- #
159
- # This API is available by invitation only.
160
- # Requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
161
- # Returns the funding configuration of the requested company.
162
- # .
163
- #
164
- # ### Security Policies
165
- #
166
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
167
- # * 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.
168
- # @param companyId [Integer] The unique identifier of the company
169
- # @return [Object]
170
- def funding_configuration_by_company(companyId)
171
- path = "/api/v2/companies/#{companyId}/funding/configuration"
172
- get(path)
173
- end
174
-
175
-
176
- # Check the funding configuration of a company
177
- #
178
- # This API is available by invitation only.
179
- # Requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
180
- # Returns the funding configuration of the requested company.
181
- # .
182
- #
183
- # ### Security Policies
184
- #
185
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
186
- # * 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.
187
- # @param companyId [Integer] The unique identifier of the company
188
- # @param currency [String] The currency of the funding. USD and CAD are the only valid currencies
189
- # @return [FundingConfigurationModel[]]
190
- def funding_configurations_by_company_and_currency(companyId, options={})
191
- path = "/api/v2/companies/#{companyId}/funding/configurations"
192
- get(path, options)
193
- end
194
-
195
-
196
- # Retrieve a single company
197
- #
198
- # Get the company object identified by this URL.
199
- # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
200
- # 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:
201
- #
202
- # * Contacts
203
- # * Items
204
- # * Locations
205
- # * Nexus
206
- # * Settings
207
- # * TaxCodes
208
- # * TaxRules
209
- # * UPC
210
- #
211
- # ### Security Policies
212
- #
213
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
214
- # @param id [Integer] The ID of the company to retrieve.
215
- # @param include [String] OPTIONAL: A comma separated list of special fetch options. * Child objects - Specify one or more of the following to retrieve objects related to each company: "Contacts", "FilingCalendars", "Items", "Locations", "Nexus", "TaxCodes", "NonReportingChildren" or "TaxRules". * Deleted objects - Specify "FetchDeleted" to retrieve information about previously deleted objects.
216
- # @return [Object]
217
- def get_company(id, options={})
218
- path = "/api/v2/companies/#{id}"
219
- get(path, options)
220
- end
221
-
222
-
223
- # Get configuration settings for this company
224
- #
225
- # Retrieve a list of all configuration settings tied to this company.
226
- #
227
- # Configuration settings provide you with the ability to control features of your account and of your
228
- # tax software. The category name `AvaCertServiceConfig` is reserved for
229
- # Avalara internal software configuration values; to store your own company-level settings, please
230
- # create a new category name that begins with `X-`, for example, `X-MyCustomCategory`.
231
- #
232
- # Company settings are permanent settings that cannot be deleted. You can set the value of a
233
- # company setting to null if desired and if the particular setting supports it.
234
- #
235
- # Avalara-based company settings for `AvaCertServiceConfig` affect your company's exemption certificate
236
- # processing, and should be changed with care.
237
- #
238
- # ### Security Policies
239
- #
240
- # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
241
- # @param id [Integer]
242
- # @return [CompanyConfigurationModel[]]
243
- def get_company_configuration(id)
244
- path = "/api/v2/companies/#{id}/configuration"
245
- get(path)
246
- end
247
-
248
-
249
- # Get this company's filing status
250
- #
251
- # Retrieve the current filing status of this company.
252
- #
253
- # For customers using Avalara's Managed Returns Service, each company within their account can request
254
- # for Avalara to file tax returns on their behalf. Avalara compliance team members will review all
255
- # requested filing calendars prior to beginning filing tax returns on behalf of this company.
256
- #
257
- # A company's filing status can be one of the following values:
258
- #
259
- # * `NoReporting` - This company is not configured to report tax returns; instead, it reports through a parent company.
260
- # * `NotYetFiling` - This company has not yet begun filing tax returns through Avalara's Managed Returns Service.
261
- # * `FilingRequested` - The company has requested to begin filing tax returns, but Avalara's compliance team has not yet begun filing.
262
- # * `FirstFiling` - The company has recently filing tax returns and is in a new status.
263
- # * `Active` - The company is currently active and is filing tax returns via Avalara Managed Returns.
264
- #
265
- # ### Security Policies
266
- #
267
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
268
- # @param id [Integer]
269
- # @return [String]
270
- def get_filing_status(id)
271
- path = "/api/v2/companies/#{id}/filingstatus"
272
- get(path)
273
- end
274
-
275
-
276
- # Check managed returns funding status for a company
277
- #
278
- # This API is available by invitation only.
279
- # Requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
280
- # Returns a list of funding setup requests and their current status.
281
- # Each object in the result is a request that was made to setup or adjust funding status for this company.
282
- #
283
- # ### Security Policies
284
- #
285
- # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
286
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
287
- # @param id [Integer] The unique identifier of the company
288
- # @return [FundingStatusModel[]]
289
- def list_funding_requests_by_company(id)
290
- path = "/api/v2/companies/#{id}/funding"
291
- get(path)
292
- end
293
-
294
-
295
- # Retrieve a list of MRS Companies with account
296
- #
297
- # This API is available by invitation only.
298
- #
299
- # Get a list of companies with an active MRS service.
300
- #
301
- # ### Security Policies
302
- #
303
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
304
- # @return [FetchResult]
305
- def list_mrs_companies()
306
- path = "/api/v2/companies/mrs"
307
- get(path)
308
- end
309
-
310
-
311
- # Retrieve all companies
312
- #
313
- # Get multiple company objects.
314
- #
315
- # A `company` represents a single corporation or individual that is registered to handle transactional taxes.
316
- #
317
- # 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/) .
318
- # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
319
- # 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:
320
- #
321
- # * Contacts
322
- # * Items
323
- # * Locations
324
- # * Nexus
325
- # * Settings
326
- # * TaxCodes
327
- # * TaxRules
328
- # * UPC
329
- #
330
- # ### Security Policies
331
- #
332
- # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
333
- # @param include [String] A comma separated list of objects to fetch underneath this company. Any object with a URL path underneath this company can be fetched by specifying its name.
334
- # @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:* IsFein, contacts, items, locations, nexus, settings, taxCodes, taxRules, upcs, nonReportingChildCompanies, exemptCerts
335
- # @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.
336
- # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
337
- # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
338
- # @return [FetchResult]
339
- def query_companies(options={})
340
- path = "/api/v2/companies"
341
- get(path, options)
342
- end
343
-
344
-
345
- # Change configuration settings for this company
346
- #
347
- # Update configuration settings tied to this company.
348
- #
349
- # Configuration settings provide you with the ability to control features of your account and of your
350
- # tax software. The category names `AvaCertServiceConfig` is reserved for
351
- # Avalara internal software configuration values; to store your own company-level settings, please
352
- # create a new category name that begins with `X-`, for example, `X-MyCustomCategory`.
353
- #
354
- # Company settings are permanent settings that cannot be deleted. You can set the value of a
355
- # company setting to null if desired and if the particular setting supports it.
356
- #
357
- # Avalara-based company settings for `AvaCertServiceConfig` affect your company's exemption certificate
358
- # processing, and should be changed with care.
359
- #
360
- # ### Security Policies
361
- #
362
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
363
- # @param id [Integer]
364
- # @param model [CompanyConfigurationModel[]]
365
- # @return [CompanyConfigurationModel[]]
366
- def set_company_configuration(id, model)
367
- path = "/api/v2/companies/#{id}/configuration"
368
- post(path, model)
369
- end
370
-
371
-
372
- # Update a single company
373
- #
374
- # Replace the existing company object at this URL with an updated object.
375
- #
376
- # A `CompanyModel` represents a single corporation or individual that is registered to handle transactional taxes.
377
- # All data from the existing object will be replaced with data in the object you PUT.
378
- #
379
- # When calling `UpdateCompany`, you are permitted to update the company itself. Updates to the nested objects
380
- # such as contacts, locations, or settings are not permitted. To update the nested objects
381
- #
382
- # To set a field's value to `null`, you may either set its value to `null` or omit that field from the object you PUT.
383
- #
384
- # NOTE: Please do not use these blacklisted characters in company name and code: ';', '\', '|'.
385
- #
386
- # ### Security Policies
387
- #
388
- # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
389
- # @param id [Integer] The ID of the company you wish to update.
390
- # @param model [Object] The company object you wish to update.
391
- # @return [Object]
392
- def update_company(id, model)
393
- path = "/api/v2/companies/#{id}"
394
- put(path, model)
395
- end
396
-
397
- end
398
- end
1
+ module AvaTax
2
+ class Client
3
+ module Companies
4
+
5
+
6
+ # Checks whether the integration being used to set up this company and run transactions onto this company is compliant to all requirements.
7
+ #
8
+ # Examines the most recent 100 transactions or data from the last month when verifying transaction-related integrations.
9
+ # For partners who write integrations against AvaTax for many clients, this API is a way to do a quick self testing to verify whether the
10
+ # written integrations for a company are sufficient enough to be delivered to the respective customers to start using it.
11
+ #
12
+ # This API provides messages specific enough (through predefined checks) to guide the partner on what integrations are still missing from the company to get fully certified.
13
+ # The API makes the following checks to conclude if the company is NOT fully certified:
14
+ # 1. Any past month items contains generic tax code of P0000000.
15
+ # 2. All the companies on the requesting account are test companies.
16
+ # 3. No Voided/Cancelled documents in the past 30 days.
17
+ # 4. There are less than 2 committed documents.
18
+ # 5. Any documentCode is a generic GUID string.
19
+ # 6. Any customerCode on document is a generic GUID string.
20
+ # 7. No document has more than 1 documentLine.
21
+ # 8. All of the documents have missing exemptionNo, customerUsageType, taxDateOverride or negative amount.
22
+ # 9. Any document quantity is a negative number.
23
+ # 10. Any document have repeated lines.
24
+ # 11. No document has shipping charge.
25
+ # 12. All documents have same ItemCodes, descriptions and taxCodes.
26
+ # 13. Less than 2 addresses used across all documents.
27
+ # 14. Whether locationCode was used in documents.
28
+ # 15. Account with AvaGlobal subscription and no documents have VATBuyerId.
29
+ # 16. Any document has currencyCode not being USD for accounts with AvaGlobal subscription.
30
+ # 17. All documents have countryCode used for accounts with AvaGlobal subscription.
31
+ #
32
+ # ### Security Policies
33
+ #
34
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
35
+ # @param id [Integer] The ID of the company to check if its integration is certified.
36
+ # @return [String]
37
+ def certify_integration(id)
38
+ path = "/api/v2/companies/#{id}/certify"
39
+ get(path)
40
+ end
41
+
42
+
43
+ # Change the filing status of this company
44
+ #
45
+ # Changes the current filing status of this company.
46
+ #
47
+ # For customers using Avalara's Managed Returns Service, each company within their account can request
48
+ # for Avalara to file tax returns on their behalf. Avalara compliance team members will review all
49
+ # requested filing calendars prior to beginning filing tax returns on behalf of this company.
50
+ #
51
+ # The following changes may be requested through this API:
52
+ #
53
+ # * If a company is in `NotYetFiling` status, the customer may request this be changed to `FilingRequested`.
54
+ # * Avalara compliance team members may change a company from `FilingRequested` to `FirstFiling`.
55
+ # * Avalara compliance team members may change a company from `FirstFiling` to `Active`.
56
+ #
57
+ # All other status changes must be requested through the Avalara customer support team.
58
+ #
59
+ # ### Security Policies
60
+ #
61
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
62
+ # @param id [Integer]
63
+ # @param model [Object]
64
+ # @return [String]
65
+ def change_filing_status(id, model)
66
+ path = "/api/v2/companies/#{id}/filingstatus"
67
+ post(path, model)
68
+ end
69
+
70
+
71
+ # Quick setup for a company with a single physical address
72
+ #
73
+ # Shortcut to quickly setup a single-physical-location company with critical information and activate it.
74
+ # This API provides quick and simple company setup functionality and does the following things:
75
+ #
76
+ # * Create a company object with its own tax profile
77
+ # * Add a key contact person for the company
78
+ # * Set up one physical location for the main office
79
+ # * Declare nexus in all taxing jurisdictions for that main office address
80
+ # * Activate the company
81
+ #
82
+ # This API only provides a limited subset of functionality compared to the 'Create Company' API call.
83
+ # If you need additional features or options not present in this 'Quick Setup' API call, please use the full 'Create Company' call instead.
84
+ # Please allow 1 minute before making transactions using the company.
85
+ #
86
+ # ### Security Policies
87
+ #
88
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
89
+ # @param model [Object] Information about the company you wish to create.
90
+ # @return [Object]
91
+ def company_initialize(model)
92
+ path = "/api/v2/companies/initialize"
93
+ post(path, model)
94
+ end
95
+
96
+
97
+ # Create new companies
98
+ #
99
+ # Create one or more new company objects.
100
+ # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
101
+ # You may attach nested data objects such as contacts, locations, and nexus with this CREATE call, and those objects will be created with the company.
102
+ #
103
+ # NOTE: Please do not use these blacklisted characters in company name and code: ';', '\', '|'.
104
+ #
105
+ # ### Security Policies
106
+ #
107
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
108
+ # @param model [CompanyModel[]] Either a single company object or an array of companies to create
109
+ # @return [CompanyModel[]]
110
+ def create_companies(model)
111
+ path = "/api/v2/companies"
112
+ post(path, model)
113
+ end
114
+
115
+
116
+ # Request managed returns funding setup for a company
117
+ #
118
+ # This API is available by invitation only.
119
+ # Companies that use the Avalara Managed Returns or the SST Certified Service Provider services are
120
+ # required to setup their funding configuration before Avalara can begin filing tax returns on their
121
+ # behalf.
122
+ # Funding configuration for each company is set up by submitting a funding setup request, which can
123
+ # be sent either via email or via an embedded HTML widget.
124
+ # When the funding configuration is submitted to Avalara, it will be reviewed by treasury team members
125
+ # before approval.
126
+ # This API records that an ambedded HTML funding setup widget was activated.
127
+ # This API requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
128
+ #
129
+ # ### Security Policies
130
+ #
131
+ # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
132
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
133
+ # @param id [Integer] The unique identifier of the company
134
+ # @param model [Object] The funding initialization request
135
+ # @return [Object]
136
+ def create_funding_request(id, model)
137
+ path = "/api/v2/companies/#{id}/funding/setup"
138
+ post(path, model)
139
+ end
140
+
141
+
142
+ # Delete a single company
143
+ #
144
+ # Deleting a company will delete all child companies, and all users attached to this company.
145
+ #
146
+ # ### Security Policies
147
+ #
148
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, SSTAdmin, TechnicalSupportAdmin.
149
+ # @param id [Integer] The ID of the company you wish to delete.
150
+ # @return [ErrorDetail[]]
151
+ def delete_company(id)
152
+ path = "/api/v2/companies/#{id}"
153
+ delete(path)
154
+ end
155
+
156
+
157
+ # Check the funding configuration of a company
158
+ #
159
+ # This API is available by invitation only.
160
+ # Requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
161
+ # Returns the funding configuration of the requested company.
162
+ # .
163
+ #
164
+ # ### Security Policies
165
+ #
166
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
167
+ # * 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.
168
+ # @param companyId [Integer] The unique identifier of the company
169
+ # @return [Object]
170
+ def funding_configuration_by_company(companyId)
171
+ path = "/api/v2/companies/#{companyId}/funding/configuration"
172
+ get(path)
173
+ end
174
+
175
+
176
+ # Check the funding configuration of a company
177
+ #
178
+ # This API is available by invitation only.
179
+ # Requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
180
+ # Returns the funding configuration of the requested company.
181
+ # .
182
+ #
183
+ # ### Security Policies
184
+ #
185
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
186
+ # * 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.
187
+ # @param companyId [Integer] The unique identifier of the company
188
+ # @param currency [String] The currency of the funding. USD and CAD are the only valid currencies
189
+ # @return [FundingConfigurationModel[]]
190
+ def funding_configurations_by_company_and_currency(companyId, options={})
191
+ path = "/api/v2/companies/#{companyId}/funding/configurations"
192
+ get(path, options)
193
+ end
194
+
195
+
196
+ # Retrieve a single company
197
+ #
198
+ # Get the company object identified by this URL.
199
+ # A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
200
+ # 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:
201
+ #
202
+ # * Contacts
203
+ # * Items
204
+ # * Locations
205
+ # * Nexus
206
+ # * Settings
207
+ # * TaxCodes
208
+ # * TaxRules
209
+ # * UPC
210
+ # * Parameters
211
+ #
212
+ # ### Security Policies
213
+ #
214
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
215
+ # @param id [Integer] The ID of the company to retrieve.
216
+ # @param include [String] OPTIONAL: A comma separated list of special fetch options. * Child objects - Specify one or more of the following to retrieve objects related to each company: "Contacts", "FilingCalendars", "Items", "Locations", "Nexus", "TaxCodes", "NonReportingChildren" or "TaxRules". * Deleted objects - Specify "FetchDeleted" to retrieve information about previously deleted objects.
217
+ # @return [Object]
218
+ def get_company(id, options={})
219
+ path = "/api/v2/companies/#{id}"
220
+ get(path, options)
221
+ end
222
+
223
+
224
+ # Get configuration settings for this company
225
+ #
226
+ # Retrieve a list of all configuration settings tied to this company.
227
+ #
228
+ # Configuration settings provide you with the ability to control features of your account and of your
229
+ # tax software. The category name `AvaCertServiceConfig` is reserved for
230
+ # Avalara internal software configuration values; to store your own company-level settings, please
231
+ # create a new category name that begins with `X-`, for example, `X-MyCustomCategory`.
232
+ #
233
+ # Company settings are permanent settings that cannot be deleted. You can set the value of a
234
+ # company setting to null if desired and if the particular setting supports it.
235
+ #
236
+ # Avalara-based company settings for `AvaCertServiceConfig` affect your company's exemption certificate
237
+ # processing, and should be changed with care.
238
+ #
239
+ # ### Security Policies
240
+ #
241
+ # * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
242
+ # @param id [Integer]
243
+ # @return [CompanyConfigurationModel[]]
244
+ def get_company_configuration(id)
245
+ path = "/api/v2/companies/#{id}/configuration"
246
+ get(path)
247
+ end
248
+
249
+
250
+ # Get this company's filing status
251
+ #
252
+ # Retrieve the current filing status of this company.
253
+ #
254
+ # For customers using Avalara's Managed Returns Service, each company within their account can request
255
+ # for Avalara to file tax returns on their behalf. Avalara compliance team members will review all
256
+ # requested filing calendars prior to beginning filing tax returns on behalf of this company.
257
+ #
258
+ # A company's filing status can be one of the following values:
259
+ #
260
+ # * `NoReporting` - This company is not configured to report tax returns; instead, it reports through a parent company.
261
+ # * `NotYetFiling` - This company has not yet begun filing tax returns through Avalara's Managed Returns Service.
262
+ # * `FilingRequested` - The company has requested to begin filing tax returns, but Avalara's compliance team has not yet begun filing.
263
+ # * `FirstFiling` - The company has recently filing tax returns and is in a new status.
264
+ # * `Active` - The company is currently active and is filing tax returns via Avalara Managed Returns.
265
+ #
266
+ # ### Security Policies
267
+ #
268
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
269
+ # @param id [Integer]
270
+ # @return [String]
271
+ def get_filing_status(id)
272
+ path = "/api/v2/companies/#{id}/filingstatus"
273
+ get(path)
274
+ end
275
+
276
+
277
+ # Check managed returns funding status for a company
278
+ #
279
+ # This API is available by invitation only.
280
+ # Requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
281
+ # Returns a list of funding setup requests and their current status.
282
+ # Each object in the result is a request that was made to setup or adjust funding status for this company.
283
+ #
284
+ # ### Security Policies
285
+ #
286
+ # * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
287
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
288
+ # @param id [Integer] The unique identifier of the company
289
+ # @return [FundingStatusModel[]]
290
+ def list_funding_requests_by_company(id)
291
+ path = "/api/v2/companies/#{id}/funding"
292
+ get(path)
293
+ end
294
+
295
+
296
+ # Retrieve a list of MRS Companies with account
297
+ #
298
+ # This API is available by invitation only.
299
+ #
300
+ # Get a list of companies with an active MRS service.
301
+ #
302
+ # ### Security Policies
303
+ #
304
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
305
+ # @return [FetchResult]
306
+ def list_mrs_companies()
307
+ path = "/api/v2/companies/mrs"
308
+ get(path)
309
+ end
310
+
311
+
312
+ # Retrieve all companies
313
+ #
314
+ # Get multiple company objects.
315
+ #
316
+ # A `company` represents a single corporation or individual that is registered to handle transactional taxes.
317
+ #
318
+ # 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/) .
319
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
320
+ # 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:
321
+ #
322
+ # * Contacts
323
+ # * Items
324
+ # * Locations
325
+ # * Nexus
326
+ # * Settings
327
+ # * TaxCodes
328
+ # * TaxRules
329
+ # * UPC
330
+ # * Parameters
331
+ #
332
+ # ### Security Policies
333
+ #
334
+ # * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser.
335
+ # @param include [String] A comma separated list of objects to fetch underneath this company. Any object with a URL path underneath this company can be fetched by specifying its name.
336
+ # @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:* IsFein, contacts, items, locations, nexus, settings, taxCodes, taxRules, upcs, nonReportingChildCompanies, exemptCerts, parameters
337
+ # @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.
338
+ # @param skip [Integer] If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
339
+ # @param orderBy [String] A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
340
+ # @return [FetchResult]
341
+ def query_companies(options={})
342
+ path = "/api/v2/companies"
343
+ get(path, options)
344
+ end
345
+
346
+
347
+ # Change configuration settings for this company
348
+ #
349
+ # Update configuration settings tied to this company.
350
+ #
351
+ # Configuration settings provide you with the ability to control features of your account and of your
352
+ # tax software. The category names `AvaCertServiceConfig` is reserved for
353
+ # Avalara internal software configuration values; to store your own company-level settings, please
354
+ # create a new category name that begins with `X-`, for example, `X-MyCustomCategory`.
355
+ #
356
+ # Company settings are permanent settings that cannot be deleted. You can set the value of a
357
+ # company setting to null if desired and if the particular setting supports it.
358
+ #
359
+ # Avalara-based company settings for `AvaCertServiceConfig` affect your company's exemption certificate
360
+ # processing, and should be changed with care.
361
+ #
362
+ # ### Security Policies
363
+ #
364
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, SSTAdmin, TechnicalSupportAdmin.
365
+ # @param id [Integer]
366
+ # @param model [CompanyConfigurationModel[]]
367
+ # @return [CompanyConfigurationModel[]]
368
+ def set_company_configuration(id, model)
369
+ path = "/api/v2/companies/#{id}/configuration"
370
+ post(path, model)
371
+ end
372
+
373
+
374
+ # Update a single company
375
+ #
376
+ # Replace the existing company object at this URL with an updated object.
377
+ #
378
+ # A `CompanyModel` represents a single corporation or individual that is registered to handle transactional taxes.
379
+ # All data from the existing object will be replaced with data in the object you PUT.
380
+ #
381
+ # When calling `UpdateCompany`, you are permitted to update the company itself. Updates to the nested objects
382
+ # such as contacts, locations, or settings are not permitted. To update the nested objects
383
+ #
384
+ # To set a field's value to `null`, you may either set its value to `null` or omit that field from the object you PUT.
385
+ #
386
+ # NOTE: Please do not use these blacklisted characters in company name and code: ';', '\', '|'.
387
+ #
388
+ # ### Security Policies
389
+ #
390
+ # * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
391
+ # @param id [Integer] The ID of the company you wish to update.
392
+ # @param model [Object] The company object you wish to update.
393
+ # @return [Object]
394
+ def update_company(id, model)
395
+ path = "/api/v2/companies/#{id}"
396
+ put(path, model)
397
+ end
398
+
399
+ end
400
+ end
399
401
  end