Skip to content

Commit 2aaf8f6

Browse files
authored
Merge pull request #185 from avadev/21.7.1
21.7.1 update
2 parents 050349c + cb4d0aa commit 2aaf8f6

File tree

2 files changed

+64
-17
lines changed

2 files changed

+64
-17
lines changed

lib/AvaTaxClient.js

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
* @author Ted Spence <ted.spence@avalara.com>
1111
* @copyright 2004-2018 Avalara, Inc.
1212
* @license https://www.apache.org/licenses/LICENSE-2.0
13-
* @version 21.6.0
13+
* @version 21.7.1
1414
* @link https://github.com/avadev/AvaTax-REST-V2-JS-SDK
1515
*/
1616

1717
import fetch from 'isomorphic-fetch';
1818
import { createBasicAuthHeader } from './utils/basic_auth';
1919
import { withTimeout } from './utils/withTimeout';
20+
var JSONbig = require('json-bigint')({ useNativeBigInt: true });
2021

2122
export default class AvaTaxClient {
2223
/**
@@ -42,7 +43,7 @@ export default class AvaTaxClient {
4243
appName +
4344
'; ' +
4445
appVersion +
45-
'; JavascriptSdk; 21.6.0; ' +
46+
'; JavascriptSdk; 21.7.1; ' +
4647
machineName;
4748
}
4849

@@ -85,24 +86,25 @@ export default class AvaTaxClient {
8586
},
8687
body: JSON.stringify(payload)
8788
})).then(res => {
88-
var contentType = res.headers._headers['content-type'][0];
89+
var contentType = res.headers._headers['content-type'][0];
8990

9091
if (contentType === 'application/vnd.ms-excel' || contentType === 'text/csv') {
9192
return res;
9293
}
93-
return res.json();
94-
}).then(json => {
95-
// handle error
96-
if (json.error) {
97-
let ex = new Error(json.error.message);
98-
ex.code = json.error.code;
99-
ex.target = json.error.target;
100-
ex.details = json.error.details;
101-
throw ex;
102-
} else {
103-
return json;
104-
}
105-
})
94+
return res.text();
95+
}).then(text => {
96+
var json = JSONbig.parse(text);
97+
// handle error
98+
if (json.error) {
99+
let ex = new Error(json.error.message);
100+
ex.code = json.error.code;
101+
ex.target = json.error.target;
102+
ex.details = json.error.details;
103+
throw ex;
104+
} else {
105+
return json;
106+
}
107+
})
106108
}
107109

108110
/**
@@ -3289,6 +3291,31 @@ export default class AvaTaxClient {
32893291
return this.restCall({ url: path, verb: 'get', payload: null });
32903292
}
32913293

3294+
/**
3295+
* List all market place locations.
3296+
*
3297+
* List all market place locations.
3298+
*
3299+
*
3300+
* @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/).
3301+
* @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.
3302+
* @param int skip If nonzero, skip this number of results before returning data. Used with `$top` to provide pagination for large datasets.
3303+
* @param string orderBy A comma separated list of sort statements in the format `(fieldname) [ASC|DESC]`, for example `id ASC`.
3304+
* @return FetchResult
3305+
*/
3306+
listAllMarketplaceLocations({ filter, top, skip, orderBy } = {}) {
3307+
var path = this.buildUrl({
3308+
url: `/api/v2/definitions/listallmarketplacelocations`,
3309+
parameters: {
3310+
$filter: filter,
3311+
$top: top,
3312+
$skip: skip,
3313+
$orderBy: orderBy
3314+
}
3315+
});
3316+
return this.restCall({ url: path, verb: 'get', payload: null });
3317+
}
3318+
32923319
/**
32933320
* Retrieve the full list of the AvaFile Forms available
32943321
*
@@ -6196,6 +6223,7 @@ export default class AvaTaxClient {
61966223
*
61976224
* * Parameters
61986225
* * Classifications
6226+
* * Tags
61996227
*
62006228
* ### Security Policies
62016229
*
@@ -8375,6 +8403,25 @@ export default class AvaTaxClient {
83758403
return this.restCall({ url: path, verb: 'delete', payload: null });
83768404
}
83778405

8406+
/**
8407+
* Retrieve List of Accounts by Account Migration Status
8408+
*
8409+
* ### Security Policies
8410+
*
8411+
* * This API requires one of the following user roles: FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin.
8412+
*
8413+
*
8414+
* @param string writeMode (See TssAccountMigrationId::* for a list of allowable values)
8415+
* @return object
8416+
*/
8417+
listAccountsByTssWriteMode({ writeMode } = {}) {
8418+
var path = this.buildUrl({
8419+
url: `/api/v2/accounts/ListAccountsByTssWriteMode/${writeMode}`,
8420+
parameters: {}
8421+
});
8422+
return this.restCall({ url: path, verb: 'get', payload: null });
8423+
}
8424+
83788425
/**
83798426
* Reset a user's password programmatically
83808427
*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "avatax",
3-
"version": "21.6.0",
3+
"version": "21.7.1",
44
"description": "AvaTax v2 SDK for languages using JavaScript",
55
"main": "index.js",
66
"homepage": "https://github.com/avadev/AvaTax-REST-V2-JS-SDK",

0 commit comments

Comments
 (0)