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

Added support for mail innovations. #376

Open
wants to merge 6 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
14 changes: 9 additions & 5 deletions src/Entity/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class Service implements NodeInterface
const S_3DAYSELECT = '12';
const S_GROUND = '03';
const S_SURE_POST = '93';
const S_EXPEDITED_MAIL = 'M4';
const S_PRIORITY_MAIL_INNOVATIONS = 'M5';
const S_ECONOMY_MAIL_INNOVATIONS = 'M6';
const S_MAIL_INNOVATIONS_RETURNS = 'M7';

// Valid international values
const S_STANDARD = '11';
Expand Down Expand Up @@ -100,12 +104,12 @@ class Service implements NodeInterface
'85' => 'UPS Today Express',
'86' => 'UPS Today Express Saver',
'96' => 'UPS Worldwide Express Freight',
'59' => 'UPS Second Day Air AM',
'65' => 'UPS Saver',
'70' => 'UPS Access Point Economy',
'74' => 'UPS Express 12:00',
'93' => 'UPS Sure Post',
'96' => 'UPS Worldwide Express Freight',

'M4' => 'UPS Expedited Mail',
'M5' => 'UPS Priority Mail Innovations',
'M6' => 'UPS Economy Mail Innovations',
'M7' => 'UPS MaiI Innovations (MI) Returns',
];

/** @deprecated */
Expand Down
54 changes: 50 additions & 4 deletions src/Entity/Shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,16 @@ class Shipment
*/
private $locale;

/**
* @var string
*/
private $USPSEndorsement;

/**
* @var string
*/
private $PackageID;

public function __construct()
{
$this->setShipper(new Shipper());
Expand Down Expand Up @@ -601,6 +611,44 @@ public function setShipmentTotalWeight(ShipmentTotalWeight $shipmentTotalWeight)
$this->shipmentTotalWeight = $shipmentTotalWeight;
}

/**
* @param string $uspsEndorsement
* @return Shipment
*/
public function setUSPSEndorsement($uspsEndorsement)
{
$this->USPSEndorsement = $uspsEndorsement;

return $this;
}

/**
* @return string
*/
public function getUSPSEndorsement()
{
return $this->USPSEndorsement;
}

/**
* @param string $PackageID
* @return Shipment
*/
public function setPackageID($PackageID)
{
$this->PackageID = $PackageID;

return $this;
}

/**
* @return string
*/
public function getPackageID()
{
return $this->PackageID;
}

public function getTaxInformationIndicator(): bool
{
return $this->taxInformationIndicator;
Expand All @@ -612,13 +660,10 @@ public function getTaxInformationIndicator(): bool
public function setTaxInformationIndicator(bool $taxInformationIndicator): self
{
$this->taxInformationIndicator = $taxInformationIndicator;

return $this;
}

/**
* @return string
*/
public function getLocale()
{
return $this->locale;
Expand All @@ -635,4 +680,5 @@ public function setLocale($locale)

return $this;
}

}
1 change: 1 addition & 0 deletions src/Entity/UnitOfMeasurement.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class UnitOfMeasurement implements NodeInterface
// PackageWeight
const UOM_LBS = 'LBS'; // Pounds (defalut)
const UOM_KGS = 'KGS'; // Kilograms
const UOM_OZS = 'OZS'; // Ounces

// Dimensions
const UOM_IN = 'IN'; // Inches
Expand Down
8 changes: 8 additions & 0 deletions src/Shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ private function createConfirmRequest(
$shipmentNode->appendChild($xml->createElement('MovementReferenceNumber', $shipment->getMovementReferenceNumber()));
}

if ($shipment->getUSPSEndorsement()) {
$shipmentNode->appendChild($xml->createElement('USPSEndorsement', $shipment->getUSPSEndorsement()));
}

if ($shipment->getPackageID()) {
$shipmentNode->appendChild($xml->createElement('PackageID', $shipment->getPackageID()));
}

$serviceNode = $shipmentNode->appendChild($xml->createElement('Service'));
$serviceNode->appendChild($xml->createElement('Code', $shipment->getService()->getCode()));

Expand Down
Loading