Skip to content

Commit

Permalink
Merge pull request #88 from contygm/master
Browse files Browse the repository at this point in the history
DEVCON-3371 - API 18.12: Generate PHP SDK
  • Loading branch information
qjavalara authored Jan 16, 2019
2 parents 731d902 + 713789b commit 8bd07b9
Show file tree
Hide file tree
Showing 6 changed files with 789 additions and 41 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ To use the AvaTax PHP SDK from Composer:

The PHP SDK uses a fluent interface to define a connection to AvaTax and to make API calls to calculate tax on transactions. Here's an example of connecting to the API.

```
```php
<?php

// Include the AvaTaxClient library
Expand Down Expand Up @@ -80,4 +80,5 @@ $t = $tb->withAddress('ShipFrom', '123 Main Street', null, null, 'Irvine', 'CA',
echo('<h2>Transaction #2</h2>');
echo('<pre>' . json_encode($t, JSON_PRETTY_PRINT) . '</pre>');

?>
```
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
{
"name": "Bob Maidens",
"email": "[email protected]"
},
{
"name": "Genevieve Conty",
"email": "[email protected]"
}
],
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ protected function restCall($apiUrl, $verb, $guzzleParams)
}
$guzzleParams['headers'] = [
'Accept' => 'application/json',
'X-Avalara-Client' => "{$this->appName}; {$this->appVersion}; PhpRestClient; 18.10.5-260; {$this->machineName}"
'X-Avalara-Client' => "{$this->appName}; {$this->appVersion}; PhpRestClient; 18.12.0; {$this->machineName}"
];
} else {
$guzzleParams['headers'] = [
'Accept' => 'application/json',
'Authorization' => 'Bearer '.$this->auth[0],
'X-Avalara-Client' => "{$this->appName}; {$this->appVersion}; PhpRestClient; 18.10.5-260; {$this->machineName}"
'X-Avalara-Client' => "{$this->appName}; {$this->appVersion}; PhpRestClient; 18.12.0; {$this->machineName}"
];
}

Expand Down
62 changes: 62 additions & 0 deletions src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,7 @@ class ErrorCodeId
const C_RANGECOMPAREERROR = "RangeCompareError";
const C_RANGESETERROR = "RangeSetError";
const C_TAXPAYERNUMBERREQUIRED = "TaxpayerNumberRequired";
const C_ENTITYLIMITEXCEEDED = "EntityLimitExceeded";
const C_COMMONPASSWORD = "CommonPassword";
const C_WEAKPASSWORD = "WeakPassword";
const C_STRINGLENGTHERROR = "StringLengthError";
Expand Down Expand Up @@ -726,6 +727,7 @@ class ErrorCodeId
const C_NOFILTERCRITERIAEXCEPTION = "NoFilterCriteriaException";
const C_OPENCLAUSEEXCEPTION = "OpenClauseException";
const C_JSONFORMATERROR = "JsonFormatError";
const C_INVALIDDECIMALVALUE = "InvalidDecimalValue";
const C_UNHANDLEDEXCEPTION = "UnhandledException";
const C_REPORTINGCOMPANYMUSTHAVECONTACTSERROR = "ReportingCompanyMustHaveContactsError";
const C_COMPANYPROFILENOTSET = "CompanyProfileNotSet";
Expand Down Expand Up @@ -1014,6 +1016,8 @@ class ErrorCodeId
const C_TAXRULEREQUIRESNEXUS = "TaxRuleRequiresNexus";
const C_UPCCODENOTUNIQUE = "UPCCodeNotUnique";
const C_CANNOTUPDATESOURCEORINSTANCE = "CannotUpdateSourceOrInstance";
const C_TAXCODEASSOCIATEDWITHITEMCODENOTFOUND = "TaxCodeAssociatedWithItemCodeNotFound";
const C_DUPLICATESYSTEMFORITEM = "DuplicateSystemForItem";

/**
* SendSales API errors
Expand All @@ -1034,6 +1038,15 @@ class ErrorCodeId
*/
const C_TRACEDATANOTAVAILABLE = "TraceDataNotAvailable";

/**
* Item parameter errors
*/
const C_INVALIDPARAMETERUNITMEASUREMENTTYPE = "InvalidParameterUnitMeasurementType";
const C_PARAMETERUNITREQUIRED = "ParameterUnitRequired";
const C_INVALIDPARAMETERVALUEDATATYPE = "InvalidParameterValueDataType";
const C_INVALIDPARAMETERATTRIBUTETYPE = "InvalidParameterAttributeType";
const C_SUBSCRIPTIONREQUIREDFORPARAMETER = "SubscriptionRequiredForParameter";

}


Expand Down Expand Up @@ -1633,6 +1646,11 @@ class AddressCategoryId
*/
const C_MARKETPLACEREMITSTAX = "MarketplaceRemitsTax";

/**
* Address refers to the mailing address of your company which is not a physical location.
*/
const C_NONPHYSICAL = "NonPhysical";

}


Expand Down Expand Up @@ -2570,6 +2588,50 @@ class PaymentType
}


/**
* What object experienced the error?
*/
class ErrorTargetCode
{

/**
* Error target is unknown
*/
const C_UNKNOWN = "Unknown";

/**
* There was an error in the request URL, querystring, or body
*/
const C_HTTPREQUEST = "HttpRequest";

/**
* There was an error in the HTTP Request headers
*/
const C_HTTPREQUESTHEADERS = "HttpRequestHeaders";

/**
* Some data provided by the user was incorrect
*/
const C_INCORRECTDATA = "IncorrectData";

/**
* There was an error in the AvaTax API Server
*/
const C_AVATAXAPISERVER = "AvaTaxApiServer";

/**
* There was an error in the Avalara Identity Server
*/
const C_AVALARAIDENTITYSERVER = "AvalaraIdentityServer";

/**
* The customer's account setup does not permit certain actions
*/
const C_CUSTOMERACCOUNTSETUP = "CustomerAccountSetup";

}


/**
* Refund types
*/
Expand Down
Loading

0 comments on commit 8bd07b9

Please sign in to comment.