From 83c79ceec98e241a943021eea206da3b2ee8e533 Mon Sep 17 00:00:00 2001 From: Attila Fulop <1162360+fulopattila122@users.noreply.github.com> Date: Thu, 21 Sep 2023 08:49:02 +0300 Subject: [PATCH] Added null check to Billpayer::getName() --- Changelog.md | 1 + src/Order/Changelog.md | 1 + src/Order/Models/Billpayer.php | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index e61d86a6..9936d6bb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ - Added and extended Foundation Channel model that contains the known relationships to the "channelable" models - Added the `withinChannel[s]` methods to the ProductSearch class - Added the `Features` accessor class, which is a syntactic sugar for areas of the configuration +- Fixed possible null return type on Billpayer::getName() when is_organization is true but the company name is null ## 3.x Series diff --git a/src/Order/Changelog.md b/src/Order/Changelog.md index 030c5d2a..23df8df8 100644 --- a/src/Order/Changelog.md +++ b/src/Order/Changelog.md @@ -11,6 +11,7 @@ - Changed minimal Enum requirement to v4.1 - Upgraded to Konekt Address and User modules to v3 - Added the `currency` field to the orders table +- Fixed possible null return type on Billpayer::getName() when is_organization is true but the company name is null ## 3.x Series diff --git a/src/Order/Models/Billpayer.php b/src/Order/Models/Billpayer.php index ee3fb99f..7633cc88 100644 --- a/src/Order/Models/Billpayer.php +++ b/src/Order/Models/Billpayer.php @@ -56,7 +56,7 @@ public function getPhone(): ?string public function getName(): string { - if ($this->isOrganization()) { + if ($this->isOrganization() && $this->getCompanyName()) { return $this->getCompanyName(); }