From 383a8c7fa1c9ba2b0550866df06a746591c8111d Mon Sep 17 00:00:00 2001 From: Aron Peyroteo Date: Sat, 30 Sep 2023 16:27:38 -0300 Subject: [PATCH] Update validation rule for 'amount' field in QRStaticPaymentCreate Updated the validation rule of the 'amount' field in the QRStaticPaymentCreate ruleset from a regular expression to a simpler 'decimal' validation. This change will improve readability and maintainability of the code while still maintaining the intended restriction, which is to allow only decimal numbers with utmost two decimal places. --- src/Rules/PIX/QRStaticPaymentCreate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rules/PIX/QRStaticPaymentCreate.php b/src/Rules/PIX/QRStaticPaymentCreate.php index 576d39a..281f2b3 100644 --- a/src/Rules/PIX/QRStaticPaymentCreate.php +++ b/src/Rules/PIX/QRStaticPaymentCreate.php @@ -10,7 +10,7 @@ class QRStaticPaymentCreate public static function rules(): array { return [ - 'amount' => ['required', 'regex:/\d{1,10}\.\d{2}/'], + 'amount' => ['required', 'decimal:0,2'], 'key' => ['required', 'string'], 'transactionIdentification' => ['required', 'string'], 'additionalInformation' => ['sometimes', 'string'],