Skip to content

Commit fd90eb2

Browse files
stephenjwinnstefandoorn
authored andcommitted
TimeInTransit Service Codes, InternationalForms EEIFilingOption & AdditionalDocumentIndicator, StatusType Constants, Unit Bug Fix (gabrielbull#108)
* add new time in transit service response codes. add in EU time in transit response codes fix constant naming collisions. * Add the AdditionalDocumentIndicator, which adds the EDI or EDI-PULL section in the bottom right corner of the shipping label. This node is not present by default. * Add the EEIFilingOption node to the InternationalForms container. Associated nodes include UPSFiling, ShipperFiling, and POA. Also added a new directory for entity test classes so we can check the constructor, getters, setters, and toNode methods on the entities. Remove one StyleCI PHP Issue be more stringent. don't just assert not empty. make sure it equals what we want * Add StatusType Code Constants Per UPS Tracking API Documentation gonna get squashed also gonna get squashed * Update CHANGELOG.md to reflect 0.7.9 changes
1 parent 4b31fe4 commit fd90eb2

File tree

10 files changed

+801
-1
lines changed

10 files changed

+801
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## 0.7.9 (released 01-07-2016)
4+
5+
- Add Shipping API Support for AdditionalDocumentIndicator in the InternationalForms node
6+
- Add Shipping API Support for EEIFilingOption in the InternationalForms node
7+
- Add TimeInTransit API Response Service Code Constants for US/EU Shipments to Entity/Service.php
8+
- Add Tracking API Response StatusType Constants
9+
310
## 0.7.8 (released 23-06-2016)
411

512
- Do not create new Guzzle object instance on each Request, but re-use it.

src/Entity/EEIFilingOption.php

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
<?php
2+
3+
namespace Ups\Entity;
4+
5+
use DOMDocument;
6+
use DOMElement;
7+
use Ups\NodeInterface;
8+
9+
class EEIFilingOption implements NodeInterface
10+
{
11+
const FO_SHIPPER = '1'; // Shipper Filed
12+
const FO_UPS = '3'; // UPS Filed
13+
14+
/**
15+
* @var string
16+
*/
17+
private $code;
18+
19+
/**
20+
* @var string
21+
*/
22+
private $emailAddress;
23+
24+
/**
25+
* @var string
26+
*/
27+
private $description;
28+
29+
/**
30+
* @var UPSFiled
31+
*/
32+
private $upsFiled;
33+
34+
/**
35+
* @var ShipperFiled
36+
*/
37+
private $shipperFiled;
38+
39+
/**
40+
* @param null|object $attributes
41+
*/
42+
public function __construct($attributes = null)
43+
{
44+
if (null !== $attributes) {
45+
if (isset($attributes->Code)) {
46+
$this->setCode($attributes->Code);
47+
}
48+
if (isset($attributes->EmailAddress)) {
49+
$this->setEmailAddress($attributes->EmailAddress);
50+
}
51+
if (isset($attributes->Description)) {
52+
$this->setDescription($attributes->Description);
53+
}
54+
if (isset($attributes->UPSFiled)) {
55+
$this->setUPSFiled(new UPSFiled($attributes->UPSFiled));
56+
}
57+
if (isset($attributes->ShipperFiled)) {
58+
$this->setShipperFiled(new ShipperFiled($attributes->ShipperFiled));
59+
}
60+
}
61+
}
62+
63+
/**
64+
* @param null|DOMDocument $document
65+
*
66+
* @return DOMElement
67+
*/
68+
public function toNode(DOMDocument $document = null)
69+
{
70+
if (null === $document) {
71+
$document = new DOMDocument();
72+
}
73+
74+
$node = $document->createElement('EEIFilingOption');
75+
76+
$code = $this->getCode();
77+
if (isset($code)) {
78+
$node->appendChild($document->createElement('Code', $code));
79+
}
80+
81+
$emailAddress = $this->getEmailAddress();
82+
if (isset($emailAddress)) {
83+
$node->appendChild($document->createElement('EMailAdress', $emailAddress));
84+
}
85+
86+
$description = $this->getDescription();
87+
if (isset($description)) {
88+
$node->appendChild($document->createElement('Description', $description));
89+
}
90+
91+
$upsFiled = $this->getUPSFiled();
92+
if (isset($upsFiled)) {
93+
$node->appendChild($upsFiled->toNode($document));
94+
}
95+
96+
$shipperFiled = $this->getShipperFiled();
97+
if (isset($shipperFiled)) {
98+
$node->appendChild($shipperFiled->toNode($document));
99+
}
100+
101+
return $node;
102+
}
103+
104+
/**
105+
* @return string
106+
*/
107+
public function getCode()
108+
{
109+
return $this->code;
110+
}
111+
112+
/**
113+
* @param string $code
114+
*
115+
* @return $this
116+
*/
117+
public function setCode($code)
118+
{
119+
$this->code = $code;
120+
121+
return $this;
122+
}
123+
124+
/**
125+
* @return string
126+
*/
127+
public function getEmailAddress()
128+
{
129+
return $this->emailAddress;
130+
}
131+
132+
/**
133+
* @param string $emailAddress
134+
*
135+
* @return $this
136+
*/
137+
public function setEmailAddress($emailAddress)
138+
{
139+
$this->emailAddress = $emailAddress;
140+
141+
return $this;
142+
}
143+
144+
/**
145+
* @return string
146+
*/
147+
public function getDescription()
148+
{
149+
return $this->description;
150+
}
151+
152+
/**
153+
* @param string $description
154+
*
155+
* @return $this
156+
*/
157+
public function setDescription($description)
158+
{
159+
$this->description = $description;
160+
161+
return $this;
162+
}
163+
164+
/**
165+
* @return UPSFiled
166+
*/
167+
public function getUPSFiled()
168+
{
169+
return $this->upsFiled;
170+
}
171+
172+
/**
173+
* @param UPSFiled $upsFiled
174+
*
175+
* @return $this
176+
*/
177+
public function setUPSFiled(UPSFiled $upsFiled)
178+
{
179+
$this->upsFiled = $upsFiled;
180+
181+
return $this;
182+
}
183+
184+
/**
185+
* @return ShipperFiled
186+
*/
187+
public function getShipperFiled()
188+
{
189+
return $this->shipperFiled;
190+
}
191+
192+
/**
193+
* @param ShipperFiled $shipperFiled
194+
*
195+
* @return $this
196+
*/
197+
public function setShipperFiled(ShipperFiled $shipperFiled)
198+
{
199+
$this->shipperFiled = $shipperFiled;
200+
201+
return $this;
202+
}
203+
}

src/Entity/InternationalForms.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ class InternationalForms implements NodeInterface
134134
*/
135135
private $freightCharges;
136136

137+
/**
138+
* @var bool
139+
*/
140+
private $additionalDocumentIndicator;
141+
142+
/**
143+
* @var EEIFilingOption
144+
*/
145+
private $eeiFilingOption;
146+
137147
/**
138148
* @return array
139149
*/
@@ -177,6 +187,9 @@ public function __construct($attributes = null)
177187
if (isset($attributes->CurrencyCode)) {
178188
$this->setCurrencyCode($attributes->CurrencyCode);
179189
}
190+
if (isset($attributes->EEIFilingOption)) {
191+
$this->setEEIFilingOption(new EEIFilingOption($attributes->EEIFilingOption));
192+
}
180193
}
181194
}
182195

