Skip to content

Golang ICAN Addresses validation

License

Notifications You must be signed in to change notification settings

bchainhub/go-ican

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Go-ICAN

Basic Golang ICAN validator

Validations:

  • Validate if country/crypto code and check digits are present
  • Validate if country/crypto code is in accepted country code list
  • Validate national BCAN code format
  • Validate mod97 check digits

Testing

Test suite includes example of ICAN's for most countries and fake ICAN's. Errors are as specific as possible.

Example

package main

import (
	"fmt"
	"github.com/cryptohub-digital/go-ican"
)

func main() {
	ican, err := ican.NewICAN("NL40ABNA0517552264")

	if err != nil {
		fmt.Printf("%v\n", err)
	} else {
		fmt.Printf("%v\n", ican.PrintCode)
		fmt.Printf("%v\n", ican.Code)
	}
}

License

CORE License