OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_FULL_WALLET_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_FULL_WALLET_H_ |
6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_FULL_WALLET_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_FULL_WALLET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 // - a proxy card for the backing card selected from a user's wallet items | 30 // - a proxy card for the backing card selected from a user's wallet items |
31 class FullWallet { | 31 class FullWallet { |
32 public: | 32 public: |
33 ~FullWallet(); | 33 ~FullWallet(); |
34 | 34 |
35 // Returns an empty scoped_ptr if the input invalid, an empty wallet with | 35 // Returns an empty scoped_ptr if the input invalid, an empty wallet with |
36 // required actions if there are any, or a valid wallet. | 36 // required actions if there are any, or a valid wallet. |
37 static scoped_ptr<FullWallet> | 37 static scoped_ptr<FullWallet> |
38 CreateFullWallet(const base::DictionaryValue& dictionary); | 38 CreateFullWallet(const base::DictionaryValue& dictionary); |
39 | 39 |
40 // Decrypts and returns the primary account number (PAN) using the generated | 40 // Returns corresponding data for |type|. |
41 // one time pad, |one_time_pad_|. | 41 string16 GetInfo(AutofillFieldType type); |
42 const std::string& GetPan(); | |
43 | |
44 // Decrypts and returns the card verification number (CVN) using the generated | |
45 // one time pad, |one_time_pad_|. | |
46 const std::string& GetCvn(); | |
47 | 42 |
48 // Whether or not |action| is in |required_actions_|. | 43 // Whether or not |action| is in |required_actions_|. |
49 bool HasRequiredAction(RequiredAction action) const; | 44 bool HasRequiredAction(RequiredAction action) const; |
50 | 45 |
51 bool operator==(const FullWallet& other) const; | 46 bool operator==(const FullWallet& other) const; |
52 bool operator!=(const FullWallet& other) const; | 47 bool operator!=(const FullWallet& other) const; |
53 | 48 |
54 // If there are required actions |billing_address_| might contain NULL. | 49 // If there are required actions |billing_address_| might contain NULL. |
55 const Address* billing_address() const { return billing_address_.get(); } | 50 const Address* billing_address() const { return billing_address_.get(); } |
56 | 51 |
(...skipping 15 matching lines...) Expand all Loading... |
72 friend class FullWalletTest; | 67 friend class FullWalletTest; |
73 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet); | 68 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet); |
74 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions); | 69 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions); |
75 FullWallet(int expiration_month, | 70 FullWallet(int expiration_month, |
76 int expiration_year, | 71 int expiration_year, |
77 const std::string& iin, | 72 const std::string& iin, |
78 const std::string& encrypted_rest, | 73 const std::string& encrypted_rest, |
79 scoped_ptr<Address> billing_address, | 74 scoped_ptr<Address> billing_address, |
80 scoped_ptr<Address> shipping_address, | 75 scoped_ptr<Address> shipping_address, |
81 const std::vector<RequiredAction>& required_actions); | 76 const std::vector<RequiredAction>& required_actions); |
| 77 |
| 78 // Decrypts both |pan_| and |cvn_|. |
82 void DecryptCardInfo(); | 79 void DecryptCardInfo(); |
83 | 80 |
| 81 // Decrypts and returns the primary account number (PAN) using the generated |
| 82 // one time pad, |one_time_pad_|. |
| 83 const std::string& GetPan(); |
| 84 |
| 85 // Decrypts and returns the card verification number (CVN) using the generated |
| 86 // one time pad, |one_time_pad_|. |
| 87 const std::string& GetCvn(); |
| 88 |
84 // The expiration month of the proxy card. It should be 1-12. | 89 // The expiration month of the proxy card. It should be 1-12. |
85 int expiration_month_; | 90 int expiration_month_; |
86 | 91 |
87 // The expiration year of the proxy card. It should be a 4-digit year. | 92 // The expiration year of the proxy card. It should be a 4-digit year. |
88 int expiration_year_; | 93 int expiration_year_; |
89 | 94 |
90 // Primary account number (PAN). Its format is \d{16}. | 95 // Primary account number (PAN). Its format is \d{16}. |
91 std::string pan_; | 96 std::string pan_; |
92 | 97 |
93 // Card verification number (CVN). Its format is \d{3}. | 98 // Card verification number (CVN). Its format is \d{3}. |
(...skipping 18 matching lines...) Expand all Loading... |
112 // The one time pad used for FullWallet encryption. | 117 // The one time pad used for FullWallet encryption. |
113 std::vector<uint8> one_time_pad_; | 118 std::vector<uint8> one_time_pad_; |
114 | 119 |
115 DISALLOW_COPY_AND_ASSIGN(FullWallet); | 120 DISALLOW_COPY_AND_ASSIGN(FullWallet); |
116 }; | 121 }; |
117 | 122 |
118 } // namespace wallet | 123 } // namespace wallet |
119 } // namespace autofill | 124 } // namespace autofill |
120 | 125 |
121 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_FULL_WALLET_H_ | 126 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_FULL_WALLET_H_ |
OLD | NEW |