Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fre5h/rnokpp
🇺🇦 🆔 Helper functions to work with Ukrainian registration number of the taxpayer's account card (РНОКПП).
https://github.com/fre5h/rnokpp
go go-library library rnokpp tax-number ukraine
Last synced: 19 days ago
JSON representation
🇺🇦 🆔 Helper functions to work with Ukrainian registration number of the taxpayer's account card (РНОКПП).
- Host: GitHub
- URL: https://github.com/fre5h/rnokpp
- Owner: fre5h
- License: mit
- Created: 2022-07-28T19:22:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-01T13:37:36.000Z (11 months ago)
- Last Synced: 2024-10-11T13:12:53.937Z (about 1 month ago)
- Topics: go, go-library, library, rnokpp, tax-number, ukraine
- Language: Go
- Homepage: https://github.com/fre5h/rnokpp
- Size: 77.1 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# RNOKPP (РНОКПП)
Helper functions to work with Ukrainian registration number of the taxpayer's account card (RNOKPP).
Допоміжні функції для роботи з реєстраційним номером облікової картки платника податків (РНОКПП).[![Build Status](https://img.shields.io/github/actions/workflow/status/fre5h/rnokpp/ci.yml?branch=main&style=flat-square)](https://github.com/fre5h/rnokpp/actions?query=workflow%3ACI+branch%3Amain+)
[![CodeCov](https://img.shields.io/codecov/c/github/fre5h/rnokpp.svg?style=flat-square)](https://codecov.io/github/fre5h/rnokpp)
[![Go Report Card](https://goreportcard.com/badge/github.com/fre5h/rnokpp?style=flat-square)](https://goreportcard.com/report/github.com/fre5h/rnokpp)
[![License](https://img.shields.io/github/license/fre5h/rnokpp?style=flat-square)](https://pkg.go.dev/github.com/fre5h/rnokpp)
[![Gitter](https://img.shields.io/badge/gitter-join%20chat-brightgreen.svg?style=flat-square)](https://gitter.im/fre5h/rnokpp)
[![GoDoc](https://pkg.go.dev/badge/github.com/fre5h/rnokpp)](https://pkg.go.dev/github.com/fre5h/rnokpp)## Demo ⚙️
You can test it with my [RNOKPP Telegram Bot](https://t.me/rnokpp_bot).
## Requirements 🧐
* GO >= 1.20
## Features 🎁
- [x] Get details about RNOKPP
- [x] Get gender
- [x] Check gender
- [x] Check validity
- [x] Generate RNOKPP by date and gender
- [x] Generate random RNOKPP## Using 👨🎓
###### main.go
```go
package mainimport (
"fmt"
"time""github.com/fre5h/rnokpp"
)func main() {
// Get details about RNOKPP
details, _ := rnokpp.GetDetails("3652504575")
fmt.Println("details:", details) // valid, male, 01.01.2000// Get gender from RNOKPP
gender1, _ := rnokpp.GetGender("3652504575")
fmt.Println("gender1:", gender1) // male
gender2, _ := rnokpp.GetGender("3068208400")
fmt.Println("gender2:", gender2) // female// Check gender
isMale, _ := rnokpp.IsMale("3652504575")
fmt.Println("is male:", isMale) // true
isFemale, _ := rnokpp.IsFemale("3652504575")
fmt.Println("is female:", isFemale) // false// Check valid RNOKPP
validRnokpp := rnokpp.IsValid("3652504575")
invalidRnokpp := rnokpp.IsValid("1234567890")
fmt.Println("rnokpp valid:", validRnokpp, invalidRnokpp) // true, false// Generate RNOKPP by date and gender
birthday, _ := time.Parse("02.01.2006", "01.01.2000")
generatedRnokppMale, _ := rnokpp.GenerateRnokpp(birthday, rnokpp.Male)
fmt.Println("valid RNOKPP for male with birthday on 01.01.2000:", generatedRnokppMale) // valid RNOKPP for male with birthday on 01.01.2000, e.g. 3652322032
generatedRnokppFemale, _ := rnokpp.GenerateRnokpp(birthday, rnokpp.Female)
fmt.Println("valid RNOKPP for female with birthday on 01.01.2000:", generatedRnokppFemale) // valid RNOKPP for female with birthday on 01.01.2000, e.g. 3652347000// Generate a one random RNOKPP
generatedRandomRnokpp, _ := rnokpp.GenerateRandomRnokpp()
fmt.Println("random rnokpp:", generatedRandomRnokpp) // e.g. random rnokpp: 3300507061
// Or generate some number of random RNOKPPs
generatedRandomRnokpps, _ := rnokpp.GenerateRandomRnokppN(3)
for i, generatedRandomRnokpp := range generatedRandomRnokpps {
fmt.Printf("random rnokpp #%d: %s\n", i, generatedRandomRnokpp)
}
}
```###### bash
```text
$ go get "github.com/fre5h/rnokpp"@v1.1.2
go: downloading github.com/fre5h/rnokpp v1.1.2
go: added github.com/fre5h/rnokpp v1.1.2$ go run main.go
details: valid, male, 01.01.2000
gender1: male
gender2: female
is male: true
is female: false
rnokpp valid: true false
valid RNOKPP for male with birthday on 01.01.2000: 3652322032
valid RNOKPP for female with birthday on 01.01.2000: 3652347000
random rnokpp: 3300507061
random rnokpp #0: 3946436021
random rnokpp #1: 2642527503
random rnokpp #2: 2620337525
```## Contributing 🤝
See [CONTRIBUTING](https://github.com/fre5h/rnokpp/blob/master/.github/CONTRIBUTING.md) file.