avatax 14.4.4 → 17.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +54 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +7 -0
  5. data/.yardopts +5 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +201 -191
  8. data/README.md +63 -61
  9. data/Rakefile +9 -0
  10. data/avatax.gemspec +39 -0
  11. data/example/avatax.rb +14 -0
  12. data/example/credentials.example.yaml +5 -0
  13. data/lib/avatax.rb +19 -13
  14. data/lib/avatax/api.rb +27 -0
  15. data/lib/avatax/client.rb +32 -0
  16. data/lib/avatax/client/accounts.rb +110 -0
  17. data/lib/avatax/client/addresses.rb +52 -0
  18. data/lib/avatax/client/batches.rb +117 -0
  19. data/lib/avatax/client/companies.rb +218 -0
  20. data/lib/avatax/client/contacts.rb +115 -0
  21. data/lib/avatax/client/definitions.rb +569 -0
  22. data/lib/avatax/client/filingcalendars.rb +313 -0
  23. data/lib/avatax/client/filings.rb +417 -0
  24. data/lib/avatax/client/free.rb +104 -0
  25. data/lib/avatax/client/fundingrequests.rb +53 -0
  26. data/lib/avatax/client/items.rb +111 -0
  27. data/lib/avatax/client/jurisdictionoverrides.rb +125 -0
  28. data/lib/avatax/client/locations.rb +158 -0
  29. data/lib/avatax/client/nexus.rb +157 -0
  30. data/lib/avatax/client/notices.rb +297 -0
  31. data/lib/avatax/client/onboarding.rb +23 -0
  32. data/lib/avatax/client/pointofsale.rb +24 -0
  33. data/lib/avatax/client/registrar.rb +216 -0
  34. data/lib/avatax/client/settings.rb +137 -0
  35. data/lib/avatax/client/subscriptions.rb +66 -0
  36. data/lib/avatax/client/taxcodes.rb +127 -0
  37. data/lib/avatax/client/taxrules.rb +127 -0
  38. data/lib/avatax/client/transactions.rb +473 -0
  39. data/lib/avatax/client/upcs.rb +112 -0
  40. data/lib/avatax/client/users.rb +112 -0
  41. data/lib/avatax/client/utilities.rb +52 -0
  42. data/lib/avatax/configuration.rb +53 -18
  43. data/lib/avatax/connection.rb +28 -0
  44. data/lib/avatax/request.rb +38 -0
  45. data/lib/avatax/version.rb +3 -0
  46. data/spec/avatax/client/accounts_spec.rb +26 -0
  47. data/spec/avatax_spec.rb +59 -0
  48. data/spec/fixtures/accounts.json +16 -0
  49. data/spec/spec_helper.rb +47 -0
  50. metadata +143 -30
  51. data/lib/avatax/address_service.rb +0 -31
  52. data/lib/avatax/tax_service.rb +0 -61
