Skip to content

Commit

Permalink
Adding Delivery Confirmation functionality to PackageServiceOptions f…
Browse files Browse the repository at this point in the history
…or domestic shipments.

Was told by UPS support that:

"Please try to request a Adult Signature under PackageServiceOptions and not ShipmentServiceOptions. Usually, ShipmentServiceOptions is for International packages. "

When originally using Delivery Confirmation on ShipmentServiceOptions, I was receiving the error, which is now resolved with the committed changes.

"The requested accessory option is unavailable between the selected locations."

An example of code to utilize this on a domestic shipment is:

```
    $deliveryConfirmation = new \Ups\Entity\DeliveryConfirmation;
    $deliveryConfirmation->setDcisType(2);

    $packageServiceOptions = new \Ups\Entity\PackageServiceOptions();
    $packageServiceOptions->setDeliveryConfirmation($deliveryConfirmation);
    $package->setPackageServiceOptions($packageServiceOptions);
```
  • Loading branch information
conrad10781 committed Oct 25, 2017
1 parent 7867787 commit 4d19234
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Entity/PackageServiceOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class PackageServiceOptions implements NodeInterface
*/
private $holdForPickup;

/**
* @var DeliveryConfirmation
*/
private $deliveryConfirmation;

/**
* @param null $parameters
*/
Expand All @@ -60,6 +65,9 @@ public function __construct($parameters = null)
if (isset($parameters->HoldForPickup)) {
$this->setHoldForPickup($parameters->HoldForPickup);
}
if (isset($parameters->DeliveryConfirmation)) {
$this->setDeliveryConfirmation($parameters->DeliveryConfirmation);
}
}
}

Expand Down Expand Up @@ -87,6 +95,9 @@ public function toNode(DOMDocument $document = null)
if ($this->getHazMatPackageInformation() !== null) {
$node->appendChild($this->getHazMatPackageInformation()->toNode($document));
}
if (isset($this->deliveryConfirmation)) {
$node->appendChild($this->deliveryConfirmation->toNode($document));
}

return $node;
}
Expand Down Expand Up @@ -194,4 +205,22 @@ public function setHazMatPackageInformation($hazMatPackageInformation)
{
$this->hazMatPackageInformation = $hazMatPackageInformation;
}

/**
* @param DeliveryConfirmation $deliveryConfirmation
* @return ShipmentServiceOptions
*/
public function setDeliveryConfirmation(DeliveryConfirmation $deliveryConfirmation)
{
$this->deliveryConfirmation = $deliveryConfirmation;
return $this;
}

/**
* @return DeliveryConfirmation|null
*/
public function getDeliveryConfirmation()
{
return $this->deliveryConfirmation;
}
}

0 comments on commit 4d19234

Please sign in to comment.