View Source SimpleCardBrand.Guards (SimpleCardBrand v1.0.1)
Guard macros.
NOTE: defguard is a macro so the doc tests do not run.
Summary
Functions
Compare the first eight (8) digits of the pan
against the UkrCard range.
Use in guards where pan
is known to be bytes.
Compare the first six (6) digits of the pan
against the Verve brand range.
Use in guards where pan
is known to be bytes.
Check the PAN length is in the minimum to maximum allowed length (inclusive).
Use in guards where pan_length
is known to be an integer.
Functions
Compare the first eight (8) digits of the pan
against the UkrCard range.
Use in guards where pan
is known to be bytes.
Examples
iex> SimpleCardBrand.Guards.is_ukrcard("60420099123212")
true
iex> SimpleCardBrand.Guards.is_ukrcard("6042010022222")
false
Compare the first six (6) digits of the pan
against the Verve brand range.
Use in guards where pan
is known to be bytes.
Examples
iex> SimpleCardBrand.Guards.is_verve("506099212121")
true
iex> SimpleCardBrand.Guards.is_verve("50609123")
false
Check the PAN length is in the minimum to maximum allowed length (inclusive).
Use in guards where pan_length
is known to be an integer.
Examples
iex> SimpleCardBrand.Guards.pan_range(16, 12, 19)
true
iex> SimpleCardBrand.Guards.pan_range(16, 19, 19)
false