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 IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ | 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ |
6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ | 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "components/autofill/core/browser/credit_card.h" |
15 #include "components/payments/core/payment_options_provider.h" | 16 #include "components/payments/core/payment_options_provider.h" |
16 #include "components/payments/core/payment_request_base_delegate.h" | 17 #include "components/payments/core/payment_request_base_delegate.h" |
17 #include "components/payments/core/payments_profile_comparator.h" | 18 #include "components/payments/core/payments_profile_comparator.h" |
18 #include "ios/web/public/payments/payment_request.h" | 19 #include "ios/web/public/payments/payment_request.h" |
19 | 20 |
20 namespace autofill { | 21 namespace autofill { |
21 class AutofillProfile; | 22 class AutofillProfile; |
22 class CreditCard; | |
23 class PersonalDataManager; | 23 class PersonalDataManager; |
24 class RegionDataLoader; | 24 class RegionDataLoader; |
25 } // namespace autofill | 25 } // namespace autofill |
26 | 26 |
27 namespace payments { | 27 namespace payments { |
28 class AddressNormalizer; | 28 class AddressNormalizer; |
29 class AddressNormalizerImpl; | 29 class AddressNormalizerImpl; |
30 class CurrencyFormatter; | 30 class CurrencyFormatter; |
31 } // namespace payments | 31 } // namespace payments |
32 | 32 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 const std::set<std::string>& basic_card_specified_networks() const { | 154 const std::set<std::string>& basic_card_specified_networks() const { |
155 return basic_card_specified_networks_; | 155 return basic_card_specified_networks_; |
156 } | 156 } |
157 | 157 |
158 const std::map<std::string, std::set<std::string>>& stringified_method_data() | 158 const std::map<std::string, std::set<std::string>>& stringified_method_data() |
159 const { | 159 const { |
160 return stringified_method_data_; | 160 return stringified_method_data_; |
161 } | 161 } |
162 | 162 |
| 163 const std::set<autofill::CreditCard::CardType>& supported_card_types_set() |
| 164 const { |
| 165 return supported_card_types_set_; |
| 166 } |
| 167 |
163 // Adds |credit_card| to the list of cached credit cards, updates the list of | 168 // Adds |credit_card| to the list of cached credit cards, updates the list of |
164 // available credit cards, and returns a reference to the cached copy of | 169 // available credit cards, and returns a reference to the cached copy of |
165 // |credit_card|. | 170 // |credit_card|. |
166 virtual autofill::CreditCard* AddCreditCard( | 171 virtual autofill::CreditCard* AddCreditCard( |
167 const autofill::CreditCard& credit_card); | 172 const autofill::CreditCard& credit_card); |
168 | 173 |
169 // Returns the available autofill credit cards for this user that match a | 174 // Returns the available autofill credit cards for this user that match a |
170 // supported type specified in |web_payment_request_|. | 175 // supported type specified in |web_payment_request_|. |
171 const std::vector<autofill::CreditCard*>& credit_cards() const { | 176 const std::vector<autofill::CreditCard*>& credit_cards() const { |
172 return credit_cards_; | 177 return credit_cards_; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 std::vector<std::string> supported_card_networks_; | 275 std::vector<std::string> supported_card_networks_; |
271 // A subset of |supported_card_networks_| which is only the networks that have | 276 // A subset of |supported_card_networks_| which is only the networks that have |
272 // been specified as part of the "basic-card" supported method. Callers should | 277 // been specified as part of the "basic-card" supported method. Callers should |
273 // use |supported_card_networks_| for merchant support checks. | 278 // use |supported_card_networks_| for merchant support checks. |
274 std::set<std::string> basic_card_specified_networks_; | 279 std::set<std::string> basic_card_specified_networks_; |
275 | 280 |
276 // A mapping of the payment method names to the corresponding JSON-stringified | 281 // A mapping of the payment method names to the corresponding JSON-stringified |
277 // payment method specific data. | 282 // payment method specific data. |
278 std::map<std::string, std::set<std::string>> stringified_method_data_; | 283 std::map<std::string, std::set<std::string>> stringified_method_data_; |
279 | 284 |
| 285 // The set of supported card types (e.g., credit, debit, prepaid). |
| 286 std::set<autofill::CreditCard::CardType> supported_card_types_set_; |
| 287 |
280 // A vector of pointers to the shipping options in |web_payment_request_|. | 288 // A vector of pointers to the shipping options in |web_payment_request_|. |
281 std::vector<web::PaymentShippingOption*> shipping_options_; | 289 std::vector<web::PaymentShippingOption*> shipping_options_; |
282 web::PaymentShippingOption* selected_shipping_option_; | 290 web::PaymentShippingOption* selected_shipping_option_; |
283 | 291 |
284 payments::PaymentsProfileComparator profile_comparator_; | 292 payments::PaymentsProfileComparator profile_comparator_; |
285 | 293 |
286 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 294 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
287 }; | 295 }; |
288 | 296 |
289 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ | 297 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ |
OLD | NEW |