Skip to content

Commit

Permalink
Merge pull request #72 from han8909227/18-5
Browse files Browse the repository at this point in the history
18.5
  • Loading branch information
ted-spence-avalara authored Jun 5, 2018
2 parents 63b2455 + 202a4d2 commit 7238e92
Show file tree
Hide file tree
Showing 3 changed files with 292 additions and 67 deletions.
41 changes: 29 additions & 12 deletions src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,26 @@ class ServiceTypeId
*/
const C_MRSCOMPLIANCEMANAGER = "MRSComplianceManager";

/**
* AvaBikeTax
*/
const C_AVABIKETAX = "AvaBikeTax";

/**
* AvaCheckoutBag
*/
const C_AVACHECKOUTBAG = "AvaCheckoutBag";

/**
* TFOCompliance
*/
const C_TFOCOMPLIANCE = "TFOCompliance";

/**
* Send Sales Rate file service
*/
const C_SENDSALESRATEFILE = "SendSalesRateFile";

}


Expand Down Expand Up @@ -853,12 +873,6 @@ class ErrorCodeId
const C_NONOUTLETFORM = "NonOutletForm";
const C_OVERLAPPINGFILINGCALENDAR = "OverlappingFilingCalendar";

/**
* Location error codes
*/
const C_QUESTIONNOTNEEDEDFORTHISADDRESS = "QuestionNotNeededForThisAddress";
const C_QUESTIONNOTVALIDFORTHISADDRESS = "QuestionNotValidForThisAddress";

/**
* Create or update transaction error codes
*/
Expand Down Expand Up @@ -887,6 +901,7 @@ class ErrorCodeId
const C_INVALIDPDFORIMAGEFILE = "InvalidPdfOrImageFile";
const C_INVALIDCOVERLETTERTITLE = "InvalidCoverLetterTitle";
const C_ACCOUNTNOTPROVISIONED = "AccountNotProvisioned";
const C_INVALIDREQUESTCONTENTTYPE = "InvalidRequestContentType";

/**
* Multi document error codes
Expand Down Expand Up @@ -944,8 +959,14 @@ class ErrorCodeId
const C_ADVANCEDRULEBADCSVTABLE = "AdvancedRuleBadCsvTable";
const C_ADVANCEDRULEREQUESTRULEERROR = "AdvancedRuleRequestRuleError";
const C_ADVANCEDRULERESPONSERULEERROR = "AdvancedRuleResponseRuleError";
const C_ADVANCEDRULENOTAPPROVED = "AdvancedRuleNotApproved";
const C_INVALIDDOCUMENTSTATUSTOADDORDELETELINES = "InvalidDocumentStatusToAddOrDeleteLines";

/**
* SendSales API errors
*/
const C_UNSUPPORTEDFILEFORMAT = "UnsupportedFileFormat";

}


Expand Down Expand Up @@ -1484,7 +1505,7 @@ class AddressTypeId
/**
* This location is a marketplace vendor that handles transactions on behalf of the company.
* When you select `Marketplace` as the address type for a location, you must then choose either
* `SellersRemitsTax` or `MarketplaceRemitsTax` to indicate which business entity is responsible
* `SellerRemitsTax` or `MarketplaceRemitsTax` to indicate which business entity is responsible
* for collecting and remitting tax for this location.
*/
const C_MARKETPLACE = "Marketplace";
Expand Down Expand Up @@ -1529,7 +1550,7 @@ class AddressCategoryId
* and your company is responsible for collecting and remitting all taxes for transactions tied
* to this location.
*/
const C_SELLERSREMITSTAX = "SellersRemitsTax";
const C_SELLERREMITSTAX = "SellerRemitsTax";

/**
* The marketplace vendor collects and remits tax on your behalf for all transactions tied
Expand Down Expand Up @@ -1590,15 +1611,11 @@ class NexusTypeId

/**
* Indicates the entity is voluntarily collecting tax (default)
*
* This has replaced Collect
*/
const C_SALESORSELLERSUSETAX = "SalesOrSellersUseTax";

/**
* Indicates the entity is required to collect tax in the state
*
* This has replaced Legal
*/
const C_SALESTAX = "SalesTax";

Expand Down
170 changes: 145 additions & 25 deletions src/Methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,50 @@ public function deleteAdvancedRuleTable($accountId, $csvTableName)
return $this->restCall($path, 'DELETE', $guzzleParams);
}

/**
* Disable an advanced rule so that it cannot be run.
*
* This API is available by invite only and implementation support is required.
* Please contact your Customer Account Manager if you are interested in using
* Advanced Rules in your AvaTax integration. ///
*
*
* @param int $accountId
* @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values)
* @return AdvancedRuleScriptModel
*/
public function disableAdvancedRuleScript($accountId, $scriptType)
{
$path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}/disable";
$guzzleParams = [
'query' => [],
'body' => null
];
return $this->restCall($path, 'POST', $guzzleParams);
}

