OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/content/browser/wallet/wallet_client.h" | 5 #include "components/autofill/content/browser/wallet/wallet_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 UTF16ToUTF8(instrument->primary_account_number()), true); | 401 UTF16ToUTF8(instrument->primary_account_number()), true); |
402 card_verification_number = net::EscapeUrlEncodedData( | 402 card_verification_number = net::EscapeUrlEncodedData( |
403 UTF16ToUTF8(instrument->card_verification_number()), true); | 403 UTF16ToUTF8(instrument->card_verification_number()), true); |
404 | 404 |
405 if (instrument->object_id().empty()) { | 405 if (instrument->object_id().empty()) { |
406 request_dict.Set(kInstrumentKey, instrument->ToDictionary().release()); | 406 request_dict.Set(kInstrumentKey, instrument->ToDictionary().release()); |
407 request_dict.SetString(kInstrumentPhoneNumberKey, | 407 request_dict.SetString(kInstrumentPhoneNumberKey, |
408 instrument->address()->phone_number()); | 408 instrument->address()->phone_number()); |
409 } else { | 409 } else { |
410 DCHECK(instrument->address() || | 410 DCHECK(instrument->address() || |
411 (instrument->expiration_month() > 0 && | 411 instrument->expiration_differs_from_server()); |
412 instrument->expiration_year() > 0)); | |
413 | 412 |
414 request_dict.SetString(kUpgradedInstrumentIdKey, | 413 request_dict.SetString(kUpgradedInstrumentIdKey, |
415 instrument->object_id()); | 414 instrument->object_id()); |
416 | 415 |
417 if (instrument->address()) { | 416 if (instrument->address()) { |
418 request_dict.SetString(kInstrumentPhoneNumberKey, | 417 request_dict.SetString(kInstrumentPhoneNumberKey, |
419 instrument->address()->phone_number()); | 418 instrument->address()->phone_number()); |
420 request_dict.Set( | 419 request_dict.Set( |
421 kUpgradedBillingAddressKey, | 420 kUpgradedBillingAddressKey, |
422 instrument->address()->ToDictionaryWithoutID().release()); | 421 instrument->address()->ToDictionaryWithoutID().release()); |
423 } | 422 } |
424 | 423 |
425 if (instrument->expiration_month() > 0 && | 424 if (instrument->expiration_differs_from_server()) { |
426 instrument->expiration_year() > 0) { | 425 // Updating expiration date requires a CVC. |
427 DCHECK(!instrument->card_verification_number().empty()); | 426 DCHECK(!instrument->card_verification_number().empty()); |
428 request_dict.SetInteger(kInstrumentExpMonthKey, | 427 request_dict.SetInteger(kInstrumentExpMonthKey, |
429 instrument->expiration_month()); | 428 instrument->expiration_month()); |
430 request_dict.SetInteger(kInstrumentExpYearKey, | 429 request_dict.SetInteger(kInstrumentExpYearKey, |
431 instrument->expiration_year()); | 430 instrument->expiration_year()); |
432 } | 431 } |
433 | 432 |
434 if (request_dict.HasKey(kInstrumentKey)) | 433 if (request_dict.HasKey(kInstrumentKey)) |
435 request_dict.SetString(kInstrumentType, "CREDIT_CARD"); | 434 request_dict.SetString(kInstrumentType, "CREDIT_CARD"); |
436 } | 435 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 NOTREACHED(); | 820 NOTREACHED(); |
822 return AutofillMetrics::UNKNOWN_API_CALL; | 821 return AutofillMetrics::UNKNOWN_API_CALL; |
823 } | 822 } |
824 | 823 |
825 NOTREACHED(); | 824 NOTREACHED(); |
826 return AutofillMetrics::UNKNOWN_API_CALL; | 825 return AutofillMetrics::UNKNOWN_API_CALL; |
827 } | 826 } |
828 | 827 |
829 } // namespace wallet | 828 } // namespace wallet |
830 } // namespace autofill | 829 } // namespace autofill |
OLD | NEW |