CcValidation v0.1.1 CcValidation View Source

CcValidation implements methods to verify validity of a credit card number

Link to this section Summary

Functions

Validate a credit card number using Luhn Algorithm

Link to this section Functions

Link to this function validate(number, check_test_numbers \\ false) View Source

Validate a credit card number using Luhn Algorithm

Examples

Valid credit card iex> CcValidation.validate(“4716892095589823”)

Invalid credit card iex> CcValidation.validate(“4024007106963124”)

Test card returns false iex> CcValidation.validate(“4111111111111111”)

Validate test card numbers when check_test_numbers is true

A valid test card iex> CcValidation.validate(“4111111111111111”, true)

An invalid test card iex> CcValidation.validate(“4212121212121212”, true)

A valid card when checking for test numbers just passes through to the validate function but will also return that it is not a test card iex> CcValidation.validate(“4716892095589823”, true)

Card numbers that are of length less than 13 or greater than 19 are

invalid.

iex> CcValidation.validate(“123”)

iex> CcValidation.validate(“12345678901234567890”)