| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_INSTRUMENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_INSTRUMENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_INSTRUMENT_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_INSTRUMENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 UNKNOWN, | 31 UNKNOWN, |
| 32 VISA, | 32 VISA, |
| 33 MASTER_CARD, | 33 MASTER_CARD, |
| 34 AMEX, | 34 AMEX, |
| 35 DISCOVER, | 35 DISCOVER, |
| 36 JCB, | 36 JCB, |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // Convert the info in |card| to an Instrument using |profile| for address. | 39 // Convert the info in |card| to an Instrument using |profile| for address. |
| 40 Instrument(const CreditCard& card, | 40 Instrument(const CreditCard& card, |
| 41 const string16& card_verification_number, | 41 const base::string16& card_verification_number, |
| 42 const AutofillProfile& profile); | 42 const AutofillProfile& profile); |
| 43 | 43 |
| 44 Instrument(const string16& primary_account_number, | 44 Instrument(const base::string16& primary_account_number, |
| 45 const string16& card_verification_number, | 45 const base::string16& card_verification_number, |
| 46 int expiration_month, | 46 int expiration_month, |
| 47 int expiration_year, | 47 int expiration_year, |
| 48 FormOfPayment form_of_payment, | 48 FormOfPayment form_of_payment, |
| 49 scoped_ptr<Address> address); | 49 scoped_ptr<Address> address); |
| 50 | 50 |
| 51 Instrument(const Instrument& instrument); | 51 Instrument(const Instrument& instrument); |
| 52 | 52 |
| 53 ~Instrument(); | 53 ~Instrument(); |
| 54 | 54 |
| 55 scoped_ptr<base::DictionaryValue> ToDictionary() const; | 55 scoped_ptr<base::DictionaryValue> ToDictionary() const; |
| 56 | 56 |
| 57 // Users of this class should call IsValid to check that the inputs provided | 57 // Users of this class should call IsValid to check that the inputs provided |
| 58 // in the constructor were valid for use with Google Wallet. | 58 // in the constructor were valid for use with Google Wallet. |
| 59 bool IsValid() const; | 59 bool IsValid() const; |
| 60 | 60 |
| 61 const string16& primary_account_number() const { | 61 const base::string16& primary_account_number() const { |
| 62 return primary_account_number_; | 62 return primary_account_number_; |
| 63 } | 63 } |
| 64 const string16& card_verification_number() const { | 64 const base::string16& card_verification_number() const { |
| 65 return card_verification_number_; | 65 return card_verification_number_; |
| 66 } | 66 } |
| 67 int expiration_month() const { return expiration_month_; } | 67 int expiration_month() const { return expiration_month_; } |
| 68 int expiration_year() const { return expiration_year_; } | 68 int expiration_year() const { return expiration_year_; } |
| 69 const Address& address() const { return *address_; } | 69 const Address& address() const { return *address_; } |
| 70 FormOfPayment form_of_payment() const { return form_of_payment_; } | 70 FormOfPayment form_of_payment() const { return form_of_payment_; } |
| 71 const string16& last_four_digits() { return last_four_digits_; } | 71 const base::string16& last_four_digits() { return last_four_digits_; } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 void Init(); | 74 void Init(); |
| 75 | 75 |
| 76 // |primary_account_number_| is expected to be \d{12-19}. | 76 // |primary_account_number_| is expected to be \d{12-19}. |
| 77 string16 primary_account_number_; | 77 base::string16 primary_account_number_; |
| 78 | 78 |
| 79 // |card_verification_number_| is expected to be \d{3-4}. | 79 // |card_verification_number_| is expected to be \d{3-4}. |
| 80 string16 card_verification_number_; | 80 base::string16 card_verification_number_; |
| 81 | 81 |
| 82 // |expiration month_| should be 1-12. | 82 // |expiration month_| should be 1-12. |
| 83 int expiration_month_; | 83 int expiration_month_; |
| 84 | 84 |
| 85 // |expiration_year_| should be a 4-digit year. | 85 // |expiration_year_| should be a 4-digit year. |
| 86 int expiration_year_; | 86 int expiration_year_; |
| 87 | 87 |
| 88 // The payment network of the instrument, e.g. Visa. | 88 // The payment network of the instrument, e.g. Visa. |
| 89 FormOfPayment form_of_payment_; | 89 FormOfPayment form_of_payment_; |
| 90 | 90 |
| 91 // The billing address of the instrument. | 91 // The billing address of the instrument. |
| 92 scoped_ptr<Address> address_; | 92 scoped_ptr<Address> address_; |
| 93 | 93 |
| 94 // The last four digits of |primary_account_number_|. | 94 // The last four digits of |primary_account_number_|. |
| 95 string16 last_four_digits_; | 95 base::string16 last_four_digits_; |
| 96 | 96 |
| 97 DISALLOW_ASSIGN(Instrument); | 97 DISALLOW_ASSIGN(Instrument); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace wallet | 100 } // namespace wallet |
| 101 } // namespace autofill | 101 } // namespace autofill |
| 102 | 102 |
| 103 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_INSTRUMENT_H_ | 103 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_INSTRUMENT_H_ |
| OLD | NEW |