diff --git a/src/Ups/Entity/Shipper.php b/src/Ups/Entity/Shipper.php index 0d93770d..b19ed28c 100644 --- a/src/Ups/Entity/Shipper.php +++ b/src/Ups/Entity/Shipper.php @@ -29,6 +29,11 @@ class Shipper implements NodeInterface */ protected $name; + /** + * @var string + */ + protected $companyName; + /** * @var string */ @@ -75,6 +80,9 @@ public function __construct($attributes = null) if (isset($attributes->Name)) { $this->setName($attributes->Name); } + if (isset($attributes->CompanyName)) { + $this->setCompanyName($attributes->CompanyName); + } if (isset($attributes->AttentionName)) { $this->setAttentionName($attributes->AttentionName); } @@ -219,6 +227,24 @@ public function setName($name) return $this; } + /** + * @return string + */ + public function getCompanyName() + { + return $this->companyName; + } + + /** + * @param string $companyName + * @return $this + */ + public function setCompanyName($companyName) + { + $this->companyName = $companyName; + return $this; + } + /** * @return string */ diff --git a/src/Ups/Shipping.php b/src/Ups/Shipping.php index f4769304..51551566 100644 --- a/src/Ups/Shipping.php +++ b/src/Ups/Shipping.php @@ -89,7 +89,7 @@ private function createConfirmRequest($validation, $shipment, $labelSpecOpts, $r $request->appendChild($node); $request->appendChild($xml->createElement('RequestAction', 'ShipConfirm')); - $request->appendChild($xml->createElement('RequestOption', $validation ? : '')); + $request->appendChild($xml->createElement('RequestOption', $validation ? : 'nonvalidate')); // Page 47 $shipmentNode = $container->appendChild($xml->createElement('Shipment')); @@ -176,7 +176,7 @@ private function createConfirmRequest($validation, $shipment, $labelSpecOpts, $r if (isset($shipment->ShipFrom)) { $shipFromNode = $shipmentNode->appendChild($xml->createElement('ShipFrom')); - $shipFromNode->appendChild($xml->createElement('CompanyName', $shipment->ShipFrom->CompanyName)); + $shipFromNode->appendChild($xml->createElement('CompanyName', $shipment->ShipFrom->getCompanyName())); if (isset($shipment->ShipFrom->AttentionName)) { $shipFromNode->appendChild($xml->createElement('AttentionName', $shipment->ShipFrom->AttentionName)); @@ -283,7 +283,7 @@ private function createConfirmRequest($validation, $shipment, $labelSpecOpts, $r } $serviceNode = $shipmentNode->appendChild($xml->createElement('Service')); - $serviceNode->appendChild($xml->createElement('Code', $shipment->Service->Code)); + $serviceNode->appendChild($xml->createElement('Code', $shipment->Service->getCode())); if (isset($shipment->Service->Description)) { $serviceNode->appendChild($xml->createElement('Description', $shipment->Service->Description)); @@ -308,7 +308,7 @@ private function createConfirmRequest($validation, $shipment, $labelSpecOpts, $r $node->appendChild($xml->createElement('NegotiatedRatesIndicator')); } - foreach ($shipment->Package as &$package) { + foreach ($shipment->getPackages() as &$package) { $node = $shipmentNode->appendChild($xml->createElement('Package')); $ptNode = $node->appendChild($xml->createElement('PackagingType')); @@ -398,7 +398,6 @@ private function createConfirmRequest($validation, $shipment, $labelSpecOpts, $r $node->appendChild($xml->createElement('Description', $receiptSpecOpts->ImageFormat->Description)); } } - return $xml->saveXML(); } @@ -442,7 +441,7 @@ private function createAcceptRequest($shipmentDigest) $request->appendChild($node); $request->appendChild($xml->createElement('RequestAction', 'ShipAccept')); - $container->appendChild($xml->createElement('ShipmentDigest', $shipmentDigest)); + $container->appendChild($xml->createElement('ShipmentDigest', $shipmentDigest->ShipmentDigest)); return $xml->saveXML(); }