diff --git a/src/Model/Consignment/AbstractConsignment.php b/src/Model/Consignment/AbstractConsignment.php index 56299d87..818f9744 100755 --- a/src/Model/Consignment/AbstractConsignment.php +++ b/src/Model/Consignment/AbstractConsignment.php @@ -229,6 +229,16 @@ abstract class AbstractConsignment */ public const LABEL_DESCRIPTION_MAX_LENGTH = 45; + /** + * @var int + */ + public const PERSON_NAME_MAX_LENGTH = 50; + + /** + * @var int + */ + public const COMPANY_NAME_MAX_LENGTH = 50; + /** * @internal * @var null|string @@ -1245,7 +1255,7 @@ public function getPerson(): string */ public function setPerson(string $person): self { - $this->person = $person; + $this->person = Str::limit($person, self::PERSON_NAME_MAX_LENGTH); return $this; } @@ -1268,6 +1278,10 @@ public function getCompany(): ?string */ public function setCompany(?string $company): self { + if (isset($company)) { + $company = Str::limit($company, self::COMPANY_NAME_MAX_LENGTH); + } + $this->company = $company; return $this; diff --git a/src/Model/Consignment/UPSConsignment.php b/src/Model/Consignment/UPSConsignment.php index d1315aec..a71cf4e7 100644 --- a/src/Model/Consignment/UPSConsignment.php +++ b/src/Model/Consignment/UPSConsignment.php @@ -11,6 +11,11 @@ class UPSConsignment extends AbstractConsignment { public const DEFAULT_WEIGHT = 3000; + /** + * @var int + */ + public const PERSON_NAME_MAX_LENGTH = 35; + /** * @internal * @var int