avatax 14.4.4 → 17.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +54 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/.yardopts +5 -0
- data/Gemfile +3 -0
- data/LICENSE +201 -191
- data/README.md +63 -61
- data/Rakefile +9 -0
- data/avatax.gemspec +39 -0
- data/example/avatax.rb +14 -0
- data/example/credentials.example.yaml +5 -0
- data/lib/avatax.rb +19 -13
- data/lib/avatax/api.rb +27 -0
- data/lib/avatax/client.rb +32 -0
- data/lib/avatax/client/accounts.rb +110 -0
- data/lib/avatax/client/addresses.rb +52 -0
- data/lib/avatax/client/batches.rb +117 -0
- data/lib/avatax/client/companies.rb +218 -0
- data/lib/avatax/client/contacts.rb +115 -0
- data/lib/avatax/client/definitions.rb +569 -0
- data/lib/avatax/client/filingcalendars.rb +313 -0
- data/lib/avatax/client/filings.rb +417 -0
- data/lib/avatax/client/free.rb +104 -0
- data/lib/avatax/client/fundingrequests.rb +53 -0
- data/lib/avatax/client/items.rb +111 -0
- data/lib/avatax/client/jurisdictionoverrides.rb +125 -0
- data/lib/avatax/client/locations.rb +158 -0
- data/lib/avatax/client/nexus.rb +157 -0
- data/lib/avatax/client/notices.rb +297 -0
- data/lib/avatax/client/onboarding.rb +23 -0
- data/lib/avatax/client/pointofsale.rb +24 -0
- data/lib/avatax/client/registrar.rb +216 -0
- data/lib/avatax/client/settings.rb +137 -0
- data/lib/avatax/client/subscriptions.rb +66 -0
- data/lib/avatax/client/taxcodes.rb +127 -0
- data/lib/avatax/client/taxrules.rb +127 -0
- data/lib/avatax/client/transactions.rb +473 -0
- data/lib/avatax/client/upcs.rb +112 -0
- data/lib/avatax/client/users.rb +112 -0
- data/lib/avatax/client/utilities.rb +52 -0
- data/lib/avatax/configuration.rb +53 -18
- data/lib/avatax/connection.rb +28 -0
- data/lib/avatax/request.rb +38 -0
- data/lib/avatax/version.rb +3 -0
- data/spec/avatax/client/accounts_spec.rb +26 -0
- data/spec/avatax_spec.rb +59 -0
- data/spec/fixtures/accounts.json +16 -0
- data/spec/spec_helper.rb +47 -0
- metadata +143 -30
- data/lib/avatax/address_service.rb +0 -31
- data/lib/avatax/tax_service.rb +0 -61
@@ -0,0 +1,104 @@
|
|
1
|
+
module AvaTax
|
2
|
+
class Client
|
3
|
+
module Free
|
4
|
+
|
5
|
+
|
6
|
+
# FREE API - Request a free trial of AvaTax
|
7
|
+
#
|
8
|
+
# Call this API to obtain a free AvaTax sandbox account.
|
9
|
+
#
|
10
|
+
# This API is free to use. No authentication credentials are required to call this API.
|
11
|
+
# The account will grant a full trial version of AvaTax (e.g. AvaTaxPro) for a limited period of time.
|
12
|
+
# After this introductory period, you may continue to use the free TaxRates API.
|
13
|
+
#
|
14
|
+
# Limitations on free trial accounts:
|
15
|
+
#
|
16
|
+
# * Only one free trial per company.
|
17
|
+
# * The free trial account does not expire.
|
18
|
+
# * Includes a limited time free trial of AvaTaxPro; after that date, the free TaxRates API will continue to work.
|
19
|
+
# * Each free trial account must have its own valid email address.
|
20
|
+
#
|
21
|
+
# @param FreeTrialRequestModel model Required information to provision a free trial account.
|
22
|
+
# @return NewAccountModel
|
23
|
+
def request_free_trial(model)
|
24
|
+
path = "/api/v2/accounts/freetrials/request"
|
25
|
+
|
26
|
+
post(path, model)
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
# FREE API - Sales tax rates for a specified address
|
31
|
+
#
|
32
|
+
# # Free-To-Use
|
33
|
+
#
|
34
|
+
# The TaxRates API is a free-to-use, no cost option for estimating sales tax rates.
|
35
|
+
# Any customer can request a free AvaTax account and make use of the TaxRates API.
|
36
|
+
# However, this API is currently limited for US only
|
37
|
+
#
|
38
|
+
# Note that the TaxRates API assumes the sale of general tangible personal property when estimating the sales tax
|
39
|
+
# rate for a specified address. Avalara provides the `CreateTransaction` API, which provides extensive tax calculation
|
40
|
+
# support for scenarios including, but not limited to:
|
41
|
+
#
|
42
|
+
# * Nexus declarations
|
43
|
+
# * Taxability based on product/service type
|
44
|
+
# * Sourcing rules affecting origin/destination states
|
45
|
+
# * Customers who are exempt from certain taxes
|
46
|
+
# * States that have dollar value thresholds for tax amounts
|
47
|
+
# * Refunds for products purchased on a different date
|
48
|
+
# * Detailed jurisdiction names and state assigned codes
|
49
|
+
# * And more!
|
50
|
+
#
|
51
|
+
# Please see [Estimating Tax with REST v2](http://developer.avalara.com/blog/2016/11/04/estimating-tax-with-rest-v2/)
|
52
|
+
# for information on how to upgrade to the full AvaTax CreateTransaction API.
|
53
|
+
#
|
54
|
+
# @param string line1 The street address of the location.
|
55
|
+
# @param string line2 The street address of the location.
|
56
|
+
# @param string line3 The street address of the location.
|
57
|
+
# @param string city The city name of the location.
|
58
|
+
# @param string region The state or region of the location
|
59
|
+
# @param string postalCode The postal code of the location.
|
60
|
+
# @param string country The two letter ISO-3166 country code.
|
61
|
+
# @return TaxRateModel
|
62
|
+
def tax_rates_by_address(options={})
|
63
|
+
path = "/api/v2/taxrates/byaddress"
|
64
|
+
|
65
|
+
get(path, options)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
# FREE API - Sales tax rates for a specified country and postal code
|
70
|
+
#
|
71
|
+
# # Free-To-Use
|
72
|
+
#
|
73
|
+
# The TaxRates API is a free-to-use, no cost option for estimating sales tax rates.
|
74
|
+
# Any customer can request a free AvaTax account and make use of the TaxRates API.
|
75
|
+
# However, this API is currently limited for US only
|
76
|
+
#
|
77
|
+
# Note that the TaxRates API assumes the sale of general tangible personal property when estimating the sales tax
|
78
|
+
# rate for a specified address. Avalara provides the `CreateTransaction` API, which provides extensive tax calculation
|
79
|
+
# support for scenarios including, but not limited to:
|
80
|
+
#
|
81
|
+
# * Nexus declarations
|
82
|
+
# * Taxability based on product/service type
|
83
|
+
# * Sourcing rules affecting origin/destination states
|
84
|
+
# * Customers who are exempt from certain taxes
|
85
|
+
# * States that have dollar value thresholds for tax amounts
|
86
|
+
# * Refunds for products purchased on a different date
|
87
|
+
# * Detailed jurisdiction names and state assigned codes
|
88
|
+
# * And more!
|
89
|
+
#
|
90
|
+
# Please see [Estimating Tax with REST v2](http://developer.avalara.com/blog/2016/11/04/estimating-tax-with-rest-v2/)
|
91
|
+
# for information on how to upgrade to the full AvaTax CreateTransaction API.
|
92
|
+
#
|
93
|
+
# @param string country The two letter ISO-3166 country code.
|
94
|
+
# @param string postalCode The postal code of the location.
|
95
|
+
# @return TaxRateModel
|
96
|
+
def tax_rates_by_postal_code(options={})
|
97
|
+
path = "/api/v2/taxrates/bypostalcode"
|
98
|
+
|
99
|
+
get(path, options)
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module AvaTax
|
2
|
+
class Client
|
3
|
+
module FundingRequests
|
4
|
+
|
5
|
+
|
6
|
+
# Request the javascript for a funding setup widget
|
7
|
+
#
|
8
|
+
# This API is available by invitation only.
|
9
|
+
# Companies that use the Avalara Managed Returns or the SST Certified Service Provider services are
|
10
|
+
# required to setup their funding configuration before Avalara can begin filing tax returns on their
|
11
|
+
# behalf.
|
12
|
+
# Funding configuration for each company is set up by submitting a funding setup request, which can
|
13
|
+
# be sent either via email or via an embedded HTML widget.
|
14
|
+
# When the funding configuration is submitted to Avalara, it will be reviewed by treasury team members
|
15
|
+
# before approval.
|
16
|
+
# This API returns back the actual javascript code to insert into your application to render the
|
17
|
+
# JavaScript funding setup widget inline.
|
18
|
+
# Use the 'methodReturn.javaScript' return value to insert this widget into your HTML page.
|
19
|
+
# This API requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
|
20
|
+
#
|
21
|
+
# @param int id The unique ID number of this funding request
|
22
|
+
# @return FundingStatusModel
|
23
|
+
def activate_funding_request(id)
|
24
|
+
path = "/api/v2/fundingrequests/#{id}/widget"
|
25
|
+
|
26
|
+
get(path)
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
# Retrieve status about a funding setup request
|
31
|
+
#
|
32
|
+
# This API is available by invitation only.
|
33
|
+
# Companies that use the Avalara Managed Returns or the SST Certified Service Provider services are
|
34
|
+
# required to setup their funding configuration before Avalara can begin filing tax returns on their
|
35
|
+
# behalf.
|
36
|
+
# Funding configuration for each company is set up by submitting a funding setup request, which can
|
37
|
+
# be sent either via email or via an embedded HTML widget.
|
38
|
+
# When the funding configuration is submitted to Avalara, it will be reviewed by treasury team members
|
39
|
+
# before approval.
|
40
|
+
# This API checks the status on an existing funding request.
|
41
|
+
# This API requires a subscription to Avalara Managed Returns or SST Certified Service Provider.
|
42
|
+
#
|
43
|
+
# @param int id The unique ID number of this funding request
|
44
|
+
# @return FundingStatusModel
|
45
|
+
def funding_request_status(id)
|
46
|
+
path = "/api/v2/fundingrequests/#{id}"
|
47
|
+
|
48
|
+
get(path)
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module AvaTax
|
2
|
+
class Client
|
3
|
+
module Items
|
4
|
+
|
5
|
+
|
6
|
+
# Create a new item
|
7
|
+
#
|
8
|
+
# Creates one or more new item objects attached to this company.
|
9
|
+
#
|
10
|
+
# @param int companyId The ID of the company that owns this item.
|
11
|
+
# @param ItemModel[] model The item you wish to create.
|
12
|
+
# @return ItemModel[]
|
13
|
+
def create_items(companyId, model)
|
14
|
+
path = "/api/v2/companies/#{companyId}/items"
|
15
|
+
|
16
|
+
post(path, model)
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
# Delete a single item
|
21
|
+
#
|
22
|
+
# Marks the item object at this URL as deleted.
|
23
|
+
#
|
24
|
+
# @param int companyId The ID of the company that owns this item.
|
25
|
+
# @param int id The ID of the item you wish to delete.
|
26
|
+
# @return ErrorDetail[]
|
27
|
+
def delete_item(companyId, id)
|
28
|
+
path = "/api/v2/companies/#{companyId}/items/#{id}"
|
29
|
+
|
30
|
+
delete(path)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
# Retrieve a single item
|
35
|
+
#
|
36
|
+
# Get the item object identified by this URL.
|
37
|
+
# An 'Item' represents a product or service that your company offers for sale.
|
38
|
+
#
|
39
|
+
# @param int companyId The ID of the company that owns this item object
|
40
|
+
# @param int id The primary key of this item
|
41
|
+
# @return ItemModel
|
42
|
+
def get_item(companyId, id)
|
43
|
+
path = "/api/v2/companies/#{companyId}/items/#{id}"
|
44
|
+
|
45
|
+
get(path)
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
# Retrieve items for this company
|
50
|
+
#
|
51
|
+
# List all items defined for the current company.
|
52
|
+
#
|
53
|
+
# An 'Item' represents a product or service that your company offers for sale.
|
54
|
+
#
|
55
|
+
# 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/) .
|
56
|
+
# Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
|
57
|
+
#
|
58
|
+
# @param int companyId The ID of the company that defined these items
|
59
|
+
# @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/) .
|
60
|
+
# @param string include A comma separated list of child objects to return underneath the primary object.
|
61
|
+
# @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
|
62
|
+
# @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
|
63
|
+
# @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
64
|
+
# @return FetchResult
|
65
|
+
def list_items_by_company(companyId, options={})
|
66
|
+
path = "/api/v2/companies/#{companyId}/items"
|
67
|
+
|
68
|
+
get(path, options)
|
69
|
+
end
|
70
|
+
|
71
|
+
|
72
|
+
# Retrieve all items
|
73
|
+
#
|
74
|
+
# Get multiple item objects across all companies.
|
75
|
+
# An 'Item' represents a product or service that your company offers for sale.
|
76
|
+
#
|
77
|
+
# 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/) .
|
78
|
+
# Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
|
79
|
+
#
|
80
|
+
# @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/) .
|
81
|
+
# @param string include A comma separated list of child objects to return underneath the primary object.
|
82
|
+
# @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
|
83
|
+
# @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
|
84
|
+
# @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
85
|
+
# @return FetchResult
|
86
|
+
def query_items(options={})
|
87
|
+
path = "/api/v2/items"
|
88
|
+
|
89
|
+
get(path, options)
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
# Update a single item
|
94
|
+
#
|
95
|
+
# Replace the existing item object at this URL with an updated object.
|
96
|
+
# All data from the existing object will be replaced with data in the object you PUT.
|
97
|
+
# To set a field's value to null, you may either set its value to null or omit that field from the object you post.
|
98
|
+
#
|
99
|
+
# @param int companyId The ID of the company that this item belongs to.
|
100
|
+
# @param int id The ID of the item you wish to update
|
101
|
+
# @param ItemModel model The item object you wish to update.
|
102
|
+
# @return ItemModel
|
103
|
+
def update_item(companyId, id, model)
|
104
|
+
path = "/api/v2/companies/#{companyId}/items/#{id}"
|
105
|
+
|
106
|
+
put(path, model)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
module AvaTax
|
2
|
+
class Client
|
3
|
+
module JurisdictionOverrides
|
4
|
+
|
5
|
+
|
6
|
+
# Create one or more overrides
|
7
|
+
#
|
8
|
+
# Creates one or more jurisdiction override objects for this account.
|
9
|
+
#
|
10
|
+
# A Jurisdiction Override is a configuration setting that allows you to select the taxing
|
11
|
+
# jurisdiction for a specific address. If you encounter an address that is on the boundary
|
12
|
+
# between two different jurisdictions, you can choose to set up a jurisdiction override
|
13
|
+
# to switch this address to use different taxing jurisdictions.
|
14
|
+
#
|
15
|
+
# @param int accountId The ID of the account that owns this override
|
16
|
+
# @param JurisdictionOverrideModel[] model The jurisdiction override objects to create
|
17
|
+
# @return JurisdictionOverrideModel[]
|
18
|
+
def create_jurisdiction_overrides(accountId, model)
|
19
|
+
path = "/api/v2/accounts/#{accountId}/jurisdictionoverrides"
|
20
|
+
|
21
|
+
post(path, model)
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
# Delete a single override
|
26
|
+
#
|
27
|
+
# Marks the item object at this URL as deleted.
|
28
|
+
#
|
29
|
+
# @param int accountId The ID of the account that owns this override
|
30
|
+
# @param int id The ID of the override you wish to delete
|
31
|
+
# @return ErrorDetail[]
|
32
|
+
def delete_jurisdiction_override(accountId, id)
|
33
|
+
path = "/api/v2/accounts/#{accountId}/jurisdictionoverrides/#{id}"
|
34
|
+
|
35
|
+
delete(path)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# Retrieve a single override
|
40
|
+
#
|
41
|
+
# Get the item object identified by this URL.
|
42
|
+
#
|
43
|
+
# A Jurisdiction Override is a configuration setting that allows you to select the taxing
|
44
|
+
# jurisdiction for a specific address. If you encounter an address that is on the boundary
|
45
|
+
# between two different jurisdictions, you can choose to set up a jurisdiction override
|
46
|
+
# to switch this address to use different taxing jurisdictions.
|
47
|
+
#
|
48
|
+
# @param int accountId The ID of the account that owns this override
|
49
|
+
# @param int id The primary key of this override
|
50
|
+
# @return JurisdictionOverrideModel
|
51
|
+
def get_jurisdiction_override(accountId, id)
|
52
|
+
path = "/api/v2/accounts/#{accountId}/jurisdictionoverrides/#{id}"
|
53
|
+
|
54
|
+
get(path)
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
# Retrieve overrides for this account
|
59
|
+
#
|
60
|
+
# List all jurisdiction override objects defined for this account.
|
61
|
+
#
|
62
|
+
# A Jurisdiction Override is a configuration setting that allows you to select the taxing
|
63
|
+
# jurisdiction for a specific address. If you encounter an address that is on the boundary
|
64
|
+
# between two different jurisdictions, you can choose to set up a jurisdiction override
|
65
|
+
# to switch this address to use different taxing jurisdictions.
|
66
|
+
#
|
67
|
+
# 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/) .
|
68
|
+
# Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
|
69
|
+
#
|
70
|
+
# @param int accountId The ID of the account that owns this override
|
71
|
+
# @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/) .
|
72
|
+
# @param string include A comma separated list of child objects to return underneath the primary object.
|
73
|
+
# @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
|
74
|
+
# @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
|
75
|
+
# @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
76
|
+
# @return FetchResult
|
77
|
+
def list_jurisdiction_overrides_by_account(accountId, options={})
|
78
|
+
path = "/api/v2/accounts/#{accountId}/jurisdictionoverrides"
|
79
|
+
|
80
|
+
get(path, options)
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
# Retrieve all overrides
|
85
|
+
#
|
86
|
+
# Get multiple jurisdiction override objects across all companies.
|
87
|
+
#
|
88
|
+
# A Jurisdiction Override is a configuration setting that allows you to select the taxing
|
89
|
+
# jurisdiction for a specific address. If you encounter an address that is on the boundary
|
90
|
+
# between two different jurisdictions, you can choose to set up a jurisdiction override
|
91
|
+
# to switch this address to use different taxing jurisdictions.
|
92
|
+
#
|
93
|
+
# 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/) .
|
94
|
+
# Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
|
95
|
+
#
|
96
|
+
# @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/) .
|
97
|
+
# @param string include A comma separated list of child objects to return underneath the primary object.
|
98
|
+
# @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
|
99
|
+
# @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
|
100
|
+
# @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
101
|
+
# @return FetchResult
|
102
|
+
def query_jurisdiction_overrides(options={})
|
103
|
+
path = "/api/v2/jurisdictionoverrides"
|
104
|
+
|
105
|
+
get(path, options)
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
# Update a single jurisdictionoverride
|
110
|
+
#
|
111
|
+
# Replace the existing jurisdictionoverride object at this URL with an updated object.
|
112
|
+
#
|
113
|
+
# @param int accountId The ID of the account that this jurisdictionoverride belongs to.
|
114
|
+
# @param int id The ID of the jurisdictionoverride you wish to update
|
115
|
+
# @param JurisdictionOverrideModel model The jurisdictionoverride object you wish to update.
|
116
|
+
# @return JurisdictionOverrideModel
|
117
|
+
def update_jurisdiction_override(accountId, id, model)
|
118
|
+
path = "/api/v2/accounts/#{accountId}/jurisdictionoverrides/#{id}"
|
119
|
+
|
120
|
+
put(path, model)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module AvaTax
|
2
|
+
class Client
|
3
|
+
module Locations
|
4
|
+
|
5
|
+
|
6
|
+
# Point of sale data file generation
|
7
|
+
#
|
8
|
+
# Builds a point-of-sale data file containing tax rates and rules for this location, containing tax rates for all
|
9
|
+
# items defined for this company. This data file can be used to correctly calculate tax in the event a
|
10
|
+
# point-of-sale device is not able to reach AvaTax.
|
11
|
+
# This data file can be customized for specific partner devices and usage conditions.
|
12
|
+
# The result of this API is the file you requested in the format you requested using the 'responseType' field.
|
13
|
+
# This API builds the file on demand, and is limited to a maximum of 7500 items.
|
14
|
+
#
|
15
|
+
# @param int companyId The ID number of the company that owns this location.
|
16
|
+
# @param int id The ID number of the location to retrieve point-of-sale data.
|
17
|
+
# @param string date The date for which point-of-sale data would be calculated (today by default)
|
18
|
+
# @param string format The format of the file (JSON by default) (See PointOfSaleFileType::* for a list of allowable values)
|
19
|
+
# @param string partnerId If specified, requests a custom partner-formatted version of the file. (See PointOfSalePartnerId::* for a list of allowable values)
|
20
|
+
# @param boolean includeJurisCodes When true, the file will include jurisdiction codes in the result.
|
21
|
+
# @return FileResult
|
22
|
+
def build_point_of_sale_data_for_location(companyId, id, options={})
|
23
|
+
path = "/api/v2/companies/#{companyId}/locations/#{id}/pointofsaledata"
|
24
|
+
|
25
|
+
get(path, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# Create a new location
|
30
|
+
#
|
31
|
+
# Create one or more new location objects attached to this company.
|
32
|
+
#
|
33
|
+
# @param int companyId The ID of the company that owns this location.
|
34
|
+
# @param LocationModel[] model The location you wish to create.
|
35
|
+
# @return LocationModel[]
|
36
|
+
def create_locations(companyId, model)
|
37
|
+
path = "/api/v2/companies/#{companyId}/locations"
|
38
|
+
|
39
|
+
post(path, model)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# Delete a single location
|
44
|
+
#
|
45
|
+
# Mark the location object at this URL as deleted.
|
46
|
+
#
|
47
|
+
# @param int companyId The ID of the company that owns this location.
|
48
|
+
# @param int id The ID of the location you wish to delete.
|
49
|
+
# @return ErrorDetail[]
|
50
|
+
def delete_location(companyId, id)
|
51
|
+
path = "/api/v2/companies/#{companyId}/locations/#{id}"
|
52
|
+
|
53
|
+
delete(path)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
# Retrieve a single location
|
58
|
+
#
|
59
|
+
# Get the location object identified by this URL.
|
60
|
+
# An 'Location' represents a physical address where a company does business.
|
61
|
+
# Many taxing authorities require that you define a list of all locations where your company does business.
|
62
|
+
# These locations may require additional custom configuration or tax registration with these authorities.
|
63
|
+
# For more information on metadata requirements, see the '/api/v2/definitions/locationquestions' API.
|
64
|
+
#
|
65
|
+
# @param int companyId The ID of the company that owns this location
|
66
|
+
# @param int id The primary key of this location
|
67
|
+
# @return LocationModel
|
68
|
+
def get_location(companyId, id)
|
69
|
+
path = "/api/v2/companies/#{companyId}/locations/#{id}"
|
70
|
+
|
71
|
+
get(path)
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
# Retrieve locations for this company
|
76
|
+
#
|
77
|
+
# List all location objects defined for this company.
|
78
|
+
# An 'Location' represents a physical address where a company does business.
|
79
|
+
# Many taxing authorities require that you define a list of all locations where your company does business.
|
80
|
+
# These locations may require additional custom configuration or tax registration with these authorities.
|
81
|
+
# For more information on metadata requirements, see the '/api/v2/definitions/locationquestions' API.
|
82
|
+
#
|
83
|
+
# 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/) .
|
84
|
+
# Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
|
85
|
+
#
|
86
|
+
# @param int companyId The ID of the company that owns these locations
|
87
|
+
# @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/) .
|
88
|
+
# @param string include A comma separated list of child objects to return underneath the primary object.
|
89
|
+
# @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
|
90
|
+
# @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
|
91
|
+
# @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
92
|
+
# @return FetchResult
|
93
|
+
def list_locations_by_company(companyId, options={})
|
94
|
+
path = "/api/v2/companies/#{companyId}/locations"
|
95
|
+
|
96
|
+
get(path, options)
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
# Retrieve all locations
|
101
|
+
#
|
102
|
+
# Get multiple location objects across all companies.
|
103
|
+
# An 'Location' represents a physical address where a company does business.
|
104
|
+
# Many taxing authorities require that you define a list of all locations where your company does business.
|
105
|
+
# These locations may require additional custom configuration or tax registration with these authorities.
|
106
|
+
# For more information on metadata requirements, see the '/api/v2/definitions/locationquestions' API.
|
107
|
+
#
|
108
|
+
# 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/) .
|
109
|
+
# Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
|
110
|
+
#
|
111
|
+
# @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/) .
|
112
|
+
# @param string include A comma separated list of child objects to return underneath the primary object.
|
113
|
+
# @param int top If nonzero, return no more than this number of results. Used with $skip to provide pagination for large datasets.
|
114
|
+
# @param int skip If nonzero, skip this number of results before returning data. Used with $top to provide pagination for large datasets.
|
115
|
+
# @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
|
116
|
+
# @return FetchResult
|
117
|
+
def query_locations(options={})
|
118
|
+
path = "/api/v2/locations"
|
119
|
+
|
120
|
+
get(path, options)
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
# Update a single location
|
125
|
+
#
|
126
|
+
# Replace the existing location object at this URL with an updated object.
|
127
|
+
# All data from the existing object will be replaced with data in the object you PUT.
|
128
|
+
# To set a field's value to null, you may either set its value to null or omit that field from the object you post.
|
129
|
+
#
|
130
|
+
# @param int companyId The ID of the company that this location belongs to.
|
131
|
+
# @param int id The ID of the location you wish to update
|
132
|
+
# @param LocationModel model The location you wish to update.
|
133
|
+
# @return LocationModel
|
134
|
+
def update_location(companyId, id, model)
|
135
|
+
path = "/api/v2/companies/#{companyId}/locations/#{id}"
|
136
|
+
|
137
|
+
put(path, model)
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
# Validate the location against local requirements
|
142
|
+
#
|
143
|
+
# Returns validation information for this location.
|
144
|
+
# This API call is intended to compare this location against the currently known taxing authority rules and regulations,
|
145
|
+
# and provide information about what additional work is required to completely setup this location.
|
146
|
+
#
|
147
|
+
# @param int companyId The ID of the company that owns this location
|
148
|
+
# @param int id The primary key of this location
|
149
|
+
# @return LocationValidationModel
|
150
|
+
def validate_location(companyId, id)
|
151
|
+
path = "/api/v2/companies/#{companyId}/locations/#{id}/validate"
|
152
|
+
|
153
|
+
get(path)
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|