OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ |
6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ | 6 #define COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 virtual void InvokePaymentApp(Delegate* delegate) = 0; | 38 virtual void InvokePaymentApp(Delegate* delegate) = 0; |
39 // Returns whether the instrument is complete to be used as a payment method | 39 // Returns whether the instrument is complete to be used as a payment method |
40 // without further editing. | 40 // without further editing. |
41 virtual bool IsCompleteForPayment() = 0; | 41 virtual bool IsCompleteForPayment() = 0; |
42 // Returns a message to indicate to the user what's missing for the instrument | 42 // Returns a message to indicate to the user what's missing for the instrument |
43 // to be complete for payment. | 43 // to be complete for payment. |
44 virtual base::string16 GetMissingInfoLabel() = 0; | 44 virtual base::string16 GetMissingInfoLabel() = 0; |
45 // Returns whether the instrument is valid for the purposes of responding to | 45 // Returns whether the instrument is valid for the purposes of responding to |
46 // canMakePayment. | 46 // canMakePayment. |
47 virtual bool IsValidForCanMakePayment() = 0; | 47 virtual bool IsValidForCanMakePayment() = 0; |
| 48 // Records the use of this payment instrument. |
| 49 virtual void RecordUse() = 0; |
48 | 50 |
49 const std::string& method_name() const { return method_name_; } | 51 const std::string& method_name() const { return method_name_; } |
50 const base::string16& label() const { return label_; } | 52 const base::string16& label() const { return label_; } |
51 const base::string16& sublabel() const { return sublabel_; } | 53 const base::string16& sublabel() const { return sublabel_; } |
52 int icon_resource_id() const { return icon_resource_id_; } | 54 int icon_resource_id() const { return icon_resource_id_; } |
53 Type type() { return type_; } | 55 Type type() { return type_; } |
54 | 56 |
55 protected: | 57 protected: |
56 PaymentInstrument(const std::string& method_name, | 58 PaymentInstrument(const std::string& method_name, |
57 const base::string16& label, | 59 const base::string16& label, |
58 const base::string16& sublabel, | 60 const base::string16& sublabel, |
59 int icon_resource_id, | 61 int icon_resource_id, |
60 Type type); | 62 Type type); |
61 | 63 |
62 private: | 64 private: |
63 const std::string method_name_; | 65 const std::string method_name_; |
64 const base::string16 label_; | 66 const base::string16 label_; |
65 const base::string16 sublabel_; | 67 const base::string16 sublabel_; |
66 int icon_resource_id_; | 68 int icon_resource_id_; |
67 Type type_; | 69 Type type_; |
68 | 70 |
69 DISALLOW_COPY_AND_ASSIGN(PaymentInstrument); | 71 DISALLOW_COPY_AND_ASSIGN(PaymentInstrument); |
70 }; | 72 }; |
71 | 73 |
72 } // namespace payments | 74 } // namespace payments |
73 | 75 |
74 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ | 76 #endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_ |
OLD | NEW |