siwonpawel / go-checks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-checks

Validate common polish numbers.

Supported:

  • NIP (Numer Identyfikacji Podatkowej)
  • REGON (Rejestr Gospodarki Narodowej)
  • PESEL (Powszechny Elektroniczny System Ewidencji Ludności)

How to run

makefile is prepared to execute on podman / podman-compose if you're running docker please replace podman-compose with docker-compose

Execute this command to build and start service

make up

How to validate data

curl --request POST \
  --url http://localhost:8080/validate \
  --header 'Content-Type: application/json' \
  --data '{
	"value": "96030700272"
}'

Example response

[
	{
		"country": "PL",
		"identifier": "NIP",
		"isValid": false,
		"Warnings": [
			"Missing country identifier at beginning."
		],
		"Error": "Invalid input length.",
		"CleanedInput": "96030700272"
	},
	{
		"country": "PL",
		"identifier": "PESEL",
		"isValid": true,
		"Warnings": [
			"Missing country identifier at beginning."
		],
		"Error": "",
		"CleanedInput": "96030700272"
	},
	{
		"country": "PL",
		"identifier": "REGON",
		"isValid": false,
		"Warnings": [
			"Missing country identifier at beginning."
		],
		"Error": "Invalid input length.",
		"CleanedInput": "96030700272"
	}
]

About


Languages

Language:Go 97.9%Language:Makefile 2.1%