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

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

Issue 11293078: Integrating Online Wallet into Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes from code review Created 8 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
6 #define CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/autofill/wallet/wallet_address.h"
15
16 namespace base {
17 class DictionaryValue;
18 }
19
20 namespace wallet {
21
22 class FullWalletTest;
23
24 // FullWallet contains all the information a merchant requires from a user for
25 // that user to make a purchase.
26 class FullWallet {
27 public:
28 ~FullWallet();
29
30 // Returns an empty scoped_ptr if the input invalid, an empty wallet with
31 // required actions if there are any, or a valid wallet.
32 static scoped_ptr<FullWallet>
33 CreateFullWallet(const base::DictionaryValue& dictionary);
34
35 // Decrypts and returns primary account number (PAN) using generated one time
36 // pad, |otp|.
37 const std::string& GetPan(void* otp, size_t length);
38
39 // Decrypts and returns card verification number (CVN) using generated one
40 // time pad, |otp|.
41 const std::string& GetCvn(void* otp, size_t length);
42
43 bool operator==(const FullWallet& other) const;
44 bool operator!=(const FullWallet& other) const;
45
46 const Address* billing_address() const { return billing_address_.get(); }
47 const Address* shipping_address() const { return shipping_address_.get(); }
48 const std::vector<std::string>& required_actions() const {
49 return required_actions_;
50 }
51 int expiration_month() const { return expiration_month_; }
52 int expiration_year() const { return expiration_year_; }
53
54 private:
55 friend class FullWalletTest;
56 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWallet);
57 FRIEND_TEST_ALL_PREFIXES(FullWalletTest, CreateFullWalletWithRequiredActions);
58 FullWallet(int expiration_month,
59 int expiration_year,
60 const std::string& iin,
61 const std::string& encrypted_rest,
62 scoped_ptr<Address> billing_address,
63 scoped_ptr<Address> shipping_address,
64 const std::vector<std::string>& required_actions);
65 void DecryptCardInfo(uint8* otp, size_t length);
66 int expiration_month_;
67 int expiration_year_;
68 // Primary account number (PAN). Its format is \d{16}.
69 std::string pan_;
70 // Card verification number (CVN). Its format is \d{3}.
71 std::string cvn_;
72 // Issuer identification number (IIN). Its format is \d{6}.
73 std::string iin_;
74 // Encrypted concatentation of CVN and PAN without IIN
75 std::string encrypted_rest_;
76 scoped_ptr<Address> billing_address_;
77 scoped_ptr<Address> shipping_address_;
78 // Actions that must be completed by the user before a FullWallet can be
79 // issued to them by the Online Wallet service.
80 // TODO(ahutter): |required_actions_| should be members of an enum not
81 // strings. See http://crbug.com/165195.
82 std::vector<std::string> required_actions_;
83 DISALLOW_COPY_AND_ASSIGN(FullWallet);
84 };
85
86 } // namespace wallet
87
88 #endif // CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
89
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698