Chromium Code Reviews| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 // the name of the network directly. | 213 // the name of the network directly. |
| 214 std::string basic_card_type = | 214 std::string basic_card_type = |
| 215 autofill::data_util::GetPaymentRequestData(card.type()) | 215 autofill::data_util::GetPaymentRequestData(card.type()) |
| 216 .basic_card_payment_type; | 216 .basic_card_payment_type; |
| 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(basic_card_type) != |
| 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(basic_card_type); |
| 222 | 222 |
| 223 // Get the billing address | |
| 224 autofill::AutofillProfile billing_address; | |
|
Moe
2017/04/26 18:03:49
s/billing_address/billingAddress
sebsg
2017/04/26 18:28:26
Done.
| |
| 225 | |
| 226 // TODO(crbug.com/714768): Make sure the billing address is set and valid | |
| 227 // before getting here. Once the bug is addressed, there will be no need to | |
| 228 // copy the address, *billing_address_ptr can be used to get the basic card | |
| 229 // response. | |
| 230 if (!card.billing_address_id().empty()) { | |
| 231 autofill::AutofillProfile* billing_address_ptr = | |
| 232 autofill::PersonalDataManager::GetProfileFromProfilesByGUID( | |
|
Moe
2017/04/26 18:03:49
s/billing_address_ptr/billingAddressPtr
sebsg
2017/04/26 18:28:26
Done.
| |
| 233 card.billing_address_id(), _paymentRequest->billing_profiles()); | |
| 234 if (billing_address_ptr) | |
| 235 billing_address = *billing_address_ptr; | |
| 236 } | |
| 237 | |
| 223 paymentResponse.details = GetBasicCardResponseFromAutofillCreditCard( | 238 paymentResponse.details = GetBasicCardResponseFromAutofillCreditCard( |
| 224 card, cvc, _paymentRequest->billing_profiles(), | 239 card, cvc, billing_address, |
| 225 GetApplicationContext()->GetApplicationLocale()); | 240 GetApplicationContext()->GetApplicationLocale()); |
| 226 | 241 |
| 227 if (_paymentRequest->request_shipping()) { | 242 if (_paymentRequest->request_shipping()) { |
| 228 autofill::AutofillProfile* shippingAddress = | 243 autofill::AutofillProfile* shippingAddress = |
| 229 _paymentRequest->selected_shipping_profile(); | 244 _paymentRequest->selected_shipping_profile(); |
| 230 // TODO(crbug.com/602666): User should get here only if they have selected | 245 // TODO(crbug.com/602666): User should get here only if they have selected |
| 231 // a shipping address. | 246 // a shipping address. |
| 232 DCHECK(shippingAddress); | 247 DCHECK(shippingAddress); |
| 233 paymentResponse.shipping_address = GetPaymentAddressFromAutofillProfile( | 248 paymentResponse.shipping_address = GetPaymentAddressFromAutofillProfile( |
| 234 *shippingAddress, GetApplicationContext()->GetApplicationLocale()); | 249 *shippingAddress, GetApplicationContext()->GetApplicationLocale()); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 - (void)paymentMethodSelectionCoordinatorDidReturn: | 494 - (void)paymentMethodSelectionCoordinatorDidReturn: |
| 480 (PaymentMethodSelectionCoordinator*)coordinator { | 495 (PaymentMethodSelectionCoordinator*)coordinator { |
| 481 // Clear the 'Updated' label on the payment summary item, if there is one. | 496 // Clear the 'Updated' label on the payment summary item, if there is one. |
| 482 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; | 497 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
| 483 | 498 |
| 484 [_methodSelectionCoordinator stop]; | 499 [_methodSelectionCoordinator stop]; |
| 485 _methodSelectionCoordinator = nil; | 500 _methodSelectionCoordinator = nil; |
| 486 } | 501 } |
| 487 | 502 |
| 488 @end | 503 @end |
| OLD | NEW |