Commit 73d492a7 authored by estade's avatar estade Committed by Commit bot

Make IsLocalDuplicateOfServerCard separator-insensitive

BUG=none

Review URL: https://codereview.chromium.org/791053009

Cr-Commit-Position: refs/heads/master@{#310723}
parent 5c777688
......@@ -599,7 +599,7 @@ bool CreditCard::IsLocalDuplicateOfServerCard(const CreditCard& other) const {
return true;
if (other.record_type() == FULL_SERVER_CARD)
return number_ == other.number_;
return StripSeparators(number_) == StripSeparators(other.number_);
// For masked cards, this is the best we can do to compare card numbers.
return TypeAndLastFourDigits() == other.TypeAndLastFourDigits();
......
......@@ -186,6 +186,9 @@ TEST(CreditCardTest, Compare) {
{ LOCAL_CARD, "", "423456789012", "", "",
MASKED_SERVER_CARD, "John Dillinger", "9012", "01", "2010", kMasterCard,
false },
{ LOCAL_CARD, "John Dillinger", "4234-5678-9012", "01", "2010",
FULL_SERVER_CARD, "John Dillinger", "423456789012", "01", "2010", nullptr,
true },
};
for (size_t i = 0; i < arraysize(test_cases); ++i) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment