go-credit-card

Credit card validation with the Luhn algorithm for golang

  • 所有者: durango/go-credit-card
  • 平台:
  • 许可证: Other
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

go-credit-card Build Status Coverage Status GoDoc

Basic credit card validation using the Luhn algorithm

Currently identifies the following credit card companies:

  • American Express
  • Bankcard
  • China Unionpay
  • Dankort
  • Diners Club Carte Blanche
  • Diners Club enRoute
  • Diners Club International
  • Discover
  • InterPayment
  • InstaPayment
  • JCB
  • Maestro
  • MasterCard
  • Visa
  • Visa Electron

Installation

go get github.com/durango/go-credit-card

Quick Start

// Initialize a new card:
card := creditcard.Card{Number: "4242424242424242", Cvv: "11111", Month: "02", Year: "2016"}

// Retrieve the card's method (which credit card company this card belongs to)
err := card.Method() // card.Company({Short: "visa", Long: "Visa"})

// Display last four digits
lastFour, err := card.LastFour() // 4242

// Validate the card's number (without capturing)
err := card.Validate() // will return an error due to not allowing test cards

err := card.Validate(true) // this will work though

主要指标

概览
名称与所有者durango/go-credit-card
主编程语言Go
编程语言Go (语言数: 2)
平台
许可证Other
所有者活动
创建于2014-09-12 19:23:52
推送于2022-07-15 16:03:04
最后一次提交2022-04-04 09:12:59
发布数0
用户参与
星数138
关注者数3
派生数40
提交数49
已启用问题?
问题数6
打开的问题数2
拉请求数4
打开的拉请求数3
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?