CreditCard
Credit card validations library
Summary
Functions
Returns the type of card
Returns true if the validation options is set to recognize the card’s class. Otherwise, false
Returns true if number is among the list of test credit card numbers ;otherwise, it returns false
Returns CreditCard options map
Returns True if card matches the allowed card patterns. By default, the set of cards matched against are Amex, VISA, MasterCard, Discover, Diners Club and JCB. Otherwise, false
Performs luhn check on the credit card number
Types
validation_error :: {:error, :unrecognized_card_type}
Functions
Specs
card_type(String.t) :: atom | validation_error
Returns the type of card
Examples
iex> CreditCard.card_type("3566002020360505")
:jcb
Returns true if the validation options is set to recognize the card’s class. Otherwise, false.
Examples
iex> CreditCard.is_allowed_card_type?("5555555555554444")
true
Specs
is_test_number(String.t) :: boolean
Returns true if number is among the list of test credit card numbers ;otherwise, it returns false.
Returns True if card matches the allowed card patterns. By default, the set of cards matched against are Amex, VISA, MasterCard, Discover, Diners Club and JCB. Otherwise, false
Examples
iex> CreditCard.valid?(“4000111111111115”) false
Specs
verify_luhn(String.t) :: boolean
Performs luhn check on the credit card number