Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/payments/core/autofill_payment_instrument.h" | |
| 6 | |
| 7 #include "base/json/json_writer.h" | |
| 8 #include "base/strings/utf_string_conversions.h" | |
| 9 #include "base/values.h" | |
| 10 #include "components/autofill/core/browser/autofill_data_util.h" | |
| 11 #include "components/payments/core/basic_card_response.h" | |
| 12 #include "components/payments/core/payment_request_data_util.h" | |
| 13 | |
| 14 namespace payments { | |
| 15 | |
| 16 AutofillPaymentInstrument::AutofillPaymentInstrument( | |
| 17 const std::string& method_name, | |
| 18 const autofill::CreditCard& credit_card, | |
| 19 const std::vector<autofill::AutofillProfile*>& billing_profiles, | |
| 20 const std::string& app_locale) | |
| 21 : PaymentInstrument(method_name), | |
| 22 credit_card_(credit_card), | |
| 23 billing_profiles_(billing_profiles), | |
| 24 app_locale_(app_locale) {} | |
| 25 AutofillPaymentInstrument::~AutofillPaymentInstrument() {} | |
| 26 | |
| 27 void AutofillPaymentInstrument::InvokePaymentApp( | |
| 28 PaymentInstrument::Delegate* delegate) { | |
| 29 DCHECK(delegate); | |
| 30 std::string stringified_details; | |
| 31 // TODO(mathp): Show the CVC dialog and use the data instead of the | |
| 32 // placeholder string. | |
|
please use gerrit instead
2017/03/08 14:46:09
FYI, this can be accomplished via FullCardRequest
| |
| 33 std::unique_ptr<base::DictionaryValue> response_value = | |
| 34 payments::data_util::GetBasicCardResponseFromAutofillCreditCard( | |
| 35 credit_card_, base::ASCIIToUTF16("123"), billing_profiles_, | |
| 36 app_locale_) | |
| 37 .ToDictionaryValue(); | |
| 38 base::JSONWriter::Write(*response_value, &stringified_details); | |
| 39 delegate->OnInstrumentDetailsReady(method_name(), stringified_details); | |
| 40 } | |
| 41 | |
| 42 } // namespace payments | |
| OLD | NEW |