From 51ccf743cf37e94ef6fda935df3ec08051e354e0 Mon Sep 17 00:00:00 2001 From: kevinverschoor <61683999+kevinverschoor@users.noreply.github.com> Date: Fri, 3 May 2024 09:10:41 +0200 Subject: [PATCH 1/2] PLUG-3436 - Add character limit to firstname --- Model/PayPaymentCreate.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Model/PayPaymentCreate.php b/Model/PayPaymentCreate.php index 9c2a9641..ed9268a1 100644 --- a/Model/PayPaymentCreate.php +++ b/Model/PayPaymentCreate.php @@ -333,7 +333,7 @@ private function getShippingAddress() } $shippingAddress = [ - 'initials' => $arrShippingAddress['firstname'], + 'initials' => substr($arrShippingAddress['firstname'], 0, 32), 'lastName' => $arrShippingAddress['lastname'], ]; $arrAddress2 = \Paynl\Helper::splitAddress($arrShippingAddress['street']); @@ -358,7 +358,7 @@ private function getEnduserData() if ($arrBillingAddress) { $arrBillingAddress = $arrBillingAddress->toArray(); $enduser = [ - 'initials' => $arrBillingAddress['firstname'], + 'initials' => substr($arrBillingAddress['firstname'], 0, 32), 'lastName' => $arrBillingAddress['lastname'], 'phoneNumber' => payHelper::validatePhoneNumber($arrBillingAddress['telephone']), 'emailAddress' => $arrBillingAddress['email'], @@ -403,7 +403,7 @@ private function getInvoiceAddress() $arrBillingAddress = $arrBillingAddress->toArray(); $invoiceAddress = [ - 'initials' => $arrBillingAddress['firstname'] ?? '', + 'initials' => substr($arrBillingAddress['firstname'] ?? '', 0, 32), 'lastName' => $arrBillingAddress['lastname'] ?? '', ]; From 39e2a5ba53c5da99ec48e16764c5c02f11515835 Mon Sep 17 00:00:00 2001 From: kevinverschoor <61683999+kevinverschoor@users.noreply.github.com> Date: Fri, 3 May 2024 13:23:04 +0200 Subject: [PATCH 2/2] use mb_substr to limit character instead --- Model/PayPaymentCreate.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Model/PayPaymentCreate.php b/Model/PayPaymentCreate.php index ed9268a1..0ec17372 100644 --- a/Model/PayPaymentCreate.php +++ b/Model/PayPaymentCreate.php @@ -333,7 +333,7 @@ private function getShippingAddress() } $shippingAddress = [ - 'initials' => substr($arrShippingAddress['firstname'], 0, 32), + 'initials' => mb_substr($arrShippingAddress['firstname'], 0, 32), 'lastName' => $arrShippingAddress['lastname'], ]; $arrAddress2 = \Paynl\Helper::splitAddress($arrShippingAddress['street']); @@ -358,7 +358,7 @@ private function getEnduserData() if ($arrBillingAddress) { $arrBillingAddress = $arrBillingAddress->toArray(); $enduser = [ - 'initials' => substr($arrBillingAddress['firstname'], 0, 32), + 'initials' => mb_substr($arrBillingAddress['firstname'], 0, 32), 'lastName' => $arrBillingAddress['lastname'], 'phoneNumber' => payHelper::validatePhoneNumber($arrBillingAddress['telephone']), 'emailAddress' => $arrBillingAddress['email'], @@ -403,7 +403,7 @@ private function getInvoiceAddress() $arrBillingAddress = $arrBillingAddress->toArray(); $invoiceAddress = [ - 'initials' => substr($arrBillingAddress['firstname'] ?? '', 0, 32), + 'initials' => mb_substr($arrBillingAddress['firstname'] ?? '', 0, 32), 'lastName' => $arrBillingAddress['lastname'] ?? '', ];