diff --git a/src/Entity/Service.php b/src/Entity/Service.php index 137753d..0f8c190 100644 --- a/src/Entity/Service.php +++ b/src/Entity/Service.php @@ -17,6 +17,7 @@ class Service implements NodeInterface const S_3DAYSELECT = '12'; const S_GROUND = '03'; const S_SURE_POST = '93'; + const S_MAIL_INNOVATIONS = 'M4'; // Valid international values const S_STANDARD = '11'; @@ -106,6 +107,7 @@ class Service implements NodeInterface '74' => 'UPS Express 12:00', '93' => 'UPS Sure Post', '96' => 'UPS Worldwide Express Freight', + 'M4' => 'UPS Mail Innovations', ]; /** @deprecated */ diff --git a/src/Entity/Shipment.php b/src/Entity/Shipment.php index 8985482..670f692 100644 --- a/src/Entity/Shipment.php +++ b/src/Entity/Shipment.php @@ -4,6 +4,11 @@ class Shipment { + const USPS_ENDORSEMENT_RETURN_SERVICE = 1; + const USPS_ENDORSEMENT_FORWARDING_SERVICE = 2; + const USPS_ENDORSEMENT_ADDRESS_SERVICE = 3; + const USPS_ENDORSEMENT_CHANGE_SERVICE = 4; + const USPS_ENDORSEMENT_NO_SERVICE = 5; /** * @var PaymentInformation */ @@ -122,6 +127,18 @@ class Shipment * @var bool */ private $taxInformationIndicator; + + /** + * Required for Mail Innovations. + * @var integer + */ + private $uspsEndorsement; + + /** + * Required for Mail Innovations. + * @var string + */ + private $packageId; public function __construct() { @@ -610,4 +627,44 @@ public function setTaxInformationIndicator(bool $taxInformationIndicator): self return $this; } + + /** + * @return int $uspsEndorsement + */ + public function getUSPSEndorsement() + { + return $this->uspsEndorsement; + } + + /** + * @param integer $uspsEndorsement + * + * @return Shipment + */ + public function setUSPSEndorsement($uspsEndorsement) + { + $this->uspsEndorsement = $uspsEndorsement; + + return $this; + } + + /** + * @return int $packageId + */ + public function getPackageId() + { + return $this->packageId; + } + + /** + * @param integer $packageId + * + * @return Shipment + */ + public function setPackageId($packageId) + { + $this->packageId = $packageId; + + return $this; + } } diff --git a/src/Shipping.php b/src/Shipping.php index 04ee831..3fcc6ce 100644 --- a/src/Shipping.php +++ b/src/Shipping.php @@ -132,6 +132,14 @@ private function createConfirmRequest( if ($shipment->getDescription()) { $shipmentNode->appendChild($xml->createElement('Description', $shipment->getDescription())); } + + if ($shipment->getUspsEndorsement()) { + $shipmentNode->appendChild($xml->createElement('USPSEndorsement', $shipment->getUSPSEndorsement())); + } + + if ($shipment->getPackageId()) { + $shipmentNode->appendChild($xml->createElement('PackageID', $shipment->getPackageId())); + } $returnService = $shipment->getReturnService(); if (isset($returnService)) {