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

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 latest 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/memory/scoped_ptr.h"
13 #include "chrome/browser/autofill/wallet/wallet_address.h"
14
15 namespace base {
16 class DictionaryValue;
17 }
18
19 namespace wallet {
20
21 // FullWallet contains all the information a merchant requires from a user for
22 // that user to make a purchase.
23 class FullWallet {
24 public:
25 // This constructor is only public for unit testing.
26 FullWallet(int expiration_month,
27 int expiration_year,
28 const std::string& iin,
29 const std::string& encrypted_rest,
30 Address* billing_address,
31 Address* shipping_address,
32 const std::vector<std::string> required_actions);
33
34 ~FullWallet();
35
36 // Returns null if the input invalid, an empty wallet with required actions if
37 // there are any, or a valid wallet. The caller owns the returned pointer.
38 static FullWallet* CreateFullWallet(const base::DictionaryValue& dictionary);
39
40 // Decrypts and returns primary account number (PAN) using generated one time
41 // pad (OTP).
42 const std::string GetPan(void* bytes, size_t length);
43
44 // Decrypts and returns card verification number (CVN) using generated one
45 // time pad (OTP).
46 const std::string GetCvn(void* bytes, size_t length);
47
48 bool operator==(const FullWallet& other) const;
49 bool operator!=(const FullWallet& other) const;
50
51 const Address* billing_address() const { return billing_address_.get(); }
52 const Address* shipping_address() const { return shipping_address_.get(); }
53 const std::vector<std::string> required_actions() const {
54 return required_actions_;
55 }
56 int expiration_month() const { return expiration_month_; }
57 int expiration_year() const { return expiration_year_; }
58
59 private:
60 void DecryptCardInfo(uint8* otp, size_t length);
61 int expiration_month_;
62 int expiration_year_;
63 // Primary account number (PAN)
64 std::string pan_;
65 // Card verification number (CVN)
66 std::string cvn_;
67 // Issuer identification number (IIN)
68 std::string iin_;
69 // Encrypted concatentation of CVN and PAN without IIN
70 std::string encrypted_rest_;
71 scoped_ptr<Address> billing_address_;
72 scoped_ptr<Address> shipping_address_;
73 std::vector<std::string> required_actions_;
74 DISALLOW_COPY_AND_ASSIGN(FullWallet);
75 };
76
77 } // end namespace wallet
78
79 #endif // CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698