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_CONTENT_PAYMENT_REQUEST_SPEC_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ | 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 bool request_payer_name() const { return options_->request_payer_name; } | 46 bool request_payer_name() const { return options_->request_payer_name; } |
47 bool request_payer_phone() const { return options_->request_payer_phone; } | 47 bool request_payer_phone() const { return options_->request_payer_phone; } |
48 bool request_payer_email() const { return options_->request_payer_email; } | 48 bool request_payer_email() const { return options_->request_payer_email; } |
49 | 49 |
50 const std::vector<std::string>& supported_card_networks() const { | 50 const std::vector<std::string>& supported_card_networks() const { |
51 return supported_card_networks_; | 51 return supported_card_networks_; |
52 } | 52 } |
53 const std::set<std::string>& supported_card_networks_set() const { | 53 const std::set<std::string>& supported_card_networks_set() const { |
54 return supported_card_networks_set_; | 54 return supported_card_networks_set_; |
55 } | 55 } |
| 56 // Returns whether the |method_name| was specified as supported through the |
| 57 // "basic-card" payment method. If false, it means either the |method_name| is |
| 58 // not supported at all, or specified directly in supportedMethods. |
| 59 bool IsMethodSupportedThroughBasicCard(const std::string& method_name); |
56 | 60 |
57 // Uses CurrencyFormatter to format |amount| with the currency symbol for this | 61 // Uses CurrencyFormatter to format |amount| with the currency symbol for this |
58 // request's currency. Will use currency of the "total" display item, because | 62 // request's currency. Will use currency of the "total" display item, because |
59 // all items are supposed to have the same currency in a given request. | 63 // all items are supposed to have the same currency in a given request. |
60 base::string16 GetFormattedCurrencyAmount(const std::string& amount); | 64 base::string16 GetFormattedCurrencyAmount(const std::string& amount); |
61 | 65 |
62 // Uses CurrencyFormatter to get the formatted currency code for this | 66 // Uses CurrencyFormatter to get the formatted currency code for this |
63 // request's currency. Will use currency of the "total" display item, because | 67 // request's currency. Will use currency of the "total" display item, because |
64 // all items are supposed to have the same currency in a given request. | 68 // all items are supposed to have the same currency in a given request. |
65 std::string GetFormattedCurrencyCode(); | 69 std::string GetFormattedCurrencyCode(); |
(...skipping 22 matching lines...) Expand all Loading... |
88 mojom::PaymentDetailsPtr details_; | 92 mojom::PaymentDetailsPtr details_; |
89 const std::string app_locale_; | 93 const std::string app_locale_; |
90 std::unique_ptr<CurrencyFormatter> currency_formatter_; | 94 std::unique_ptr<CurrencyFormatter> currency_formatter_; |
91 | 95 |
92 // A list/set of supported basic card networks. The list is used to keep the | 96 // A list/set of supported basic card networks. The list is used to keep the |
93 // order in which they were specified by the merchant. The set is used for | 97 // order in which they were specified by the merchant. The set is used for |
94 // fast lookup of supported methods. | 98 // fast lookup of supported methods. |
95 std::vector<std::string> supported_card_networks_; | 99 std::vector<std::string> supported_card_networks_; |
96 std::set<std::string> supported_card_networks_set_; | 100 std::set<std::string> supported_card_networks_set_; |
97 | 101 |
| 102 // Only the set of basic-card specified networks. NOTE: callers should use |
| 103 // |supported_card_networks_set_| to check merchant support. |
| 104 std::set<std::string> basic_card_specified_networks_; |
| 105 |
98 base::ObserverList<Observer> observers_; | 106 base::ObserverList<Observer> observers_; |
99 | 107 |
100 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSpec); | 108 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSpec); |
101 }; | 109 }; |
102 | 110 |
103 } // namespace payments | 111 } // namespace payments |
104 | 112 |
105 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ | 113 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
OLD | NEW |