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

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

Issue 2803543005: [Payments] iOS: Support basic-card (Closed)
Patch Set: addressed comments Created 3 years, 8 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
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/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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 autofill::CreditCard* card = _paymentRequest->selected_credit_card(); 201 autofill::CreditCard* card = _paymentRequest->selected_credit_card();
202 _fullCardRequester = base::MakeUnique<FullCardRequester>( 202 _fullCardRequester = base::MakeUnique<FullCardRequester>(
203 self, _navigationController, _browserState); 203 self, _navigationController, _browserState);
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"
212 // payment method, return "basic-card" as the method_name. Otherwise, return
213 // the name of the network directly.
214 std::string basic_card_type =
215 autofill::data_util::GetPaymentRequestData(card.type())
216 .basic_card_payment_type;
211 paymentResponse.method_name = 217 paymentResponse.method_name =
212 base::ASCIIToUTF16(autofill::data_util::GetPaymentRequestData(card.type()) 218 _paymentRequest->basic_card_specified_networks().find(basic_card_type) !=
213 .basic_card_payment_type); 219 _paymentRequest->basic_card_specified_networks().end()
220 ? base::ASCIIToUTF16("basic-card")
221 : base::ASCIIToUTF16(basic_card_type);
214 222
215 paymentResponse.details = GetBasicCardResponseFromAutofillCreditCard( 223 paymentResponse.details = GetBasicCardResponseFromAutofillCreditCard(
216 card, cvc, _paymentRequest->billing_profiles(), 224 card, cvc, _paymentRequest->billing_profiles(),
217 GetApplicationContext()->GetApplicationLocale()); 225 GetApplicationContext()->GetApplicationLocale());
218 226
219 if (_paymentRequest->payment_options().request_shipping) { 227 if (_paymentRequest->payment_options().request_shipping) {
220 autofill::AutofillProfile* shippingAddress = 228 autofill::AutofillProfile* shippingAddress =
221 _paymentRequest->selected_shipping_profile(); 229 _paymentRequest->selected_shipping_profile();
222 // 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
223 // a shipping address. 231 // a shipping address.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 - (void)paymentMethodSelectionCoordinatorDidReturn: 474 - (void)paymentMethodSelectionCoordinatorDidReturn:
467 (PaymentMethodSelectionCoordinator*)coordinator { 475 (PaymentMethodSelectionCoordinator*)coordinator {
468 // Clear the 'Updated' label on the payment summary item, if there is one. 476 // Clear the 'Updated' label on the payment summary item, if there is one.
469 [_viewController updatePaymentSummaryWithTotalValueChanged:NO]; 477 [_viewController updatePaymentSummaryWithTotalValueChanged:NO];
470 478
471 [_methodSelectionCoordinator stop]; 479 [_methodSelectionCoordinator stop];
472 _methodSelectionCoordinator = nil; 480 _methodSelectionCoordinator = nil;
473 } 481 }
474 482
475 @end 483 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/payments/payment_request.mm ('k') | ios/chrome/browser/payments/payment_request_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698