From c30cafc121df21c89525dcdb59dfa39179c1bc30 Mon Sep 17 00:00:00 2001 From: "jesse.berger" Date: Wed, 25 Mar 2026 13:56:36 +0100 Subject: [PATCH] RT-17945 Added brand emails --- src/Api/BrandsApi.php | 19 ++++++++++++++++++- src/Domain/Brand.php | 12 ++++++++++++ tests/Clients/Brands/BrandsApiCreateTest.php | 2 ++ tests/Clients/Brands/BrandsApiUpdateTest.php | 2 ++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/Api/BrandsApi.php b/src/Api/BrandsApi.php index bd42083..093c424 100644 --- a/src/Api/BrandsApi.php +++ b/src/Api/BrandsApi.php @@ -61,6 +61,8 @@ public function create( ?string $state, string $country, string $email, + ?string $contactEmail, + ?string $replyToEmail, ?string $url, string $voice, ?string $fax, @@ -85,6 +87,12 @@ public function create( if ($state) { $payload['state'] = $state; } + if ($contactEmail) { + $payload['$contactEmail'] = $contactEmail; + } + if ($replyToEmail) { + $payload['$replyToEmail'] = $replyToEmail; + } if ($url) { $payload['url'] = $url; } @@ -103,7 +111,6 @@ public function create( if (isset($hideOptionalTerms)) { $payload['hideOptionalTerms'] = $hideOptionalTerms; } - $this->client->post(sprintf('v2/customers/%s/brands/%s', urlencode($customer), urlencode($handle)), $payload); } @@ -123,6 +130,8 @@ public function update( ?string $state = null, ?string $country = null, ?string $email = null, + ?string $contactEmail = null, + ?string $replyToEmail = null, ?string $url = null, ?string $voice = null, ?string $fax = null, @@ -166,6 +175,14 @@ public function update( $payload['email'] = $email; } + if ($contactEmail) { + $payload['$contactEmail'] = $contactEmail; + } + + if ($replyToEmail) { + $payload['$replyToEmail'] = $replyToEmail; + } + if ($url) { $payload['url'] = $url; } diff --git a/src/Domain/Brand.php b/src/Domain/Brand.php index 8c4da87..80cfde8 100644 --- a/src/Domain/Brand.php +++ b/src/Domain/Brand.php @@ -27,6 +27,10 @@ final class Brand implements DomainObjectInterface public string $email; + public ?string $contactEmail; + + public ?string $replyToEmail; + public ?string $contactUrl; public ?string $url; @@ -62,6 +66,8 @@ private function __construct( ?string $state, string $country, string $email, + ?string $contactEmail, + ?string $replyToEmail, ?string $contactUrl, ?string $url, string $voice, @@ -86,6 +92,8 @@ private function __construct( $this->state = $state; $this->country = $country; $this->email = $email; + $this->contactEmail = $contactEmail; + $this->replyToEmail = $replyToEmail; $this->contactUrl = $contactUrl; $this->url = $url; $this->voice = $voice; @@ -116,6 +124,8 @@ public static function fromArray(array $json): Brand $json['state'] ?? null, $json['country'], $json['email'], + $json['contactEmail'], + $json['replyToEmail'], $json['contactUrl'] ?? null, $json['url'] ?? null, $json['voice'], @@ -144,6 +154,8 @@ public function toArray(): array 'state' => $this->state, 'country' => $this->country, 'email' => $this->email, + 'contactEmail' => $this->contactEmail, + 'replyToEmail' => $this->replyToEmail, 'contactUrl' => $this->contactUrl, 'url' => $this->url, 'voice' => $this->voice, diff --git a/tests/Clients/Brands/BrandsApiCreateTest.php b/tests/Clients/Brands/BrandsApiCreateTest.php index 82662ec..2f500b1 100644 --- a/tests/Clients/Brands/BrandsApiCreateTest.php +++ b/tests/Clients/Brands/BrandsApiCreateTest.php @@ -30,6 +30,8 @@ public function test_create(): void 'statetest', 'countrytest', 'email@test.com', + 'email2@test.com', + 'email3@test.com', 'http://www.test.com', 'voicetest', 'faxtest', diff --git a/tests/Clients/Brands/BrandsApiUpdateTest.php b/tests/Clients/Brands/BrandsApiUpdateTest.php index 80d4bde..2247ad3 100644 --- a/tests/Clients/Brands/BrandsApiUpdateTest.php +++ b/tests/Clients/Brands/BrandsApiUpdateTest.php @@ -30,6 +30,8 @@ public function test_update(): void 'statetest', 'countrytest', 'email@test.com', + 'email2@test.com', + 'email3@test.com', 'http://www.test.com', 'voicetest', 'faxtest',