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

Unified Diff: components/payments/content/payment_request_state.cc

Issue 2779453002: [Payments] Return the preferred payment method name to the merchant (Closed)
Patch Set: Created 3 years, 9 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/content/payment_request_state.cc
diff --git a/components/payments/content/payment_request_state.cc b/components/payments/content/payment_request_state.cc
index f727b09e80f77e3445789fb1da7b51048cb383db..71a9cc0b55944b91966d48ac108d987a7241af2e 100644
--- a/components/payments/content/payment_request_state.cc
+++ b/components/payments/content/payment_request_state.cc
@@ -15,6 +15,8 @@
namespace payments {
+const char kBasicCardMethodName[] = "basic-card";
+
PaymentRequestState::PaymentRequestState(
PaymentRequestSpec* spec,
Delegate* delegate,
@@ -63,7 +65,13 @@ void PaymentRequestState::OnInstrumentDetailsReady(
// TODO(mathp): Fill other fields in the PaymentResponsePtr object.
mojom::PaymentResponsePtr payment_response = mojom::PaymentResponse::New();
- payment_response->method_name = method_name;
+ // Make sure that we return the method name that the merchant specified for
+ // this instrument: cards can be either specified through their name (e.g.,
+ // "visa") or through basic-card's supportedNetworks.
+ payment_response->method_name =
+ spec_->IsMethodSupportedThroughBasicCard(method_name)
+ ? kBasicCardMethodName
+ : method_name;
payment_response->stringified_details = stringified_details;
delegate_->OnPaymentResponseAvailable(std::move(payment_response));
}

Powered by Google App Engine
This is Rietveld 408576698