From c5e713b0a710d4a79fcd835ce5fb68b258652346 Mon Sep 17 00:00:00 2001 From: Gytautas <gytautas.zumaras@invertus.eu> Date: Mon, 16 Dec 2024 12:28:12 +0200 Subject: [PATCH] PIPRES:432 wrong first or second name error messages implemented --- changelog.md | 2 +- src/Exception/OrderCreationException.php | 2 ++ src/Handler/Exception/OrderExceptionHandler.php | 2 ++ src/Service/ExceptionService.php | 2 ++ views/templates/admin/_configure/helpers/form/form.tpl | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 6870d1a4f..6695ea86c 100644 --- a/changelog.md +++ b/changelog.md @@ -6,7 +6,7 @@ + Fixed issue with order status on multishop + Phone number validation improvements + Add to cart validation improvements on recurring orders -+ Code bawe improvements following prestashop standards ++ Code base improvements following prestashop standards ## Changes in release 6.2.4 ## + Workflow improvements diff --git a/src/Exception/OrderCreationException.php b/src/Exception/OrderCreationException.php index 977a8e7c0..8ac44e415 100644 --- a/src/Exception/OrderCreationException.php +++ b/src/Exception/OrderCreationException.php @@ -33,4 +33,6 @@ class OrderCreationException extends \Exception const ORDER_IS_NOT_CREATED = 7; const WRONG_FAMILY_NAME = 8; + + const WRONG_GIVEN_NAME = 9; } diff --git a/src/Handler/Exception/OrderExceptionHandler.php b/src/Handler/Exception/OrderExceptionHandler.php index 0443486b3..7d2dc74dd 100644 --- a/src/Handler/Exception/OrderExceptionHandler.php +++ b/src/Handler/Exception/OrderExceptionHandler.php @@ -32,6 +32,8 @@ public function handle(Exception $e) return new OrderCreationException($e->getMessage(), OrderCreationException::WRONG_SHIPPING_PHONE_NUMBER_EXCEPTION); } elseif (strpos($e->getMessage(), 'billingAddress.familyName')) { return new OrderCreationException($e->getMessage(), OrderCreationException::WRONG_FAMILY_NAME); + } elseif (strpos($e->getMessage(), 'billingAddress.givenName')) { + return new OrderCreationException($e->getMessage(), OrderCreationException::WRONG_GIVEN_NAME); } elseif (strpos($e->getMessage(), 'payment.amount')) { if (strpos($e->getMessage(), 'minimum')) { throw new OrderCreationException($e->getMessage(), OrderCreationException::ORDER_TOTAL_LOWER_THAN_MINIMUM); diff --git a/src/Service/ExceptionService.php b/src/Service/ExceptionService.php index 417d5eef8..d3aca54e2 100644 --- a/src/Service/ExceptionService.php +++ b/src/Service/ExceptionService.php @@ -43,6 +43,8 @@ public function getErrorMessages(): array OrderCreationException::WRONG_SHIPPING_PHONE_NUMBER_EXCEPTION => $this->module->l('It looks like you have entered incorrect phone number format in shipping address step. Please change the number and try again.', self::FILE_NAME), OrderCreationException::ORDER_TOTAL_LOWER_THAN_MINIMUM => $this->module->l('Chosen payment option is unavailable for your order total amount. Please consider using other payment option and try again.', self::FILE_NAME), OrderCreationException::ORDER_TOTAL_HIGHER_THAN_MAXIMUM => $this->module->l('Chosen payment option is unavailable for your order total amount. Please consider using other payment option and try again.', self::FILE_NAME), + OrderCreationException::WRONG_GIVEN_NAME => $this->module->l('The first name is invalid. Please check and try again.', self::FILE_NAME), + OrderCreationException::WRONG_FAMILY_NAME => $this->module->l('The second name is invalid. Please check and try again.', self::FILE_NAME), ], ShipmentCannotBeSentException::class => [ ShipmentCannotBeSentException::NO_SHIPPING_INFORMATION => $this->module->l('Shipment information cannot be sent. Order reference (%s) has no shipping information.', self::FILE_NAME), diff --git a/views/templates/admin/_configure/helpers/form/form.tpl b/views/templates/admin/_configure/helpers/form/form.tpl index 818e40160..e58d26081 100644 --- a/views/templates/admin/_configure/helpers/form/form.tpl +++ b/views/templates/admin/_configure/helpers/form/form.tpl @@ -217,7 +217,7 @@ {/if} </select> <p class="help-block"> - {$input.methodDescription|escape:'html':'UTF-8'} + {$input.methodDescription} </p> </div> </div>