Index: components/autofill/browser/credit_card.cc |
diff --git a/components/autofill/browser/credit_card.cc b/components/autofill/browser/credit_card.cc |
index 92bd9b07fb095cff5c9b5edc0f794923a3a71ad7..ee01a63d0d7f0d614313e4ae935e29a2ab3ec12a 100644 |
--- a/components/autofill/browser/credit_card.cc |
+++ b/components/autofill/browser/credit_card.cc |
@@ -150,8 +150,6 @@ base::string16 CreditCard::TypeForDisplay(const std::string& type) { |
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_JCB); |
if (type == kMasterCard) |
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_MASTERCARD); |
- if (type == kSoloCard) |
- return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_SOLO); |
if (type == kVisaCard) |
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_VISA); |
@@ -168,18 +166,19 @@ std::string CreditCard::GetCreditCardType(const base::string16& number) { |
return kGenericCard; |
benquan
2013/06/08 07:27:57
There are tons of card types, I think kGenericCard
Ilya Sherman
2013/06/18 03:37:38
Done.
|
// Credit card number specifications taken from: |
- // http://en.wikipedia.org/wiki/Credit_card_numbers and |
+ // http://en.wikipedia.org/wiki/Credit_card_numbers, |
+ // http://www.discovernetwork.com/merchants/images/Merchant_Marketing_PDF.pdf, |
+ // http://www.regular-expressions.info/creditcard.html, and |
// http://www.beachnet.com/~hstiles/cardtype.html |
benquan
2013/06/08 07:27:57
this link is dead, remove it?
Ilya Sherman
2013/06/18 03:37:38
I've kept the link, because it seems to be where t
|
+ // |
// Card Type Prefix(es) Length |
// --------------------------------------------------------------- |
// Visa 4 13,16 |
// American Express 34,37 15 |
- // Diners Club 300-305,2014,2149,36, 14,15 |
+ // Diners Club 300-305,3095,36,38-39 14 |
// Discover Card 6011,65 16 |
- // JCB 3 16 |
- // JCB 2131,1800 15 |
+ // JCB 3528-3589 16 |
// MasterCard 51-55 16 |
- // Solo (debit card) 6334,6767 16,18,19 |
// We need at least 4 digits to work with. |
if (number.length() < 4) |
@@ -199,48 +198,45 @@ std::string CreditCard::GetCreditCardType(const base::string16& number) { |
return kVisaCard; |
break; |
+ |
case 14: |
if (first_three_digits >= 300 && first_three_digits <= 305) |
return kDinersCard; |
- if (first_digit == 36) |
+ if (first_two_digits == 36) |
+ return kDinersCard; |
+ |
+ if (first_two_digits >= 38 && first_two_digits <= 39) |
+ return kDinersCard; |
+ |
+ if (first_four_digits == 3095) |
return kDinersCard; |
break; |
+ |
case 15: |
if (first_two_digits == 34 || first_two_digits == 37) |
return kAmericanExpressCard; |
- if (first_four_digits == 2131 || first_four_digits == 1800) |
- return kJCBCard; |
- |
- if (first_four_digits == 2014 || first_four_digits == 2149) |
- return kDinersCard; |
- |
break; |
+ |
case 16: |
if (first_four_digits == 6011 || first_two_digits == 65) |
return kDiscoverCard; |
- if (first_four_digits == 6334 || first_four_digits == 6767) |
- return kSoloCard; |
+ if (first_three_digits >= 644 && first_three_digits <= 649) |
+ return kDiscoverCard; |
if (first_two_digits >= 51 && first_two_digits <= 55) |
return kMasterCard; |
- if (first_digit == 3) |
+ if (first_four_digits >= 3528 && first_four_digits <= 3589) |
return kJCBCard; |
if (first_digit == 4) |
return kVisaCard; |
break; |
- case 18: |
- case 19: |
- if (first_four_digits == 6334 || first_four_digits == 6767) |
- return kSoloCard; |
- |
- break; |
} |
return kGenericCard; |
benquan
2013/06/08 07:27:57
Card type should be determined by BIN (the first 6
Ilya Sherman
2013/06/18 03:37:38
Done.
|