OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/payments/content/payment_request_state.h" | 5 #include "components/payments/content/payment_request_state.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Once the response is ready, will call back into OnPaymentResponseReady. | 81 // Once the response is ready, will call back into OnPaymentResponseReady. |
82 response_helper_ = base::MakeUnique<PaymentResponseHelper>( | 82 response_helper_ = base::MakeUnique<PaymentResponseHelper>( |
83 app_locale_, spec_, selected_instrument_, payment_request_delegate_, | 83 app_locale_, spec_, selected_instrument_, payment_request_delegate_, |
84 selected_shipping_profile_, selected_contact_profile_, this); | 84 selected_shipping_profile_, selected_contact_profile_, this); |
85 } | 85 } |
86 | 86 |
87 void PaymentRequestState::AddAutofillPaymentInstrument( | 87 void PaymentRequestState::AddAutofillPaymentInstrument( |
88 bool selected, | 88 bool selected, |
89 const autofill::CreditCard& card) { | 89 const autofill::CreditCard& card) { |
90 std::string basic_card_network = | 90 std::string basic_card_network = |
91 autofill::data_util::GetPaymentRequestData(card.type()) | 91 autofill::data_util::GetPaymentRequestData(card.network()) |
92 .basic_card_payment_type; | 92 .basic_card_issuer_network; |
93 if (!spec_->supported_card_networks_set().count(basic_card_network)) | 93 if (!spec_->supported_card_networks_set().count(basic_card_network)) |
94 return; | 94 return; |
95 | 95 |
96 // AutofillPaymentInstrument makes a copy of |card| so it is effectively | 96 // AutofillPaymentInstrument makes a copy of |card| so it is effectively |
97 // owned by this object. | 97 // owned by this object. |
98 std::unique_ptr<PaymentInstrument> instrument = | 98 std::unique_ptr<PaymentInstrument> instrument = |
99 base::MakeUnique<AutofillPaymentInstrument>( | 99 base::MakeUnique<AutofillPaymentInstrument>( |
100 basic_card_network, card, shipping_profiles_, app_locale_, | 100 basic_card_network, card, shipping_profiles_, app_locale_, |
101 payment_request_delegate_); | 101 payment_request_delegate_); |
102 available_instruments_.push_back(std::move(instrument)); | 102 available_instruments_.push_back(std::move(instrument)); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 bool PaymentRequestState::ArePaymentOptionsSatisfied() { | 244 bool PaymentRequestState::ArePaymentOptionsSatisfied() { |
245 // TODO(mathp): Have a measure of shipping address completeness. | 245 // TODO(mathp): Have a measure of shipping address completeness. |
246 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr) | 246 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr) |
247 return false; | 247 return false; |
248 | 248 |
249 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_); | 249 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_); |
250 return comparator.IsContactInfoComplete(selected_contact_profile_); | 250 return comparator.IsContactInfoComplete(selected_contact_profile_); |
251 } | 251 } |
252 | 252 |
253 } // namespace payments | 253 } // namespace payments |
OLD | NEW |