Skip to content

Commit

Permalink
added TaxInformationIndicator support (#307)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Tondereau <[email protected]>
  • Loading branch information
hsmusz and ptondereau authored Dec 8, 2020
1 parent 2026a0d commit 51608e2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
30 changes: 25 additions & 5 deletions src/Entity/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Shipment
* @var ReferenceNumber
*/
private $referenceNumber;

/**
* @var ReferenceNumber
*/
Expand All @@ -103,7 +103,7 @@ class Shipment
* @var InvoiceLineTotal
*/
private $invoiceLineTotal;

/**
* @var ShipmentTotalWeight
*/
Expand All @@ -118,6 +118,10 @@ class Shipment
* @var DeliveryTimeInformation
*/
private $deliveryTimeInformation;
/**
* @var bool
*/
private $taxInformationIndicator;

public function __construct()
{
Expand All @@ -126,6 +130,7 @@ public function __construct()
$this->setShipmentServiceOptions(new ShipmentServiceOptions());
$this->setService(new Service());
$this->rateInformation = null;
$this->taxInformationIndicator = false;
}

/**
Expand Down Expand Up @@ -205,7 +210,7 @@ public function setReferenceNumber(ReferenceNumber $referenceNumber)

return $this;
}

/**
* @param ReferenceNumber $referenceNumber
*
Expand All @@ -225,7 +230,7 @@ public function getReferenceNumber()
{
return $this->referenceNumber;
}

/**
* @return ReferenceNumber
*/
Expand Down Expand Up @@ -574,7 +579,7 @@ public function setDeliveryTimeInformation(DeliveryTimeInformation $deliveryTime
{
$this->deliveryTimeInformation = $deliveryTimeInformation;
}

/**
* @return ShipmentTotalWeight
*/
Expand All @@ -590,4 +595,19 @@ public function setShipmentTotalWeight(ShipmentTotalWeight $shipmentTotalWeight)
{
$this->shipmentTotalWeight = $shipmentTotalWeight;
}

public function getTaxInformationIndicator(): bool
{
return $this->taxInformationIndicator;
}

/**
* If called, returned prices will include Tax Information
*/
public function setTaxInformationIndicator(bool $taxInformationIndicator): self
{
$this->taxInformationIndicator = $taxInformationIndicator;

return $this;
}
}
8 changes: 6 additions & 2 deletions src/Rate.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,21 @@ private function createRequest(RateRequest $rateRequest)
if (isset($deliveryTimeInformation)) {
$shipmentNode->appendChild($deliveryTimeInformation->toNode($xml));
}

$ShipmentTotalWeight = $shipment->getShipmentTotalWeight();
if (isset($ShipmentTotalWeight)) {
$shipmentNode->appendChild($ShipmentTotalWeight->toNode($xml));
}

$InvoiceLineTotal = $shipment->getInvoiceLineTotal();
if (isset($InvoiceLineTotal)) {
$shipmentNode->appendChild($InvoiceLineTotal->toNode($xml));
}

if ($shipment->getTaxInformationIndicator()) {
$shipmentNode->appendChild($xml->createElement('TaxInformationIndicator'));
}

return $xml->saveXML();
}

Expand Down

0 comments on commit 51608e2

Please sign in to comment.