Skip to content

Elixir library to calculate and check Italian tax code (codice fiscale).

License

Notifications You must be signed in to change notification settings

tommasocerruti/codice-fiscale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodiceFiscale

Language License Contributions

CodiceFiscale is an Elixir library providing different functions regarding the Italian fiscal code (codice fiscale).
It provides functions to generate a codice fiscale based on personal information and validate whether a given codice fiscale corresponds to provided personal data.
Per leggere questo README in italiano, clicca qui.

Features

  • Calculate Codice Fiscale: Given a name, surname, birthdate, sex, and Belfiore code of the birthplace, it computes the corresponding codice fiscale.
  • Verify Codice Fiscale: Checks if a provided codice fiscale matches the expected codice fiscale based on given personal data.

Installation

Add CodiceFiscale as a dependency in your mix.exs file:

defp deps do
  [
    {:codice_fiscale, "~> 0.1.0"}
  ]
end

Then, fetch dependencies:

$ mix deps.get

Usage

Calculate Codice Fiscale

Calculates codice fiscale given name, surname, birthdate, sex and Belfiore code.

iex> CodiceFiscale.calcola("Mario", "Rossi", "1980-01-01", "M", "H501")
{:ok, "RSSMRA80A01H501U"}

Verify Codice Fiscale

Verifies codice fiscale comparing it to provided personal data.

iex> CodiceFiscale.verifica("RSSMRA80A01H501U", %{nome: "Mario", cognome: "Rossi", data_nascita: "1980-01-01", sesso: "M", codice: "H501"})
{:ok, "Il codice fiscale corrisponde ai dati anagrafici."}

Configuration

To enable logging, set the :logging_enabled key to true in your application environment:

config :codice_fiscale, logging_enabled: true

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.
Before contributing, read here.

License

This library is released under the MIT License.

About

Elixir library to calculate and check Italian tax code (codice fiscale).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages