From d9cc351e6b89943c0e1fe873a6a327e39426bc3b Mon Sep 17 00:00:00 2001 From: Damien McKenna Date: Fri, 16 Jan 2026 20:18:18 -0500 Subject: [PATCH 1/2] Truncate state_or_province to two characters Some countries will have state_or_province codes that are longer than two characters. FedEx's API will fail if this value is longer than two. Truncate the string to two characters to avoid such errors. --- src/FedexRest/Entity/Address.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/FedexRest/Entity/Address.php b/src/FedexRest/Entity/Address.php index 06c05a4..8287c5f 100644 --- a/src/FedexRest/Entity/Address.php +++ b/src/FedexRest/Entity/Address.php @@ -81,7 +81,8 @@ public function prepare(): array $address['city'] = $this->city; } if (!empty($this->state_or_province)) { - $address['stateOrProvinceCode'] = $this->state_or_province; + // Truncate the state/provice code to work around a limitation in FedEx's API. + $address['stateOrProvinceCode'] = substr($this->state_or_province, 0, 2); } if (!empty($this->postal_code)) { $address['postalCode'] = $this->postal_code; From 41ce454f8ea6e3fce1eae9950776f49830ed79f7 Mon Sep 17 00:00:00 2001 From: Damien McKenna Date: Fri, 16 Jan 2026 20:29:22 -0500 Subject: [PATCH 2/2] Typo. --- src/FedexRest/Entity/Address.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FedexRest/Entity/Address.php b/src/FedexRest/Entity/Address.php index 8287c5f..25b4ac1 100644 --- a/src/FedexRest/Entity/Address.php +++ b/src/FedexRest/Entity/Address.php @@ -81,7 +81,7 @@ public function prepare(): array $address['city'] = $this->city; } if (!empty($this->state_or_province)) { - // Truncate the state/provice code to work around a limitation in FedEx's API. + // Truncate the state/province code to work around a limitation in FedEx's API. $address['stateOrProvinceCode'] = substr($this->state_or_province, 0, 2); } if (!empty($this->postal_code)) {