OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/chrome/browser/ui/payments/payment_request_coordinator.h" | 5 #import "ios/chrome/browser/ui/payments/payment_request_coordinator.h" |
6 | 6 |
7 #include <unordered_set> | 7 #include <unordered_set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 _fullCardRequester->GetFullCard(card, _autofillManager); | 204 _fullCardRequester->GetFullCard(card, _autofillManager); |
205 } | 205 } |
206 | 206 |
207 - (void)fullCardRequestDidSucceedWithCard:(const autofill::CreditCard&)card | 207 - (void)fullCardRequestDidSucceedWithCard:(const autofill::CreditCard&)card |
208 CVC:(const base::string16&)cvc { | 208 CVC:(const base::string16&)cvc { |
209 web::PaymentResponse paymentResponse; | 209 web::PaymentResponse paymentResponse; |
210 | 210 |
211 // If the merchant specified the card network as part of the "basic-card" | 211 // If the merchant specified the card network as part of the "basic-card" |
212 // payment method, return "basic-card" as the method_name. Otherwise, return | 212 // payment method, return "basic-card" as the method_name. Otherwise, return |
213 // the name of the network directly. | 213 // the name of the network directly. |
214 std::string basic_card_type = | 214 std::string issuer_network = |
215 autofill::data_util::GetPaymentRequestData(card.type()) | 215 autofill::data_util::GetPaymentRequestData(card.network()) |
216 .basic_card_payment_type; | 216 .basic_card_issuer_network; |
217 paymentResponse.method_name = | 217 paymentResponse.method_name = |
218 _paymentRequest->basic_card_specified_networks().find(basic_card_type) != | 218 _paymentRequest->basic_card_specified_networks().find(issuer_network) != |
219 _paymentRequest->basic_card_specified_networks().end() | 219 _paymentRequest->basic_card_specified_networks().end() |
220 ? base::ASCIIToUTF16("basic-card") | 220 ? base::ASCIIToUTF16("basic-card") |
221 : base::ASCIIToUTF16(basic_card_type); | 221 : base::ASCIIToUTF16(issuer_network); |
222 | 222 |
223 paymentResponse.details = GetBasicCardResponseFromAutofillCreditCard( | 223 paymentResponse.details = GetBasicCardResponseFromAutofillCreditCard( |
224 card, cvc, _paymentRequest->billing_profiles(), | 224 card, cvc, _paymentRequest->billing_profiles(), |
225 GetApplicationContext()->GetApplicationLocale()); | 225 GetApplicationContext()->GetApplicationLocale()); |
226 | 226 |
227 if (_paymentRequest->request_shipping()) { | 227 if (_paymentRequest->request_shipping()) { |
228 autofill::AutofillProfile* shippingAddress = | 228 autofill::AutofillProfile* shippingAddress = |
229 _paymentRequest->selected_shipping_profile(); | 229 _paymentRequest->selected_shipping_profile(); |
230 // TODO(crbug.com/602666): User should get here only if they have selected | 230 // TODO(crbug.com/602666): User should get here only if they have selected |
231 // a shipping address. | 231 // a shipping address. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 - (void)paymentMethodSelectionCoordinatorDidReturn: | 479 - (void)paymentMethodSelectionCoordinatorDidReturn: |
480 (PaymentMethodSelectionCoordinator*)coordinator { | 480 (PaymentMethodSelectionCoordinator*)coordinator { |
481 // Clear the 'Updated' label on the payment summary item, if there is one. | 481 // Clear the 'Updated' label on the payment summary item, if there is one. |
482 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; | 482 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
483 | 483 |
484 [_methodSelectionCoordinator stop]; | 484 [_methodSelectionCoordinator stop]; |
485 _methodSelectionCoordinator = nil; | 485 _methodSelectionCoordinator = nil; |
486 } | 486 } |
487 | 487 |
488 @end | 488 @end |
OLD | NEW |