CNPJ
CNPJ is an acronym for "Cadastro Nacional da Pessoa Jurídica," it's a identifier number associated to companies that the Brazilian government maintains. With this number, it is possible to check or retrieve information about a company.
This library provides a validation that checks if the number is a valid CNPJ number. The CPF has check digit algorithm is similar to ISBN 10, you can check the details in Portuguese here.
Installation
If available in Hex, the package can be installed
by adding cnpj to your list of dependencies in mix.exs:
def deps do
[
{:cnpj, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/cnpj.
Quick Start
You can verify if a CNPJ is valid by calling the function CNPJ.valid?/1:
CNPJ.valid?(13_118_061_000_108)
# => true
CNPJ.valid?(13_118_061_000_107)
# => false