Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Vies/Validator/ValidatorLV.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*
* Range:
* C1 ... C11 Numeric from 0 to 9
* C1 > 3
*
* Rules:
* C11
Expand All @@ -40,8 +39,9 @@ public function validate(string $vatNumber): bool
return false;
}

if ((int)$vatNumber[0] <= 3) {
return false;
// Differentiate between legal entities and natural bodies. For the latter, there is a simpler check
if (preg_match('/^[0-3]/', $vatNumber)) {
return preg_match('/^[0-3]\d[0-1]\d/', $vatNumber) == 1;
}

$weights = [9, 1, 4, 8, 3, 10, 2, 5, 7, 6];
Expand Down
1 change: 1 addition & 0 deletions tests/Vies/Validator/ValidatorLVTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function vatNumberProvider()
{
return [
['40003009497', true],
['10038010132', true],
['40013009497', false],
['40003009496', false],
['1234567890', false],
Expand Down