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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?