From cb1abc4aa5ab7b32cfa14ce0f95c0b576c54c888 Mon Sep 17 00:00:00 2001 From: Michelangelo van Dam Date: Wed, 13 Sep 2017 09:46:32 +0200 Subject: [PATCH] Applying fix #35 on 1.0 branch A fix for 2.0 branch was provided by @krzaczek, which is now patched on 1.0 branch --- src/Vies/Validator/ValidatorBG.php | 2 ++ tests/Vies/ValidatorTest.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Vies/Validator/ValidatorBG.php b/src/Vies/Validator/ValidatorBG.php index 40aa6aa..01f5b4b 100644 --- a/src/Vies/Validator/ValidatorBG.php +++ b/src/Vies/Validator/ValidatorBG.php @@ -51,6 +51,8 @@ public function validate($vatNumber) $checkval = $this->sumWeights($weights, $vatNumber); $checkval = ($checkval % 11) == 10 ? 0 : ($checkval % 11); + } else { + $checkval = $checkval % 11; } if ($checkval != $checksum) { diff --git a/tests/Vies/ValidatorTest.php b/tests/Vies/ValidatorTest.php index a66effc..c7e6d0b 100644 --- a/tests/Vies/ValidatorTest.php +++ b/tests/Vies/ValidatorTest.php @@ -13,7 +13,7 @@ public function vatNumberProvider() return [ 'AT' => ['U10223006', ['U1022300', 'A10223006', 'U10223005']], 'BE' => ['776091951', ['0776091952', '07760919']], - 'BG' => ['301004503', ['10100450', '301004502']], + 'BG' => [['204514061', '301004503'], ['10100450', '301004502']], 'CY' => ['00532445O', ['005324451', '0053244511', '12000139V', '72000139V']], 'CZ' => [['46505334', '7103192745', '640903926', '395601439', '630903928'], ['4650533', '96505334', '46505333', '7103192743', '1903192745', '7133192745', '395632439', '396301439', '545601439', '640903927', '7103322745']],