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/ios/browser/credit_card_util.h" | 5 #include "components/autofill/ios/browser/credit_card_util.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #include "components/autofill/core/browser/autofill_type.h" | 8 #include "components/autofill/core/browser/autofill_type.h" |
9 #include "components/autofill/core/browser/credit_card.h" | 9 #include "components/autofill/core/browser/credit_card.h" |
10 | 10 |
11 namespace autofill { | 11 namespace autofill { |
12 | 12 |
13 NSString* GetCreditCardName(const CreditCard& credit_card, | 13 NSString* GetCreditCardName(const CreditCard& credit_card, |
14 const std::string& locale) { | 14 const std::string& locale) { |
15 return base::SysUTF16ToNSString(credit_card.GetInfo( | 15 return base::SysUTF16ToNSString(credit_card.GetInfo( |
16 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), locale)); | 16 autofill::AutofillType(autofill::CREDIT_CARD_NAME_FULL), locale)); |
17 } | 17 } |
18 | 18 |
19 NSString* GetCreditCardObfuscatedNumber(const CreditCard& credit_card) { | 19 NSString* GetCreditCardObfuscatedNumber(const CreditCard& credit_card) { |
20 return base::SysUTF16ToNSString(credit_card.TypeAndLastFourDigits()); | 20 return base::SysUTF16ToNSString(credit_card.NetworkAndLastFourDigits()); |
21 } | 21 } |
22 | 22 |
23 NSDateComponents* GetCreditCardExpirationDate(const CreditCard& credit_card) { | 23 NSDateComponents* GetCreditCardExpirationDate(const CreditCard& credit_card) { |
24 NSDateComponents* expiration_date = | 24 NSDateComponents* expiration_date = |
25 [[[NSDateComponents alloc] init] autorelease]; | 25 [[[NSDateComponents alloc] init] autorelease]; |
26 expiration_date.year = credit_card.expiration_year(); | 26 expiration_date.year = credit_card.expiration_year(); |
27 expiration_date.month = credit_card.expiration_month(); | 27 expiration_date.month = credit_card.expiration_month(); |
28 return expiration_date; | 28 return expiration_date; |
29 } | 29 } |
30 | 30 |
31 BOOL IsCreditCardLocal(const CreditCard& credit_card) { | 31 BOOL IsCreditCardLocal(const CreditCard& credit_card) { |
32 return credit_card.record_type() == autofill::CreditCard::LOCAL_CARD; | 32 return credit_card.record_type() == autofill::CreditCard::LOCAL_CARD; |
33 } | 33 } |
34 | 34 |
35 } // namespace autofill | 35 } // namespace autofill |
OLD | NEW |