Index: ios/chrome/browser/payments/payment_request.mm |
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm |
index 9af93a43adcf86a143ff5f51aeda91f88ab7a991..74ab610128f7815691398f26c6211a6b0dc84968 100644 |
--- a/ios/chrome/browser/payments/payment_request.mm |
+++ b/ios/chrome/browser/payments/payment_request.mm |
@@ -10,6 +10,7 @@ |
#include "components/autofill/core/browser/credit_card.h" |
#include "components/autofill/core/browser/personal_data_manager.h" |
#include "components/payments/core/currency_formatter.h" |
+#include "components/payments/core/payment_request_data_util.h" |
#include "ios/chrome/browser/application_context.h" |
#include "ios/web/public/payments/payment_request.h" |
@@ -83,10 +84,12 @@ void PaymentRequest::PopulateProfileCache() { |
} |
void PaymentRequest::PopulateCreditCardCache() { |
- for (const auto& method_data : web_payment_request_.method_data) { |
- for (const std::string& supported_method : method_data.supported_methods) { |
- supported_card_networks_.push_back(supported_method); |
- } |
+ if (!payments::data_util::ParseBasicCardSupportedNetworks( |
+ web_payment_request_.method_data, &supported_card_networks_, |
+ &basic_card_specified_networks_)) { |
+ // TODO(crbug.com/709036): close the UI and reject the promise since the |
+ // data is invalid. |
+ return; |
} |
const std::vector<autofill::CreditCard*>& credit_cards_to_suggest = |