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/payments/payment_request_coordinator.h" | 5 #import "ios/chrome/browser/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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 card.GetRawInfo(autofill::CREDIT_CARD_EXP_MONTH); | 193 card.GetRawInfo(autofill::CREDIT_CARD_EXP_MONTH); |
194 paymentResponse.details.expiry_year = | 194 paymentResponse.details.expiry_year = |
195 card.GetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR); | 195 card.GetRawInfo(autofill::CREDIT_CARD_EXP_4_DIGIT_YEAR); |
196 paymentResponse.details.card_security_code = cvc; | 196 paymentResponse.details.card_security_code = cvc; |
197 if (!card.billing_address_id().empty()) { | 197 if (!card.billing_address_id().empty()) { |
198 autofill::AutofillProfile* address = | 198 autofill::AutofillProfile* address = |
199 autofill::PersonalDataManager::GetProfileFromProfilesByGUID( | 199 autofill::PersonalDataManager::GetProfileFromProfilesByGUID( |
200 card.billing_address_id(), _paymentRequest->billing_profiles()); | 200 card.billing_address_id(), _paymentRequest->billing_profiles()); |
201 if (address) { | 201 if (address) { |
202 paymentResponse.details.billing_address = | 202 paymentResponse.details.billing_address = |
203 payment_request_util::PaymentAddressFromAutofillProfile(address); | 203 payment_request_util::GetPaymentAddressFromAutofillProfile(address); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 _viewController.view.userInteractionEnabled = NO; | 207 _viewController.view.userInteractionEnabled = NO; |
208 [_viewController setPending:YES]; | 208 [_viewController setPending:YES]; |
209 [_viewController loadModel]; | 209 [_viewController loadModel]; |
210 [[_viewController collectionView] reloadData]; | 210 [[_viewController collectionView] reloadData]; |
211 | 211 |
212 [_delegate paymentRequestCoordinator:self | 212 [_delegate paymentRequestCoordinator:self |
213 didConfirmWithPaymentResponse:paymentResponse]; | 213 didConfirmWithPaymentResponse:paymentResponse]; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 #pragma mark - ShippingAddressSelectionCoordinatorDelegate | 351 #pragma mark - ShippingAddressSelectionCoordinatorDelegate |
352 | 352 |
353 - (void)shippingAddressSelectionCoordinator: | 353 - (void)shippingAddressSelectionCoordinator: |
354 (ShippingAddressSelectionCoordinator*)coordinator | 354 (ShippingAddressSelectionCoordinator*)coordinator |
355 didSelectShippingAddress: | 355 didSelectShippingAddress: |
356 (autofill::AutofillProfile*)shippingAddress { | 356 (autofill::AutofillProfile*)shippingAddress { |
357 _pendingShippingAddress = shippingAddress; | 357 _pendingShippingAddress = shippingAddress; |
358 | 358 |
359 web::PaymentAddress address = | 359 web::PaymentAddress address = |
360 payment_request_util::PaymentAddressFromAutofillProfile(shippingAddress); | 360 payment_request_util::GetPaymentAddressFromAutofillProfile( |
| 361 shippingAddress); |
361 [_delegate paymentRequestCoordinator:self didSelectShippingAddress:address]; | 362 [_delegate paymentRequestCoordinator:self didSelectShippingAddress:address]; |
362 } | 363 } |
363 | 364 |
364 - (void)shippingAddressSelectionCoordinatorDidReturn: | 365 - (void)shippingAddressSelectionCoordinatorDidReturn: |
365 (ShippingAddressSelectionCoordinator*)coordinator { | 366 (ShippingAddressSelectionCoordinator*)coordinator { |
366 // Clear the 'Updated' label on the payment summary item, if there is one. | 367 // Clear the 'Updated' label on the payment summary item, if there is one. |
367 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; | 368 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
368 | 369 |
369 [_shippingAddressSelectionCoordinator stop]; | 370 [_shippingAddressSelectionCoordinator stop]; |
370 _shippingAddressSelectionCoordinator = nil; | 371 _shippingAddressSelectionCoordinator = nil; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 - (void)paymentMethodSelectionCoordinatorDidReturn: | 409 - (void)paymentMethodSelectionCoordinatorDidReturn: |
409 (PaymentMethodSelectionCoordinator*)coordinator { | 410 (PaymentMethodSelectionCoordinator*)coordinator { |
410 // Clear the 'Updated' label on the payment summary item, if there is one. | 411 // Clear the 'Updated' label on the payment summary item, if there is one. |
411 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; | 412 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; |
412 | 413 |
413 [_methodSelectionCoordinator stop]; | 414 [_methodSelectionCoordinator stop]; |
414 _methodSelectionCoordinator = nil; | 415 _methodSelectionCoordinator = nil; |
415 } | 416 } |
416 | 417 |
417 @end | 418 @end |
OLD | NEW |