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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 void FullCardRequest::OnUnmaskResponse(const UnmaskResponse& response) { | 71 void FullCardRequest::OnUnmaskResponse(const UnmaskResponse& response) { |
72 if (!response.exp_month.empty()) | 72 if (!response.exp_month.empty()) |
73 request_->card.SetRawInfo(CREDIT_CARD_EXP_MONTH, response.exp_month); | 73 request_->card.SetRawInfo(CREDIT_CARD_EXP_MONTH, response.exp_month); |
74 | 74 |
75 if (!response.exp_year.empty()) | 75 if (!response.exp_year.empty()) |
76 request_->card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, response.exp_year); | 76 request_->card.SetRawInfo(CREDIT_CARD_EXP_4_DIGIT_YEAR, response.exp_year); |
77 | 77 |
78 if (request_->card.record_type() == CreditCard::LOCAL_CARD && | 78 if (request_->card.record_type() == CreditCard::LOCAL_CARD && |
| 79 !request_->card.guid().empty() && |
79 (!response.exp_month.empty() || !response.exp_year.empty())) { | 80 (!response.exp_month.empty() || !response.exp_year.empty())) { |
80 personal_data_manager_->UpdateCreditCard(request_->card); | 81 personal_data_manager_->UpdateCreditCard(request_->card); |
81 } | 82 } |
82 | 83 |
83 if (!should_unmask_card_) { | 84 if (!should_unmask_card_) { |
84 if (delegate_) | 85 if (delegate_) |
85 delegate_->OnFullCardDetails(request_->card, response.cvc); | 86 delegate_->OnFullCardDetails(request_->card, response.cvc); |
86 Reset(); | 87 Reset(); |
87 autofill_client_->OnUnmaskVerificationResult(AutofillClient::SUCCESS); | 88 autofill_client_->OnUnmaskVerificationResult(AutofillClient::SUCCESS); |
88 return; | 89 return; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void FullCardRequest::Reset() { | 158 void FullCardRequest::Reset() { |
158 weak_ptr_factory_.InvalidateWeakPtrs(); | 159 weak_ptr_factory_.InvalidateWeakPtrs(); |
159 payments_client_->CancelRequest(); | 160 payments_client_->CancelRequest(); |
160 delegate_ = nullptr; | 161 delegate_ = nullptr; |
161 request_.reset(); | 162 request_.reset(); |
162 should_unmask_card_ = false; | 163 should_unmask_card_ = false; |
163 } | 164 } |
164 | 165 |
165 } // namespace payments | 166 } // namespace payments |
166 } // namespace autofill | 167 } // namespace autofill |
OLD | NEW |