Skip to content

Commit

Permalink
Fix el-GR isTaxID when checksum is 10
Browse files Browse the repository at this point in the history
Add correct tax identifier to demonstrate issue and fix.

Thanks to: Panos Papadopoulos
  • Loading branch information
dspinellis committed Nov 25, 2020
1 parent ad23f52 commit efafad2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/isTaxID.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function elGrCheck(tin) {
for (let i = 0; i < 8; i++) {
checksum += digits[i] * (2 ** (8 - i));
}
return checksum % 11 === digits[8];
return ((checksum % 11) % 10) === digits[8];
}

/*
Expand Down
1 change: 1 addition & 0 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -9512,6 +9512,7 @@ describe('Validators', () => {
args: ['el-GR'],
valid: [
'758426713',
'032792320',
'054100004'],
invalid: [
'054100005',
Expand Down

0 comments on commit efafad2

Please sign in to comment.