From b17eb566aed5b8b1fc72e9707d1788dd1925631b Mon Sep 17 00:00:00 2001 From: pista7 <54415801+pista7@users.noreply.github.com> Date: Fri, 12 Nov 2021 14:24:44 +0100 Subject: [PATCH] Add Locale to Shipment (#330) Co-authored-by: Xavi Baz --- src/Entity/Shipment.php | 25 +++++++++++++++++++++++++ src/Shipping.php | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/src/Entity/Shipment.php b/src/Entity/Shipment.php index 8985482..3404ace 100644 --- a/src/Entity/Shipment.php +++ b/src/Entity/Shipment.php @@ -123,6 +123,11 @@ class Shipment */ private $taxInformationIndicator; + /** + * @var string + */ + private $locale; + public function __construct() { $this->setShipper(new Shipper()); @@ -610,4 +615,24 @@ public function setTaxInformationIndicator(bool $taxInformationIndicator): self return $this; } + + /** + * @return string + */ + public function getLocale() + { + return $this->locale; + } + + /** + * @param string $locale + * + * @return Shipment + */ + public function setLocale($locale) + { + $this->locale = $locale; + + return $this; + } } diff --git a/src/Shipping.php b/src/Shipping.php index e1ac9cf..0165e06 100644 --- a/src/Shipping.php +++ b/src/Shipping.php @@ -429,6 +429,10 @@ private function createConfirmRequest( if ($receiptSpec) { $container->appendChild($xml->importNode($this->compileReceiptSpecificationNode($receiptSpec), true)); } + + if ($shipment->getLocale()) { + $shipmentNode->appendChild($xml->createElement('Locale', $shipment->getLocale())); + } return $xml->saveXML(); }