Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Side by Side Diff: ios/chrome/browser/ui/payments/payment_request_coordinator.mm

Issue 2842463002: [Payments] Normalize billing address for response on Desktop. (Closed)
Patch Set: Addressed comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/payments/core/payment_request_data_util_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/payments/core/payment_request_data_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698