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 ...@@ -705,14 +705,15 @@ public class PaymentRequestService
// All factories have responded, but none of them have apps. It's possible to add credit // 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 // cards, but the merchant does not support them either. The payment request must be
// rejected. // rejected.
mJourneyLogger.setNotShown(mCanMakePayment int notShowReason = mCanMakePayment ? NotShownReason.NO_MATCHING_PAYMENT_METHOD
? NotShownReason.NO_MATCHING_PAYMENT_METHOD : NotShownReason.NO_SUPPORTED_PAYMENT_METHOD;
: NotShownReason.NO_SUPPORTED_PAYMENT_METHOD); String debugMessage;
int paymentErrorReason;
if (mDelegate.isOffTheRecord()) { if (mDelegate.isOffTheRecord()) {
// If the user is in the OffTheRecord mode, hide the absence of their payment // If the user is in the OffTheRecord mode, hide the absence of their payment
// methods from the merchant site. // methods from the merchant site.
disconnectFromClientWithDebugMessage( debugMessage = ErrorStrings.USER_CANCELLED;
ErrorStrings.USER_CANCELLED, PaymentErrorReason.USER_CANCEL); paymentErrorReason = PaymentErrorReason.USER_CANCEL;
} else { } else {
if (sNativeObserverForTest != null) { if (sNativeObserverForTest != null) {
sNativeObserverForTest.onNotSupportedError(); sNativeObserverForTest.onNotSupportedError();
...@@ -722,16 +723,14 @@ public class PaymentRequestService ...@@ -722,16 +723,14 @@ public class PaymentRequestService
&& mSpec.getMethodData().get(MethodStrings.GOOGLE_PLAY_BILLING) != null) { && mSpec.getMethodData().get(MethodStrings.GOOGLE_PLAY_BILLING) != null) {
mRejectShowErrorMessage = ErrorStrings.APP_STORE_METHOD_ONLY_SUPPORTED_IN_TWA; mRejectShowErrorMessage = ErrorStrings.APP_STORE_METHOD_ONLY_SUPPORTED_IN_TWA;
} }
disconnectFromClientWithDebugMessage( debugMessage =
ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet()) ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet())
+ (TextUtils.isEmpty(mRejectShowErrorMessage) + (TextUtils.isEmpty(mRejectShowErrorMessage)
? "" ? ""
: " " + mRejectShowErrorMessage), : " " + mRejectShowErrorMessage);
PaymentErrorReason.NOT_SUPPORTED); paymentErrorReason = PaymentErrorReason.NOT_SUPPORTED;
}
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceShowFailed();
} }
onShowFailed(notShowReason, debugMessage, paymentErrorReason);
return true; return true;
} }
return disconnectForStrictShow(mIsUserGestureShow); return disconnectForStrictShow(mIsUserGestureShow);
...@@ -750,15 +749,11 @@ public class PaymentRequestService ...@@ -750,15 +749,11 @@ public class PaymentRequestService
return false; return false;
} }
if (sObserverForTest != null) {
sObserverForTest.onPaymentRequestServiceShowFailed();
}
mRejectShowErrorMessage = ErrorStrings.STRICT_BASIC_CARD_SHOW_REJECT; mRejectShowErrorMessage = ErrorStrings.STRICT_BASIC_CARD_SHOW_REJECT;
disconnectFromClientWithDebugMessage( String debugMessage =
ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet()) + " " ErrorMessageUtil.getNotSupportedErrorMessage(mSpec.getMethodData().keySet()) + " "
+ mRejectShowErrorMessage, + mRejectShowErrorMessage;
PaymentErrorReason.NOT_SUPPORTED); onShowFailed(NotShownReason.OTHER, debugMessage, PaymentErrorReason.NOT_SUPPORTED);
return true; 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