Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/birchb1024/drakaea
Generate test credit card numbers for given BIN numbers
https://github.com/birchb1024/drakaea
Last synced: 2 days ago
JSON representation
Generate test credit card numbers for given BIN numbers
- Host: GitHub
- URL: https://github.com/birchb1024/drakaea
- Owner: birchb1024
- License: mit
- Created: 2022-09-08T08:13:12.000Z (about 2 years ago)
- Default Branch: trunk
- Last Pushed: 2022-09-12T00:32:22.000Z (about 2 years ago)
- Last Synced: 2024-06-21T18:47:50.101Z (5 months ago)
- Language: Go
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-go-business-creditcard.md
- License: LICENSE
Awesome Lists containing this project
README
go-business-creditcard
======================Validate/generate credit card checksums/names.
The go-business-creditcard package is a simple port based on the
[Business::CreditCard](http://search.cpan.org/dist/Business-CreditCard/) Perl module
by [Ivan Kohler](http://search.cpan.org/~ivan/).## Installation
Simply install the package to your [$GOPATH](http://code.google.com/p/go-wiki/wiki/GOPATH "GOPATH") with the [go tool](http://golang.org/cmd/go/ "go command") from shell:
```bash
$ go get github.com/dsparling/go-business-creditcard
```
Make sure [Git is installed](http://git-scm.com/downloads) on your machine and in your system's `PATH`.*`go get` installs the latest tagged release*
## Examples
[Example.go](https://github.com/dsparling/go-business-creditcard/blob/master/examples/example.go) is a sort of hello world for go-business-creditcard and should get you started for the barebones necessities of using the package.
cd examples
go run example.go## Validate
// true
fmt.Println(creditcard.Validate("4111111111111111"))
fmt.Println(creditcard.Validate("4111 1111 1111 1111"))
fmt.Println(creditcard.Validate("4111-1111-1111-1111"))// false
fmt.Println(creditcard.Validate("1111111111111111"))
fmt.Println(creditcard.Validate("1111 1111 1111 1111"))
fmt.Println(creditcard.Validate("1111-1111-1111-1111"))## Cardtype
// Visa
fmt.Println(creditcard.Cardtype("4111111111111111"))
// MasterCard
fmt.Println(creditcard.Cardtype("5555555555554444"))
// AmericanExpress
fmt.Println(creditcard.Cardtype("378282246310005"))
// DinersClub/Carteblanche
fmt.Println(creditcard.Cardtype("30569309025904"))
// Discover
fmt.Println(creditcard.Cardtype("6011111111111117"))
// EnRoute
fmt.Println(creditcard.Cardtype("201400000000009"))
// JCB
fmt.Println(creditcard.Cardtype("3530111333300000"))## GenerateLastDigit
// Returns '9' - 5276440065421319
fmt.Println(creditcard.GenerateLastDigit("5276 4400 6542 131"))