Skip to content

Commit 51608e2

Browse files
hsmuszptondereau
andauthored
added TaxInformationIndicator support (#307)
Co-authored-by: Pierre Tondereau <[email protected]>
1 parent 2026a0d commit 51608e2

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

src/Entity/Shipment.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Shipment
7878
* @var ReferenceNumber
7979
*/
8080
private $referenceNumber;
81-
81+
8282
/**
8383
* @var ReferenceNumber
8484
*/
@@ -103,7 +103,7 @@ class Shipment
103103
* @var InvoiceLineTotal
104104
*/
105105
private $invoiceLineTotal;
106-
106+
107107
/**
108108
* @var ShipmentTotalWeight
109109
*/
@@ -118,6 +118,10 @@ class Shipment
118118
* @var DeliveryTimeInformation
119119
*/
120120
private $deliveryTimeInformation;
121+
/**
122+
* @var bool
123+
*/
124+
private $taxInformationIndicator;
121125

122126
public function __construct()
123127
{
@@ -126,6 +130,7 @@ public function __construct()
126130
$this->setShipmentServiceOptions(new ShipmentServiceOptions());
127131
$this->setService(new Service());
128132
$this->rateInformation = null;
133+
$this->taxInformationIndicator = false;
129134
}
130135

131136
/**
@@ -205,7 +210,7 @@ public function setReferenceNumber(ReferenceNumber $referenceNumber)
205210

206211
return $this;
207212
}
208-
213+
209214
/**
210215
* @param ReferenceNumber $referenceNumber
211216
*
@@ -225,7 +230,7 @@ public function getReferenceNumber()
225230
{
226231
return $this->referenceNumber;
227232
}
228-
233+
229234
/**
230235
* @return ReferenceNumber
231236
*/
@@ -574,7 +579,7 @@ public function setDeliveryTimeInformation(DeliveryTimeInformation $deliveryTime
574579
{
575580
$this->deliveryTimeInformation = $deliveryTimeInformation;
576581
}
577-
582+
578583
/**
579584
* @return ShipmentTotalWeight
580585
*/
@@ -590,4 +595,19 @@ public function setShipmentTotalWeight(ShipmentTotalWeight $shipmentTotalWeight)
590595
{
591596
$this->shipmentTotalWeight = $shipmentTotalWeight;
592597
}
598+
599+
public function getTaxInformationIndicator(): bool
600+
{
601+
return $this->taxInformationIndicator;
602+
}
603+
604+
/**
605+
* If called, returned prices will include Tax Information
606+
*/
607+
public function setTaxInformationIndicator(bool $taxInformationIndicator): self
608+
{
609+
$this->taxInformationIndicator = $taxInformationIndicator;
610+
611+
return $this;
612+
}
593613
}

src/Rate.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,21 @@ private function createRequest(RateRequest $rateRequest)
190190
if (isset($deliveryTimeInformation)) {
191191
$shipmentNode->appendChild($deliveryTimeInformation->toNode($xml));
192192
}
193-
193+
194194
$ShipmentTotalWeight = $shipment->getShipmentTotalWeight();
195195
if (isset($ShipmentTotalWeight)) {
196196
$shipmentNode->appendChild($ShipmentTotalWeight->toNode($xml));
197197
}
198-
198+
199199
$InvoiceLineTotal = $shipment->getInvoiceLineTotal();
200200
if (isset($InvoiceLineTotal)) {
201201
$shipmentNode->appendChild($InvoiceLineTotal->toNode($xml));
202202
}
203203

204+
if ($shipment->getTaxInformationIndicator()) {
205+
$shipmentNode->appendChild($xml->createElement('TaxInformationIndicator'));
206+
}
207+
204208
return $xml->saveXML();
205209
}
206210

0 commit comments

Comments
 (0)