Skip to content

reddotpay/cards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cards

-- import "github.com/reddotpay/cards"

Usage

const (
	// BrandVisa defines Visa card brand
	BrandVisa = "visa"
	// BrandMasterCard defines MasterCard card brand
	BrandMasterCard = "mastercard"
	// BrandUnionPay defines UnionPay card brand
	BrandUnionPay = "unionpay"
	// BrandDiners defines Diners card brand
	BrandDiners = "diners"
	// BrandDiscover defines Discover card brand
	BrandDiscover = "discover"
	// BrandAmericanExpress defines American Express card brand
	BrandAmericanExpress = "amex"
	// BrandJCB defines JCB card brand
	BrandJCB = "jcb"
	// BrandOthers defines undefined brands
	BrandOthers = "others"
)
var BrandCheck = map[string]func(string) bool{
	BrandVisa:            isVisa,
	BrandMasterCard:      isMasterCard,
	BrandUnionPay:        isUnionPay,
	BrandDiners:          isDiners,
	BrandDiscover:        isDiscover,
	BrandAmericanExpress: isAmericanExpress,
	BrandJCB:             isJCB,
}

BrandCheck defines a map of functions to check the various card brands

func Brand

func Brand(number string) string

Brand returns the corresponding card brand

func ValidateNumber

func ValidateNumber(number string) bool

ValidateNumber returns true if number satisfy the Luhn algorithm

About

Golang library for cards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages