Skip to content

Commit

Permalink
Merge pull request #101 from avadev/19-oct
Browse files Browse the repository at this point in the history
Update for 19-oct
  • Loading branch information
contygm authored Nov 15, 2019
2 parents 8f8e6d5 + 7a19a5d commit deb7e3d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 74 deletions.
95 changes: 22 additions & 73 deletions lib/AvaTaxClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @author Ted Spence <[email protected]>
* @copyright 2004-2018 Avalara, Inc.
* @license https://www.apache.org/licenses/LICENSE-2.0
* @version 19.9.2
* @version 19.10.0
* @link https://github.com/avadev/AvaTax-REST-V2-JS-SDK
*/

Expand Down Expand Up @@ -41,7 +41,7 @@ export default class AvaTaxClient {
appName +
'; ' +
appVersion +
'; JavascriptSdk; 19.9.2; ' +
'; JavascriptSdk; 19.10.0; ' +
machineName;
}

Expand Down Expand Up @@ -84,15 +84,14 @@ export default class AvaTaxClient {
},
body: JSON.stringify(payload)
}).then(res => {
var contentType = res.headers._headers['content-type'][0];
var contentType = res.headers._headers['content-type'][0];

if (contentType === 'application/vnd.ms-excel' || contentType === 'text/csv') {
return res;
}else{
return res.json();
return res;
}
return res.json();
})
.then(json => {
.then(json => {
// handle error
if (json.error) {
let ex = new Error(json.error.message);
Expand Down Expand Up @@ -589,6 +588,11 @@ export default class AvaTaxClient {
* predict when a batch will complete. If high performance processing is
* required, please use the
* [CreateTransaction API](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/).
*
* The maximum content length of the request body is limited to 28.6 MB. If this limit
* is exceeded, a 404 Not Found status will be returned (possibly with a CORS error if
* the API is called from a browser). In this situation, please split the request into
* smaller batches.
*
* ### Security Policies
*
Expand Down Expand Up @@ -1606,6 +1610,8 @@ export default class AvaTaxClient {
* Create one or more new company objects.
* A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
* 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.
*
* NOTE: Please do not use these blacklisted characters in company name and code: ';', '\', '|'.
*
* ### Security Policies
*
Expand Down Expand Up @@ -1870,7 +1876,7 @@ export default class AvaTaxClient {
*
* @return FetchResult
*/
listMrsCompanies({ } = {}) {
listMrsCompanies({ } = {}) {
var path = this.buildUrl({
url: `/api/v2/companies/mrs`,
parameters: {}
Expand Down Expand Up @@ -1969,6 +1975,8 @@ export default class AvaTaxClient {
* such as contacts, locations, or settings are not permitted. To update the nested objects
*
* 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.
*
* NOTE: Please do not use these blacklisted characters in company name and code: ';', '\', '|'.
*
* ### Security Policies
*
Expand Down Expand Up @@ -2230,7 +2238,7 @@ export default class AvaTaxClient {
*
* @param int companyId The unique ID number of the company that recorded this customer
* @param string customerCode The unique code representing this customer
* @return object
* @return object[]
*/
deleteCustomer({ companyId, customerCode } = {}) {
var path = this.buildUrl({
Expand Down Expand Up @@ -3200,7 +3208,7 @@ export default class AvaTaxClient {
*
* @return FetchResult
*/
listCrossBorderSections({ } = {}) {
listCrossBorderSections({ } = {}) {
var path = this.buildUrl({
url: `/api/v2/definitions/crossborder/sections`,
parameters: {}
Expand Down Expand Up @@ -3298,6 +3306,8 @@ export default class AvaTaxClient {
*
* This API allows you to examine all Avalara-supported jurisdictions. You can filter your search by supplying
* SQL-like query for fetching only the ones you concerned about. For example: effectiveDate &gt; '2016-01-01'
*
* The rate, salesRate, and useRate fields are not available on the JurisdictionModels returned by this API.
*
*
* @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/).<br />*Not filterable:* rate, salesRate, signatureCode, useRate
Expand Down Expand Up @@ -4638,67 +4648,6 @@ export default class AvaTaxClient {
return this.restCall({ url: path, verb: 'put', payload: model });
}

/**
* Delete a batch of error transactions
*
* Delete a batch of error transactions attached to a company.
*
* If any of the provided error transaction isn't found then it'll be treated as a success.
*
* ### Security Policies
*
* * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
* * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
*
*
* @param object model The request that contains error transactions to be deleted
* @return object
*/
deleteErrorTransactions({ model } = {}) {
var path = this.buildUrl({
url: `/api/v2/errortransactions`,
parameters: {}
});
return this.restCall({ url: path, verb: 'delete', payload: model });
}

/**
* Retrieve list of error transactions
*
* List error transactions attached to this company. Results are dependent on `$filter` if provided.
*
* This endpoint is limited to returning 250 error transactions at a time maximum.
*
* 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/) .
* Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
*
* ### Security Policies
*
* * This API requires one of the following user roles: AccountAdmin, AccountUser, CompanyAdmin, CompanyUser, CSPAdmin, CSPTester, ProStoresOperator, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser.
* * This API depends on the following active services<br />*Required* (all): AvaTaxPro.
*
*
* @param string companyCode The company code to filter on. This query parameter is required.
* @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/).<br />*Not filterable:* companyId, avataxErrorJson, avataxCreateTransactionJson
* @param int top 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.
* @param int skip If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
* @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
* @return FetchResult
*/
listErrorTransactions({ companyCode, filter, top, skip, orderBy } = {}) {
var path = this.buildUrl({
url: `/api/v2/errortransactions`,
parameters: {
companyCode: companyCode,
$filter: filter,
$top: top,
$skip: skip,
$orderBy: orderBy
}
});
return this.restCall({ url: path, verb: 'get', payload: null });
}

/**
* Approves linkage to a firm for a client account
*
Expand Down Expand Up @@ -9745,7 +9694,7 @@ export default class AvaTaxClient {
*
* @return FetchResult
*/
listMySubscriptions({ } = {}) {
listMySubscriptions({ } = {}) {
var path = this.buildUrl({
url: `/api/v2/utilities/subscriptions`,
parameters: {}
Expand Down Expand Up @@ -9780,7 +9729,7 @@ export default class AvaTaxClient {
*
* @return object
*/
ping({ } = {}) {
ping({ } = {}) {
var path = this.buildUrl({
url: `/api/v2/utilities/ping`,
parameters: {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "avatax",
"version": "19.9.2",
"version": "19.10.0",
"description": "AvaTax v2 SDK for languages using JavaScript",
"main": "index.js",
"homepage": "https://github.com/avadev/AvaTax-REST-V2-JS-SDK",
Expand Down

0 comments on commit deb7e3d

Please sign in to comment.