Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1801)

Unified Diff: components/autofill/core/browser/credit_card.cc

Issue 18927003: [Autofill] Don't validate China UnionPay cards with the Luhn checksum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/credit_card.cc
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc
index 9906f27ab6b34a4fc7a3c70827cf0361e0b2c2b2..ca1b20f44cdb9c2857d970a1c300e3a9fa87ce43 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -151,6 +151,8 @@ 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 == kUnionPay)
+ return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_UNION_PAY);
if (type == kVisaCard)
return l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_VISA);
@@ -172,6 +174,8 @@ int CreditCard::IconResourceId(const std::string& type) {
return IDR_AUTOFILL_CC_JCB;
if (type == kMasterCard)
return IDR_AUTOFILL_CC_MASTERCARD;
+ if (type == kUnionPay)
+ return IDR_AUTOFILL_CC_GENERIC; // Needs resource: http://crbug.com/259211
if (type == kVisaCard)
return IDR_AUTOFILL_CC_VISA;
@@ -200,6 +204,7 @@ std::string CreditCard::GetCreditCardType(const base::string16& number) {
// Discover Card 6011,644-649,65 16
// JCB 3528-3589 16
// MasterCard 51-55 16
+ // UnionPay 62 16
Albert Bodenhamer 2013/07/11 16:28:42 Wikipedia claims 62 or 88 with a length of 16-19 h
Ilya Sherman 2013/07/12 01:06:47 AFAICT, 62 is the only prefix that most places ten
// Check for prefixes of length 1.
if (number.empty())
@@ -227,6 +232,9 @@ std::string CreditCard::GetCreditCardType(const base::string16& number) {
if (first_two_digits >= 51 && first_two_digits <= 55)
return kMasterCard;
+ if (first_two_digits == 62)
+ return kUnionPay;
+
if (first_two_digits == 65)
return kDiscoverCard;
@@ -692,6 +700,7 @@ const char* const kDiscoverCard = "discoverCC";
const char* const kGenericCard = "genericCC";
const char* const kJCBCard = "jcbCC";
const char* const kMasterCard = "masterCardCC";
+const char* const kUnionPay = "unionPayCC";
const char* const kVisaCard = "visaCC";
} // namespace autofill
« no previous file with comments | « components/autofill/core/browser/credit_card.h ('k') | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698