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

Unified Diff: components/autofill/core/browser/validation.h

Issue 2813203004: [Payments] Show what's missing for incomplete payment methods. (Closed)
Patch Set: Initial Created 3 years, 8 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/autofill/core/browser/validation.h
diff --git a/components/autofill/core/browser/validation.h b/components/autofill/core/browser/validation.h
index 93a52e59b4f560d1d984fff0d0ebd5f5a5186409..6c0c1e24f4b92be43c6bac2e811620e0b96083ed 100644
--- a/components/autofill/core/browser/validation.h
+++ b/components/autofill/core/browser/validation.h
@@ -15,6 +15,8 @@ class Time;
namespace autofill {
+class CreditCard;
+
// Constants for the length of a CVC.
static const size_t GENERAL_CVC_LENGTH = 3;
static const size_t AMEX_CVC_LENGTH = 4;
@@ -42,6 +44,21 @@ bool IsValidCreditCardNumberForBasicCardNetworks(
const std::set<std::string>& supported_basic_card_networks,
base::string16* error_message);
+// 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);
+
+// A card is complete for Payment Request if it's not expired, its number is not
+// empty (a server card fills this condition) and there is a cardholder name.
+// If there is missing information, will return false and fill |missing_info|
+// with a proper string for display. |missing_info| can be nullptr if the caller
+// doesn't care about the missing info.
+// TODO(crbug.com/709776): Check for billing address association.
+bool IsCompleteForPaymentRequest(const CreditCard& credit_card,
+ const std::string& app_locale,
+ base::string16* missing_info);
+
// Returns true if |text| looks like a valid e-mail address.
bool IsValidEmailAddress(const base::string16& text);

Powered by Google App Engine
This is Rietveld 408576698