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

Unified Diff: components/payments/core/autofill_payment_instrument.cc

Issue 2757523002: [Payments] Use PaymentInstrument/AutofillPaymentInstrument throughout. (Closed)
Patch Set: addressed nits Created 3 years, 9 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/payments/core/autofill_payment_instrument.cc
diff --git a/components/payments/core/autofill_payment_instrument.cc b/components/payments/core/autofill_payment_instrument.cc
index 3f55efdde6d3333de27487f7af29a185e400d102..00c59b6a925aba1bbd78977b27abd9f7be1cf508 100644
--- a/components/payments/core/autofill_payment_instrument.cc
+++ b/components/payments/core/autofill_payment_instrument.cc
@@ -15,11 +15,18 @@ namespace payments {
AutofillPaymentInstrument::AutofillPaymentInstrument(
const std::string& method_name,
- const autofill::CreditCard& credit_card,
+ const autofill::CreditCard& card,
const std::vector<autofill::AutofillProfile*>& billing_profiles,
const std::string& app_locale)
- : PaymentInstrument(method_name),
- credit_card_(credit_card),
+ : PaymentInstrument(
+ method_name,
+ /* label= */ card.TypeAndLastFourDigits(),
+ /* sublabel= */
+ card.GetInfo(autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL),
+ app_locale),
+ autofill::data_util::GetPaymentRequestData(card.type())
+ .icon_resource_id),
+ credit_card_(card),
billing_profiles_(billing_profiles),
app_locale_(app_locale) {}
AutofillPaymentInstrument::~AutofillPaymentInstrument() {}
@@ -39,4 +46,8 @@ void AutofillPaymentInstrument::InvokePaymentApp(
delegate->OnInstrumentDetailsReady(method_name(), stringified_details);
}
+bool AutofillPaymentInstrument::IsValid() {
+ return credit_card_.IsValid();
+}
+
} // namespace payments
« no previous file with comments | « components/payments/core/autofill_payment_instrument.h ('k') | components/payments/core/payment_instrument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698