Skip to content

Commit

Permalink
PIPRES:432 wrong first or second name error messages implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
GytisZum committed Dec 16, 2024
1 parent caefb0f commit c5e713b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/Exception/OrderCreationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ class OrderCreationException extends \Exception
const ORDER_IS_NOT_CREATED = 7;

const WRONG_FAMILY_NAME = 8;

const WRONG_GIVEN_NAME = 9;
}
2 changes: 2 additions & 0 deletions src/Handler/Exception/OrderExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/Service/ExceptionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion views/templates/admin/_configure/helpers/form/form.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
{/if}
</select>
<p class="help-block">
{$input.methodDescription|escape:'html':'UTF-8'}
{$input.methodDescription}
</p>
</div>
</div>
Expand Down

0 comments on commit c5e713b

Please sign in to comment.