Commit cfa4d6e9 authored by Anne Lim's avatar Anne Lim Committed by Commit Bot

[Autofill] Add instrument_id to CreditCard class

This is a follow-up after instrument_id has been added to the
AutofillTable in cr/2390970. Please refer to bug for design doc.

Bug: 1121806
Change-Id: Ie118b2dba1e0d7890333de35c92489398cdae6a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2402130Reviewed-by: default avatarAnne Lim <annelim@google.com>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Commit-Queue: Anne Lim <annelim@google.com>
Cr-Commit-Position: refs/heads/master@{#805880}
parent 136da76d
......@@ -556,6 +556,7 @@ void CreditCard::operator=(const CreditCard& credit_card) {
temp_card_last_name_ = credit_card.temp_card_last_name_;
nickname_ = credit_card.nickname_;
card_issuer_ = credit_card.card_issuer_;
instrument_id_ = credit_card.instrument_id_;
set_guid(credit_card.guid());
set_origin(credit_card.origin());
......@@ -1055,7 +1056,8 @@ std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card) {
<< " " << credit_card.record_type() << " "
<< credit_card.use_count() << " " << credit_card.use_date() << " "
<< credit_card.billing_address_id() << " " << credit_card.nickname()
<< " " << credit_card.card_issuer();
<< " " << credit_card.card_issuer() << " "
<< credit_card.instrument_id();
}
void CreditCard::SetNameOnCardFromSeparateParts() {
......
......@@ -147,6 +147,9 @@ class CreditCard : public AutofillDataModel {
const base::string16& nickname() const { return nickname_; }
int instrument_id() const { return instrument_id_; }
void set_instrument_id(int instrument_id) { instrument_id_ = instrument_id; }
// Set the nickname with the processed input (replace all tabs and newlines
// with whitespaces, and trim leading/trailing whitespaces).
void SetNickname(const base::string16& nickname);
......@@ -380,6 +383,11 @@ class CreditCard : public AutofillDataModel {
// The issuer for the card. This is populated from the sync response. It has a
// default value of CreditCard::ISSUER_UNKNOWN.
Issuer card_issuer_;
// For masked server cards, this is the ID assigned by the server to uniquely
// identify this card. |server_id_| is the legacy version of this.
// TODO(crbug.com/1121806): remove server_id_ after full deprecation
int instrument_id_;
};
// So we can compare CreditCards with EXPECT_EQ().
......
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