findBrand static method

CardBrand findBrand(
  1. String cardNUmber
)

Implementation

static CardBrand findBrand(String cardNUmber) {
  if (_visa.matchAsPrefix(cardNUmber) != null) return CardBrand.visa;
  if (_master.matchAsPrefix(cardNUmber) != null) return CardBrand.masterCard;
  if (_discover.matchAsPrefix(cardNUmber) != null) return CardBrand.discover;
  if (_diners.matchAsPrefix(cardNUmber) != null) return CardBrand.diners;
  if (_amex.matchAsPrefix(cardNUmber) != null) return CardBrand.amex;
  if (_jcb.matchAsPrefix(cardNUmber) != null) return CardBrand.jcb;
  if (_union.matchAsPrefix(cardNUmber) != null) return CardBrand.union;
  return CardBrand.n_a;
}