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

Unified Diff: components/payments/core/payment_request_data_util.h

Issue 2800713003: [Payments] Move parsing the PaymentMethodData to "core" (Closed)
Patch Set: fix test 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/payments/core/payment_request_data_util.h
diff --git a/components/payments/core/payment_request_data_util.h b/components/payments/core/payment_request_data_util.h
index 5ad8e190e2284b55e8613163957c0bb77e01d6ca..f5fdb63eb3f7f95b12c7047a23d91c363d0e8c31 100644
--- a/components/payments/core/payment_request_data_util.h
+++ b/components/payments/core/payment_request_data_util.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_
#define COMPONENTS_PAYMENTS_CORE_PAYMENT_REQUEST_DATA_UTIL_H_
+#include <set>
#include <string>
#include <vector>
@@ -19,6 +20,7 @@ namespace payments {
struct BasicCardResponse;
struct PaymentAddress;
+class PaymentMethodData;
namespace data_util {
@@ -36,6 +38,21 @@ BasicCardResponse GetBasicCardResponseFromAutofillCreditCard(
const std::vector<autofill::AutofillProfile*>& billing_profiles,
const std::string& app_locale);
+// Parse the supported card networks from supportedMethods and "basic-card"'s
+// supportedNetworks. |out_supported_networks| is filled with list of networks
+// in the order that they were specified by the merchant.
+// |out_basic_card_supported_networks| is a subset of |out_supported_networks|
+// that includes all networks that were specified as part of "basic-card". This
+// is used to know whether to return the card network name (e.g., "visa") or
+// "basic-card" in the PaymentResponse. Returns true on success, false on
+// invalid data specified. |method_data.supported_networks| is expected to only
+// contain basic-card card network names (the list is at
+// https://www.w3.org/Payments/card-network-ids).
+bool ParseBasicCardSupportedNetworks(
+ const std::vector<PaymentMethodData>& method_data,
+ std::vector<std::string>* out_supported_networks,
+ std::set<std::string>* out_basic_card_supported_networks);
+
} // namespace data_util
} // namespace payments
« no previous file with comments | « components/payments/content/payment_request_spec.cc ('k') | components/payments/core/payment_request_data_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698