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

Unified 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: Fixed linter issue 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/wallet/full_wallet.h
diff --git a/chrome/browser/autofill/wallet/full_wallet.h b/chrome/browser/autofill/wallet/full_wallet.h
new file mode 100644
index 0000000000000000000000000000000000000000..18d8b14a178634d07cd515246b8828b47238be89
--- /dev/null
+++ b/chrome/browser/autofill/wallet/full_wallet.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
+#define CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/autofill/wallet/wallet_address.h"
+
+namespace base {
+class DictionaryValue;
+}
+
+namespace wallet {
+
+// FullWallet contains all the information a merchant requires from a user for
+// that user to make a purchase.
+class FullWallet {
+ public:
+ // 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.
+ FullWallet(int expiration_month,
+ int expiration_year,
+ const std::string& iin,
+ const std::string& encrypted_rest,
+ Address* billing_address,
+ Address* shipping_address,
+ 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.
+
+ ~FullWallet();
+
+ // Returns null if the input invalid, an empty wallet with required actions if
+ // there are any, or a valid wallet. The caller owns the returned pointer.
+ 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.
+
+ // Decrypts and returns primary account number (PAN) using generated one time
+ // pad (OTP).
+ const std::string GetPan(void* bytes, size_t length);
+
+ // Decrypts and returns card verification number (CVN) using generated one
+ // 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.
+ const std::string GetCvn(void* bytes, size_t length);
+
+ bool operator==(const FullWallet& other) const;
+ bool operator!=(const FullWallet& other) const;
+
+ const Address* billing_address() const { return billing_address_.get(); }
+ 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
+ const std::vector<std::string> required_actions() const {
+ return required_actions_;
+ }
+ int expiration_month() const { return expiration_month_; }
+ int expiration_year() const { return expiration_year_; }
+
+ private:
+ void DecryptCardInfo(uint8* otp, size_t length);
+ int expiration_month_;
+ int expiration_year_;
+ // Primary account number (PAN)
+ 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.
+ // Card verification number (CVN)
+ 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
+ // Issuer identification number (IIN)
+ std::string iin_;
+ // Encrypted concatentation of CVN and PAN without IIN
+ std::string encrypted_rest_;
+ scoped_ptr<Address> billing_address_;
+ scoped_ptr<Address> shipping_address_;
+ 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
+ DISALLOW_COPY_AND_ASSIGN(FullWallet);
+};
+
+} // end namespace wallet
+
+#endif // CHROME_BROWSER_AUTOFILL_WALLET_FULL_WALLET_H_
+

Powered by Google App Engine
This is Rietveld 408576698