OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/autofill/core/browser/payments/payments_client.h" | 5 #include "components/autofill/core/browser/payments/payments_client.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 net::EscapeUrlEncodedData(json_request, true).c_str(), | 334 net::EscapeUrlEncodedData(json_request, true).c_str(), |
335 net::EscapeUrlEncodedData(base::UTF16ToASCII(pan), true).c_str(), | 335 net::EscapeUrlEncodedData(base::UTF16ToASCII(pan), true).c_str(), |
336 net::EscapeUrlEncodedData(base::UTF16ToASCII(request_details_.cvc), | 336 net::EscapeUrlEncodedData(base::UTF16ToASCII(request_details_.cvc), |
337 true) | 337 true) |
338 .c_str()); | 338 .c_str()); |
339 VLOG(3) << "savecard request body: " << request_content; | 339 VLOG(3) << "savecard request body: " << request_content; |
340 return request_content; | 340 return request_content; |
341 } | 341 } |
342 | 342 |
343 void ParseResponse(std::unique_ptr<base::DictionaryValue> response) override { | 343 void ParseResponse(std::unique_ptr<base::DictionaryValue> response) override { |
| 344 response->GetString("credit_card_id", &server_id_); |
344 } | 345 } |
345 | 346 |
346 bool IsResponseComplete() override { return true; } | 347 bool IsResponseComplete() override { return true; } |
347 | 348 |
348 void RespondToDelegate(PaymentsClientDelegate* delegate, | 349 void RespondToDelegate(PaymentsClientDelegate* delegate, |
349 AutofillClient::PaymentsRpcResult result) override { | 350 AutofillClient::PaymentsRpcResult result) override { |
350 delegate->OnDidUploadCard(result); | 351 delegate->OnDidUploadCard(result, server_id_); |
351 } | 352 } |
352 | 353 |
353 private: | 354 private: |
354 PaymentsClient::UploadRequestDetails request_details_; | 355 PaymentsClient::UploadRequestDetails request_details_; |
| 356 std::string server_id_; |
355 }; | 357 }; |
356 | 358 |
357 } // namespace | 359 } // namespace |
358 | 360 |
359 const char PaymentsClient::kRecipientName[] = "recipient_name"; | 361 const char PaymentsClient::kRecipientName[] = "recipient_name"; |
360 const char PaymentsClient::kPhoneNumber[] = "phone_number"; | 362 const char PaymentsClient::kPhoneNumber[] = "phone_number"; |
361 | 363 |
362 PaymentsClient::UnmaskRequestDetails::UnmaskRequestDetails() {} | 364 PaymentsClient::UnmaskRequestDetails::UnmaskRequestDetails() {} |
363 PaymentsClient::UnmaskRequestDetails::~UnmaskRequestDetails() {} | 365 PaymentsClient::UnmaskRequestDetails::~UnmaskRequestDetails() {} |
364 | 366 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 589 |
588 void PaymentsClient::SetOAuth2TokenAndStartRequest() { | 590 void PaymentsClient::SetOAuth2TokenAndStartRequest() { |
589 url_fetcher_->AddExtraRequestHeader(net::HttpRequestHeaders::kAuthorization + | 591 url_fetcher_->AddExtraRequestHeader(net::HttpRequestHeaders::kAuthorization + |
590 std::string(": Bearer ") + access_token_); | 592 std::string(": Bearer ") + access_token_); |
591 | 593 |
592 url_fetcher_->Start(); | 594 url_fetcher_->Start(); |
593 } | 595 } |
594 | 596 |
595 } // namespace payments | 597 } // namespace payments |
596 } // namespace autofill | 598 } // namespace autofill |
OLD | NEW |