@@ -0,0 +1,313 @@
1
+ module AvaTax
2
+ class Client
3
+ module FilingCalendars
4
+
5
+
6
+ # Retrieve a single filing calendar
7
+ #
8
+ # This API is available by invitation only.
9
+ #
10
+ # @param int companyId The ID of the company that owns this filing calendar
11
+ # @param int id The primary key of this filing calendar
12
+ # @return FilingCalendarModel
13
+ def api_v2_companies_by_company_id_filingcalendars_by_id_get(companyId, id)
14
+ path = "/api/v2/companies/#{companyId}/filingcalendars/#{id}"
15
+
16
+ get(path)
17
+ end
18
+
19
+
20
+ # Retrieve all filing calendars for this company
21
+ #
22
+ # This API is available by invitation only.
23
+ #
24
+ # @param int companyId The ID of the company that owns these batches
25
+ # @param string filter 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/) .
26
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
27
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
28
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
29
+ # @return FetchResult
30
+ def api_v2_companies_by_company_id_filingcalendars_get(companyId, options={})
31
+ path = "/api/v2/companies/#{companyId}/filingcalendars"
32
+
33
+ get(path, options)
34
+ end
35
+
36
+
37
+ # Retrieve all filing requests for this company
38
+ #
39
+ # This API is available by invitation only.
40
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
41
+ # are reviewed and validated by Avalara Compliance before being implemented.
42
+ #
43
+ # @param int companyId The ID of the company that owns these batches
44
+ # @param string filter 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/) .
45
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
46
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
47
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
48
+ # @return FetchResult
49
+ def api_v2_companies_by_company_id_filingrequests_get(companyId, options={})
50
+ path = "/api/v2/companies/#{companyId}/filingrequests"
51
+
52
+ get(path, options)
53
+ end
54
+
55
+
56
+ # Returns a list of options for adding the specified form.
57
+ #
58
+ # This API is available by invitation only.
59
+ #
60
+ # @param int companyId The unique ID of the company that owns the filing calendar object
61
+ # @param string formCode The unique code of the form
62
+ # @return CycleAddOptionModel[]
63
+ def cycle_safe_add(companyId, options={})
64
+ path = "/api/v2/companies/#{companyId}/filingcalendars/add/options"
65
+
66
+ get(path, options)
67
+ end
68
+
69
+
70
+ # Indicates when changes are allowed to be made to a filing calendar.
71
+ #
72
+ # This API is available by invitation only.
73
+ #
74
+ # @param int companyId The unique ID of the company that owns the filing calendar object
75
+ # @param int id The unique ID of the filing calendar object
76
+ # @param FilingCalendarEditModel[] model A list of filing calendar edits to be made
77
+ # @return CycleEditOptionModel
78
+ def cycle_safe_edit(companyId, id, model)
79
+ path = "/api/v2/companies/#{companyId}/filingcalendars/#{id}/edit/options"
80
+
81
+ post(path, model)
82
+ end
83
+
84
+
85
+ # Returns a list of options for expiring a filing calendar
86
+ #
87
+ # This API is available by invitation only.
88
+ #
89
+ # @param int companyId The unique ID of the company that owns the filing calendar object
90
+ # @param int id The unique ID of the filing calendar object
91
+ # @return CycleExpireModel
92
+ def cycle_safe_expiration(companyId, id)
93
+ path = "/api/v2/companies/#{companyId}/filingcalendars/#{id}/cancel/options"
94
+
95
+ get(path)
96
+ end
97
+
98
+
99
+ # Delete a single filing calendar.
100
+ #
101
+ # This API is available by invitation only.
102
+ # Mark the existing notice object at this URL as deleted.
103
+ # A 'notice' represents a letter sent to a business by a tax authority regarding tax filing issues. Avalara
104
+ # Returns customers often receive support and assistance from the Compliance Notices team in handling notices received by taxing authorities.
105
+ #
106
+ # @param int companyId The ID of the company that owns this filing calendar.
107
+ # @param int id The ID of the filing calendar you wish to delete.
108
+ # @return ErrorDetail[]
109
+ def delete_filing_calendar(companyId, id)
110
+ path = "/api/v2/companies/#{companyId}/filingcalendars/#{id}"
111
+
112
+ delete(path)
113
+ end
114
+
115
+
116
+ # Edit existing Filing Calendar's Notes
117
+ #
118
+ # This API is available by invitation only.
119
+ # This API only allows updating of internal notes and company filing instructions.
120
+ # All other updates must go through a filing request at this time.
121
+ #
122
+ # @param int companyId The unique ID of the company that owns the filing request object
123
+ # @param int id The unique ID of the filing calendar object
124
+ # @param FilingCalendarModel model The filing calendar model you are wishing to update with.
125
+ # @return FilingCalendarModel
126
+ def filing_calendar_update(companyId, id, model)
127
+ path = "/api/v2/companies/#{companyId}/filingcalendars/#{id}"
128
+
129
+ put(path, model)
130
+ end
131
+
132
+
133
+ # Retrieve a single filing request
134
+ #
135
+ # This API is available by invitation only.
136
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
137
+ # are reviewed and validated by Avalara Compliance before being implemented.
138
+ #
139
+ # @param int companyId The ID of the company that owns this filing calendar
140
+ # @param int id The primary key of this filing calendar
141
+ # @return FilingRequestModel
142
+ def filing_requests(companyId, id)
143
+ path = "/api/v2/companies/#{companyId}/filingrequests/#{id}"
144
+
145
+ get(path)
146
+ end
147
+
148
+
149
+ # Create a new filing request to create a filing calendar
150
+ #
151
+ # This API is available by invitation only.
152
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
153
+ # are reviewed and validated by Avalara Compliance before being implemented.
154
+ #
155
+ # @param int companyId The unique ID of the company that will add the new filing calendar
156
+ # @param FilingRequestModel[] model Information about the proposed new filing calendar
157
+ # @return FilingRequestModel
158
+ def filing_requests_add(companyId, model)
159
+ path = "/api/v2/companies/#{companyId}/filingcalendars/add/request"
160
+
161
+ post(path, model)
162
+ end
163
+
164
+
165
+ # Approve existing Filing Request
166
+ #
167
+ # This API is available by invitation only.
168
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
169
+ # are reviewed and validated by Avalara Compliance before being implemented.
170
+ # The filing request must be in the "ChangeRequest" status to be approved.
171
+ #
172
+ # @param int companyId The unique ID of the company that owns the filing request object
173
+ # @param int id The unique ID of the filing request object
174
+ # @return FilingRequestModel
175
+ def filing_requests_approve(companyId, id)
176
+ path = "/api/v2/companies/#{companyId}/filingrequests/#{id}/approve"
177
+
178
+ post(path)
179
+ end
180
+
181
+
182
+ # Cancel existing Filing Request
183
+ #
184
+ # This API is available by invitation only.
185
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
186
+ # are reviewed and validated by Avalara Compliance before being implemented.
187
+ #
188
+ # @param int companyId The unique ID of the company that owns the filing request object
189
+ # @param int id The unique ID of the filing request object
190
+ # @return FilingRequestModel
191
+ def filing_requests_cancel(companyId, id)
192
+ path = "/api/v2/companies/#{companyId}/filingrequests/#{id}/cancel"
193
+
194
+ post(path)
195
+ end
196
+
197
+
198
+ # Create a new filing request to cancel a filing calendar
199
+ #
200
+ # This API is available by invitation only.
201
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
202
+ # are reviewed and validated by Avalara Compliance before being implemented.
203
+ #
204
+ # @param int companyId The unique ID of the company that owns the filing calendar object
205
+ # @param int id The unique ID number of the filing calendar to cancel
206
+ # @param FilingRequestModel[] model The cancellation request for this filing calendar
207
+ # @return FilingRequestModel
208
+ def filing_requests_new_cancel(companyId, id, model)
209
+ path = "/api/v2/companies/#{companyId}/filingcalendars/#{id}/cancel/request"
210
+
211
+ post(path, model)
212
+ end
213
+
214
+
215
+ # Create a new filing request to edit a filing calendar
216
+ #
217
+ # This API is available by invitation only.
218
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
219
+ # are reviewed and validated by Avalara Compliance before being implemented.
220
+ #
221
+ # @param int companyId The unique ID of the company that owns the filing calendar object
222
+ # @param int id The unique ID number of the filing calendar to edit
223
+ # @param FilingRequestModel[] model A list of filing calendar edits to be made
224
+ # @return FilingRequestModel
225
+ def filing_requests_new_edit(companyId, id, model)
226
+ path = "/api/v2/companies/#{companyId}/filingcalendars/#{id}/edit/request"
227
+
228
+ post(path, model)
229
+ end
230
+
231
+
232
+ # Edit existing Filing Request
233
+ #
234
+ # This API is available by invitation only.
235
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
236
+ # are reviewed and validated by Avalara Compliance before being implemented.
237
+ #
238
+ # @param int companyId The unique ID of the company that owns the filing request object
239
+ # @param int id The unique ID of the filing request object
240
+ # @param FilingRequestModel model A list of filing calendar edits to be made
241
+ # @return FilingRequestModel
242
+ def filing_requests_update(companyId, id, model)
243
+ path = "/api/v2/companies/#{companyId}/filingrequests/#{id}"
244
+
245
+ put(path, model)
246
+ end
247
+
248
+
249
+ # Gets the request status and Login Result
250
+ #
251
+ # This API is available by invitation only.
252
+ #
253
+ # @param int jobId The unique ID number of this login request
254
+ # @return LoginVerificationOutputModel
255
+ def login_verification_get(jobId)
256
+ path = "/api/v2/filingcalendars/credentials/#{jobId}"
257
+
258
+ get(path)
259
+ end
260
+
261
+
262
+ # New request for getting for validating customer's login credentials
263
+ #
264
+ # This API is available by invitation only.
265
+ #
266
+ # @param LoginVerificationInputModel model The model of the login information we are verifying
267
+ # @return LoginVerificationOutputModel
268
+ def login_verification_post(model)
269
+ path = "/api/v2/filingcalendars/credentials/verify"
270
+
271
+ post(path, model)
272
+ end
273
+
274
+
275
+ # Retrieve all filing calendars
276
+ #
277
+ # This API is available by invitation only.
278
+ #
279
+ # @param string filter 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/) .
280
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
281
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
282
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
283
+ # @return FetchResult
284
+ def query_filing_calendars(options={})
285
+ path = "/api/v2/filingcalendars"
286
+
287
+ get(path, options)
288
+ end
289
+
290
+
291
+ # Retrieve all filing requests
292
+ #
293
+ # This API is available by invitation only.
294
+ # A "filing request" represents a request to change an existing filing calendar. Filing requests
295
+ # are reviewed and validated by Avalara Compliance before being implemented.
296
+ #
297
+ # 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/) .
298
+ # Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
299
+ #
300
+ # @param string filter 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/) .
301
+ # @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
302
+ # @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
303
+ # @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
304
+ # @return FetchResult
305
+ def query_filing_requests(options={})
306
+ path = "/api/v2/filingrequests"
307
+
308
+ get(path, options)
309
+ end
310
+
311
+ end
312
+ end
313
+ end
@@ -0,0 +1,417 @@
1
+ module AvaTax
2
+ class Client
3
+ module Filings
4
+
5
+
6
+ # Approve all filings for the specified company in the given filing period.
7
+ #
8
+ # This API is available by invitation only.
9
+ # Approving a return means the customer is ready to let Avalara file that return.
10
+ # Customer either approves themselves from admin console,
11
+ # else system auto-approves the night before the filing cycle.
12
+ # Sometimes Compliance has to manually unapprove and reapprove to modify liability or filing for the customer.
13
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
14
+ # based on filing frequency of filing.
15
+ #
16
+ # @param int companyId The ID of the company that owns the filings.
17
+ # @param int year The year of the filing period to approve.
18
+ # @param int month The month of the filing period to approve.
19
+ # @param ApproveFilingsModel model The approve request you wish to execute.
20
+ # @return FilingModel[]
21
+ def approve_filings(companyId, year, month, model)
22
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/approve"
23
+
24
+ post(path, model)
25
+ end
26
+
27
+
28
+ # Approve all filings for the specified company in the given filing period and country.
29
+ #
30
+ # This API is available by invitation only.
31
+ # Approving a return means the customer is ready to let Avalara file that return.
32
+ # Customer either approves themselves from admin console,
33
+ # else system auto-approves the night before the filing cycle.
34
+ # Sometimes Compliance has to manually unapprove and reapprove to modify liability or filing for the customer.
35
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
36
+ # based on filing frequency of filing.
37
+ #
38
+ # @param int companyId The ID of the company that owns the filings.
39
+ # @param int year The year of the filing period to approve.
40
+ # @param int month The month of the filing period to approve.
41
+ # @param string country The two-character ISO-3166 code for the country.
42
+ # @param ApproveFilingsModel model The approve request you wish to execute.
43
+ # @return FilingModel[]
44
+ def approve_filings_country(companyId, year, month, country, model)
45
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/approve"
46
+
47
+ post(path, model)
48
+ end
49
+
50
+
51
+ # Approve all filings for the specified company in the given filing period, country and region.
52
+ #
53
+ # This API is available by invitation only.
54
+ # Approving a return means the customer is ready to let Avalara file that return.
55
+ # Customer either approves themselves from admin console,
56
+ # else system auto-approves the night before the filing cycle
57
+ # Sometimes Compliance has to manually unapprove and reapprove to modify liability or filing for the customer.
58
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
59
+ # based on filing frequency of filing.
60
+ #
61
+ # @param int companyId The ID of the company that owns the filings.
62
+ # @param int year The year of the filing period to approve.
63
+ # @param int month The month of the filing period to approve.
64
+ # @param string country The two-character ISO-3166 code for the country.
65
+ # @param string region The two or three character region code for the region.
66
+ # @param ApproveFilingsModel model The approve request you wish to execute.
67
+ # @return FilingModel[]
68
+ def approve_filings_country_region(companyId, year, month, country, region, model)
69
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/#{region}/approve"
70
+
71
+ post(path, model)
72
+ end
73
+
74
+
75
+ # Add an adjustment to a given filing.
76
+ #
77
+ # This API is available by invitation only.
78
+ # An "Adjustment" is usually an increase or decrease to customer funding to Avalara,
79
+ # such as early filer discount amounts that are refunded to the customer, or efile fees from websites.
80
+ # Sometimes may be a manual change in tax liability similar to an augmentation.
81
+ # This API creates a new adjustment for an existing tax filing.
82
+ # This API can only be used when the filing has not yet been approved.
83
+ #
84
+ # @param int companyId The ID of the company that owns the filing being adjusted.
85
+ # @param int year The year of the filing's filing period being adjusted.
86
+ # @param int month The month of the filing's filing period being adjusted.
87
+ # @param string country The two-character ISO-3166 code for the country of the filing being adjusted.
88
+ # @param string region The two or three character region code for the region.
89
+ # @param string formCode The unique code of the form being adjusted.
90
+ # @param FilingAdjustmentModel[] model A list of Adjustments to be created for the specified filing.
91
+ # @return FilingAdjustmentModel[]
92
+ def create_return_adjustment(companyId, year, month, country, region, formCode, model)
93
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/#{region}/#{formCode}/adjust"
94
+
95
+ post(path, model)
96
+ end
97
+
98
+
99
+ # Add an augmentation for a given filing.
100
+ #
101
+ # This API is available by invitation only.
102
+ # An "Augmentation" is a manually added increase or decrease in tax liability, by either customer or Avalara
103
+ # usually due to customer wanting to report tax Avatax does not support, e.g. bad debts, rental tax.
104
+ # This API creates a new augmentation for an existing tax filing.
105
+ # This API can only be used when the filing has not been approved.
106
+ #
107
+ # @param int companyId The ID of the company that owns the filing being changed.
108
+ # @param int year The month of the filing's filing period being changed.
109
+ # @param int month The month of the filing's filing period being changed.
110
+ # @param string country The two-character ISO-3166 code for the country of the filing being changed.
111
+ # @param string region The two or three character region code for the region of the filing being changed.
112
+ # @param string formCode The unique code of the form being changed.
113
+ # @param FilingAugmentationModel[] model A list of augmentations to be created for the specified filing.
114
+ # @return FilingAugmentationModel[]
115
+ def create_return_augmentation(companyId, year, month, country, region, formCode, model)
116
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/#{region}/#{formCode}/augment"
117
+
118
+ post(path, model)
119
+ end
120
+
121
+
122
+ # Delete an adjustment for a given filing.
123
+ #
124
+ # This API is available by invitation only.
125
+ # An "Adjustment" is usually an increase or decrease to customer funding to Avalara,
126
+ # such as early filer discount amounts that are refunded to the customer, or efile fees from websites.
127
+ # Sometimes may be a manual change in tax liability similar to an augmentation.
128
+ # This API deletes an adjustment for an existing tax filing.
129
+ # This API can only be used when the filing has been unapproved.
130
+ #
131
+ # @param int companyId The ID of the company that owns the filing being adjusted.
132
+ # @param int id The ID of the adjustment being deleted.
133
+ # @return ErrorDetail[]
134
+ def delete_return_adjustment(companyId, id)
135
+ path = "/api/v2/companies/#{companyId}/filings/adjust/#{id}"
136
+
137
+ delete(path)
138
+ end
139
+
140
+
141
+ # Delete an augmentation for a given filing.
142
+ #
143
+ # This API is available by invitation only.
144
+ # An "Augmentation" is a manually added increase or decrease in tax liability, by either customer or Avalara
145
+ # usually due to customer wanting to report tax Avatax does not support, e.g. bad debts, rental tax.
146
+ # This API deletes an augmentation for an existing tax filing.
147
+ # This API can only be used when the filing has been unapproved.
148
+ #
149
+ # @param int companyId The ID of the company that owns the filing being changed.
150
+ # @param int id The ID of the augmentation being added.
151
+ # @return ErrorDetail[]
152
+ def delete_return_augmentation(companyId, id)
153
+ path = "/api/v2/companies/#{companyId}/filings/augment/#{id}"
154
+
155
+ delete(path)
156
+ end
157
+
158
+
159
+ # Retrieve worksheet checkup report for company and filing period.
160
+ #
161
+ # This API is available by invitation only.
162
+ #
163
+ # @param int worksheetId The unique id of the worksheet.
164
+ # @param int companyId The unique ID of the company that owns the worksheet.
165
+ # @return FilingsCheckupModel
166
+ def filings_checkup_report(worksheetId, companyId)
167
+ path = "/api/v2/companies/#{companyId}/filings/#{worksheetId}/checkup"
168
+
169
+ get(path)
170
+ end
171
+
172
+
173
+ # Retrieve worksheet checkup report for company and filing period.
174
+ #
175
+ # This API is available by invitation only.
176
+ #
177
+ # @param int companyId The unique ID of the company that owns the worksheets object.
178
+ # @param int year The year of the filing period.
179
+ # @param int month The month of the filing period.
180
+ # @return FilingsCheckupModel
181
+ def filings_checkup_reports(companyId, year, month)
182
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/checkup"
183
+
184
+ get(path)
185
+ end
186
+
187
+
188
+ # Retrieve a single attachment for a filing
189
+ #
190
+ # This API is available by invitation only.
191
+ #
192
+ # @param int companyId The ID of the company that owns the filings.
193
+ # @param int filingId The unique id of the worksheet return.
194
+ # @param int fileId The unique id of the document you are downloading
195
+ # @return FileResult
196
+ def get_filing_attachment(companyId, filingId, options={})
197
+ path = "/api/v2/companies/#{companyId}/filings/#{filingId}/attachment"
198
+
199
+ get(path, options)
200
+ end
201
+
202
+
203
+ # Retrieve a list of filings for the specified company in the year and month of a given filing period.
204
+ #
205
+ # This API is available by invitation only.
206
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
207
+ # based on filing frequency of filing.
208
+ #
209
+ # @param int companyId The ID of the company that owns the filings.
210
+ # @param int year The year of the filing period.
211
+ # @param int month The two digit month of the filing period.
212
+ # @return FileResult
213
+ def get_filing_attachments(companyId, year, month)
214
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/attachments"
215
+
216
+ get(path)
217
+ end
218
+
219
+
220
+ # Retrieve a single trace file for a company filing period
221
+ #
222
+ # This API is available by invitation only.
223
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
224
+ # based on filing frequency of filing.
225
+ #
226
+ # @param int companyId The ID of the company that owns the filings.
227
+ # @param int year The year of the filing period.
228
+ # @param int month The two digit month of the filing period.
229
+ # @return FileResult
230
+ def get_filing_attachments_trace_file(companyId, year, month)
231
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/attachments/tracefile"
232
+
233
+ get(path)
234
+ end
235
+
236
+
237
+ # Retrieve a list of filings for the specified company in the year and month of a given filing period.
238
+ #
239
+ # This API is available by invitation only.
240
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
241
+ # based on filing frequency of filing.
242
+ #
243
+ # @param int companyId The ID of the company that owns the filings.
244
+ # @param int year The year of the filing period.
245
+ # @param int month The two digit month of the filing period.
246
+ # @return FetchResult
247
+ def get_filings(companyId, year, month)
248
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}"
249
+
250
+ get(path)
251
+ end
252
+
253
+
254
+ # Retrieve a list of filings for the specified company in the given filing period and country.
255
+ #
256
+ # This API is available by invitation only.
257
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
258
+ # based on filing frequency of filing.
259
+ #
260
+ # @param int companyId The ID of the company that owns the filings.
261
+ # @param int year The year of the filing period.
262
+ # @param int month The two digit month of the filing period.
263
+ # @param string country The two-character ISO-3166 code for the country.
264
+ # @return FetchResult
265
+ def get_filings_by_country(companyId, year, month, country)
266
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}"
267
+
268
+ get(path)
269
+ end
270
+
271
+
272
+ # Retrieve a list of filings for the specified company in the filing period, country and region.
273
+ #
274
+ # This API is available by invitation only.
275
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
276
+ # based on filing frequency of filing.
277
+ #
278
+ # @param int companyId The ID of the company that owns the filings.
279
+ # @param int year The year of the filing period.
280
+ # @param int month The two digit month of the filing period.
281
+ # @param string country The two-character ISO-3166 code for the country.
282
+ # @param string region The two or three character region code for the region.
283
+ # @return FetchResult
284
+ def get_filings_by_country_region(companyId, year, month, country, region)
285
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/#{region}"
286
+
287
+ get(path)
288
+ end
289
+
290
+
291
+ # Retrieve a list of filings for the specified company in the given filing period, country, region and form.
292
+ #
293
+ # This API is available by invitation only.
294
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
295
+ # based on filing frequency of filing.
296
+ #
297
+ # @param int companyId The ID of the company that owns the filings.
298
+ # @param int year The year of the filing period.
299
+ # @param int month The two digit month of the filing period.
300
+ # @param string country The two-character ISO-3166 code for the country.
301
+ # @param string region The two or three character region code for the region.
302
+ # @param string formCode The unique code of the form.
303
+ # @return FetchResult
304
+ def get_filings_by_return_name(companyId, year, month, country, region, formCode)
305
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/#{region}/#{formCode}"
306
+
307
+ get(path)
308
+ end
309
+
310
+
311
+ # Rebuild a set of filings for the specified company in the given filing period.
312
+ #
313
+ # This API is available by invitation only.
314
+ # Rebuilding a return means re-creating or updating the amounts to be filed (worksheet) for a filing.
315
+ # Rebuilding has to be done whenever a customer adds transactions to a filing.
316
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
317
+ # based on filing frequency of filing.
318
+ # This API requires filing to be unapproved.
319
+ #
320
+ # @param int companyId The ID of the company that owns the filings.
321
+ # @param int year The year of the filing period to be rebuilt.
322
+ # @param int month The month of the filing period to be rebuilt.
323
+ # @param RebuildFilingsModel model The rebuild request you wish to execute.
324
+ # @return FetchResult
325
+ def rebuild_filings(companyId, year, month, model)
326
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/rebuild"
327
+
328
+ post(path, model)
329
+ end
330
+
331
+
332
+ # Rebuild a set of filings for the specified company in the given filing period and country.
333
+ #
334
+ # This API is available by invitation only.
335
+ # Rebuilding a return means re-creating or updating the amounts to be filed (worksheet) for a filing.
336
+ # Rebuilding has to be done whenever a customer adds transactions to a filing.
337
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
338
+ # based on filing frequency of filing.
339
+ # This API requires filing to be unapproved.
340
+ #
341
+ # @param int companyId The ID of the company that owns the filings.
342
+ # @param int year The year of the filing period to be rebuilt.
343
+ # @param int month The month of the filing period to be rebuilt.
344
+ # @param string country The two-character ISO-3166 code for the country.
345
+ # @param RebuildFilingsModel model The rebuild request you wish to execute.
346
+ # @return FetchResult
347
+ def rebuild_filings_by_country(companyId, year, month, country, model)
348
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/rebuild"
349
+
350
+ post(path, model)
351
+ end
352
+
353
+
354
+ # Rebuild a set of filings for the specified company in the given filing period, country and region.
355
+ #
356
+ # This API is available by invitation only.
357
+ # Rebuilding a return means re-creating or updating the amounts to be filed for a filing.
358
+ # Rebuilding has to be done whenever a customer adds transactions to a filing.
359
+ # A "filing period" is the year and month of the date of the latest customer transaction allowed to be reported on a filing,
360
+ # based on filing frequency of filing.
361
+ # This API requires filing to be unapproved.
362
+ #
363
+ # @param int companyId The ID of the company that owns the filings.
364
+ # @param int year The year of the filing period to be rebuilt.
365
+ # @param int month The month of the filing period to be rebuilt.
366
+ # @param string country The two-character ISO-3166 code for the country.
367
+ # @param string region The two or three character region code for the region.
368
+ # @param RebuildFilingsModel model The rebuild request you wish to execute.
369
+ # @return FetchResult
370
+ def rebuild_filings_by_country_region(companyId, year, month, country, region, model)
371
+ path = "/api/v2/companies/#{companyId}/filings/#{year}/#{month}/#{country}/#{region}/rebuild"
372
+
373
+ post(path, model)
374
+ end
375
+
376
+
377
+ # Edit an adjustment for a given filing.
378
+ #
379
+ # This API is available by invitation only.
380
+ # An "Adjustment" is usually an increase or decrease to customer funding to Avalara,
381
+ # such as early filer discount amounts that are refunded to the customer, or efile fees from websites.
382
+ # Sometimes may be a manual change in tax liability similar to an augmentation.
383
+ # This API modifies an adjustment for an existing tax filing.
384
+ # This API can only be used when the filing has not yet been approved.
385
+ #
386
+ # @param int companyId The ID of the company that owns the filing being adjusted.
387
+ # @param int id The ID of the adjustment being edited.
388
+ # @param FilingAdjustmentModel model The updated Adjustment.
389
+ # @return FilingAdjustmentModel
390
+ def update_return_adjustment(companyId, id, model)
391
+ path = "/api/v2/companies/#{companyId}/filings/adjust/#{id}"
392
+
393
+ put(path, model)
394
+ end
395
+
396
+
397
+ # Edit an augmentation for a given filing.
398
+ #
399
+ # This API is available by invitation only.
400
+ # An "Augmentation" is a manually added increase or decrease in tax liability, by either customer or Avalara
401
+ # usually due to customer wanting to report tax Avatax does not support, e.g. bad debts, rental tax.
402
+ # This API modifies an augmentation for an existing tax filing.
403
+ # This API can only be used when the filing has not been approved.
404
+ #
405
+ # @param int companyId The ID of the company that owns the filing being changed.
406
+ # @param int id The ID of the augmentation being edited.
407
+ # @param FilingAugmentationModel model The updated Augmentation.
408
+ # @return FilingModel
409
+ def update_return_augmentation(companyId, id, model)
410
+ path = "/api/v2/companies/#{companyId}/filings/augment/#{id}"
411
+
412
+ put(path, model)
413
+ end
414
+
415
+ end
416
+ end
417
+ end