Skip to content

Commit 656680d

Browse files
committed
Add EmailAddress field to Shipper and ShipTo entities.
1 parent 112784b commit 656680d

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/Entity/ShipTo.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class ShipTo
66
{
77
private ?string $name;
88
private string $attentionName = "";
9+
private string $email = "";
910
private Phone $phone;
1011
private Address $address;
1112
private string $residential = "";
@@ -14,7 +15,7 @@ public function __construct()
1415
{
1516
$this->phone = new Phone();
1617
}
17-
18+
1819
public function setName(string $name): self
1920
{
2021
$this->name = $name;
@@ -48,6 +49,17 @@ public function getPhone(): Phone
4849
return $this->phone;
4950
}
5051

52+
public function setEmail(string $email): self
53+
{
54+
$this->email = $email;
55+
return $this;
56+
}
57+
58+
public function getEmail(): string
59+
{
60+
return $this->email;
61+
}
62+
5163
public function setAddress(Address $address): self
5264
{
5365
$this->address = $address;
@@ -85,6 +97,10 @@ public function toArray(): array
8597
$shipTo["Phone"] = $this->phone->toArray();
8698
}
8799

100+
if ($this->email) {
101+
$shipTo["EmailAddress"] = $this->email;
102+
}
103+
88104
if ($this->residential) {
89105
$shipTo["Residential"] = $this->residential;
90106
}

src/Entity/Shipper.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Shipper
77
private ?string $name;
88
private string $attentionName = "";
99
private string $taxIdentificationNumber = "";
10+
private string $email = "";
1011
private Phone $phone;
1112
private ?string $shipperNumber;
1213
private string $faxNumber = "";
@@ -61,6 +62,17 @@ public function getPhone(): Phone
6162
return $this->phone;
6263
}
6364

65+
public function setEmail(string $email): self
66+
{
67+
$this->email = $email;
68+
return $this;
69+
}
70+
71+
public function getEmail(): string
72+
{
73+
return $this->email;
74+
}
75+
6476
public function setShippingNumber(string $shipper_number): self
6577
{
6678
$this->shipperNumber = $shipper_number;
@@ -114,6 +126,10 @@ public function toArray(): array
114126
$shipper["Phone"] = $this->phone->toArray();
115127
}
116128

129+
if ($this->email) {
130+
$shipTo["EmailAddress"] = $this->email;
131+
}
132+
117133
if ($this->faxNumber) {
118134
$shipper["FaxNumber"] = $this->faxNumber;
119135
}

0 commit comments

Comments
 (0)