Documentation ¶
Overview ¶
Package creditcard provides methods for validating credit cards
Index ¶
- type Card
- func (c *Card) LastFour() (string, error)
- func (c *Card) LastFourDigits() (string, error)
- func (c *Card) Method() error
- func (c *Card) MethodValidate() (Company, error)
- func (c *Card) Validate(allowTestNumbers ...bool) error
- func (c *Card) ValidateCVV() error
- func (c *Card) ValidateExpiration() error
- func (c *Card) ValidateNumber() bool
- func (c *Card) Wipe()
- type Company
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Card ¶
Card holds generic information about the credit card
func (*Card) LastFourDigits ¶
LastFourDigits as an alias for LastFour
func (*Card) Method ¶
Method returns an error from MethodValidate() or returns the credit card with it's company / issuer attached to it
func (*Card) MethodValidate ¶
MethodValidate adds/checks/verifies the credit card's company / issuer
func (*Card) Validate ¶
Validate returns nil or an error describing why the credit card didn't validate this method checks for expiration date, CCV/CVV and the credit card's numbers. For allowing test cards to go through, simply pass true (bool) as the first argument
func (*Card) ValidateCVV ¶
validates the length of the card's CVV value
func (*Card) ValidateExpiration ¶
validates the credit card's expiration date
func (*Card) ValidateNumber ¶
ValidateNumber will check the credit card's number against the Luhn algorithm