Skip to content

TimeInTransit Service Codes, InternationalForms EEIFilingOption & AdditionalDocumentIndicator, StatusType Constants, Unit Bug Fix #108

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

Merged
merged 5 commits into from
Jul 4, 2016
Merged
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## 0.7.9 (released 01-07-2016)

- Add Shipping API Support for AdditionalDocumentIndicator in the InternationalForms node
- Add Shipping API Support for EEIFilingOption in the InternationalForms node
- Add TimeInTransit API Response Service Code Constants for US/EU Shipments to Entity/Service.php
- Add Tracking API Response StatusType Constants

## 0.7.8 (released 23-06-2016)

- Do not create new Guzzle object instance on each Request, but re-use it.
Expand Down
203 changes: 203 additions & 0 deletions src/Entity/EEIFilingOption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<?php

namespace Ups\Entity;

use DOMDocument;
use DOMElement;
use Ups\NodeInterface;

class EEIFilingOption implements NodeInterface
{
const FO_SHIPPER = '1'; // Shipper Filed
const FO_UPS = '3'; // UPS Filed

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

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

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

/**
* @var UPSFiled
*/
private $upsFiled;

/**
* @var ShipperFiled
*/
private $shipperFiled;

/**
* @param null|object $attributes
*/
public function __construct($attributes = null)
{
if (null !== $attributes) {
if (isset($attributes->Code)) {
$this->setCode($attributes->Code);
}
if (isset($attributes->EmailAddress)) {
$this->setEmailAddress($attributes->EmailAddress);
}
if (isset($attributes->Description)) {
$this->setDescription($attributes->Description);
}
if (isset($attributes->UPSFiled)) {
$this->setUPSFiled(new UPSFiled($attributes->UPSFiled));
}
if (isset($attributes->ShipperFiled)) {
$this->setShipperFiled(new ShipperFiled($attributes->ShipperFiled));
}
}
}

/**
* @param null|DOMDocument $document
*
* @return DOMElement
*/
public function toNode(DOMDocument $document = null)
{
if (null === $document) {
$document = new DOMDocument();
}

$node = $document->createElement('EEIFilingOption');

$code = $this->getCode();
if (isset($code)) {
$node->appendChild($document->createElement('Code', $code));
}

$emailAddress = $this->getEmailAddress();
if (isset($emailAddress)) {
$node->appendChild($document->createElement('EMailAdress', $emailAddress));
}

$description = $this->getDescription();
if (isset($description)) {
$node->appendChild($document->createElement('Description', $description));
}

$upsFiled = $this->getUPSFiled();
if (isset($upsFiled)) {
$node->appendChild($upsFiled->toNode($document));
}

$shipperFiled = $this->getShipperFiled();
if (isset($shipperFiled)) {
$node->appendChild($shipperFiled->toNode($document));
}

return $node;
}

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

/**
* @param string $code
*
* @return $this
*/
public function setCode($code)
{
$this->code = $code;

return $this;
}

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

/**
* @param string $emailAddress
*
* @return $this
*/
public function setEmailAddress($emailAddress)
{
$this->emailAddress = $emailAddress;

return $this;
}

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

/**
* @param string $description
*
* @return $this
*/
public function setDescription($description)
{
$this->description = $description;

return $this;
}

/**
* @return UPSFiled
*/
public function getUPSFiled()
{
return $this->upsFiled;
}

/**
* @param UPSFiled $upsFiled
*
* @return $this
*/
public function setUPSFiled(UPSFiled $upsFiled)
{
$this->upsFiled = $upsFiled;

return $this;
}

/**
* @return ShipperFiled
*/
public function getShipperFiled()
{
return $this->shipperFiled;
}

/**
* @param ShipperFiled $shipperFiled
*
* @return $this
*/
public function setShipperFiled(ShipperFiled $shipperFiled)
{
$this->shipperFiled = $shipperFiled;

return $this;
}
}
57 changes: 57 additions & 0 deletions src/Entity/InternationalForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ class InternationalForms implements NodeInterface
*/
private $freightCharges;

/**
* @var bool
*/
private $additionalDocumentIndicator;

/**
* @var EEIFilingOption
*/
private $eeiFilingOption;

/**
* @return array
*/
Expand Down Expand Up @@ -177,6 +187,9 @@ public function __construct($attributes = null)
if (isset($attributes->CurrencyCode)) {
$this->setCurrencyCode($attributes->CurrencyCode);
}
if (isset($attributes->EEIFilingOption)) {
$this->setEEIFilingOption(new EEIFilingOption($attributes->EEIFilingOption));
}
}
}

Expand Down Expand Up @@ -303,6 +316,12 @@ public function toNode(DOMDocument $document = null)
if ($this->getFreightCharges() !== null) {
$node->appendChild($this->getFreightCharges()->toNode($document));
}
if ($this->getAdditionalDocumentIndicator() !== null) {
$node->appendChild($document->createElement('AdditionalDocumentIndicator'));
}
if ($this->getEEIFilingOption() !== null) {
$node->appendChild($this->getEEIFilingOption()->toNode($document));
}
foreach ($this->products as $product) {
$node->appendChild($product->toNode($document));
}
Expand Down Expand Up @@ -457,4 +476,42 @@ public function getCurrencyCode()
{
return $this->currencyCode;
}

/**
* @param $additionalDocumentIndicator
*
* @return $this
*/
public function setAdditionalDocumentIndicator($additionalDocumentIndicator)
{
$this->additionalDocumentIndicator = $additionalDocumentIndicator;
}

/**
* @return bool
*/
public function getAdditionalDocumentIndicator()
{
return $this->additionalDocumentIndicator;
}

/**
* @param EEIFilingOption $eeiFilingOption
*
* @return $this
*/
public function setEEIFilingOption(EEIFilingOption $eeiFilingOption)
{
$this->eeiFilingOption = $eeiFilingOption;

return $this;
}

/**
* @return EEIFilingOption
*/
public function getEEIFilingOption()
{
return $this->eeiFilingOption;
}
}
Loading