Help us shape the future of Go! Take the 2026 Go Developer Survey

mimir

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2019 License: MIT Imports: 4 Imported by: 0

README

Mimir  Build Status GoDoc

What is Mimir ?

Mimir is a lightweight library that exposes some functions to validate some banking informations.

Disclaimer

This library is still in development, so it might be possible that some methods change over time.

Methods available

As the project just started, it is quite poor in method.
Stay tuned for updates !

Method Name Short Description
IsIBANValid Validate an IBAN
GetCheckDigits Compute check digits from a valid IBAN
PrintFormatIBAN Format IBAN as it would be printed
GetCountryConfiguration Get country configuration (ISO 13616-Compliant IBAN Formats)
Supported countries

Please visit SUPPORTED_COUNTRIES.md

Use

Get
$ go get -u github.com/vdlbk/mimir
Examples
Validate an IBAN
package main

import (
	"fmt"
	"github.com/vdlbk/mimir"
)

func main(){
	IBAN := "FR1420041010050500013M02606"
	
	ok, _ := mimir.IsIBANValid(IBAN)
	fmt.Println(ok) // true
	
	badIBAN := "FR1420041010050500013M02605"
    	
    ok, _ = mimir.IsIBANValid(badIBAN)
    fmt.Println(ok) // false
}

Documentation

Index

Constants

View Source
const (
	// ErrIBANTooshort is the error when a IBAN is too short for the validation process
	ErrIBANTooshort = mimirError("IBAN is too short")

	// ErrIBANIncorrectLength is the error when a IBAN does not have the required length
	ErrIBANIncorrectLength = mimirError("IBAN incorrect length")

	// ErrIBANInvalidChecksum is the error when a IBAN is invalid
	ErrIBANInvalidChecksum = mimirError("IBAN invalid checksum")

	// ErrCountryCodeDoesNotExist is the error when you lookup for a country code that does not exists
	ErrCountryCodeDoesNotExist = mimirError("Country Code does not exist")
)

Variables

This section is empty.

Functions

func GetCheckDigits added in v0.1.1

func GetCheckDigits(iban string) (string, string, error)

GetCheckDigits compute the check digits from a given IBAN. Returns the computed digits, the IBAN set with the check digits or an error if something goes wrong

func GetCountryConfiguration added in v0.1.1

func GetCountryConfiguration(countryCode string) (*configuration, error)

GetCountryConfiguration returns ISO 13616-Compliant IBAN Formats from a given country code If the countryCode does not exist in the list, returns an error `ErrCountryCodeDoesNotExist`

func IsIBANValid

func IsIBANValid(iban string) (bool, error)

IsIBANValid checks if the given IBAN is valid based on the country its belong to

func PrintFormatIBAN added in v0.2.0

func PrintFormatIBAN(iban string) (string, error)

PrintFormatIBAN format the given IBAN based on the regular way to print it depending the country. It will use the PrintFormat of the configuration to insure the result.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL