Skip to content

Commit

Permalink
Merge pull request #6 from rclarkburns/legacy
Browse files Browse the repository at this point in the history
Adds JsonSerializable interface workaround

Thanks for making these changes! I'm going to close out your issue #5 with this merge.
  • Loading branch information
Anya Stettler committed Jul 15, 2014
2 parents 24e5991 + 6f08cd3 commit 1dfd191
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 17 deletions.
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/BaseResult.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class BaseResult implements JsonSerializable
{

public function jsonSerialize(){
return [
return array(
'TransactionId' => $this->getTransactionId(),
'ResultCode' => $this->getResultCode(),
'Messages' => $this->getMessages()
];
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/CancelTaxResult.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public function parseResult($jsonString)
}

public function jsonSerialize(){
return [
return array(
'DocId' => $this->getDocId(),
'TransactionId' => $this->getTransactionId(),
'ResultCode' => $this->getResultCode(),
'Messages' => $this->getMessages()
];
);
}

public function getDocId() { return $this->DocId; }
Expand Down
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/EstimateTaxResult.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public static function parseResult($jsonString)
}

public function jsonSerialize(){
return[
return array(
'Rate' => $this->getRate(),
'Tax' => $this->getTax(),
'TaxDetails' => $this->getTaxDetails(),
'ResultCode' => $this->getResultCode(),
'Messages' => $this->getMessages()
];
);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/GetTaxResult.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static function parseResult($jsonString)
}

public function jsonSerialize(){
return[
return array(
'DocCode' => $this->getDocCode(),
'DocDate' => $this->getDocDate(),
'Timestamp' => $this->getTimestamp(),
Expand All @@ -115,7 +115,7 @@ public function jsonSerialize(){
'TaxAddresses' => $this->getTaxAddresses(),
'ResultCode'=> $this->getResultCode(),
'Messages' => $this->getMessages()
];
);
}

public function getDocCode() { return $this->DocCode; }
Expand Down
13 changes: 13 additions & 0 deletions AvaTaxClasses/classes/JsonSerializable.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* Created by PhpStorm.
* User: clark
* Date: 7/14/14
* Time: 12:44 PM
*/

interface JsonSerializable {

public function jsonSerialize();

}
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/Message.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public function parseMessages($jsonString)

}
public function jsonSerialize(){
return[
return array(
'Summary' => $this->getSummary(),
'Details' => $this->getDetails(),
'RefersTo' => $this->getRefersTo(),
'Severity' => $this->getSeverity(),
'Source' => $this->getSource(),
];
);
}

public function getSummary() { return $this->Summary; }
Expand Down
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/TaxDetail.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function parseTaxDetails($jsonString)
return $detailArray;
}
public function jsonSerialize(){
return[
return array(
'JurisType' => $this->getJurisType(),
'Taxable' => $this->getTaxable(),
'Rate' => $this->getRate(),
Expand All @@ -88,7 +88,7 @@ public function jsonSerialize(){
'TaxName' => $this->getTaxName(),
'Country' => $this->getCountry(),
'Region' => $this->getRegion()
];
);
}

public function getJurisType(){ return $this->JurisType; }
Expand Down
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/TaxLine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public static function parseTaxLines($jsonString)
return $lineArray;
}
public function jsonSerialize(){
return[
return array(
'TaxDetails' => $this->getTaxDetails(),
'LineNo' => $this->getLineNo(),
'TaxCode' => $this->getTaxCode(),
Expand All @@ -94,7 +94,7 @@ public function jsonSerialize(){
'Rate' => $this->getRate(),
'Tax' => $this->getTax(),
'TaxCalculated' => $this->getTaxCalculated()
];
);
}

public function getTaxDetails() { return $this->TaxDetails; }
Expand Down
4 changes: 2 additions & 2 deletions AvaTaxClasses/classes/ValidateResult.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public static function parseResult($jsonString)
return new self( $resultcode , $validaddress , $messages );
}
public function jsonSerialize(){
return[
return array(
'ValidAddress' => $this->getValidAddress(),
'ResultCode' => $this->getResultCode(),
'Messages' => $this->getMessages()
];
);
}

public function getValidAddress() { return $this->ValidAddress; }
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Contents:

Dependencies:
-----------
- PHP 5.0 or later
- PHP 5.3 or later
- Not tested on versions older than PHP 5.3

Requirements:
----------
Expand Down

0 comments on commit 1dfd191

Please sign in to comment.