/**
* Enable an approved advanced rule so that it can be run.
*
* This API is available by invite only and implementation support is required.
* Please contact your Customer Account Manager if you are interested in using
* Advanced Rules in your AvaTax integration.
*
*
* @param int $accountId
* @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values)
* @return AdvancedRuleScriptModel
*/
public function enableAdvancedRuleScript($accountId, $scriptType)
{
$path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}/enable";
$guzzleParams = [
'query' => [],
'body' => null
];
return $this->restCall($path, 'POST', $guzzleParams);
}

/**
* Get an account's advanced rule script.
*
Expand Down Expand Up @@ -562,7 +606,16 @@ public function createBatches($companyId, $model)
/**
* Delete a single batch
*
* Marks the batch identified by this URL as deleted.
*
* If you attempt to delete a batch that is being processed, you will receive an error message.
* Deleting a batch does not delete any transactions that were created by importing the batch.
*
* Because the batch system processes with a degree of concurrency, and
* because of batch sizes in the queue vary, AvaTax API is unable to accurately
* 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/).
*
*
* @param int $companyId The ID of the company that owns this batch.
Expand Down Expand Up @@ -1713,9 +1766,14 @@ public function setCompanyConfiguration($id, $model)
* Update a single company
*
* Replace the existing company object at this URL with an updated object.
* A 'company' represents a single corporation or individual that is registered to handle transactional taxes.
*
* A `CompanyModel` represents a single corporation or individual that is registered to handle transactional taxes.
* All data from the existing object will be replaced with data in the object you PUT.
* To set a field's value to null, you may either set its value to null or omit that field from the object you post.
*
* When calling `UpdateCompany`, you are permitted to update the company itself. Updates to the nested objects
* 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.
*
*
* @param int $id The ID of the company you wish to update.
Expand Down Expand Up @@ -3121,17 +3179,15 @@ public function listParameters($filter, $top, $skip, $orderBy)
* This API is intended to be useful to identify the capabilities of a particular user logon.
*
*
* @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.
* @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
*/
public function listPermissions($filter, $top, $skip, $orderBy)
public function listPermissions($top, $skip)
{
$path = "/api/v2/definitions/permissions";
$guzzleParams = [
'query' => ['$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy],
'query' => ['$top' => $top, '$skip' => $skip],
'body' => null
];
return $this->restCall($path, 'GET', $guzzleParams);
Expand Down Expand Up @@ -3439,17 +3495,15 @@ public function listTaxCodes($filter, $top, $skip, $orderBy)
* This API is intended to be useful for broadly searching for tax codes by tax code type.
*
*
* @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.
* @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 TaxCodeTypesModel
*/
public function listTaxCodeTypes($filter, $top, $skip, $orderBy)
public function listTaxCodeTypes($top, $skip)
{
$path = "/api/v2/definitions/taxcodetypes";
$guzzleParams = [
'query' => ['$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy],
'query' => ['$top' => $top, '$skip' => $skip],
'body' => null
];
return $this->restCall($path, 'GET', $guzzleParams);
Expand Down Expand Up @@ -3978,17 +4032,18 @@ public function listFilingCalendars($companyId, $filter, $top, $skip, $orderBy,
*
*
* @param int $companyId The ID of the company that owns these batches
* @param int $filingCalendarId Specific filing calendar id for the request
* @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.
* @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
*/
public function listFilingRequests($companyId, $filter, $top, $skip, $orderBy)
public function listFilingRequests($companyId, $filingCalendarId, $filter, $top, $skip, $orderBy)
{
$path = "/api/v2/companies/{$companyId}/filingrequests";
$guzzleParams = [
'query' => ['$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy],
'query' => ['filingCalendarId' => $filingCalendarId, '$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy],
'body' => null
];
return $this->restCall($path, 'GET', $guzzleParams);
Expand Down Expand Up @@ -4072,17 +4127,18 @@ public function queryFilingCalendars($filter, $top, $skip, $orderBy, $returnCoun
* Paginate your results using the `$top`, `$skip`, and `$orderby` parameters.
*
*
* @param int $filingCalendarId Specific filing calendar id for the request
* @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.
* @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
*/
public function queryFilingRequests($filter, $top, $skip, $orderBy)
public function queryFilingRequests($filingCalendarId, $filter, $top, $skip, $orderBy)
{
$path = "/api/v2/filingrequests";
$guzzleParams = [
'query' => ['$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy],
'query' => ['filingCalendarId' => $filingCalendarId, '$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy],
'body' => null
];
return $this->restCall($path, 'GET', $guzzleParams);
Expand Down Expand Up @@ -4828,18 +4884,16 @@ public function updateReturnPayment($companyId, $id, $model)
/**
* FREE API - Request a free trial of AvaTax
*
* Call this API to obtain a free AvaTax sandbox account.
* Call this API to obtain a free AvaTax account.
*
* This API is free to use. No authentication credentials are required to call this API. You must read and accept Avalara's terms and conditions.
* The account will grant a full trial version of AvaTax (e.g. AvaTaxPro) for a limited period of time.
* After this introductory period, you may continue to use the free TaxRates API.
*
* Limitations on free trial accounts:
* This API is free to use. No authentication credentials are required to call this API. You must read and
* accept [Avalara's terms and conditions](https://www1.avalara.com/us/en/legal/terms.html) for the account to be
* created.
*
* If all conditions are met, this API will grant a free trial version of AvaTax. For a list of functionality
* available in the free trial and its limitations, please see the [AvaTax Developer Website Free Trial page](https://developer.avalara.com/avatax/signup/).
*
* * Only one free trial per company.
* * The free trial account does not expire.
* * Includes a limited time free trial of AvaTaxPro; after that date, the free TaxRates API will continue to work.
* * Each free trial account must have its own valid email address.
* After your free trial concludes, you will still be able to use the [Free AvaTax API Suite](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Free/).
*
*
* @param FreeTrialRequestModel $model Required information to provision a free trial account.
Expand Down Expand Up @@ -6119,6 +6173,30 @@ public function updateNexus($companyId, $id, $model)
return $this->restCall($path, 'PUT', $guzzleParams);
}

/**
* Delete a single notice.
*
* This API is available by invitation only.
* 'Notice comments' are updates by the notice team on the work to be done and that has been done so far on a notice.
* A 'notice' represents a letter sent to a business by a tax authority regarding tax filing issues. Avalara
* Returns customers often receive support and assistance from the Compliance Notices team in handling notices received by taxing authorities.
*
*
* @param int $companyId The ID of the company that owns this notice.
* @param int $id The ID of the notice you wish to delete the finance detail from.
* @param int $commentDetailsId The ID of the comment you wish to delete.
* @return ErrorDetail[]
*/
public function commentDetailsDelete($companyId, $id, $commentDetailsId)
{
$path = "/api/v2/companies/{$companyId}/notices/{$id}/commentdetails/{$commentdetailsid}";
$guzzleParams = [
'query' => [],
'body' => null
];
return $this->restCall($path, 'DELETE', $guzzleParams);
}

/**
* Create a new notice comment.
*
Expand Down Expand Up @@ -6331,6 +6409,31 @@ public function downloadNoticeAttachment($companyId, $id)
return $this->restCall($path, 'GET', $guzzleParams);
}

/**
* Delete a single notice.
*
* This API is available by invitation only.
* 'Notice finance details' is the categorical breakdown of the total charge levied by the tax authority on our customer,
* as broken down in our "notice log" found in Workflow. Main examples of the categories are 'Tax Due', 'Interest', 'Penalty', 'Total Abated'.
* A 'notice' represents a letter sent to a business by a tax authority regarding tax filing issues. Avalara
* Returns customers often receive support and assistance from the Compliance Notices team in handling notices received by taxing authorities.
*
*
* @param int $companyId The ID of the company that owns this notice.
* @param int $id The ID of the notice you wish to delete the finance detail from.
* @param int $financeDetailsId The ID of the finance detail you wish to delete.
* @return ErrorDetail[]
*/
public function financedetailsdelete($companyId, $id, $financeDetailsId)
{
$path = "/api/v2/companies/{$companyId}/notices/{$id}/financedetails/{$financedetailsid}";
$guzzleParams = [
'query' => [],
'body' => null
];
return $this->restCall($path, 'DELETE', $guzzleParams);
}

/**
* Retrieve a single notice.
*
Expand Down Expand Up @@ -6620,7 +6723,7 @@ public function changePassword($model)
*
*
* @param AccountModel $model The account you wish to create.
* @return AccountModel
* @return AccountModel[]
*/
public function createAccount($model)
{
Expand Down Expand Up @@ -7493,6 +7596,23 @@ public function buildTaxContentFileForLocation($companyId, $id, $date, $format,
* to reconcile the actual transaction and determine the difference between the estimated general tax
* rate and the final transaction tax.
*
* The file provided by this API is in CSV format with the following columns:
*
* * ZIP_CODE - The five digit zip code for this record.
* * STATE_ABBREV - A valid two character US state abbreviation for this record. Zip codes may span multiple states.
* * COUNTY_NAME - A valid county name for this record. Zip codes may span multiple counties.
* * CITY_NAME - A valid city name for this record. Zip codes may span multiple cities.
* * STATE_SALES_TAX - The state component of the sales tax rate.
* * STATE_USE_TAX - The state component of the use tax rate.
* * COUNTY_SALES_TAX - The county component of the sales tax rate.
* * COUNTY_USE_TAX - The county component of the use tax rate.
* * CITY_SALES_TAX - The city component of the sales tax rate.
* * CITY_USE_TAX - The city component of the use tax rate.
* * TOTAL_SALES_TAX - The total tax rate for sales tax for this postal code. This value may not equal the sum of the state/county/city due to special tax jurisdiction rules.
* * TOTAL_USE_TAX - The total tax rate for use tax for this postal code. This value may not equal the sum of the state/county/city due to special tax jurisdiction rules.
* * TAX_SHIPPING_ALONE - This column contains 'Y' if shipping is taxable.
* * TAX_SHIPPING_AND_HANDLING_TOGETHER - This column contains 'Y' if shipping and handling are taxable when sent together.
*
* For more detailed tax content, please use the `BuildTaxContentFile` API which allows usage of exact items and exact locations.
*
*
Expand Down
Loading

0 comments on commit 7238e92

Please sign in to comment.