View Source QRNBU.Types.TaxID (NBU payment QR v0.3.3)

Tax identification number for Ukrainian entities.

Format Specification

  • Length: 8 or 10 digits
  • Cannot be exactly 9 digits (reserved for internal use)
  • Must contain only digits

Types

  • 8 digits: Individual taxpayer ID
  • 10 digits: Legal entity (EDRPOU) or individual with RNTRC

Examples

iex> QRNBU.Types.TaxID.new("12345678")
{:ok, %QRNBU.Types.TaxID{}}

iex> QRNBU.Types.TaxID.new("1234567890")
{:ok, %QRNBU.Types.TaxID{}}

iex> QRNBU.Types.TaxID.new("123456789")
{:error, "Tax ID cannot be exactly 9 characters (reserved for internal use)"}

iex> QRNBU.Types.TaxID.new("123")
{:error, "Tax ID must be 8 or 10 digits"}

Summary

Functions

Creates a new TaxID with validation.

Extracts the string value from a TaxID.

Types

@opaque t()

Functions

@spec new(String.t()) :: {:ok, t()} | {:error, String.t()}

Creates a new TaxID with validation.

Returns {:ok, tax_id} if valid, {:error, reason} otherwise.

@spec to_string(t()) :: String.t()

Extracts the string value from a TaxID.