Commit 868afec8 authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Commit Bot

[WebLayer] Clean up not-show error handling for method-not-found

Changes:
* De-dups the not-show error handling for disconnectForStrictShow and
  disconnectIfNoPaymentMethodsSupported by onShowFailed().

Behaviour changes:
* When the strict-show conditions fail, adds this behaviour:
  logs "NotShownReason.OTHER".

Bug: 1148902

Change-Id: I30dacb87f9e785466edd76a2de9ceb9b6ed9be9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2540574
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarNick Burris <nburris@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828187}
parent fe5770be
......@@ -705,14 +705,15 @@ public class PaymentRequestService
// All factories have responded, but none of them have apps. It's possible to add credit
// cards, but the merchant does not support them either. The payment request must be
// rejected.
mJourneyLogger.setNotShown(mCanMakePayment
? NotShownReason.NO_MATCHING_PAYMENT_METHOD
: NotShownReason.NO_SUPPORTED_PAYMENT_METHOD);
int notShowReason = mCanMakePayment ? NotShownReason.NO_MATCHING_PAYMENT_METHOD
: NotShownReason.NO_SUPPORTED_PAYMENT_METHOD;
String debugMessage;
int paymentErrorReason;
if (mDelegate.isOffTheRecord()) {
// If the user is in the OffTheRecord mode, hide the absence of their payment
// methods from the merchant site.
disconnectFromClientWithDebugMessage(
ErrorStrings.USER_CANCELLED, PaymentErrorReason.USER_CANCEL);
debugMessage = ErrorStrings.USER_CANCELLED;
paymentErrorReason = PaymentErrorReason.USER_CANCEL;
} else {
if (sNativeObserverForTest != null) {
sNativeObserverForTest.onNotSupportedError();
......@@ -722,16 +723,14 @@ public class PaymentRequestService
&& mSpec.getMethodData().get(MethodStrings.GOOGLE_PLAY_BILLING) != null) {
mRejectShowErrorMessage = ErrorStrings.APP_STORE_METHOD_ONLY_SUPPORTED_IN_TWA;
}
disconnectFromClientWithDebugMessage(
debugMessage =
ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet())
+ (TextUtils.isEmpty(mRejectShowErrorMessage)
? ""
: " " + mRejectShowErrorMessage),
PaymentErrorReason.NOT_SUPPORTED);
}
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceShowFailed();
+ (TextUtils.isEmpty(mRejectShowErrorMessage)
? ""
: " " + mRejectShowErrorMessage);
paymentErrorReason = PaymentErrorReason.NOT_SUPPORTED;
}
onShowFailed(notShowReason, debugMessage, paymentErrorReason);
return true;
}
return disconnectForStrictShow(mIsUserGestureShow);
......@@ -750,15 +749,11 @@ public class PaymentRequestService
return false;
}
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceShowFailed();
}
mRejectShowErrorMessage = ErrorStrings.STRICT_BASIC_CARD_SHOW_REJECT;
disconnectFromClientWithDebugMessage(
String debugMessage =
ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet()) + " "
+ mRejectShowErrorMessage,
PaymentErrorReason.NOT_SUPPORTED);
+ mRejectShowErrorMessage;
onShowFailed(NotShownReason.OTHER, debugMessage, PaymentErrorReason.NOT_SUPPORTED);
return true;
}
......
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