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

Side by Side Diff: components/autofill/core/browser/credit_card.cc

Issue 2849523003: Add billing address as a mandatory field of Payments credit cards. (Closed)
Patch Set: Merge branch 'master' into billing Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/credit_card.h" 5 #include "components/autofill/core/browser/credit_card.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 671
672 bool CreditCard::IsLocalDuplicateOfServerCard(const CreditCard& other) const { 672 bool CreditCard::IsLocalDuplicateOfServerCard(const CreditCard& other) const {
673 if (record_type() != LOCAL_CARD || other.record_type() == LOCAL_CARD) 673 if (record_type() != LOCAL_CARD || other.record_type() == LOCAL_CARD)
674 return false; 674 return false;
675 675
676 // If |this| is only a partial card, i.e. some fields are missing, assume 676 // If |this| is only a partial card, i.e. some fields are missing, assume
677 // those fields match. 677 // those fields match.
678 if ((!name_on_card_.empty() && name_on_card_ != other.name_on_card_) || 678 if ((!name_on_card_.empty() && name_on_card_ != other.name_on_card_) ||
679 (expiration_month_ != 0 && 679 (expiration_month_ != 0 &&
680 expiration_month_ != other.expiration_month_) || 680 expiration_month_ != other.expiration_month_) ||
681 (expiration_year_ != 0 && expiration_year_ != other.expiration_year_)) { 681 (expiration_year_ != 0 && expiration_year_ != other.expiration_year_) ||
682 (!billing_address_id_.empty() &&
683 billing_address_id_ != other.billing_address_id_)) {
682 return false; 684 return false;
683 } 685 }
684 686
685 if (number_.empty()) 687 if (number_.empty())
686 return true; 688 return true;
687 689
688 return HasSameNumberAs(other); 690 return HasSameNumberAs(other);
689 } 691 }
690 692
691 bool CreditCard::HasSameNumberAs(const CreditCard& other) const { 693 bool CreditCard::HasSameNumberAs(const CreditCard& other) const {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 const char kDinersCard[] = "dinersCC"; 932 const char kDinersCard[] = "dinersCC";
931 const char kDiscoverCard[] = "discoverCC"; 933 const char kDiscoverCard[] = "discoverCC";
932 const char kGenericCard[] = "genericCC"; 934 const char kGenericCard[] = "genericCC";
933 const char kJCBCard[] = "jcbCC"; 935 const char kJCBCard[] = "jcbCC";
934 const char kMasterCard[] = "masterCardCC"; 936 const char kMasterCard[] = "masterCardCC";
935 const char kMirCard[] = "mirCC"; 937 const char kMirCard[] = "mirCC";
936 const char kUnionPay[] = "unionPayCC"; 938 const char kUnionPay[] = "unionPayCC";
937 const char kVisaCard[] = "visaCC"; 939 const char kVisaCard[] = "visaCC";
938 940
939 } // namespace autofill 941 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_test_utils.cc ('k') | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698