Skip to content

Commit

Permalink
support more php versions
Browse files Browse the repository at this point in the history
adds travis testing for php versions 7.2, 7.3, 7.4 and 8.0
update invalid function definitions which has required params after
 optional ones (php8.0 refuses to build with these errors)
add guzzle 7 support
closes avadev#119
closes avadev#129
  • Loading branch information
Ben Roberts authored and rlerdorf committed Aug 23, 2021
1 parent e0dd71d commit 5cbc02d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 23 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
language: php
php:
- '5.6'
- '7.2'
- '7.3'
- '7.4'
- '8.0'

before_script: composer install

script: phpunit --configuration tests/phpunit.xml
script: phpunit --configuration tests/phpunit.xml
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"guzzlehttp/guzzle": "~6|~7"
},
"require-dev": {
"phpunit/phpunit": "5.7"
"phpunit/phpunit": ">=5.7"
},
"support": {
"docs": "https://developer.avalara.com",
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class AvaTaxClientBase
*
* @throws \Exception
*/
public function __construct($appName, $appVersion, $machineName="", $environment, $guzzleParams = [])
public function __construct($appName, $appVersion, $machineName="", $environment=null, $guzzleParams = [])
{
// app name and app version are mandatory fields.
if ($appName == "" || $appName == null || $appVersion == "" || $appVersion == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/ClientExtensionExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ClientExtensionExample extends AvaTaxClient
* @param string $environment Indicates which server to use; acceptable values are "sandbox" or "production", or the full URL of your AvaTax instance.
* @param array $guzzleParams Extra parameters to pass to the guzzle HTTP client (http://docs.guzzlephp.org/en/latest/request-options.html)
*/
public function __construct($appName, $appVersion, $machineName="", $environment, $guzzleParams = [], $clientConfig = null)
public function __construct($appName, $appVersion, $machineName="", $environment=null, $guzzleParams = [], $clientConfig = null)
{
parent::__construct($appName, $appVersion, $machineName, $environment, $guzzleParams);
$this->clientConfig = $clientConfig;
Expand Down
36 changes: 18 additions & 18 deletions src/Methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -4226,7 +4226,7 @@ public function listPreferredPrograms($filter=null, $top=null, $skip=null, $orde
* @param string $countryCode If not null, return all records with this code.
* @return FetchResult
*/
public function listProductClassificationSystems($filter=null, $top=null, $skip=null, $orderBy=null, $countryCode) {
public function listProductClassificationSystems($filter=null, $top=null, $skip=null, $orderBy=null, $countryCode=null) {
$path = "/api/v2/definitions/productclassificationsystems";
$guzzleParams = [
'query' => ['$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy, '$countryCode' => $countryCode],
Expand Down Expand Up @@ -4260,7 +4260,7 @@ public function listProductClassificationSystems($filter=null, $top=null, $skip=
* @param string $countryCode If not null, return all records with this code.
* @return FetchResult
*/
public function listProductClassificationSystemsByCompany($companyCode, $filter=null, $top=null, $skip=null, $orderBy=null, $countryCode) {
public function listProductClassificationSystemsByCompany($companyCode, $filter=null, $top=null, $skip=null, $orderBy=null, $countryCode=null) {
$path = "/api/v2/definitions/productclassificationsystems/bycompany/{$companyCode}";
$guzzleParams = [
'query' => ['$filter' => $filter, '$top' => $top, '$skip' => $skip, '$orderBy' => $orderBy, '$countryCode' => $countryCode],
Expand Down Expand Up @@ -6644,7 +6644,7 @@ public function validateLocation($companyId, $id) {
* @param AdjustMultiDocumentModel $model The adjust request you wish to execute
* @return MultiDocumentModel
*/
public function adjustMultiDocumentTransaction($code, $type, $include=null, $model) {
public function adjustMultiDocumentTransaction($code, $type, $include=null, $model=null) {
$path = "/api/v2/transactions/multidocument/{$code}/type/{$type}/adjust";
$guzzleParams = [
'query' => ['include' => $include],
Expand Down Expand Up @@ -6790,7 +6790,7 @@ public function commitMultiDocumentTransaction($model) {
* @param CreateMultiDocumentModel $model the multi document transaction model
* @return MultiDocumentModel
*/
public function createMultiDocumentTransaction($include=null, $model) {
public function createMultiDocumentTransaction($include=null, $model=null) {
$path = "/api/v2/transactions/multidocument";
$guzzleParams = [
'query' => ['$include' => $include],
Expand Down Expand Up @@ -7008,7 +7008,7 @@ public function listMultiDocumentTransactions($filter=null, $include=null, $top=
* @param RefundTransactionModel $model Information about the refund to create
* @return MultiDocumentModel
*/
public function refundMultiDocumentTransaction($code, $type, $include=null, $model) {
public function refundMultiDocumentTransaction($code, $type, $include=null, $model=null) {
$path = "/api/v2/transactions/multidocument/{$code}/type/{$type}/refund";
$guzzleParams = [
'query' => ['$include' => $include],
Expand Down Expand Up @@ -9246,7 +9246,7 @@ public function updateTaxRule($companyId, $id, $model) {
* @param AddTransactionLineModel $model information about the transaction and lines to be added
* @return TransactionModel
*/
public function addLines($include=null, $model) {
public function addLines($include=null, $model=null) {
$path = "/api/v2/companies/transactions/lines/add";
$guzzleParams = [
'query' => ['$include' => $include],
Expand Down Expand Up @@ -9301,7 +9301,7 @@ public function addLines($include=null, $model) {
* @param AdjustTransactionModel $model The adjustment you wish to make
* @return TransactionModel
*/
public function adjustTransaction($companyCode, $transactionCode, $documentType, $include=null, $model) {
public function adjustTransaction($companyCode, $transactionCode, $documentType, $include=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/adjust";
$guzzleParams = [
'query' => ['documentType' => $documentType, '$include' => $include],
Expand Down Expand Up @@ -9478,7 +9478,7 @@ public function bulkLockTransaction($model) {
* @param ChangeTransactionCodeModel $model The code change request you wish to execute
* @return TransactionModel
*/
public function changeTransactionCode($companyCode, $transactionCode, $documentType, $include=null, $model) {
public function changeTransactionCode($companyCode, $transactionCode, $documentType, $include=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/changecode";
$guzzleParams = [
'query' => ['documentType' => $documentType, '$include' => $include],
Expand Down Expand Up @@ -9531,7 +9531,7 @@ public function changeTransactionCode($companyCode, $transactionCode, $documentT
* @param CommitTransactionModel $model The commit request you wish to execute
* @return TransactionModel
*/
public function commitTransaction($companyCode, $transactionCode, $documentType, $include=null, $model) {
public function commitTransaction($companyCode, $transactionCode, $documentType, $include=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/commit";
$guzzleParams = [
'query' => ['documentType' => $documentType, '$include' => $include],
Expand Down Expand Up @@ -9587,7 +9587,7 @@ public function commitTransaction($companyCode, $transactionCode, $documentType,
* @param CreateOrAdjustTransactionModel $model The transaction you wish to create or adjust
* @return TransactionModel
*/
public function createOrAdjustTransaction($include=null, $model) {
public function createOrAdjustTransaction($include=null, $model=null) {
$path = "/api/v2/transactions/createoradjust";
$guzzleParams = [
'query' => ['$include' => $include],
Expand Down Expand Up @@ -9650,7 +9650,7 @@ public function createOrAdjustTransaction($include=null, $model) {
* @param CreateTransactionModel $model The transaction you wish to create
* @return TransactionModel
*/
public function createTransaction($include=null, $model) {
public function createTransaction($include=null, $model=null) {
$path = "/api/v2/transactions/create";
$guzzleParams = [
'query' => ['$include' => $include],
Expand Down Expand Up @@ -9690,7 +9690,7 @@ public function createTransaction($include=null, $model) {
* @param RemoveTransactionLineModel $model information about the transaction and lines to be removed
* @return TransactionModel
*/
public function deleteLines($include=null, $model) {
public function deleteLines($include=null, $model=null) {
$path = "/api/v2/companies/transactions/lines/delete";
$guzzleParams = [
'query' => ['$include' => $include],
Expand Down Expand Up @@ -9927,7 +9927,7 @@ public function listTransactionsByCompany($companyCode, $dataSourceId, $include=
* @param LockTransactionModel $model The lock request you wish to execute
* @return TransactionModel
*/
public function lockTransaction($companyCode, $transactionCode, $documentType, $include=null, $model) {
public function lockTransaction($companyCode, $transactionCode, $documentType, $include=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/lock";
$guzzleParams = [
'query' => ['documentType' => $documentType, '$include' => $include],
Expand Down Expand Up @@ -9993,7 +9993,7 @@ public function lockTransaction($companyCode, $transactionCode, $documentType, $
* @param RefundTransactionModel $model Information about the refund to create
* @return TransactionModel
*/
public function refundTransaction($companyCode, $transactionCode, $include=null, $documentType, $useTaxDateOverride, $model) {
public function refundTransaction($companyCode, $transactionCode, $include=null, $documentType=null, $useTaxDateOverride=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/refund";
$guzzleParams = [
'query' => ['$include' => $include, 'documentType' => $documentType, 'useTaxDateOverride' => $useTaxDateOverride],
Expand Down Expand Up @@ -10046,7 +10046,7 @@ public function refundTransaction($companyCode, $transactionCode, $include=null,
* @param SettleTransactionModel $model The data from an external system to reconcile against AvaTax
* @return TransactionModel
*/
public function settleTransaction($companyCode, $transactionCode, $documentType, $include=null, $model) {
public function settleTransaction($companyCode, $transactionCode, $documentType, $include=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/settle";
$guzzleParams = [
'query' => ['documentType' => $documentType, '$include' => $include],
Expand Down Expand Up @@ -10189,7 +10189,7 @@ public function unvoidTransaction($companyCode, $transactionCode, $documentType,
* @param VerifyTransactionModel $model The data from an external system to reconcile against AvaTax
* @return TransactionModel
*/
public function verifyTransaction($companyCode, $transactionCode, $documentType, $include=null, $model) {
public function verifyTransaction($companyCode, $transactionCode, $documentType, $include=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/verify";
$guzzleParams = [
'query' => ['documentType' => $documentType, '$include' => $include],
Expand Down Expand Up @@ -10243,7 +10243,7 @@ public function verifyTransaction($companyCode, $transactionCode, $documentType,
* @param VoidTransactionModel $model The void request you wish to execute. To void a transaction the code must be set to 'DocVoided'
* @return TransactionModel
*/
public function voidTransaction($companyCode, $transactionCode, $documentType, $include=null, $model) {
public function voidTransaction($companyCode, $transactionCode, $documentType, $include=null, $model=null) {
$path = "/api/v2/companies/{$companyCode}/transactions/{$transactionCode}/void";
$guzzleParams = [
'query' => ['documentType' => $documentType, '$include' => $include],
Expand Down Expand Up @@ -10760,4 +10760,4 @@ public function ping() {
}

}
?>
?>
3 changes: 2 additions & 1 deletion tests/basicWorkflowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
final class AvaTaxClientTest extends TestCase
{
/**
* @expectedException \Exception
*/
public function testConstructorThrowsExceptionForMissingRequirements()
{
$this->expectException(Exception::class);

new Avalara\AvaTaxClient('', '', '', '');
}

Expand Down

0 comments on commit 5cbc02d

Please sign in to comment.