Commit 86be08c4 authored by Jeevan Shikaram's avatar Jeevan Shikaram Committed by Commit Bot

[Play Billing] Update helper to stay in sync with ARC++.

Update WebPaymentIntentHelper to stay in sync with the copy in ARC++.
This CL pulls out the extraction of payment intent details to a new
method so that ARC++ can use it synchronously.

Bug: 1109119
Change-Id: Ic0c784a3fc51ed853ef51e0535c51b6b3fb06b60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352259Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Jeevan Shikaram <jshikaram@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798038}
parent eac94ae8
......@@ -95,6 +95,22 @@ public class WebPaymentIntentHelper {
void onPaymentSuccess(String methodName, String details, PayerData payerData);
}
/**
* Get stringified payment details from a payment intent.
*
* @param data The payment intent data.
* @return The stringified payment details, if any.
*/
@Nullable
public static String getPaymentIntentDetails(Intent data) {
String details = data.getExtras().getString(EXTRA_RESPONSE_DETAILS);
if (details == null) {
// try to get deprecated details rather than early returning.
details = data.getExtras().getString(EXTRA_DEPRECATED_RESPONSE_INSTRUMENT_DETAILS);
}
return details;
}
/**
* Parse the Payment Intent response.
* @param resultCode Result code of the requested intent.
......@@ -125,11 +141,7 @@ public class WebPaymentIntentHelper {
return;
}
String details = data.getExtras().getString(EXTRA_RESPONSE_DETAILS);
if (details == null) {
// try to get deprecated details rather than early returning.
details = data.getExtras().getString(EXTRA_DEPRECATED_RESPONSE_INSTRUMENT_DETAILS);
}
String details = getPaymentIntentDetails(data);
if (TextUtils.isEmpty(details)) {
errorCallback.onPaymentError(ErrorStrings.MISSING_DETAILS_FROM_PAYMENT_APP);
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment