Skip to content

Documentation / @facturometro/einvoice / identifiers / tinGr

Function: tinGr() ​

tinGr(value): boolean

Defined in: packages/validator/src/identifiers/gr-tin.ts:20

u:TinVerification: the check digit of a Greek tax identification number (AFM), used by the Greek rules (GR-R-001-2, GR-R-003, GR-R-009, GR-R-010).

Port of the Schematron function: the first eight digits are weighted 256, 128, ..., 2 and (sum mod 11) mod 10 must equal the ninth digit. Only the first nine characters are looked at, exactly as upstream; any of them not being a digit (or the value being shorter) makes the arithmetic NaN there and returns false here.

Parameters ​

value ​

string

The identifier; the callers pass it raw or as a substring.

Returns ​

boolean

true when the check digit is right.

Example ​

ts
import { tinGr } from '@facturometro/validator';

tinGr('090000045'); // true
tinGr('090000044'); // false

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.