diff --git a/Model/TaxSchemes/NewZealandGst.php b/Model/TaxSchemes/NewZealandGst.php index ceeb534..19aacac 100644 --- a/Model/TaxSchemes/NewZealandGst.php +++ b/Model/TaxSchemes/NewZealandGst.php @@ -380,8 +380,7 @@ public function isValidNzbn(?string $nzbn): bool foreach (str_split($withoutcheck) as $key => $digit) { $sum += ((int) $digit * $weights[$key]); } - $remainder = $sum % 10; - $calculatedCheck = 10 - $remainder; + $calculatedCheck = (ceil($sum/10) * 10) - $sum; if ($calculatedCheck == $check) { return true; } diff --git a/Test/Unit/CheckNzGstTest.php b/Test/Unit/CheckNzGstTest.php index 9477b70..f873cb6 100644 --- a/Test/Unit/CheckNzGstTest.php +++ b/Test/Unit/CheckNzGstTest.php @@ -71,6 +71,10 @@ public function testIsValidNzbn($number, $valid): void public function isValidNZBNDataProvider(): array { return [ + ["9429039098740", true], + ["9429034243282", true], + ["9429041535110", true], + ["9429049999198", true], ["6291041500213", true], ["6291041500212", false], ["123456789", false], @@ -80,3 +84,4 @@ public function isValidNZBNDataProvider(): array ]; } } +