@@ -303,6 +316,12 @@ public function toNode(DOMDocument $document = null)
303316
if ($this->getFreightCharges() !== null) {
304317
$node->appendChild($this->getFreightCharges()->toNode($document));
305318
}
319+
if ($this->getAdditionalDocumentIndicator() !== null) {
320+
$node->appendChild($document->createElement('AdditionalDocumentIndicator'));
321+
}
322+
if ($this->getEEIFilingOption() !== null) {
323+
$node->appendChild($this->getEEIFilingOption()->toNode($document));
324+
}
306325
foreach ($this->products as $product) {
307326
$node->appendChild($product->toNode($document));
308327
}
@@ -457,4 +476,42 @@ public function getCurrencyCode()
457476
{
458477
return $this->currencyCode;
459478
}
479+
480+
/**
481+
* @param $additionalDocumentIndicator
482+
*
483+
* @return $this
484+
*/
485+
public function setAdditionalDocumentIndicator($additionalDocumentIndicator)
486+
{
487+
$this->additionalDocumentIndicator = $additionalDocumentIndicator;
488+
}
489+
490+
/**
491+
* @return bool
492+
*/
493+
public function getAdditionalDocumentIndicator()
494+
{
495+
return $this->additionalDocumentIndicator;
496+
}
497+
498+
/**
499+
* @param EEIFilingOption $eeiFilingOption
500+
*
501+
* @return $this
502+
*/
503+
public function setEEIFilingOption(EEIFilingOption $eeiFilingOption)
504+
{
505+
$this->eeiFilingOption = $eeiFilingOption;
506+
507+
return $this;
508+
}
509+
510+
/**
511+
* @return EEIFilingOption
512+
*/
513+
public function getEEIFilingOption()
514+
{
515+
return $this->eeiFilingOption;
516+
}
460517
}

0 commit comments

Comments
 (0)