getCardBin method

String getCardBin(
  1. String cardNumber
)

Implementation

String getCardBin(String cardNumber) {
  String bin;
  switch (detectCCType(cardNumber)) {
    case BandeiraCartao.visa:
      bin = 'Visa';
      break;

    case BandeiraCartao.americanExpress:
      bin = 'Amex';
      break;

    case BandeiraCartao.mastercard:
      bin = 'Master';
      break;

    case BandeiraCartao.discover:
      bin = 'Discover';
      break;

    case BandeiraCartao.elo:
      bin = 'Elo';
      break;

    default:
      bin = '';
      break;
  }

  return bin;
}