10000 GitHub - zaffka/rutax: Parser and validation tool for Russian Tax Identification Numbers (INN)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

zaffka/rutax

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Russian TaxID (TIN, INN) Validation Package

Go Reference Go Report Card Tests

The rutax package provides functionality for validating and parsing Russian Tax Identification Numbers (INN - Идентификационный Номер Налогоплательщика, TIN - Tax Identification Number).

Features

  • Parsing and validation of TaxID for individuals and legal entities
  • Checksum verification according to the official algorithm

Installation

go get github.com/zaffka/rutax@latest

Usage

rutax.ParseID(innStr string) (rutax.ID, error)

Main package function:

  1. Verifies string format compliance with INN requirements
  2. Validates checksums at key positions in the parsed string
  3. Returns a structure with INN data

The returned ID structure contains:

  • Num - validated INN(TIN) number
  • IsLegal - flag indicating whether it belongs to a legal entity

Example:

package main

import (
	"fmt"
	"github.com/zaffka/rutax"
)

func main() {
	// Parsing TaxID
	id, err := rutax.ParseID("7710140679")
	if err != nil {
		fmt.Println("Error:", err)

		return
	}

	fmt.Printf("INN: %s, Legal entity: %v\n", id.Num, id.IsLegal)
}

Errors

The package returns the following error types:

  • ErrIDIncorrect - INN format error (length, numeric characters)
  • ErrChecksumFailed - checksum validation error

License

MIT

About

Parser and validation tool for Russian Tax Identification Numbers (INN)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0