| 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 398edb70f90faf1fc894814e61755c95390ae106..c05a048806d06c51b40e18831459350651a2eda6 100644
|
| --- a/components/payments/core/autofill_payment_instrument.cc
|
| +++ b/components/payments/core/autofill_payment_instrument.cc
|
| @@ -10,6 +10,7 @@
|
| #include "components/autofill/core/browser/autofill_data_util.h"
|
| #include "components/autofill/core/browser/autofill_type.h"
|
| #include "components/autofill/core/browser/field_types.h"
|
| +#include "components/autofill/core/browser/validation.h"
|
| #include "components/autofill/core/common/autofill_clock.h"
|
| #include "components/payments/core/basic_card_response.h"
|
| #include "components/payments/core/payment_request_data_util.h"
|
| @@ -17,20 +18,6 @@
|
|
|
| namespace payments {
|
|
|
| -namespace {
|
| -
|
| -// Returns whether |card| has a non-empty number and cardholder name. Server
|
| -// cards will have a non-empty number.
|
| -bool CreditCardHasNumberAndName(const autofill::CreditCard& card,
|
| - const std::string& app_locale) {
|
| - return !card.number().empty() &&
|
| - !card.GetInfo(autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL),
|
| - app_locale)
|
| - .empty();
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| AutofillPaymentInstrument::AutofillPaymentInstrument(
|
| const std::string& method_name,
|
| const autofill::CreditCard& card,
|
| @@ -67,17 +54,15 @@ void AutofillPaymentInstrument::InvokePaymentApp(
|
| weak_ptr_factory_.GetWeakPtr());
|
| }
|
|
|
| -bool AutofillPaymentInstrument::IsCompleteForPayment() {
|
| - // A card is complete for payment if it's not expired, its number is not
|
| - // empty (a server card fills this condition) and there is a cardholder name.
|
| - // TODO(crbug.com/709776): Check for billing address association.
|
| - return !credit_card_.IsExpired(autofill::AutofillClock::Now()) &&
|
| - CreditCardHasNumberAndName(credit_card_, app_locale_);
|
| +bool AutofillPaymentInstrument::IsCompleteForPayment(
|
| + base::string16* missing_info) {
|
| + return autofill::IsCompleteForPaymentRequest(credit_card_, app_locale_,
|
| + missing_info);
|
| }
|
|
|
| bool AutofillPaymentInstrument::IsValidForCanMakePayment() {
|
| // An expired card is still valid for the purposes of canMakePayment.
|
| - return CreditCardHasNumberAndName(credit_card_, app_locale_);
|
| + return autofill::CreditCardHasNumberAndName(credit_card_, app_locale_);
|
| }
|
|
|
| void AutofillPaymentInstrument::OnFullCardRequestSucceeded(
|
|
|