Skip to content

jacoelho/banking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banking

GoDoc

Banking related library.

Install

go get -u github.com/jacoelho/banking

IBAN

Supports IBAN validation based on swift rules.

Usage

Validation

err := iban.Validate("SOME IBAN")

Replace check digits

result, err := iban.ReplaceChecksum("GB99NWBK60161331926819")
// Output: GB29NWBK60161331926819

Generation

iban, err := iban.Generate("GB")
// Output: GB29NWBK60161331926819

Printing

iban.PaperFormat("GB29NWBK60161331926819"))
// Output: GB29 NWBK 6016 1331 9268 19

BBAN

// Get BBAN from IBAN
result, _ := iban.GetBBAN("GB29NWBK60161331926819")

fmt.Println(result.BBAN, result.BankCode, result.BranchCode, result.AccountNumber)
// Output: NWBK60161331926819 NWBK 601613 31926819

IsSEPA

// IsSEPA returns if an iban country is a SEPA member
result, _ := iban.IsSEPA("GB29NWBK60161331926819")
fmt.Println(result)
// Output: true

ISO-7064

Mod-97-10 implemented.

Generate

cd registry
go install -v ./...
cd ..
./bin/generator  -registry-file ./docs/registry.yml

Roadmap

  • generator with specific values
  • country bban verifier

License

MIT License

See LICENSE to see the full text.