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

Unified 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: Address comments Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
index d6387942a952d36a7ce039d655cb0ffe060e185c..85247d2a723230e0a631b6414ae455868bdf19eb 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -505,6 +505,21 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
PaymentResponse response = new PaymentResponse();
response.methodName = methodName;
response.stringifiedDetails = stringifiedDetails;
+
+ PaymentOption selectedShippingAddress = mShippingAddresses.getSelectedItem();
+ if (selectedShippingAddress != null) {
+ // Shipping addresses are created in show(). The should all be instances of
+ // AutofillAddress.
+ assert selectedShippingAddress instanceof AutofillAddress;
+ response.shippingAddress =
+ ((AutofillAddress) selectedShippingAddress).toShippingAddress();
+ }
+
+ PaymentOption selectedShippingOption = mShippingOptions.getSelectedItem();
+ if (selectedShippingOption != null && selectedShippingOption.getIdentifier() != null) {
+ response.shippingOptionId = selectedShippingOption.getIdentifier();
+ }
+
mClient.onPaymentResponse(response);
}
@@ -513,7 +528,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
*/
@Override
public void onInstrumentDetailsError() {
- disconnectFromClientWithDebugMessage("Fialed to retrieve payment instrument details");
+ disconnectFromClientWithDebugMessage("Failed to retrieve payment instrument details");
closeUI(false);
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/payments/PaymentRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698