OLD | NEW |
---|---|
(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. | |
Ilya Sherman
2012/12/14 04:56:43
nit: Please instead make it private (or at most pr
ahutter
2012/12/15 01:06:31
Done.
| |
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); | |
Ilya Sherman
2012/12/14 04:56:43
nit: Pass by reference.
ahutter
2012/12/15 01:06:31
Done.
| |
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); | |
Ilya Sherman
2012/12/14 04:56:43
This method should return a scoped_ptr<> rather th
ahutter
2012/12/15 01:06:31
Done.
| |
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). | |
Evan Stade
2012/12/07 19:57:44
please use variable names in your documentation, l
ahutter
2012/12/15 01:06:31
Done.
| |
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(); } | |
Ilya Sherman
2012/12/14 04:56:43
nit: Please return by const-reference instead of c
ahutter
2012/12/15 01:06:31
They could be NULL. What should I do in that case
Ilya Sherman
2012/12/15 01:23:59
Ah, in that case const pointer is ok, but please d
| |
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_; | |
Evan Stade
2012/12/07 19:57:44
docs on the format they're stored in
ahutter
2012/12/15 01:06:31
Done.
| |
65 // Card verification number (CVN) | |
66 std::string cvn_; | |
Evan Stade
2012/12/07 19:57:44
why is this not an int of some kind
ahutter
2012/12/15 01:06:31
There can be leading zeros.
Evan Stade
2012/12/15 02:22:37
I don't see how that leads to ambiguity. You know
| |
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_; | |
Evan Stade
2012/12/07 19:57:44
docs
ahutter
2012/12/15 01:06:31
Done. Added a TODO and bug to clean this up a litt
| |
74 DISALLOW_COPY_AND_ASSIGN(FullWallet); | |
75 }; | |
76 | |
77 } // end namespace wallet | |
78 | |
79 #endif // CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_ | |
80 | |
OLD | NEW |