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

Unified Diff: ios/chrome/browser/payments/payment_request.mm

Issue 2803543005: [Payments] iOS: Support basic-card (Closed)
Patch Set: addressed comments 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: 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..86625b5af19e8744c7b3036359acb78e624ce8fd 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,21 +84,18 @@ 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 =
personal_data_manager_->GetCreditCardsToSuggest();
credit_card_cache_.reserve(credit_cards_to_suggest.size());
- // TODO(crbug.com/602666): Update the following logic to allow basic card
- // payment. https://w3c.github.io/webpayments-methods-card/
- // new PaymentRequest([{supportedMethods: ['basic-card'],
- // data: {supportedNetworks:['visa']}]}], ...);
-
for (const auto* credit_card : credit_cards_to_suggest) {
std::string spec_card_type =
autofill::data_util::GetPaymentRequestData(credit_card->type())
« no previous file with comments | « ios/chrome/browser/payments/payment_request.h ('k') | ios/chrome/browser/payments/payment_request_coordinator.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698