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.7.1
13+ * @version 21.6.0
1414 * @link https://github.com/avadev/AvaTax-REST-V2-JS-SDK
1515 */
1616
1717import fetch from 'isomorphic-fetch';
1818import { createBasicAuthHeader } from './utils/basic_auth';
1919import { withTimeout } from './utils/withTimeout';
20- var JSONbig = require('json-bigint')({ useNativeBigInt: true });
2120
2221export default class AvaTaxClient {
2322 /**
@@ -43,7 +42,7 @@ export default class AvaTaxClient {
4342 appName +
4443 '; ' +
4544 appVersion +
46- '; JavascriptSdk; 21.7.1 ; ' +
45+ '; JavascriptSdk; 21.6.0 ; ' +
4746 machineName;
4847 }
4948
@@ -86,25 +85,24 @@ export default class AvaTaxClient {
8685 },
8786 body: JSON.stringify(payload)
8887 })).then(res => {
89- var contentType = res.headers._headers['content-type'][0];
88+ var contentType = res.headers._headers['content-type'][0];
9089
9190 if (contentType === 'application/vnd.ms-excel' || contentType === 'text/csv') {
9291 return res;
9392 }
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- })
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+ })
108106 }
109107
110108 /**
@@ -3291,31 +3289,6 @@ export default class AvaTaxClient {
32913289 return this.restCall({ url: path, verb: 'get', payload: null });
32923290 }
32933291
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-
33193292 /**
33203293 * Retrieve the full list of the AvaFile Forms available
33213294 *
@@ -6223,7 +6196,6 @@ export default class AvaTaxClient {
62236196 *
62246197 * * Parameters
62256198 * * Classifications
6226- * * Tags
62276199 *
62286200 * ### Security Policies
62296201 *
@@ -8403,25 +8375,6 @@ export default class AvaTaxClient {
84038375 return this.restCall({ url: path, verb: 'delete', payload: null });
84048376 }
84058377
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-
84258378 /**
84268379 * Reset a user's password programmatically
84278380 *
0 commit comments