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

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

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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_INSTRUMENT_H_
6 #define CHROME_BROWSER_AUTOFILL_WALLET_INSTRUMENT_H_
7
8 #include <string>
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/string16.h"
12
13 namespace base {
14 class DictionaryValue;
15 }
16
17 namespace autofill {
18 namespace wallet {
19
20 class Address;
21
22 // This class contains all the data necessary to save a new instrument to a
23 // user's Google Wallet using WalletClient::SaveInstrument or
24 // WalletClient::SaveInstrumentAndAddress.
25 class Instrument {
26 public:
27 enum FormOfPayment {
28 UNKNOWN,
29 VISA,
30 MASTER_CARD,
31 AMEX,
32 DISCOVER,
33 JCB,
34 };
35
36 Instrument(const string16& primary_account_number,
37 const string16& card_verification_number,
38 int expiration_month,
39 int expiration_year,
40 FormOfPayment form_of_payment,
41 scoped_ptr<Address> address);
42 ~Instrument();
43
44 scoped_ptr<base::DictionaryValue> ToDictionary() const;
45
46 // Users of this class should call IsValid to check that the inputs provided
47 // in the constructor were valid for use with Google Wallet.
48 bool IsValid() const;
49
50 const string16& primary_account_number() const {
51 return primary_account_number_;
52 }
53 const string16& card_verification_number() const {
54 return card_verification_number_;
55 }
56 int expiration_month() const { return expiration_month_; }
57 int expiration_year() const { return expiration_year_; }
58 const Address& address() const { return *address_; }
59 FormOfPayment form_of_payment() const { return form_of_payment_; }
60 const string16& last_four_digits() { return last_four_digits_; }
61
62 private:
63 // |primary_account_number_| is expected to be \d{12-19}.
64 string16 primary_account_number_;
65
66 // |card_verification_number_| is expected to be \d{3-4}.
67 string16 card_verification_number_;
68
69 // |expiration month_| should be 1-12.
70 int expiration_month_;
71
72 // |expiration_year_| should be a 4-digit year.
73 int expiration_year_;
74
75 // The payment network of the instrument, e.g. Visa.
76 FormOfPayment form_of_payment_;
77
78 // The billing address of the instrument.
79 scoped_ptr<Address> address_;
80
81 // The last four digits of |primary_account_number_|.
82 string16 last_four_digits_;
83
84 DISALLOW_COPY_AND_ASSIGN(Instrument);
85 };
86
87 } // namespace wallet
88 } // namespace autofill
89
90 #endif // CHROME_BROWSER_AUTOFILL_WALLET_INSTRUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698