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 <set> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "ios/web/public/payments/payment_request.h" | 12 #include "ios/web/public/payments/payment_request.h" |
12 | 13 |
13 namespace autofill { | 14 namespace autofill { |
14 class AutofillProfile; | 15 class AutofillProfile; |
15 class CreditCard; | 16 class CreditCard; |
16 class PersonalDataManager; | 17 class PersonalDataManager; |
17 } // namespace autofill | 18 } // namespace autofill |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Returns the available autofill profiles for this user to be used as | 94 // Returns the available autofill profiles for this user to be used as |
94 // billing profiles. | 95 // billing profiles. |
95 const std::vector<autofill::AutofillProfile*>& billing_profiles() const { | 96 const std::vector<autofill::AutofillProfile*>& billing_profiles() const { |
96 return shipping_profiles_; | 97 return shipping_profiles_; |
97 } | 98 } |
98 | 99 |
99 const std::vector<std::string>& supported_card_networks() const { | 100 const std::vector<std::string>& supported_card_networks() const { |
100 return supported_card_networks_; | 101 return supported_card_networks_; |
101 } | 102 } |
102 | 103 |
| 104 const std::set<std::string>& basic_card_specified_networks() const { |
| 105 return basic_card_specified_networks_; |
| 106 } |
| 107 |
103 // Adds |credit_card| to the list of cached credit cards and returns a pointer | 108 // Adds |credit_card| to the list of cached credit cards and returns a pointer |
104 // to the cached copy. | 109 // to the cached copy. |
105 virtual autofill::CreditCard* AddCreditCard( | 110 virtual autofill::CreditCard* AddCreditCard( |
106 const autofill::CreditCard& credit_card); | 111 const autofill::CreditCard& credit_card); |
107 | 112 |
108 // Returns the available autofill credit cards for this user that match a | 113 // Returns the available autofill credit cards for this user that match a |
109 // supported type specified in |web_payment_request_|. | 114 // supported type specified in |web_payment_request_|. |
110 const std::vector<autofill::CreditCard*>& credit_cards() const { | 115 const std::vector<autofill::CreditCard*>& credit_cards() const { |
111 return credit_cards_; | 116 return credit_cards_; |
112 } | 117 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 176 |
172 // Credit cards returnd by the Data Manager may change due to (e.g.) | 177 // Credit cards returnd by the Data Manager may change due to (e.g.) |
173 // sync events, meaning PaymentRequest may outlive them. Therefore, credit | 178 // sync events, meaning PaymentRequest may outlive them. Therefore, credit |
174 // cards are fetched once and their copies are cached here. Whenever credit | 179 // cards are fetched once and their copies are cached here. Whenever credit |
175 // cards are requested a vector of pointers to these copies are returned. | 180 // cards are requested a vector of pointers to these copies are returned. |
176 std::vector<autofill::CreditCard> credit_card_cache_; | 181 std::vector<autofill::CreditCard> credit_card_cache_; |
177 | 182 |
178 std::vector<autofill::CreditCard*> credit_cards_; | 183 std::vector<autofill::CreditCard*> credit_cards_; |
179 autofill::CreditCard* selected_credit_card_; | 184 autofill::CreditCard* selected_credit_card_; |
180 | 185 |
181 // A vector of supported basic card networks. | 186 // A vector of supported basic card networks. This encompasses everything that |
| 187 // the merchant supports and should be used for support checks. |
182 std::vector<std::string> supported_card_networks_; | 188 std::vector<std::string> supported_card_networks_; |
| 189 // A subset of |supported_card_networks_| which is only the networks that have |
| 190 // been specified as part of the "basic-card" supported method. Callers should |
| 191 // use |supported_card_networks_| for merchant support checks. |
| 192 std::set<std::string> basic_card_specified_networks_; |
183 | 193 |
184 // A vector of pointers to the shipping options in |web_payment_request_|. | 194 // A vector of pointers to the shipping options in |web_payment_request_|. |
185 std::vector<web::PaymentShippingOption*> shipping_options_; | 195 std::vector<web::PaymentShippingOption*> shipping_options_; |
186 web::PaymentShippingOption* selected_shipping_option_; | 196 web::PaymentShippingOption* selected_shipping_option_; |
187 | 197 |
188 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); | 198 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); |
189 }; | 199 }; |
190 | 200 |
191 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ | 201 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_H_ |
OLD | NEW |