From 164c766a26f7eb2ca8da33d52e1ab1c347f08a71 Mon Sep 17 00:00:00 2001 From: Avalara-ChrisWalker Date: Thu, 19 Dec 2019 10:08:56 -0800 Subject: [PATCH 1/6] Fixed19.12 update --- lib/AvaTaxClient.js | 81 +++++++++++++++++++++++++++++++-------------- package.json | 2 +- 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/lib/AvaTaxClient.js b/lib/AvaTaxClient.js index eb11dcf5..d6663350 100644 --- a/lib/AvaTaxClient.js +++ b/lib/AvaTaxClient.js @@ -10,7 +10,7 @@ * @author Ted Spence * @copyright 2004-2018 Avalara, Inc. * @license https://www.apache.org/licenses/LICENSE-2.0 - * @version 19.11.0 + * @version 19.12.0 * @link https://github.com/avadev/AvaTax-REST-V2-JS-SDK */ @@ -31,14 +31,17 @@ export default class AvaTaxClient { this.baseUrl = 'https://rest.avatax.com'; if (environment == 'sandbox') { this.baseUrl = 'https://sandbox-rest.avatax.com'; - } else if ( /^(https:\/\/|http:\/\/)/.test(environment) ) { + } else if ( + environment.substring(0, 8) == 'https://' || + environment.substring(0, 7) == 'http://' + ) { this.baseUrl = environment; } this.clientId = appName + '; ' + appVersion + - '; JavascriptSdk; 19.11.0; ' + + '; JavascriptSdk; 19.12.0; ' + machineName; } @@ -83,13 +86,13 @@ export default class AvaTaxClient { }).then(res => { var contentType = res.headers._headers['content-type'][0]; - if (contentType === 'application/vnd.ms-excel' || contentType === 'text/csv') + if (contentType === 'application/vnd.ms-excel' || contentType === 'text/csv') { { return res; } return res.json(); }) - .then(json => { + .then(json => { // handle error if (json.error) { let ex = new Error(json.error.message); @@ -452,7 +455,6 @@ export default class AvaTaxClient { * * * This API requires the user role Compliance Root User. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param object[] model The AvaFileForm you wish to create. @@ -475,7 +477,6 @@ export default class AvaTaxClient { * * * This API requires one of the following user roles: Compliance Root User, ComplianceUser, FirmAdmin. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param int id The ID of the AvaFileForm you wish to delete. @@ -497,7 +498,6 @@ export default class AvaTaxClient { * ### Security Policies * * * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CompanyUser, Compliance Root User, Compliance Temp User, ComplianceAdmin, ComplianceUser, FirmAdmin, FirmUser, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. * * @@ -522,7 +522,6 @@ export default class AvaTaxClient { * * * This API requires one of the following user roles: AccountAdmin, AccountOperator, CompanyAdmin, CompanyUser, Compliance Root User, Compliance Temp User, ComplianceAdmin, ComplianceUser, FirmAdmin, FirmUser, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @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/).
*Not filterable:* outletTypeId @@ -554,7 +553,6 @@ export default class AvaTaxClient { * * * This API requires the user role Compliance Root User. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param int id The ID of the AvaFileForm you wish to update @@ -1692,7 +1690,6 @@ export default class AvaTaxClient { * * * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param int companyId The unique identifier of the company @@ -1718,7 +1715,6 @@ export default class AvaTaxClient { * * * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param int companyId The unique identifier of the company @@ -2236,7 +2232,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({ @@ -2405,7 +2401,7 @@ export default class AvaTaxClient { * * A customer may have multiple attributes that control its behavior. You may link or unlink attributes to a * customer at any time. The full list of defined attributes may be found using `QueryCompanyCustomerAttributes` API. - * + * * A customer object defines information about a person or business that purchases products from your * company. When you create a tax transaction in AvaTax, you can use the `customerCode` from this * record in your `CreateTransaction` API call. AvaTax will search for this `customerCode` value and @@ -2924,7 +2920,7 @@ export default class AvaTaxClient { /** * List certificate attributes used by a company * - * List the certificate attributes defined by a company. + * List the certificate attributes defined by a company either specified by the user or the user's default company. * * A certificate may have multiple attributes that control its behavior. You may apply or remove attributes to a * certificate at any time. @@ -2933,16 +2929,18 @@ export default class AvaTaxClient { * check and provision account. * * + * @param int companyid Id of the company the user wish to fetch the certificates' attributes from. If not specified the API will use user's default company. * @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/). * @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 */ - listCertificateAttributes({ filter, top, skip, orderBy } = {}) { + listCertificateAttributes({ companyid, filter, top, skip, orderBy } = {}) { var path = this.buildUrl({ url: `/api/v2/definitions/certificateattributes`, parameters: { + companyid: companyid, $filter: filter, $top: top, $skip: skip, @@ -4646,6 +4644,44 @@ export default class AvaTaxClient { return this.restCall({ url: path, verb: 'put', payload: model }); } + /** + * Retrieve a list of filed returns for the specified company in the year and month of a given filing period. + * + * ### Security Policies + * + * * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser. + * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser, CompanyUser, AccountUser, CompanyAdmin, AccountAdmin. + * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. + * + * + * @param int companyId The ID of the company that owns these batches + * @param int endPeriodMonth The month of the period you are trying to retrieve + * @param int endPeriodYear The year of the period you are trying to retrieve + * @param string frequency The frequency of the return you are trying to retrieve (See FilingFrequencyId::* for a list of allowable values) + * @param string status The status of the return(s) you are trying to retrieve (See FilingStatusId::* for a list of allowable values) + * @param string country The country of the return(s) you are trying to retrieve + * @param string region The region of the return(s) you are trying to retrieve + * @param int filingCalendarId The filing calendar id of the return you are trying to retrieve + * @param string taxformCode The unique tax form code of the form. + * @return FetchResult + */ + getFiledReturns({ companyId, endPeriodMonth, endPeriodYear, frequency, status, country, region, filingCalendarId, taxformCode } = {}) { + var path = this.buildUrl({ + url: `/api/v2/companies/${companyId}/filings/returns/filed`, + parameters: { + endPeriodMonth: endPeriodMonth, + endPeriodYear: endPeriodYear, + frequency: frequency, + status: status, + country: country, + region: region, + filingCalendarId: filingCalendarId, + taxformCode: taxformCode + } + }); + return this.restCall({ url: path, verb: 'get', payload: null }); + } + /** * Approves linkage to a firm for a client account * @@ -4998,7 +5034,6 @@ export default class AvaTaxClient { * * * This API requires one of the following user roles: AccountAdmin, AccountOperator, AccountUser, CompanyAdmin, CompanyUser, Compliance Root User, ComplianceAdmin, ComplianceUser, CSPAdmin, CSPTester, FirmAdmin, FirmUser, ProStoresOperator, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin, TechnicalSupportUser, TreasuryAdmin, TreasuryUser. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param int id The unique ID number of this funding request @@ -5030,7 +5065,6 @@ export default class AvaTaxClient { * * * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param int id The unique ID number of this funding request @@ -6837,7 +6871,7 @@ export default class AvaTaxClient { /** * Request a new Avalara account * - * This API is for use by partner onboarding services customers only. + * This API is for use by partner provisioning services customers only. * * Avalara invites select partners to refer new customers to the AvaTax service using the onboarding features * of AvaTax. These partners can create accounts for new customers using this API. @@ -6856,7 +6890,7 @@ export default class AvaTaxClient { * * * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin. * * This API is available by invitation only. - * * This API is available by invitation only. To request access to this feature, please speak to a business development manager and request access to [Onboarding:RequestNewAccount]. + * * This API is available by invitation only. To request access to this feature, please speak to a business development manager and request access to [Provisioning:RequestNewAccount]. * * * @param object model Information about the account you wish to create and the selected product offerings. @@ -6873,14 +6907,14 @@ export default class AvaTaxClient { /** * Request a new entitilement to an existing customer * - * This API is for use by partner onboarding services customers only. This will allow the partners to allow + * This API is for use by partner provisioning services customers only. This will allow the partners to allow * the add new entitlement to an existing customer * * ### Security Policies * * * This API requires one of the following user roles: AccountAdmin, CompanyAdmin, CSPTester, FirmAdmin, Registrar, SiteAdmin, SSTAdmin, SystemAdmin, TechnicalSupportAdmin. * * This API is available by invitation only. - * * This API is available by invitation only. To request access to this feature, please speak to a business development manager and request access to [Onboarding:RequestNewAccount]. + * * This API is available by invitation only. To request access to this feature, please speak to a business development manager and request access to [Provisioning:RequestNewAccount]. * * * @param int id The avatax account id of the customer @@ -8389,7 +8423,6 @@ export default class AvaTaxClient { * * * This API requires the user role Compliance Root User. * * This API depends on the following active services
*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.
*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged. - * * This API is available by invitation only.
*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser. * * * @param object model bulk lock request @@ -9666,7 +9699,7 @@ export default class AvaTaxClient { * specific features of AvaTax. * * - * @param string serviceTypeId The service to check (See ServiceTypeId::* for a list of allowable values) + * @param string serviceTypeId The service to check * @return object */ getMySubscription({ serviceTypeId } = {}) { diff --git a/package.json b/package.json index 4347ffc6..6b5a81a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "avatax", - "version": "19.11.0", + "version": "19.12.0", "description": "AvaTax v2 SDK for languages using JavaScript", "main": "index.js", "homepage": "https://github.com/avadev/AvaTax-REST-V2-JS-SDK", From 0f924bd0e3724ac410840ef669716abff28818f1 Mon Sep 17 00:00:00 2001 From: Avalara-ChrisWalker <37675577+Avalara-ChrisWalker@users.noreply.github.com> Date: Thu, 19 Dec 2019 10:12:22 -0800 Subject: [PATCH 2/6] Update AvaTaxClient.js --- lib/AvaTaxClient.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/AvaTaxClient.js b/lib/AvaTaxClient.js index d6663350..8becb553 100644 --- a/lib/AvaTaxClient.js +++ b/lib/AvaTaxClient.js @@ -87,7 +87,6 @@ export default class AvaTaxClient { var contentType = res.headers._headers['content-type'][0]; if (contentType === 'application/vnd.ms-excel' || contentType === 'text/csv') { - { return res; } return res.json(); From 6b89948e71ac9e2d224748f902894f45b7b77c1f Mon Sep 17 00:00:00 2001 From: "Chris.Walker" Date: Thu, 19 Dec 2019 10:22:55 -0800 Subject: [PATCH 3/6] travis --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7941f2b6..83d3252a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,6 @@ jobs: name: Build Test - stage: "Deploy" name: Deploy - before_deploy: - - npm run build deploy: provider: npm email: svc.developer@avalara.com From 049cb3fd4eb2539933dec2709b2df21b5ad60ac0 Mon Sep 17 00:00:00 2001 From: "Chris.Walker" Date: Thu, 19 Dec 2019 10:25:50 -0800 Subject: [PATCH 4/6] travis --- .travis.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83d3252a..7ce07fdc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,3 @@ jobs: script: npm run lint - script: npm run build name: Build Test - - stage: "Deploy" - name: Deploy - deploy: - provider: npm - email: svc.developer@avalara.com - api_key: - secure: FX4IjFpoQYOoJYB3x7Z5LXDg7sB5cTx5re1LweqAGxGwRQavOspRSiKrL0tKBGWHMwUZDvrQ5uOl5bCTu0WaHIZd13fWSBaY+eIUj8xlzSMpvJ7ZKw4D4gZ/Ci2xPZlwIXLp/rvUkz3YZgXeqfpLarVEci96xJOq2hLlr9W5IOrfWJt587NjR/IpbeigabtExAk1bPPlflPu68FUXKkAOzzT0+5fQMdHp1/+WctrVzxnuq14IXgnlQGBC5f8PXL+XxTyPewIDNyhV2S6eA6NSGwuZSW32v6xPbZLqittKDNSEzUaLq2JWCoRHVwc5PLmPJL0xUeIGfptWKwRnxzvv/iGYW6wen0PdD4HAouMg2cHe/LyyMXirw/QvhIoKNvsiGSX+GxrLfIpq+RAS6qobCgSOBXM5kHtwy8bB2QLsxCEkTMCvVvjxEXbxqQyk3JfMN/Ggv3JBQEW7p2pLoTxy18h7EkbSEYOdFGMME9QzcapdNxkOKRCFutfqQCKUYatVs8+MTR6h2QR6uybFhE11SoBC0Zs/zGzicePSg5H/8igpX4u7lxy40SMvSH/TsErIORdEmSHobTFmHLMTA1UuAdXATJ3tUUJU8V9JXvM/2a9pBopN6i7x2mXARN5je+ORxB/yJUFmfkcopgfwuLxlO4ujVXjkDeyqriODx6Gxzw= - on: - tags: true - branch: master \ No newline at end of file From 7ad70127dc0294aede3756ab507df7c3928a0b7f Mon Sep 17 00:00:00 2001 From: Avalara-ChrisWalker <37675577+Avalara-ChrisWalker@users.noreply.github.com> Date: Thu, 19 Dec 2019 10:35:31 -0800 Subject: [PATCH 5/6] Update AvaTaxClient.js --- lib/AvaTaxClient.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/AvaTaxClient.js b/lib/AvaTaxClient.js index 8becb553..8455768e 100644 --- a/lib/AvaTaxClient.js +++ b/lib/AvaTaxClient.js @@ -41,7 +41,7 @@ export default class AvaTaxClient { appName + '; ' + appVersion + - '; JavascriptSdk; 19.12.0; ' + + '; JavascriptSdk; 19.12.1; ' + machineName; } From b55752583d7d1b8fee313e843daf5f9eedec8cf2 Mon Sep 17 00:00:00 2001 From: Avalara-ChrisWalker <37675577+Avalara-ChrisWalker@users.noreply.github.com> Date: Thu, 19 Dec 2019 10:35:51 -0800 Subject: [PATCH 6/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b5a81a8..f94fa9a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "avatax", - "version": "19.12.0", + "version": "19.12.1", "description": "AvaTax v2 SDK for languages using JavaScript", "main": "index.js", "homepage": "https://github.com/avadev/AvaTax-REST-V2-JS-SDK",