View Source SimpleCardBrand.Guards (SimpleCardBrand v1.0.0)

Guard macros.

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

Link to this macro

is_ukrcard(pan)

View Source (since 0.1.1) (macro)

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
Link to this macro

is_verve(pan)

View Source (since 0.1.1) (macro)

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
Link to this macro

pan_range(pan_length, minimum, maximum)

View Source (since 0.1.1) (macro)

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