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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java

Issue 1937783002: Provide shipping in PaymentRequest response (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.graphics.Bitmap; 8 import android.graphics.Bitmap;
9 import android.os.Handler; 9 import android.os.Handler;
10 import android.text.TextUtils; 10 import android.text.TextUtils;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 if (mPaymentInformationCallback != null) provideDefaultPaymentInform ation(); 489 if (mPaymentInformationCallback != null) provideDefaultPaymentInform ation();
490 } 490 }
491 } 491 }
492 492
493 /** 493 /**
494 * Called after retrieving instrument details. 494 * Called after retrieving instrument details.
495 */ 495 */
496 @Override 496 @Override
497 public void onInstrumentDetailsReady(String methodName, String stringifiedDe tails) { 497 public void onInstrumentDetailsReady(String methodName, String stringifiedDe tails) {
498 PaymentResponse response = new PaymentResponse(); 498 PaymentResponse response = new PaymentResponse();
499
499 response.methodName = methodName; 500 response.methodName = methodName;
500 response.stringifiedDetails = stringifiedDetails; 501 response.stringifiedDetails = stringifiedDetails;
502
503 PaymentOption selectedShippingAddress = mShippingAddresses.getSelectedIt em();
504 if (selectedShippingAddress != null) {
505 assert selectedShippingAddress instanceof AutofillAddress;
506 response.shippingAddress =
507 ((AutofillAddress) selectedShippingAddress).toShippingAddres s();
508 }
509
510 PaymentOption selectedShippingOption = mShippingOptions.getSelectedItem( );
511 if (selectedShippingOption != null && selectedShippingOption.getIdentifi er() != null) {
512 response.shippingOptionId = selectedShippingOption.getIdentifier();
513 }
514
501 mClient.onPaymentResponse(response); 515 mClient.onPaymentResponse(response);
502 } 516 }
503 517
504 /** 518 /**
505 * Called if unable to retrieve instrument details. 519 * Called if unable to retrieve instrument details.
506 */ 520 */
507 @Override 521 @Override
508 public void onInstrumentDetailsError() { 522 public void onInstrumentDetailsError() {
509 disconnectFromClientWithDebugMessage("Fialed to retrieve payment instrum ent details"); 523 disconnectFromClientWithDebugMessage("Fialed to retrieve payment instrum ent details");
510 closeUI(false); 524 closeUI(false);
(...skipping 24 matching lines...) Expand all
535 if (mPaymentMethods != null) { 549 if (mPaymentMethods != null) {
536 for (int i = 0; i < mPaymentMethods.getSize(); i++) { 550 for (int i = 0; i < mPaymentMethods.getSize(); i++) {
537 PaymentOption option = mPaymentMethods.getItem(i); 551 PaymentOption option = mPaymentMethods.getItem(i);
538 assert option instanceof PaymentInstrument; 552 assert option instanceof PaymentInstrument;
539 ((PaymentInstrument) option).dismiss(); 553 ((PaymentInstrument) option).dismiss();
540 } 554 }
541 mPaymentMethods = null; 555 mPaymentMethods = null;
542 } 556 }
543 } 557 }
544 } 558 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698