View Source QRNBU.Validators.RecipientCode (NBU payment QR v0.3.3)

Validator for recipient identification code (EDRPOU/IPN/passport).

Validates Ukrainian business (EDRPOU) and individual (IPN) tax identification codes.

Summary

Functions

Validates recipient code.

Functions

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

Validates recipient code.

Rules

  • Must be 8 or 10 digits for EDRPOU/IPN
  • Can be any alphanumeric format for passport numbers

Examples

iex> QRNBU.Validators.RecipientCode.validate("12345678")
{:ok, "12345678"}

iex> QRNBU.Validators.RecipientCode.validate("1234567890")
{:ok, "1234567890"}

iex> QRNBU.Validators.RecipientCode.validate("AB123456")
{:ok, "AB123456"}

iex> QRNBU.Validators.RecipientCode.validate("")
{:error, "Recipient code is required"}

iex> QRNBU.Validators.RecipientCode.validate("123")
{:error, "Recipient code must be 8-10 digits or valid passport format"}