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 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // - a proxy card for the backing card selected from a user's wallet items | 31 // - a proxy card for the backing card selected from a user's wallet items |
32 class FullWallet { | 32 class FullWallet { |
33 public: | 33 public: |
34 ~FullWallet(); | 34 ~FullWallet(); |
35 | 35 |
36 // Returns an empty scoped_ptr if the input invalid, an empty wallet with | 36 // Returns an empty scoped_ptr if the input invalid, an empty wallet with |
37 // required actions if there are any, or a valid wallet. | 37 // required actions if there are any, or a valid wallet. |
38 static scoped_ptr<FullWallet> | 38 static scoped_ptr<FullWallet> |
39 CreateFullWallet(const base::DictionaryValue& dictionary); | 39 CreateFullWallet(const base::DictionaryValue& dictionary); |
40 | 40 |
| 41 // Returns a wallet built from the provided clear-text data. |
| 42 // Data is not validated; |pan|, |cvn| and |billing_address| must be set. |
| 43 static scoped_ptr<FullWallet> |
| 44 CreateFullWalletFromClearText(int expiration_month, |
| 45 int expiration_year, |
| 46 const std::string& pan, |
| 47 const std::string& cvn, |
| 48 scoped_ptr<Address> billing_address, |
| 49 scoped_ptr<Address> shipping_address); |
| 50 |
41 // Returns corresponding data for |type|. | 51 // Returns corresponding data for |type|. |
42 base::string16 GetInfo(AutofillFieldType type); | 52 base::string16 GetInfo(AutofillFieldType type); |
43 | 53 |
44 // Whether or not |action| is in |required_actions_|. | 54 // Whether or not |action| is in |required_actions_|. |
45 bool HasRequiredAction(RequiredAction action) const; | 55 bool HasRequiredAction(RequiredAction action) const; |
46 | 56 |
47 // The type of the card that this FullWallet contains and the last four digits | 57 // The type of the card that this FullWallet contains and the last four digits |
48 // like this "Visa - 4111". | 58 // like this "Visa - 4111". |
49 base::string16 TypeAndLastFourDigits(); | 59 base::string16 TypeAndLastFourDigits(); |
50 | 60 |
(...skipping 19 matching lines...) Expand all Loading... |
70 | 80 |
71 private: | 81 private: |
72 friend class FullWalletTest; | 82 friend class FullWalletTest; |
73 friend scoped_ptr<FullWallet> GetTestFullWallet(); | 83 friend scoped_ptr<FullWallet> GetTestFullWallet(); |
74 friend scoped_ptr<FullWallet> GetTestFullWalletInstrumentOnly(); | 84 friend scoped_ptr<FullWallet> GetTestFullWalletInstrumentOnly(); |
75 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet); | 85 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet); |
76 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions); | 86 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions); |
77 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthCorrectDecryptionTest); | 87 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthCorrectDecryptionTest); |
78 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthUnderDecryptionTest); | 88 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthUnderDecryptionTest); |
79 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, GetCreditCardInfo); | 89 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, GetCreditCardInfo); |
| 90 |
80 FullWallet(int expiration_month, | 91 FullWallet(int expiration_month, |
81 int expiration_year, | 92 int expiration_year, |
82 const std::string& iin, | 93 const std::string& iin, |
83 const std::string& encrypted_rest, | 94 const std::string& encrypted_rest, |
84 scoped_ptr<Address> billing_address, | 95 scoped_ptr<Address> billing_address, |
85 scoped_ptr<Address> shipping_address, | 96 scoped_ptr<Address> shipping_address, |
86 const std::vector<RequiredAction>& required_actions); | 97 const std::vector<RequiredAction>& required_actions); |
87 | 98 |
88 // Decrypts both |pan_| and |cvn_|. | 99 // Decrypts both |pan_| and |cvn_|. |
89 void DecryptCardInfo(); | 100 void DecryptCardInfo(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // The one time pad used for FullWallet encryption. | 138 // The one time pad used for FullWallet encryption. |
128 std::vector<uint8> one_time_pad_; | 139 std::vector<uint8> one_time_pad_; |
129 | 140 |
130 DISALLOW_COPY_AND_ASSIGN(FullWallet); | 141 DISALLOW_COPY_AND_ASSIGN(FullWallet); |
131 }; | 142 }; |
132 | 143 |
133 } // namespace wallet | 144 } // namespace wallet |
134 } // namespace autofill | 145 } // namespace autofill |
135 | 146 |
136 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ | 147 #endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_FULL_WALLET_H_ |
OLD | NEW |