From 15c21d14219486e36badb2758d908aff141dc686 Mon Sep 17 00:00:00 2001 From: han8909227 Date: Fri, 25 May 2018 13:22:04 -0700 Subject: [PATCH 1/2] with REST 18.5 updates --- src/Constants.php | 85 +++++++----- src/Methods.php | 326 ++++++++++++++-------------------------------- src/Models.php | 148 ++++++++++++++++----- 3 files changed, 270 insertions(+), 289 deletions(-) diff --git a/src/Constants.php b/src/Constants.php index a33842c..d86b1b2 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -26,28 +26,6 @@ class TransactionAddressType } -/** - * - */ -class AdvancedRuleScriptType -{ - const C_REQUESTRULE = "RequestRule"; - const C_RESPONSERULE = "ResponseRule"; - -} - - -/** - * - */ -class AdvancedRuleCrashBehavior -{ - const C_FAILONERROR = "FailOnError"; - const C_PROCEEDWITHORIGINAL = "ProceedWithOriginal"; - -} - - /** * Casing to use for validation result */ @@ -433,6 +411,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"; + } @@ -853,12 +851,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 */ @@ -887,6 +879,7 @@ class ErrorCodeId const C_INVALIDPDFORIMAGEFILE = "InvalidPdfOrImageFile"; const C_INVALIDCOVERLETTERTITLE = "InvalidCoverLetterTitle"; const C_ACCOUNTNOTPROVISIONED = "AccountNotProvisioned"; + const C_INVALIDREQUESTCONTENTTYPE = "InvalidRequestContentType"; /** * Multi document error codes @@ -944,8 +937,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"; + } @@ -1105,6 +1104,28 @@ class JurisdictionType } +/** + * + */ +class AdvancedRuleCrashBehavior +{ + const C_FAILONERROR = "FailOnError"; + const C_PROCEEDWITHORIGINAL = "ProceedWithOriginal"; + +} + + +/** + * + */ +class AdvancedRuleScriptType +{ + const C_REQUESTRULE = "RequestRule"; + const C_RESPONSERULE = "ResponseRule"; + +} + + /** * A list of possible AvaFile Form Types. */ @@ -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"; @@ -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 @@ -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"; diff --git a/src/Methods.php b/src/Methods.php index edb5dc1..ef15b74 100644 --- a/src/Methods.php +++ b/src/Methods.php @@ -223,206 +223,6 @@ public function resolveAddressPost($model) return $this->restCall($path, 'POST', $guzzleParams); } - /** - * Approve an advanced rule script to 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 The ID of the account that owns the Advanced Rule. - * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) - * @return AdvancedRuleScriptModel - */ - public function approveAdvancedRuleScript($accountId, $scriptType) - { - $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}/approve"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'POST', $guzzleParams); - } - - /** - * Create an advanced rule. - * - * 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 The ID of the account that will own the Advanced Rule. - * @param string $scriptType The script transform type, Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) - * @param string $crashBehavior The behavior the script should take if it crashes: Fail or Proceed. (See AdvancedRuleCrashBehavior::* for a list of allowable values) - * @param object $file The JavaScript file containing the advanced rule. - * @return string - */ - public function createAdvancedRuleScript($accountId, $scriptType, $crashBehavior, $file) - { - $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}"; - $guzzleParams = [ - 'query' => ['crashBehavior' => $crashBehavior], - 'body' => null - ]; - return $this->restCall($path, 'POST', $guzzleParams); - } - - /** - * Create a lookup table for an advanced rule - * - * 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 The ID of the account that owns the Advanced Rule. - * @param string $csvTableName The name to assign the CSV lookup table. - * @param object $file A CSV file containing lookup data for an advanced rule. - * @return string - */ - public function createAdvancedRuleTable($accountId, $csvTableName, $file) - { - $path = "/api/v2/accounts/{$accountId}/advancedruletables/{$csvTableName}"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'POST', $guzzleParams); - } - - /** - * Delete an account's active advanced rule - * - * 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 The ID of the account that owns the Advanced Rule. - * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) - * @return ErrorDetail[] - */ - public function deleteAdvancedRuleScript($accountId, $scriptType) - { - $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'DELETE', $guzzleParams); - } - - /** - * Delete a lookup table for an advanced rule. - * - * 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 The ID of the account that owns the Advanced Rule. - * @param string $csvTableName The name of the CSV lookup table to delete. - * @return ErrorDetail[] - */ - public function deleteAdvancedRuleTable($accountId, $csvTableName) - { - $path = "/api/v2/accounts/{$accountId}/advancedruletables/{$csvTableName}"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'DELETE', $guzzleParams); - } - - /** - * Get an account's advanced rule script. - * - * 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 The ID of the account that owns the Advanced Rule. - * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) - * @return AdvancedRuleScriptModel - */ - public function getAdvancedRuleScript($accountId, $scriptType) - { - $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'GET', $guzzleParams); - } - - /** - * Get an advanced rule lookup table for an account - * - * 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 The ID of the account that owns the Advanced Rule. - * @param string $csvTableName The name of the CSV lookup table to get. - * @return AdvancedRuleTableModel - */ - public function getAdvancedRuleTable($accountId, $csvTableName) - { - $path = "/api/v2/accounts/{$accountId}/advancedruletables/{$csvTableName}"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'GET', $guzzleParams); - } - - /** - * Get all advanced rule lookup tables for an account - * - * 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 The ID of the account that owns the Advanced Rule. - * @return AdvancedRuleTableModel - */ - public function getAdvancedRuleTables($accountId) - { - $path = "/api/v2/accounts/{$accountId}/advancedruletables"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'GET', $guzzleParams); - } - - /** - * Unapprove an advanced rule script 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 The ID of the account that owns the Advanced Rule. - * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) - * @return AdvancedRuleScriptModel - */ - public function unapproveAdvancedRuleScript($accountId, $scriptType) - { - $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}/unapprove"; - $guzzleParams = [ - 'query' => [], - 'body' => null - ]; - return $this->restCall($path, 'POST', $guzzleParams); - } - /** * Create a new AvaFileForm * @@ -562,7 +362,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. @@ -1713,9 +1522,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. @@ -3121,17 +2935,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); @@ -3439,17 +3251,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); @@ -3978,17 +3788,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); @@ -4072,17 +3883,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); @@ -4828,18 +4640,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. - * - * 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. + * Call this API to obtain a free AvaTax account. * - * 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. @@ -6119,6 +5929,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. * @@ -6331,6 +6165,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. * @@ -6620,7 +6479,7 @@ public function changePassword($model) * * * @param AccountModel $model The account you wish to create. - * @return AccountModel + * @return AccountModel[] */ public function createAccount($model) { @@ -7493,6 +7352,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. * * diff --git a/src/Models.php b/src/Models.php index 76c7d8e..e7ffce0 100644 --- a/src/Models.php +++ b/src/Models.php @@ -944,6 +944,11 @@ class AdvancedRuleScriptModel */ public $isApproved; + /** + * @var boolean The rule has been disabled + */ + public $isDisabled; + } /** @@ -1026,7 +1031,7 @@ class AvaFileFormModel public $formTypeId; /** - * @var string (See FilingOptionTypeId::* for a list of allowable values) + * @var string The type of Filing option (See FilingOptionTypeId::* for a list of allowable values) */ public $filingOptionTypeId; @@ -1041,7 +1046,7 @@ class AvaFileFormModel public $dueDay; /** - * @var string (See DueDateTypeId::* for a list of allowable values) + * @var string The type of E-file due date. (See DueDateTypeId::* for a list of allowable values) */ public $efileDueDateTypeId; @@ -1603,7 +1608,7 @@ class CertificateModel public $isSingleCertificate; /** - * @var ExemptionReasonModel The exemption reason associated with this certificate. + * @var ExemptionReasonModel The exemption reason associated with this certificate. For example, the reason code for exemption for purposes of resale is `RESALE`. For a list of exemption reasons, call `ListCertificateExemptReasons`. */ public $exemptionReason; @@ -1971,42 +1976,42 @@ class CompanyModel public $modifiedUserId; /** - * @var ContactModel[] Optional: A list of contacts defined for this company. To fetch this list, add the query string "?$include=Contacts" to your URL. + * @var ContactModel[] Optional: A list of contacts defined for this company. To fetch this list, add the query string `?$include=Contacts` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $contacts; /** - * @var ItemModel[] Optional: A list of items defined for this company. To fetch this list, add the query string "?$include=Items" to your URL. + * @var ItemModel[] Optional: A list of items defined for this company. To fetch this list, add the query string `?$include=Items` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $items; /** - * @var LocationModel[] Optional: A list of locations defined for this company. To fetch this list, add the query string "?$include=Locations" to your URL. + * @var LocationModel[] Optional: A list of locations defined for this company. To fetch this list, add the query string `?$include=Locations` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $locations; /** - * @var NexusModel[] Optional: A list of nexus defined for this company. To fetch this list, add the query string "?$include=Nexus" to your URL. + * @var NexusModel[] Optional: A list of nexus defined for this company. To fetch this list, add the query string `?$include=Nexus` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $nexus; /** - * @var SettingModel[] Optional: A list of settings defined for this company. To fetch this list, add the query string "?$include=Settings" to your URL. + * @var SettingModel[] Optional: A list of settings defined for this company. To fetch this list, add the query string `?$include=Settings` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $settings; /** - * @var TaxCodeModel[] Optional: A list of tax codes defined for this company. To fetch this list, add the query string "?$include=TaxCodes" to your URL. + * @var TaxCodeModel[] Optional: A list of tax codes defined for this company. To fetch this list, add the query string `?$include=TaxCodes` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $taxCodes; /** - * @var TaxRuleModel[] Optional: A list of tax rules defined for this company. To fetch this list, add the query string "?$include=TaxRules" to your URL. + * @var TaxRuleModel[] Optional: A list of tax rules defined for this company. To fetch this list, add the query string `?$include=TaxRules` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $taxRules; /** - * @var UPCModel[] Optional: A list of UPCs defined for this company. To fetch this list, add the query string "?$include=UPCs" to your URL. + * @var UPCModel[] Optional: A list of UPCs defined for this company. To fetch this list, add the query string `?$include=UPCs` to your URL. When calling `CreateCompany`, you may provide a list of objects in this element and they will be created alongside the company. The `UpdateCompany` API does not permit updating nested objects. */ public $upcs; @@ -4297,7 +4302,7 @@ class SkyscraperStatusModel public $country; /** - * @var string They Scraper type (See ScraperType::* for a list of allowable values) + * @var string The Scraper type (See ScraperType::* for a list of allowable values) */ public $scraperType; @@ -5120,6 +5125,26 @@ class TaxTypeGroupModel */ public $description; + /** + * @var int If this tax type group requires a subscription, this contains the ID number of the subscription type required to use it. + */ + public $subscriptionTypeId; + + /** + * @var string If this tax type group requires a subscription, this contains the friendly name of the subscription type required to use it. + */ + public $subscriptionDescription; + + /** + * @var string The name of the tab in the AvaTax website corresponding to this tax type group. + */ + public $tabName; + + /** + * @var boolean True if this tax type group is displayed in the user interface of the AvaTax website. + */ + public $showColumn; + } /** @@ -5171,6 +5196,26 @@ class NexusTaxTypeGroupModel */ public $description; + /** + * @var int If this tax type group requires a subscription, this contains the ID number of the subscription type required to use it. + */ + public $subscriptionTypeId; + + /** + * @var string If this tax type group requires a subscription, this contains the friendly name of the subscription type required to use it. + */ + public $subscriptionDescription; + + /** + * @var string The name of the tab in the AvaTax website corresponding to this tax type group. + */ + public $tabName; + + /** + * @var boolean True if this tax type group is displayed in the user interface of the AvaTax website. + */ + public $showColumn; + } /** @@ -5626,6 +5671,11 @@ class FilingCalendarModel */ public $prepayPercentage; + /** + * @var float If your company is required to make a prepayment that is designated by a fixed amount each period, please specify the amount here. + */ + public $fixedPrepaymentAmount; + /** * @var string The type of tax to report on this return. (See MatchingTaxType::* for a list of allowable values) */ @@ -6166,6 +6216,11 @@ class LoginVerificationInputModel */ public $region; + /** + * @var string TaxFormCode for the verification request + */ + public $taxFormCode; + /** * @var string Username that we are using for verification */ @@ -6359,6 +6414,11 @@ class FilingReturnModelBasic */ public $accrualType; + /** + * @var FilingAttachmentModel[] The attachments for this return. + */ + public $attachments; + /** * @var string The date when this record was created. */ @@ -6376,6 +6436,24 @@ class FilingReturnModelBasic } +/** + * An attachment associated with a filing return + */ +class FilingAttachmentModel +{ + + /** + * @var int The resourceFileId used to retrieve the attachment + */ + public $resourceFileId; + + /** + * @var string The description of the attachment + */ + public $description; + +} + /** * Represents a listing of all tax calculation data for filings and for accruing to future filings. */ @@ -6758,6 +6836,11 @@ class FilingReturnModel */ public $nonTaxableAccrualAmount; + /** + * @var float The total amount of taxable sales accrued in the current active period + */ + public $taxableAccrualAmount; + /** * @var float The total amount of sales tax accrued in the current active period */ @@ -7047,24 +7130,6 @@ class FilingPaymentModel } -/** - * An attachment associated with a filing return - */ -class FilingAttachmentModel -{ - - /** - * @var int The resourceFileId used to retrieve the attachment - */ - public $resourceFileId; - - /** - * @var string The description of the attachment - */ - public $description; - -} - /** * Rebuild a set of filings. */ @@ -7522,6 +7587,11 @@ class TransactionModel */ public $messages; + /** + * @var InvoiceMessageModel[] Invoice messages associated with this document. Currently, this stores legally-required VAT messages. + */ + public $invoiceMessages; + } /** @@ -7956,6 +8026,24 @@ class TransactionSummary } +/** + * Represents a message to be displayed on an invoice. + */ +class InvoiceMessageModel +{ + + /** + * @var string The content of the invoice message. + */ + public $content; + + /** + * @var string[] The applicable tax line numbers and codes. + */ + public $lineNumbers; + +} + /** * An individual tax detail element. Represents the amount of tax calculated for a particular jurisdiction, for a particular line in an invoice. */ From 202a4d22005f8e924b9cae417fbac26a04839e5b Mon Sep 17 00:00:00 2001 From: han8909227 Date: Tue, 29 May 2018 16:48:14 -0700 Subject: [PATCH 2/2] Update to 18.5 --- src/Constants.php | 44 ++++----- src/Methods.php | 244 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 266 insertions(+), 22 deletions(-) diff --git a/src/Constants.php b/src/Constants.php index d86b1b2..2612291 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -26,6 +26,28 @@ class TransactionAddressType } +/** + * + */ +class AdvancedRuleScriptType +{ + const C_REQUESTRULE = "RequestRule"; + const C_RESPONSERULE = "ResponseRule"; + +} + + +/** + * + */ +class AdvancedRuleCrashBehavior +{ + const C_FAILONERROR = "FailOnError"; + const C_PROCEEDWITHORIGINAL = "ProceedWithOriginal"; + +} + + /** * Casing to use for validation result */ @@ -1104,28 +1126,6 @@ class JurisdictionType } -/** - * - */ -class AdvancedRuleCrashBehavior -{ - const C_FAILONERROR = "FailOnError"; - const C_PROCEEDWITHORIGINAL = "ProceedWithOriginal"; - -} - - -/** - * - */ -class AdvancedRuleScriptType -{ - const C_REQUESTRULE = "RequestRule"; - const C_RESPONSERULE = "ResponseRule"; - -} - - /** * A list of possible AvaFile Form Types. */ diff --git a/src/Methods.php b/src/Methods.php index ef15b74..268d7e2 100644 --- a/src/Methods.php +++ b/src/Methods.php @@ -223,6 +223,250 @@ public function resolveAddressPost($model) return $this->restCall($path, 'POST', $guzzleParams); } + /** + * Approve an advanced rule script to 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 The ID of the account that owns the Advanced Rule. + * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) + * @return AdvancedRuleScriptModel + */ + public function approveAdvancedRuleScript($accountId, $scriptType) + { + $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}/approve"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + return $this->restCall($path, 'POST', $guzzleParams); + } + + /** + * Create an advanced rule. + * + * 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 The ID of the account that will own the Advanced Rule. + * @param string $scriptType The script transform type, Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) + * @param string $crashBehavior The behavior the script should take if it crashes: Fail or Proceed. (See AdvancedRuleCrashBehavior::* for a list of allowable values) + * @param object $file The JavaScript file containing the advanced rule. + * @return string + */ + public function createAdvancedRuleScript($accountId, $scriptType, $crashBehavior, $file) + { + $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}"; + $guzzleParams = [ + 'query' => ['crashBehavior' => $crashBehavior], + 'body' => null + ]; + return $this->restCall($path, 'POST', $guzzleParams); + } + + /** + * Create a lookup table for an advanced rule + * + * 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 The ID of the account that owns the Advanced Rule. + * @param string $csvTableName The name to assign the CSV lookup table. + * @param object $file A CSV file containing lookup data for an advanced rule. + * @return string + */ + public function createAdvancedRuleTable($accountId, $csvTableName, $file) + { + $path = "/api/v2/accounts/{$accountId}/advancedruletables/{$csvTableName}"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + return $this->restCall($path, 'POST', $guzzleParams); + } + + /** + * Delete an account's active advanced rule + * + * 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 The ID of the account that owns the Advanced Rule. + * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) + * @return ErrorDetail[] + */ + public function deleteAdvancedRuleScript($accountId, $scriptType) + { + $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + return $this->restCall($path, 'DELETE', $guzzleParams); + } + + /** + * Delete a lookup table for an advanced rule. + * + * 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 The ID of the account that owns the Advanced Rule. + * @param string $csvTableName The name of the CSV lookup table to delete. + * @return ErrorDetail[] + */ + public function deleteAdvancedRuleTable($accountId, $csvTableName) + { + $path = "/api/v2/accounts/{$accountId}/advancedruletables/{$csvTableName}"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + 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. + * + * 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 The ID of the account that owns the Advanced Rule. + * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) + * @return AdvancedRuleScriptModel + */ + public function getAdvancedRuleScript($accountId, $scriptType) + { + $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + return $this->restCall($path, 'GET', $guzzleParams); + } + + /** + * Get an advanced rule lookup table for an account + * + * 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 The ID of the account that owns the Advanced Rule. + * @param string $csvTableName The name of the CSV lookup table to get. + * @return AdvancedRuleTableModel + */ + public function getAdvancedRuleTable($accountId, $csvTableName) + { + $path = "/api/v2/accounts/{$accountId}/advancedruletables/{$csvTableName}"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + return $this->restCall($path, 'GET', $guzzleParams); + } + + /** + * Get all advanced rule lookup tables for an account + * + * 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 The ID of the account that owns the Advanced Rule. + * @return AdvancedRuleTableModel + */ + public function getAdvancedRuleTables($accountId) + { + $path = "/api/v2/accounts/{$accountId}/advancedruletables"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + return $this->restCall($path, 'GET', $guzzleParams); + } + + /** + * Unapprove an advanced rule script 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 The ID of the account that owns the Advanced Rule. + * @param string $scriptType The script transform type: Request or Response. (See AdvancedRuleScriptType::* for a list of allowable values) + * @return AdvancedRuleScriptModel + */ + public function unapproveAdvancedRuleScript($accountId, $scriptType) + { + $path = "/api/v2/accounts/{$accountId}/advancedrulescripts/{$scriptType}/unapprove"; + $guzzleParams = [ + 'query' => [], + 'body' => null + ]; + return $this->restCall($path, 'POST', $guzzleParams); + } + /** * Create a new AvaFileForm *