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/autofill/core/browser/payments/full_card_request.h" | 5 #include "components/autofill/core/browser/payments/full_card_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 autofill_client_->LoadRiskData( | 61 autofill_client_->LoadRiskData( |
62 base::Bind(&FullCardRequest::OnDidGetUnmaskRiskData, | 62 base::Bind(&FullCardRequest::OnDidGetUnmaskRiskData, |
63 weak_ptr_factory_.GetWeakPtr())); | 63 weak_ptr_factory_.GetWeakPtr())); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 bool FullCardRequest::IsGettingFullCard() const { | 67 bool FullCardRequest::IsGettingFullCard() const { |
68 return !!request_; | 68 return !!request_; |
69 } | 69 } |
70 | 70 |
| 71 // TODO(crbug.com/656981): Update the credit card expiration on file. |
71 void FullCardRequest::OnUnmaskResponse(const UnmaskResponse& response) { | 72 void FullCardRequest::OnUnmaskResponse(const UnmaskResponse& response) { |
72 if (!response.exp_month.empty()) | 73 if (!response.exp_month.empty()) |
73 request_->card.SetRawInfo(CREDIT_CARD_EXP_MONTH, response.exp_month); | 74 request_->card.SetRawInfo(CREDIT_CARD_EXP_MONTH, response.exp_month); |
74 | 75 |
75 if (!response.exp_year.empty()) | 76 if (!response.exp_year.empty()) |
76 request_->card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, response.exp_year); | 77 request_->card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, response.exp_year); |
77 | 78 |
78 if (request_->card.record_type() == CreditCard::LOCAL_CARD && | 79 if (request_->card.record_type() == CreditCard::LOCAL_CARD && |
79 !request_->card.guid().empty() && | 80 !request_->card.guid().empty() && |
80 (!response.exp_month.empty() || !response.exp_year.empty())) { | 81 (!response.exp_month.empty() || !response.exp_year.empty())) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 void FullCardRequest::Reset() { | 159 void FullCardRequest::Reset() { |
159 weak_ptr_factory_.InvalidateWeakPtrs(); | 160 weak_ptr_factory_.InvalidateWeakPtrs(); |
160 payments_client_->CancelRequest(); | 161 payments_client_->CancelRequest(); |
161 delegate_ = nullptr; | 162 delegate_ = nullptr; |
162 request_.reset(); | 163 request_.reset(); |
163 should_unmask_card_ = false; | 164 should_unmask_card_ = false; |
164 } | 165 } |
165 | 166 |
166 } // namespace payments | 167 } // namespace payments |
167 } // namespace autofill | 168 } // namespace autofill |
OLD | NEW |