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 29, 2020
1 parent 0f8e597 commit 421d077
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 @@ -9571,6 +9571,7 @@ describe('Validators', () => {
args: ['el-GR'],
valid: [
'758426713',
'032792320',
'054100004'],
invalid: [
'054100005',
Expand Down

0 comments on commit 421d077

Please sign in to comment.