Skip to content

Commit

Permalink
Merge pull request #96 from jbrinksmeier/95-fi-vat-allow-0-as-last-digit
Browse files Browse the repository at this point in the history
for vat numbers from FI, allow 0 as last digit
  • Loading branch information
krzaczek committed Feb 11, 2020
2 parents 3d36f0c + 0eb9680 commit 824a870
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Vies/Validator/ValidatorFI.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public function validate(string $vatNumber): bool
$weights = [7, 9, 10, 5, 8, 4, 2];
$checkval = $this->sumWeights($weights, $vatNumber);

return 11 - ($checkval % 11) == (int) $vatNumber[7];
return (0 === $checkval % 11)
? (int) $vatNumber[7] === 0
: 11 - ($checkval % 11) == (int) $vatNumber[7];
}
}
1 change: 1 addition & 0 deletions tests/Vies/Validator/ValidatorFITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function vatNumberProvider()
['09853608', true],
['09853607', false],
['1234567', false],
['01089940', true],
];
}
}

0 comments on commit 824a870

Please sign in to comment.