Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Mail Innovation label creation #316

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Entity/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 */
Expand Down
57 changes: 57 additions & 0 deletions src/Entity/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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;
}
}
8 changes: 8 additions & 0 deletions src/Shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down