Skip to content

Commit

Permalink
Merge pull request #119 from avadev/Fixed19.12
Browse files Browse the repository at this point in the history
Fixed19.12 update
  • Loading branch information
Avalara-ChrisWalker authored Dec 19, 2019
2 parents c9382c5 + b557525 commit e8ea746
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 38 deletions.
12 changes: 0 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,3 @@ jobs:
script: npm run lint
- script: npm run build
name: Build Test
- stage: "Deploy"
name: Deploy
before_deploy:
- npm run build
deploy:
provider: npm
email: [email protected]
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
82 changes: 57 additions & 25 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.11.0
* @version 19.12.0
* @link https://github.com/avadev/AvaTax-REST-V2-JS-SDK
*/

Expand All @@ -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.1; ' +
machineName;
}

Expand Down Expand Up @@ -83,13 +86,12 @@ 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);
Expand Down Expand Up @@ -452,7 +454,6 @@ export default class AvaTaxClient {
*
* * This API requires the user role Compliance Root User.
* * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param object[] model The AvaFileForm you wish to create.
Expand All @@ -475,7 +476,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<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param int id The ID of the AvaFileForm you wish to delete.
Expand All @@ -497,7 +497,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.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
* * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
*
*
Expand All @@ -522,7 +521,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<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*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/).<br />*Not filterable:* outletTypeId
Expand Down Expand Up @@ -554,7 +552,6 @@ export default class AvaTaxClient {
*
* * This API requires the user role Compliance Root User.
* * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param int id The ID of the AvaFileForm you wish to update
Expand Down Expand Up @@ -1692,7 +1689,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<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param int companyId The unique identifier of the company
Expand All @@ -1718,7 +1714,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<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param int companyId The unique identifier of the company
Expand Down Expand Up @@ -2236,7 +2231,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 @@ -2405,7 +2400,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
Expand Down Expand Up @@ -2924,7 +2919,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.
Expand All @@ -2933,16 +2928,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,
Expand Down Expand Up @@ -4646,6 +4643,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.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser, CompanyUser, AccountUser, CompanyAdmin, AccountAdmin.
* * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*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
*
Expand Down Expand Up @@ -4998,7 +5033,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<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param int id The unique ID number of this funding request
Expand Down Expand Up @@ -5030,7 +5064,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<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param int id The unique ID number of this funding request
Expand Down Expand Up @@ -6837,7 +6870,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.
Expand All @@ -6856,7 +6889,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.
Expand All @@ -6873,14 +6906,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
Expand Down Expand Up @@ -8389,7 +8422,6 @@ export default class AvaTaxClient {
*
* * This API requires the user role Compliance Root User.
* * This API depends on the following active services<br />*Returns* (at least one of): Mrs, MRSComplianceManager, AvaTaxCsp.<br />*Firm Managed* (for accounts managed by a firm): ARA, ARAManaged.
* * This API is available by invitation only.<br />*Exempt security roles*: ComplianceRootUser, ComplianceAdmin, ComplianceUser, TechnicalSupportAdmin, TechnicalSupportUser.
*
*
* @param object model bulk lock request
Expand Down Expand Up @@ -9666,7 +9698,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 } = {}) {
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.11.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",
Expand Down

0 comments on commit e8ea746

Please sign in to comment.