Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: chrome/browser/autofill/wallet/full_wallet.h

Issue 11777007: Adds wallet::RequiredAction for when we start interacting with Online Wallet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ahutter@ review Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/autofill/wallet/full_wallet.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
6 #define CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_ 6 #define CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/autofill/wallet/required_action.h"
14 #include "chrome/browser/autofill/wallet/wallet_address.h" 15 #include "chrome/browser/autofill/wallet/wallet_address.h"
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
18 } 19 }
19 20
20 namespace wallet { 21 namespace wallet {
21 22
22 class FullWalletTest; 23 class FullWalletTest;
23 24
24 // FullWallet contains all the information a merchant requires from a user for 25 // FullWallet contains all the information a merchant requires from a user for
25 // that user to make a purchase. 26 // that user to make a purchase. This includes:
27 // - billing information
28 // - shipping information
29 // - a proxy card for the backing card selected from a user's wallet items
26 class FullWallet { 30 class FullWallet {
27 public: 31 public:
28 ~FullWallet(); 32 ~FullWallet();
29 33
30 // Returns an empty scoped_ptr if the input invalid, an empty wallet with 34 // Returns an empty scoped_ptr if the input invalid, an empty wallet with
31 // required actions if there are any, or a valid wallet. 35 // required actions if there are any, or a valid wallet.
32 static scoped_ptr<FullWallet> 36 static scoped_ptr<FullWallet>
33 CreateFullWallet(const base::DictionaryValue& dictionary); 37 CreateFullWallet(const base::DictionaryValue& dictionary);
34 38
35 // Decrypts and returns primary account number (PAN) using generated one time 39 // Decrypts and returns primary account number (PAN) using generated one time
36 // pad, |otp|. 40 // pad, |otp|.
37 const std::string& GetPan(void* otp, size_t length); 41 const std::string& GetPan(void* otp, size_t length);
38 42
39 // Decrypts and returns card verification number (CVN) using generated one 43 // Decrypts and returns card verification number (CVN) using generated one
40 // time pad, |otp|. 44 // time pad, |otp|.
41 const std::string& GetCvn(void* otp, size_t length); 45 const std::string& GetCvn(void* otp, size_t length);
42 46
43 bool operator==(const FullWallet& other) const; 47 bool operator==(const FullWallet& other) const;
44 bool operator!=(const FullWallet& other) const; 48 bool operator!=(const FullWallet& other) const;
45 49
46 // If there are required actions |billing_address_| might contain NULL. 50 // If there are required actions |billing_address_| might contain NULL.
47 const Address* billing_address() const { return billing_address_.get(); } 51 const Address* billing_address() const { return billing_address_.get(); }
48 52
49 // If there are required actions or shipping address is not required 53 // If there are required actions or shipping address is not required
50 // |shipping_address_| might contain NULL. 54 // |shipping_address_| might contain NULL.
51 const Address* shipping_address() const { return shipping_address_.get(); } 55 const Address* shipping_address() const { return shipping_address_.get(); }
52 56
53 const std::vector<std::string>& required_actions() const { 57 const std::vector<RequiredAction>& required_actions() const {
54 return required_actions_; 58 return required_actions_;
55 } 59 }
56 int expiration_month() const { return expiration_month_; } 60 int expiration_month() const { return expiration_month_; }
57 int expiration_year() const { return expiration_year_; } 61 int expiration_year() const { return expiration_year_; }
58 62
59 private: 63 private:
60 friend class FullWalletTest; 64 friend class FullWalletTest;
61 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet); 65 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet);
62 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions); 66 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions);
63 FullWallet(int expiration_month, 67 FullWallet(int expiration_month,
64 int expiration_year, 68 int expiration_year,
65 const std::string& iin, 69 const std::string& iin,
66 const std::string& encrypted_rest, 70 const std::string& encrypted_rest,
67 scoped_ptr<Address> billing_address, 71 scoped_ptr<Address> billing_address,
68 scoped_ptr<Address> shipping_address, 72 scoped_ptr<Address> shipping_address,
69 const std::vector<std::string>& required_actions); 73 const std::vector<RequiredAction>& required_actions);
70 void DecryptCardInfo(uint8* otp, size_t length); 74 void DecryptCardInfo(uint8* otp, size_t length);
71 int expiration_month_; 75 int expiration_month_;
72 int expiration_year_; 76 int expiration_year_;
73 // Primary account number (PAN). Its format is \d{16}. 77 // Primary account number (PAN). Its format is \d{16}.
74 std::string pan_; 78 std::string pan_;
75 // Card verification number (CVN). Its format is \d{3}. 79 // Card verification number (CVN). Its format is \d{3}.
76 std::string cvn_; 80 std::string cvn_;
77 // Issuer identification number (IIN). Its format is \d{6}. 81 // Issuer identification number (IIN). Its format is \d{6}.
78 std::string iin_; 82 std::string iin_;
79 // Encrypted concatentation of CVN and PAN without IIN 83 // Encrypted concatentation of CVN and PAN without IIN
80 std::string encrypted_rest_; 84 std::string encrypted_rest_;
81 scoped_ptr<Address> billing_address_; 85 scoped_ptr<Address> billing_address_;
82 scoped_ptr<Address> shipping_address_; 86 scoped_ptr<Address> shipping_address_;
83 // Actions that must be completed by the user before a FullWallet can be 87 // Actions that must be completed by the user before a FullWallet can be
84 // issued to them by the Online Wallet service. 88 // issued to them by the Online Wallet service.
85 // TODO(ahutter): |required_actions_| should be members of an enum not 89 std::vector<RequiredAction> required_actions_;
86 // strings. See http://crbug.com/165195.
87 std::vector<std::string> required_actions_;
88 DISALLOW_COPY_AND_ASSIGN(FullWallet); 90 DISALLOW_COPY_AND_ASSIGN(FullWallet);
89 }; 91 };
90 92
91 } // namespace wallet 93 } // namespace wallet
92 94
93 #endif // CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_ 95 #endif // CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
94 96
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/wallet/full_wallet.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698